Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issues/485 #493

Merged
merged 7 commits into from
Nov 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand All @@ -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() );
Expand Down
Original file line number Diff line number Diff line change
@@ -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" );
}
}
73 changes: 73 additions & 0 deletions src/test/projects/aar-child/aar-child-library/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jboss.aerogear</groupId>
<artifactId>aar-child-library</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>aar</packaging>
<name>Library</name>
<url>http://github.com/secondsun/maven-android-plugin-aar-packaging</url>

<parent>
<groupId>org.jboss.aerogear</groupId>
<artifactId>aar-child-project</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<scm>
<connection>scm:git:[email protected]:secondsun/maven-android-plugin-aar-packaging.git</connection>
<developerConnection>scm:git:[email protected]:aerogear/maven-android-plugin-aar-packaging.git</developerConnection>
<url>[email protected]:secondsun/maven-android-plugin-aar-packaging.git</url>
<tag>HEAD</tag>
</scm>

<build>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<type>jar</type>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="org.jboss.aerogear.android.parent">

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>
<application/>
</manifest>
Original file line number Diff line number Diff line change
@@ -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);
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AAR PAckaging lib Parent</string>
<string name="story">[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]</string>
</resources>
69 changes: 69 additions & 0 deletions src/test/projects/aar-child/aar-child-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>2.0.0-SNAPSHOT</version>
<artifactId>aar-child-test</artifactId>
<packaging>apk</packaging>
<name>Integration Tests</name>
<url>http://aerogear.org</url>

<parent>
<groupId>org.jboss.aerogear</groupId>
<artifactId>aar-child-project</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<dependencies>

<!-- Project dependencies -->
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>4.1.1.4</version>
</dependency>

<dependency>
<groupId>org.jboss.aerogear</groupId>
<artifactId>aar-child-library</artifactId>
<version>${project.version}</version>
<type>aar</type>
</dependency>
<dependency>
<groupId>org.jboss.aerogear</groupId>
<artifactId>aar-child-library</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<test>
<skip>false</skip>
</test>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="org.jboss.aerogear.android.parent.test">

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>

<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.jboss.aerogear.android.parent.test" />

<application
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">Aerogear-android-integration-testsTest</string>
<string name="title_activity_main">MainActivity</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>

</resources>
78 changes: 78 additions & 0 deletions src/test/projects/aar-child/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jboss.aerogear</groupId>
<artifactId>aar-child-project</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Project</name>
<url>http://aerogear.org</url>


<modules>
<module>aar-child-library</module>
<module>aar-child-test</module>
</modules>

<scm>
<connection>scm:git:[email protected]:secondsun/maven-android-plugin-aar-packaging.git</connection>
<developerConnection>scm:git:[email protected]:aerogear/maven-android-plugin-aar-packaging.git</developerConnection>
<url>[email protected]:secondsun/maven-android-plugin-aar-packaging.git</url>
<tag>HEAD</tag>
</scm>

<properties>

<!-- Plugins versions -->
<maven.android.plugin.version>${it-plugin.version}</maven.android.plugin.version>

<!-- Android configs -->
<android.platform>19</android.platform>
<android.debug>false</android.debug>
<proguard.skip>true</proguard.skip>
</properties>

<dependencies>

<!-- Project dependencies -->
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${maven.android.plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>