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..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 @@ -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 ); } @@ -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() ); 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..61ef34d72 --- /dev/null +++ b/src/test/java/com/jayway/maven/plugins/android/sample/ApkWithProvidedJarBuildExampleIT.java @@ -0,0 +1,60 @@ +/* + * 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. + * + * Contributors : + * JBoss, Home of Professional Open Source + */ +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" ); + } +} 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..0e50cf99e --- /dev/null +++ b/src/test/projects/aar-child/aar-child-library/pom.xml @@ -0,0 +1,73 @@ + + + + 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.simpligility.maven.plugins + 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..166a727bf --- /dev/null +++ b/src/test/projects/aar-child/aar-child-test/pom.xml @@ -0,0 +1,69 @@ + + + + 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 + + + + + + + com.google.android + android-test + 4.1.1.4 + + + + org.jboss.aerogear + aar-child-library + ${project.version} + aar + + + org.jboss.aerogear + aar-child-library + ${project.version} + jar + provided + + + + + + + com.simpligility.maven.plugins + 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..5957f5254 --- /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 + + + + + + ${it-plugin.version} + + + 19 + false + true + + + + + + + com.google.android + android + 4.1.1.4 + provided + + + + + + + + + com.simpligility.maven.plugins + android-maven-plugin + ${maven.android.plugin.version} + true + + + + + + +