Skip to content

Commit

Permalink
auto update snapshot-version, snapshot-versionCode via regex property
Browse files Browse the repository at this point in the history
  • Loading branch information
kevlahnota committed Oct 10, 2024
1 parent 28a28bf commit ad81b0e
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 7 deletions.
2 changes: 1 addition & 1 deletion forge-gui-android/filters/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
${alpha-version}
${snapshot-version}
88 changes: 82 additions & 6 deletions forge-gui-android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<build.min.memory>-Xms1024m</build.min.memory>
<build.max.memory>-Xmx1536m</build.max.memory>
<alpha-version>${revision}</alpha-version>
<!-- the previous android:versionCode was 106650000, so it must be larger or it will not be installed -->
<alpha-versionCode>200000000</alpha-versionCode>
<sign.keystore>keystore</sign.keystore>
<sign.alias>alias</sign.alias>
<sign.storepass>storepass</sign.storepass>
Expand Down Expand Up @@ -39,6 +37,52 @@
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>timestamp-property</id>
<phase>initialize</phase>
<goals>
<goal>timestamp-property</goal>
</goals>
<configuration>
<name>month.date</name>
<pattern>MMdd</pattern>
</configuration>
</execution>
<execution>
<id>regex-property</id>
<phase>initialize</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>snapshot-version</name>
<value>${revision}</value>
<regex>-SNAPSHOT</regex>
<replacement>-SNAPSHOT-${month.date}</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
<execution>
<id>regex-property2</id>
<phase>initialize</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>snapshot-versionCode</name>
<value>${revision}</value>
<regex>[^0-9]</regex>
<replacement></replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
Expand All @@ -53,7 +97,7 @@
<filtering>true</filtering>
</resource>
</resources>
<finalName>forge-android-${alpha-version}</finalName>
<finalName>forge-android-${snapshot-version}</finalName>
</build>
<dependencies>
<dependency>
Expand Down Expand Up @@ -268,7 +312,7 @@
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<manifestVersionName>${alpha-version}</manifestVersionName>
<manifestVersionCode>${alpha-versionCode}</manifestVersionCode>
<manifestVersionCode>1</manifestVersionCode>
</configuration>
</execution>
</executions>
Expand All @@ -283,6 +327,38 @@
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>timestamp-property</id>
<phase>initialize</phase>
<goals>
<goal>timestamp-property</goal>
</goals>
<configuration>
<name>month.date</name>
<pattern>MMdd</pattern>
</configuration>
</execution>
<execution>
<id>regex-property</id>
<phase>initialize</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>snapshot-version</name>
<value>${revision}</value>
<regex>-SNAPSHOT</regex>
<replacement>-SNAPSHOT-${month.date}</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<version>3.4.1</version>
Expand Down Expand Up @@ -388,8 +464,8 @@
</goals>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<manifestVersionName>${alpha-version}</manifestVersionName>
<manifestVersionCode>${alpha-versionCode}</manifestVersionCode>
<manifestVersionName>${snapshot-version}</manifestVersionName>
<manifestVersionCode>${snapshot-versionCode}0${month.date}</manifestVersionCode>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit ad81b0e

Please sign in to comment.