Skip to content

Commit

Permalink
ndk: set APP_BUILD_SCRIPT for makefile parameter instead of -f
Browse files Browse the repository at this point in the history
-added integration test project
  • Loading branch information
kedzie committed Sep 22, 2015
1 parent 6d155d4 commit aa937f9
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class AndroidNdk
+ "alternative, you may add the parameter to commandline: -Dandroid.ndk.path=... or set environment "
+ "variable " + NdkBuildMojo.ENV_ANDROID_NDK_HOME + ".";

public static final String[] NDK_ARCHITECTURES = { "armeabi", "armeabi-v7a", "mips", "mips64", "x86", "x86_64" };
public static final String[] NDK_ARCHITECTURES = { "armeabi", "armeabi-v7a", "arm64-v8a", "mips", "mips64", "x86", "x86_64" };

/**
* Arm toolchain implementations.
Expand Down Expand Up @@ -122,7 +122,10 @@ else if ( SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX )
}

String fileName = "";
if ( toolchain.startsWith( "arm" ) )
if( toolchain.startsWith( "arm64-v8a")) {
fileName = "aarch64-linux-android-strip" + extension;
}
else if ( toolchain.startsWith( "arm" ) )
{
fileName = "arm-linux-androideabi-strip" + extension;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ harArtifactHandler, getUnpackedLibsDirectory()
getLog().error( "Specified makefile " + makeFile + " does not exist" );
throw new MojoExecutionException( "Specified makefile " + makeFile + " does not exist" );
}
commands.add( "-f" );
commands.add( makefile );
commands.add( "APP_BUILD_SCRIPT=" + makefile );
}

configureApplicationMakefile( commands );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
libs
obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.acme.hellojni"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
</manifest>
40 changes: 40 additions & 0 deletions src/test/projects/native/native-code-nonstandard-structure/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>

<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>

<parent>
<groupId>com.jayway.maven.plugins.android.generation2.samples</groupId>
<artifactId>native-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>native-code-nonstandard-structure</artifactId>
<!--
Packaging is defined as 'so' - this will indicate to the Maven Android
plugin that it is meant to compile the native code. The resulting native
library is attached to the build
-->
<packaging>so</packaging>

<name>Android NDK - Native Sample Non-standard folder structure</name>

<build>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>

<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<ndkArchitectures>x86 armeabi</ndkArchitectures>
<makefile>src/Android.mk</makefile>
<applicationMakefile>src/Application.mk</applicationMakefile>
<attachHeaderFiles>false</attachHeaderFiles>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2009 The Android Open Source Project
#
# 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.
#
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := native-code-nonstandard-structure
LOCAL_SRC_FILES := hello-jni.c

include $(BUILD_SHARED_LIBRARY)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ABI := armeabi x86
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* 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.
*
*/
#include <string.h>
#include <jni.h>

/* This is a trivial JNI example where we use a native method
* to return a new VM String. See the corresponding Java source
* file located at:
*
* apps/samples/hello-jni/project/src/com/example/HelloJni/HelloJni.java
*/
jstring
Java_com_acme_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
jobject thiz )
{
return (*env)->NewStringUTF(env, "Hello from Native JNI!");
}
1 change: 1 addition & 0 deletions src/test/projects/native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<module>java-with-native-apklib-dependency</module>
<!-- <module>mixed-java-native-with-apklib-dependency</module> -->
<module>transient-apklib-with-native</module>
<module>native-code-nonstandard-structure</module>
</modules>

<dependencyManagement>
Expand Down

0 comments on commit aa937f9

Please sign in to comment.