From dc4a0ad8a4fbf7850d879feb3e80f28dbe91ef69 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Wed, 22 Oct 2014 10:57:11 -0400 Subject: [PATCH 1/7] Adding test project --- src/test/projects/aar-child/LICENSE.md | 14 ++++ .../aar-child/aar-child-library/pom.xml | 72 +++++++++++++++++ .../src/main/AndroidManifest.xml | 9 +++ .../android/parent/ParentStoryTeller.java | 21 +++++ .../src/main/res/values/strings.xml | 5 ++ .../projects/aar-child/aar-child-test/pom.xml | 61 +++++++++++++++ .../src/main/AndroidManifest.xml | 19 +++++ .../parent/test/ParentAndGrandparentTest.java | 15 ++++ .../src/main/res/values/strings.xml | 9 +++ src/test/projects/aar-child/pom.xml | 78 +++++++++++++++++++ 10 files changed, 303 insertions(+) create mode 100644 src/test/projects/aar-child/LICENSE.md create mode 100644 src/test/projects/aar-child/aar-child-library/pom.xml create mode 100644 src/test/projects/aar-child/aar-child-library/src/main/AndroidManifest.xml create mode 100644 src/test/projects/aar-child/aar-child-library/src/main/java/org/jboss/aerogear/android/parent/ParentStoryTeller.java create mode 100644 src/test/projects/aar-child/aar-child-library/src/main/res/values/strings.xml create mode 100644 src/test/projects/aar-child/aar-child-test/pom.xml create mode 100644 src/test/projects/aar-child/aar-child-test/src/main/AndroidManifest.xml create mode 100644 src/test/projects/aar-child/aar-child-test/src/main/java/org/jboss/aerogear/android/parent/test/ParentAndGrandparentTest.java create mode 100644 src/test/projects/aar-child/aar-child-test/src/main/res/values/strings.xml create mode 100644 src/test/projects/aar-child/pom.xml diff --git a/src/test/projects/aar-child/LICENSE.md b/src/test/projects/aar-child/LICENSE.md new file mode 100644 index 000000000..933245158 --- /dev/null +++ b/src/test/projects/aar-child/LICENSE.md @@ -0,0 +1,14 @@ + JBoss, Home of Professional Open Source + Copyright Red Hat, Inc., and individual contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/src/test/projects/aar-child/aar-child-library/pom.xml b/src/test/projects/aar-child/aar-child-library/pom.xml new file mode 100644 index 000000000..ed7bbbb79 --- /dev/null +++ b/src/test/projects/aar-child/aar-child-library/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.jboss.aerogear + aar-child-library + 2.0.0-SNAPSHOT + aar + Library + http://github.com/secondsun/maven-android-plugin-aar-packaging + + + org.jboss.aerogear + aar-child-project + 2.0.0-SNAPSHOT + + + + scm:git:git@github.com:secondsun/maven-android-plugin-aar-packaging.git + scm:git:git@github.com:aerogear/maven-android-plugin-aar-packaging.git + git@github.com:secondsun/maven-android-plugin-aar-packaging.git + HEAD + + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + package + + attach-artifact + + + + + jar + ${project.build.directory}/${project.build.finalName}.jar + + + + + + + + + + + diff --git a/src/test/projects/aar-child/aar-child-library/src/main/AndroidManifest.xml b/src/test/projects/aar-child/aar-child-library/src/main/AndroidManifest.xml new file mode 100644 index 000000000..4a3120d8b --- /dev/null +++ b/src/test/projects/aar-child/aar-child-library/src/main/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/src/test/projects/aar-child/aar-child-library/src/main/java/org/jboss/aerogear/android/parent/ParentStoryTeller.java b/src/test/projects/aar-child/aar-child-library/src/main/java/org/jboss/aerogear/android/parent/ParentStoryTeller.java new file mode 100644 index 000000000..ee7b8c027 --- /dev/null +++ b/src/test/projects/aar-child/aar-child-library/src/main/java/org/jboss/aerogear/android/parent/ParentStoryTeller.java @@ -0,0 +1,21 @@ +package org.jboss.aerogear.android.parent; + + + +import android.content.Context; + +public class ParentStoryTeller { + + private final Context mContext; + + public ParentStoryTeller(Context mContext) { + this.mContext = mContext; + } + + public String tellStory() { + return mContext.getString(R.string.story); + } + + + +} diff --git a/src/test/projects/aar-child/aar-child-library/src/main/res/values/strings.xml b/src/test/projects/aar-child/aar-child-library/src/main/res/values/strings.xml new file mode 100644 index 000000000..f695fffcc --- /dev/null +++ b/src/test/projects/aar-child/aar-child-library/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + + AAR PAckaging lib Parent + [At a town meeting] I\'m sorry my opponent didn\'t think enough of you to show up for this debate. I\'m sure he had more important things to do.[Homer imitates Patterson drinking, everyone laughs] + diff --git a/src/test/projects/aar-child/aar-child-test/pom.xml b/src/test/projects/aar-child/aar-child-test/pom.xml new file mode 100644 index 000000000..696c92b7f --- /dev/null +++ b/src/test/projects/aar-child/aar-child-test/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + 2.0.0-SNAPSHOT + aar-child-test + apk + Integration Tests + http://aerogear.org + + + org.jboss.aerogear + aar-child-project + 2.0.0-SNAPSHOT + + + + + org.jboss.aerogear + aar-child-library + ${project.version} + aar + + + org.jboss.aerogear + aar-child-library + ${project.version} + jar + provided + + + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + + + false + + + + + + diff --git a/src/test/projects/aar-child/aar-child-test/src/main/AndroidManifest.xml b/src/test/projects/aar-child/aar-child-test/src/main/AndroidManifest.xml new file mode 100644 index 000000000..878f696ff --- /dev/null +++ b/src/test/projects/aar-child/aar-child-test/src/main/AndroidManifest.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/src/test/projects/aar-child/aar-child-test/src/main/java/org/jboss/aerogear/android/parent/test/ParentAndGrandparentTest.java b/src/test/projects/aar-child/aar-child-test/src/main/java/org/jboss/aerogear/android/parent/test/ParentAndGrandparentTest.java new file mode 100644 index 000000000..68eee9f93 --- /dev/null +++ b/src/test/projects/aar-child/aar-child-test/src/main/java/org/jboss/aerogear/android/parent/test/ParentAndGrandparentTest.java @@ -0,0 +1,15 @@ +package org.jboss.aerogear.android.parent.test; + +import android.content.Context; +import org.jboss.aerogear.android.parent.ParentStoryTeller; + + +public class ParentAndGrandparentTest extends android.test.AndroidTestCase{ + + + public void testParent() { + Context context = getContext(); + ParentStoryTeller teller = new ParentStoryTeller(context); + teller.tellStory(); + } +} diff --git a/src/test/projects/aar-child/aar-child-test/src/main/res/values/strings.xml b/src/test/projects/aar-child/aar-child-test/src/main/res/values/strings.xml new file mode 100644 index 000000000..4dc8e13f6 --- /dev/null +++ b/src/test/projects/aar-child/aar-child-test/src/main/res/values/strings.xml @@ -0,0 +1,9 @@ + + + + Aerogear-android-integration-testsTest + MainActivity + Settings + Hello world! + + \ No newline at end of file diff --git a/src/test/projects/aar-child/pom.xml b/src/test/projects/aar-child/pom.xml new file mode 100644 index 000000000..83b5a52ee --- /dev/null +++ b/src/test/projects/aar-child/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.jboss.aerogear + aar-child-project + 2.0.0-SNAPSHOT + pom + Project + http://aerogear.org + + + + aar-child-library + aar-child-test + + + + scm:git:git@github.com:secondsun/maven-android-plugin-aar-packaging.git + scm:git:git@github.com:aerogear/maven-android-plugin-aar-packaging.git + git@github.com:secondsun/maven-android-plugin-aar-packaging.git + HEAD + + + + + + 4.0.0-SNAPSHOT + + + 19 + false + true + + + + + + + android + android + provided + 4.4.2_r4 + + + + + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + ${maven.android.plugin.version} + true + + + + + + + From 920e4d5303e76486c8e5b292d7f5400c129f87b5 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Wed, 22 Oct 2014 11:01:12 -0400 Subject: [PATCH 2/7] Adding test to check that provided jars do not hide aar libs in the compiled project --- .../ApkWithProvidedJarBuildExampleIT.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java diff --git a/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java b/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java new file mode 100644 index 000000000..00930eb6b --- /dev/null +++ b/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java @@ -0,0 +1,59 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright Red Hat, Inc., + * Copyright (C) 2014 simpligility technologies inc., + * and individual contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jayway.maven.plugins.android.sample; + + +import io.takari.maven.testing.TestResources; +import io.takari.maven.testing.executor.MavenExecutionResult; +import io.takari.maven.testing.executor.MavenRuntime; +import io.takari.maven.testing.executor.MavenVersions; +import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder; +import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner; + +import java.io.File; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.jayway.maven.plugins.android.PluginInfo; + +@RunWith(MavenJUnitTestRunner.class) +@MavenVersions({"3.2.3"}) +public class ApkWithProvidedJarBuildExampleIT { + + @Rule + public final TestResources resources = new TestResources(); + + public final MavenRuntime mavenRuntime; + + public ApkWithProvidedJarBuildExampleIT(MavenRuntimeBuilder builder) throws Exception { + this.mavenRuntime = builder.build(); + } + + @Test + public void buildInstall() throws Exception { + File basedir = resources.getBasedir( "aar-child" ); + MavenExecutionResult result = mavenRuntime + .forProject(basedir) + .execute( "clean", "install" ); + result.assertErrorFreeLog(); + result.assertLogText( "Tests run: 4, Failures: 0, Errors: 0" ); + } +} From a128de91db7aca13ed3b942697abe8eb61522643 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Wed, 22 Oct 2014 10:56:05 -0400 Subject: [PATCH 3/7] Fixing code being tested --- .../phase_prebuild/ClasspathModifierLifecycleParticipant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java b/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java index 51215f069..e24f3c3e3 100644 --- a/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java +++ b/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java @@ -255,7 +255,7 @@ private void addClassesToClasspath( UnpackedLibHelper helper, MavenProject proje } // Add the classes to the classpath - final Dependency dependency = createSystemScopeDependency( artifact, classesJar, null ); + final Dependency dependency = createSystemScopeDependency( artifact, classesJar, "extracted" ); project.getModel().addDependency( dependency ); } From f381962543afaf651e8b03a9c06d7ea980084cb4 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Mon, 27 Oct 2014 10:23:46 -0400 Subject: [PATCH 4/7] Finessing license headers --- .../sample/ApkWithProvidedJarBuildExampleIT.java | 5 +++-- src/test/projects/aar-child/LICENSE.md | 14 -------------- .../projects/aar-child/aar-child-library/pom.xml | 7 ++++--- 3 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 src/test/projects/aar-child/LICENSE.md diff --git a/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java b/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java index 00930eb6b..61ef34d72 100644 --- a/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java +++ b/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java @@ -1,6 +1,4 @@ /* - * JBoss, Home of Professional Open Source - * Copyright Red Hat, Inc., * Copyright (C) 2014 simpligility technologies inc., * and individual contributors * @@ -15,6 +13,9 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Contributors : + * JBoss, Home of Professional Open Source */ package com.jayway.maven.plugins.android.sample; diff --git a/src/test/projects/aar-child/LICENSE.md b/src/test/projects/aar-child/LICENSE.md deleted file mode 100644 index 933245158..000000000 --- a/src/test/projects/aar-child/LICENSE.md +++ /dev/null @@ -1,14 +0,0 @@ - JBoss, Home of Professional Open Source - Copyright Red Hat, Inc., and individual contributors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/src/test/projects/aar-child/aar-child-library/pom.xml b/src/test/projects/aar-child/aar-child-library/pom.xml index ed7bbbb79..94909c2ec 100644 --- a/src/test/projects/aar-child/aar-child-library/pom.xml +++ b/src/test/projects/aar-child/aar-child-library/pom.xml @@ -1,8 +1,5 @@ 4.0.0 From 8bd0359f8209c52eb5952bf5503a9b73b6644677 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Mon, 27 Oct 2014 10:28:23 -0400 Subject: [PATCH 5/7] Changing from Google Android to the Android in Maven Central --- src/test/projects/aar-child/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/projects/aar-child/pom.xml b/src/test/projects/aar-child/pom.xml index 83b5a52ee..d756ac9b1 100644 --- a/src/test/projects/aar-child/pom.xml +++ b/src/test/projects/aar-child/pom.xml @@ -53,10 +53,10 @@ - android - android - provided - 4.4.2_r4 + com.google.android + android + 4.1.1.4 + provided From c65a2fdb50e23b260269cecd11edc0499aa2d683 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Wed, 29 Oct 2014 18:52:23 -0400 Subject: [PATCH 6/7] Using new plugin groupId --- src/test/projects/aar-child/aar-child-library/pom.xml | 2 +- src/test/projects/aar-child/aar-child-test/pom.xml | 10 +++++++++- src/test/projects/aar-child/pom.xml | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/test/projects/aar-child/aar-child-library/pom.xml b/src/test/projects/aar-child/aar-child-library/pom.xml index 94909c2ec..0e50cf99e 100644 --- a/src/test/projects/aar-child/aar-child-library/pom.xml +++ b/src/test/projects/aar-child/aar-child-library/pom.xml @@ -42,7 +42,7 @@ - com.jayway.maven.plugins.android.generation2 + com.simpligility.maven.plugins android-maven-plugin diff --git a/src/test/projects/aar-child/aar-child-test/pom.xml b/src/test/projects/aar-child/aar-child-test/pom.xml index 696c92b7f..166a727bf 100644 --- a/src/test/projects/aar-child/aar-child-test/pom.xml +++ b/src/test/projects/aar-child/aar-child-test/pom.xml @@ -30,6 +30,14 @@ + + + + com.google.android + android-test + 4.1.1.4 + + org.jboss.aerogear aar-child-library @@ -48,7 +56,7 @@ - com.jayway.maven.plugins.android.generation2 + com.simpligility.maven.plugins android-maven-plugin diff --git a/src/test/projects/aar-child/pom.xml b/src/test/projects/aar-child/pom.xml index d756ac9b1..5957f5254 100644 --- a/src/test/projects/aar-child/pom.xml +++ b/src/test/projects/aar-child/pom.xml @@ -41,7 +41,7 @@ - 4.0.0-SNAPSHOT + ${it-plugin.version} 19 @@ -65,7 +65,7 @@ - com.jayway.maven.plugins.android.generation2 + com.simpligility.maven.plugins android-maven-plugin ${maven.android.plugin.version} true From 832fd819540367bfb1a1832c26dde6c9efae7a07 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Wed, 29 Oct 2014 21:22:37 -0400 Subject: [PATCH 7/7] Fixing artifactIdCollision --- .../phase_prebuild/ClasspathModifierLifecycleParticipant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java b/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java index e24f3c3e3..431292ffd 100644 --- a/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java +++ b/src/main/java/com/jayway/maven/plugins/android/phase_prebuild/ClasspathModifierLifecycleParticipant.java @@ -264,7 +264,7 @@ private Dependency createSystemScopeDependency( Artifact artifact, File location String artifactId = artifact.getArtifactId(); if ( suffix != null ) { - artifactId = "_" + suffix; + artifactId += "_" + suffix; } final Dependency dependency = new Dependency(); dependency.setGroupId( artifact.getGroupId() );