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

arm64-v8a APP_ABI is now supported by android-maven-plugin #574

Merged
merged 1 commit into from
Mar 31, 2015
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
34 changes: 30 additions & 4 deletions src/main/java/com/jayway/maven/plugins/android/AndroidNdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public class AndroidNdk
public static final String[] ARM_TOOLCHAIN = { "arm-linux-androideabi-4.9", "arm-linux-androideabi-4.8",
"arm-linux-androideabi-4.7", "arm-linux-androideabi-4.6", "arm-linux-androideabi-4.4.3" };

/**
* Arm64 toolchain implementations.
*/
public static final String[] ARM64_TOOLCHAIN = { "aarch64-linux-android-4.9" };

/**
* x86 toolchain implementations.
*/
Expand Down Expand Up @@ -110,6 +115,10 @@ else if ( SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX )
{
fileName = "arm-linux-androideabi-strip" + extension;
}
else if ( toolchain.startsWith( "aarch64" ) )
{
fileName = "aarch64-linux-android-strip" + extension;
}
else if ( toolchain.startsWith( "x86" ) )
{
fileName = "i686-linux-android-strip" + extension;
Expand Down Expand Up @@ -177,10 +186,14 @@ public String getToolchain( File file ) throws MojoExecutionException

// try to resolve the toolchain now
String ndkArchitecture = file.getParentFile().getName();
if ( ndkArchitecture.startsWith( "arm" ) )
if ( ndkArchitecture.startsWith( "armeabi" ) )
{
resolvedNdkToolchain = resolveNdkToolchain( ARM_TOOLCHAIN );
}
else if ( ndkArchitecture.startsWith( "arm64" ) )
{
resolvedNdkToolchain = resolveNdkToolchain( ARM64_TOOLCHAIN );
}
else if ( ndkArchitecture.startsWith( "x86" ) )
{
resolvedNdkToolchain = resolveNdkToolchain( X86_TOOLCHAIN );
Expand Down Expand Up @@ -220,11 +233,16 @@ public File getGdbServer( String ndkArchitecture ) throws MojoExecutionException
{
// create a list of possible gdb server parent folder locations
List<String> gdbServerLocations = new ArrayList<String>();
if ( ndkArchitecture.startsWith( "arm" ) )
if ( ndkArchitecture.startsWith( "armeabi" ) )
{
gdbServerLocations.add( "android-arm" );
gdbServerLocations.add( "android-armeabi" );
gdbServerLocations.addAll( Arrays.asList( ARM_TOOLCHAIN ) );
}
else if ( ndkArchitecture.startsWith( "arm64" ) )
{
gdbServerLocations.add( "android-arm64" );
gdbServerLocations.addAll( Arrays.asList( ARM64_TOOLCHAIN ) );
}
else if ( ndkArchitecture.startsWith( "x86" ) )
{
gdbServerLocations.add( "android-x86" );
Expand Down Expand Up @@ -270,14 +288,22 @@ public String getToolchainFromArchitecture( final String ndkArchitecture,
final NDKArchitectureToolchainMappings ndkArchitectureToolchainMappings
) throws MojoExecutionException
{
if ( ndkArchitecture.startsWith( "arm" ) )
if ( ndkArchitecture.startsWith( "armeabi" ) )
{
if ( ndkArchitectureToolchainMappings != null )
{
return ndkArchitectureToolchainMappings.getArmeabi();
}
return AndroidNdk.ARM_TOOLCHAIN[0];
}
else if ( ndkArchitecture.startsWith( "arm64" ) )
{
if ( ndkArchitectureToolchainMappings != null )
{
return ndkArchitectureToolchainMappings.getArm64();
}
return AndroidNdk.ARM64_TOOLCHAIN[0];
}
else if ( ndkArchitecture.startsWith( "x86" ) )
{
if ( ndkArchitectureToolchainMappings != null )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class NDKArchitectureToolchainMappings
{
String x86 = AndroidNdk.X86_TOOLCHAIN[0];
String armeabi = AndroidNdk.ARM_TOOLCHAIN[0];
String mips = AndroidNdk.ARM_TOOLCHAIN[0];
String arm64 = AndroidNdk.ARM64_TOOLCHAIN[0];
String mips = AndroidNdk.MIPS_TOOLCHAIN[0];

public String getArmeabi()
{
Expand All @@ -21,6 +22,16 @@ public void setArmeabi( final String armeabi )
this.armeabi = armeabi;
}

public String getArm64()
{
return arm64;
}

public void setArm64( final String arm64 )
{
this.arm64 = arm64;
}

public String getMips()
{
return mips;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public class NdkBuildMojo extends AbstractAndroidMojo


/**
* Specifies the final name of the library output by the build (this allows
* Specifies the final name of the library output by the build (this allows
* the pom to override the default artifact name). The value should not
* include the 'lib' prefix or filename extension (e.g. '.so').
*/
Expand Down Expand Up @@ -519,6 +519,7 @@ private void configureNdkToolchain( String architecture, List<String> commands )
// <ndkArchitectures>
// <x86>x86-4.6</x86>
// <armeabi>x86-4.6</armeabi>
// <arm64-v8a>aarch64-4.9</arm64-v8a>
// </ndkArchitectures>
final String toolchainFromArchitecture = getAndroidNdk().getToolchainFromArchitecture(
architecture, ndkArchitectureToolchainMappings );
Expand Down Expand Up @@ -572,7 +573,7 @@ private File findNativeLibrary( File nativeLibDirectory ) throws MojoExecutionEx
public boolean accept( final File dir, final String name )
{
String libraryName = ndkFinalLibraryName;

if ( libraryName == null || libraryName.isEmpty() )
{
libraryName = project.getArtifactId();
Expand Down Expand Up @@ -622,7 +623,7 @@ public boolean accept( final File dir, final String name )
}
return files[ 0 ];
}

private File nativeLibraryFromName( File nativeLibDirectory ) throws MojoExecutionException
{
final File libraryFile;
Expand Down Expand Up @@ -661,7 +662,7 @@ private File nativeLibraryFromName( File nativeLibDirectory ) throws MojoExecuti

return libraryFile;
}

private CommandExecutor.ErrorListener getNdkErrorListener()
{
return new CommandExecutor.ErrorListener()
Expand Down Expand Up @@ -839,9 +840,9 @@ private void setupNativeLibraryEnvironment( MakefileHelper makefileHelper, Comma
if ( NativeHelper.hasStaticNativeLibraryArtifact( resolveNativeLibraryArtifacts, getUnpackedLibsDirectory(),
architecture ) )
{
String staticlibs = makefileHelper.createLibraryList( resolveNativeLibraryArtifacts,
String staticlibs = makefileHelper.createLibraryList( resolveNativeLibraryArtifacts,
architecture,
true );
true );
executor.addEnvironment( "ANDROID_MAVEN_PLUGIN_LOCAL_STATIC_LIBRARIES", staticlibs );
getLog().debug( "Set ANDROID_MAVEN_PLUGIN_LOCAL_STATIC_LIBRARIES = " + staticlibs );
}
Expand All @@ -850,22 +851,22 @@ private void setupNativeLibraryEnvironment( MakefileHelper makefileHelper, Comma
if ( NativeHelper.hasSharedNativeLibraryArtifact( resolveNativeLibraryArtifacts, getUnpackedLibsDirectory(),
architecture ) )
{
String sharedlibs = makefileHelper.createLibraryList( resolveNativeLibraryArtifacts,
String sharedlibs = makefileHelper.createLibraryList( resolveNativeLibraryArtifacts,
architecture,
false );
false );
executor.addEnvironment( "ANDROID_MAVEN_PLUGIN_LOCAL_SHARED_LIBRARIES", sharedlibs );
getLog().debug( "Set ANDROID_MAVEN_PLUGIN_LOCAL_SHARED_LIBRARIES = " + sharedlibs );
}
}

private Set<Artifact> findNativeLibraryDependencies() throws MojoExecutionException
{
final NativeHelper nativeHelper = getNativeHelper();
final Set<Artifact> staticLibraryArtifacts = nativeHelper
.getNativeDependenciesArtifacts( this, getUnpackedLibsDirectory(), false );
final Set<Artifact> sharedLibraryArtifacts = nativeHelper
.getNativeDependenciesArtifacts( this, getUnpackedLibsDirectory(), true );

final Set<Artifact> mergedArtifacts = new LinkedHashSet<Artifact>();
filterNativeDependencies( mergedArtifacts, staticLibraryArtifacts );
filterNativeDependencies( mergedArtifacts, sharedLibraryArtifacts );
Expand All @@ -891,7 +892,7 @@ private void filterNativeDependencies( Set<Artifact> targetSet, Set<Artifact> so
{
for ( Artifact a : source )
{
if ( project.getGroupId().equals( a.getGroupId() )
if ( project.getGroupId().equals( a.getGroupId() )
&& project.getArtifactId().equals( a.getArtifactId() ) )
{
getLog().warn( "Excluding native dependency attached by this build" );
Expand Down