Skip to content

Commit

Permalink
Revert to maven-resource-filtering for updating the version code
Browse files Browse the repository at this point in the history
Although some of the Android docutmentino indicates otherwise, the Android
Market won't let you publish an APK with a lower versionCode than
previously published for that product. So unfortunately, we can't use
the nice 'versionCodeUpdateFromVersion' flag from android-maven-plugin v3.

Reverts some of commit 3b80319.
  • Loading branch information
rtyley committed May 24, 2012
1 parent c557ce3 commit dfdd958
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 4 deletions.
2 changes: 1 addition & 1 deletion agit-integration-tests/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us --><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" android:versionCode="1290" android:versionName="1.29-SNAPSHOT" package="com.madgag.agit.tests">
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us --><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.30-SNAPSHOT" package="com.madgag.agit.tests">

<!-- We add an application tag here just so that we can indicate that
this package needs to link against the android.test library,
Expand Down
2 changes: 1 addition & 1 deletion agit/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" android:versionCode="1290" android:versionName="1.29-SNAPSHOT" package="com.madgag.agit">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" android:versionCode="${versionCode}" android:versionName="1.29-SNAPSHOT" package="com.madgag.agit">
<application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/Theme.App">

<activity android:name="DashboardActivity">
Expand Down
62 changes: 61 additions & 1 deletion agit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@
<include>CREDITS.*</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/filtered-manifest</targetPath>
<includes>
<include>AndroidManifest.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
Expand All @@ -136,14 +144,39 @@
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<androidManifestFile>${project.build.directory}/filtered-manifest/AndroidManifest.xml
</androidManifestFile>
</configuration>
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>release-to-market</id>
<id>development</id>
<!-- using this since activeByDefault does not work well with multiple profiles -->
<activation>
<property>
<name>environment</name>
<value>!production</value>
</property>
</activation>
<properties>
<deployment.stage>In Development</deployment.stage>
<android.debuggable>true</android.debuggable>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
<deployment.stage>In Production</deployment.stage>
<android.debuggable>false</android.debuggable>
</properties>
</profile>
<profile>
<id>release</id>
<!-- via this activation the profile is automatically used when the release is done with the maven release
plugin -->
<activation>
Expand Down Expand Up @@ -205,6 +238,33 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-signed-aligned.apk</file>
<type>apk</type>
<classifier>signed-aligned</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/proguard_map.txt</file>
<type>map</type>
<classifier>release</classifier>
</artifact>
</artifacts>
</configuration>
<executions>
<execution>
<id>attach-signed-aligned</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<android.version>4.0.1.2</android.version>
<maven.build.timestamp.format>yyMMdddHH</maven.build.timestamp.format>
<!-- Apparently necessary due to http://jira.codehaus.org/browse/MRESOURCES-99 and also more readable -->
<versionCode>${maven.build.timestamp}</versionCode>
</properties>
<licenses>
<license>
Expand Down Expand Up @@ -120,7 +123,6 @@
</proguard>
<manifest>
<versionName />
<versionCodeUpdateFromVersion>true</versionCodeUpdateFromVersion>
<debuggable>true</debuggable>
</manifest>
</configuration>
Expand Down

0 comments on commit dfdd958

Please sign in to comment.