Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Drop arm as a default CPU ABI
Browse files Browse the repository at this point in the history
With the latest version of the NDK, `arm` is not supported.

Fixes #1890.
  • Loading branch information
LegNeato committed May 24, 2018
1 parent 1844025 commit b6c985a
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 48 deletions.
4 changes: 2 additions & 2 deletions docs/concept/buckconfig.soy
Original file line number Diff line number Diff line change
Expand Up @@ -2873,10 +2873,10 @@ your <code>.buckjavaargs</code> file</a>:
{call buckconfig.entry}
{param section: 'ndk' /}
{param name: 'cpu_abis' /}
{param example_value: 'armv7, x86' /}
{param example_value: 'armv7, arm64, x86' /}
{param description}
A comma separated list of the CPU ABIs that this repo supports. Buck will only build NDK code
for these ABIs.
for these ABIs. The default is <code>armv7, x86</code>.
{/param}
{/call}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public class NdkCxxPlatforms {

public static final NdkCompilerType DEFAULT_COMPILER_TYPE = NdkCompilerType.GCC;
public static final String DEFAULT_TARGET_APP_PLATFORM = "android-16";
public static final ImmutableSet<String> DEFAULT_CPU_ABIS =
ImmutableSet.of("arm", "armv7", "x86");
public static final ImmutableSet<String> DEFAULT_CPU_ABIS = ImmutableSet.of("armv7", "x86");
public static final NdkCxxRuntime DEFAULT_CXX_RUNTIME = NdkCxxRuntime.GNUSTL;

private static final ImmutableMap<Platform, Host> BUILD_PLATFORMS =
Expand Down
4 changes: 0 additions & 4 deletions test/com/facebook/buck/android/AndroidAarIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ public void testCxxLibraryDependent() throws InterruptedException, IOException {
zipInspector.assertFileExists("classes.jar");
zipInspector.assertFileExists("R.txt");
zipInspector.assertFileExists("res/");
zipInspector.assertFileExists("jni/armeabi/libdep.so");
zipInspector.assertFileExists("jni/armeabi/libnative.so");
zipInspector.assertFileExists("jni/armeabi-v7a/libdep.so");
zipInspector.assertFileExists("jni/armeabi-v7a/libnative.so");
zipInspector.assertFileExists("jni/x86/libdep.so");
Expand All @@ -254,10 +252,8 @@ public void testNativeLibraryDependent() throws InterruptedException, IOExceptio
zipInspector.assertFileExists("classes.jar");
zipInspector.assertFileExists("R.txt");
zipInspector.assertFileExists("res/");
zipInspector.assertFileExists("assets/lib/armeabi/libfoo.so");
zipInspector.assertFileExists("assets/lib/armeabi-v7a/libfoo.so");
zipInspector.assertFileExists("assets/lib/x86/libfoo.so");
zipInspector.assertFileExists("jni/armeabi/libbar.so");
zipInspector.assertFileExists("jni/armeabi-v7a/libbar.so");
zipInspector.assertFileExists("jni/x86/libbar.so");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ public void testCxxLibraryDep() throws IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi/libgnustl_shared.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libgnustl_shared.so");
zipInspector.assertFileExists("lib/x86/libnative_cxx_lib.so");
Expand All @@ -108,8 +106,6 @@ public void testCxxLibraryDepModular() throws IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi/libgnustl_shared.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libgnustl_shared.so");
zipInspector.assertFileDoesNotExist("lib/x86/libnative_cxx_lib.so");
Expand All @@ -131,8 +127,6 @@ public void testCxxLibraryDepClang() throws IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi/libc++_shared.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libc++_shared.so");
zipInspector.assertFileExists("lib/x86/libnative_cxx_lib.so");
Expand All @@ -149,7 +143,6 @@ public void testCxxLibraryDepWithNoFilters() throws IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/x86/libnative_cxx_lib.so");
}
Expand All @@ -164,7 +157,6 @@ public void testNoCxxDepsDoesNotIncludeNdkRuntime() throws IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileDoesNotExist("lib/armeabi/libgnustl_shared.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libgnustl_shared.so");
zipInspector.assertFileDoesNotExist("lib/x86/libgnustl_shared.so");
}
Expand Down Expand Up @@ -207,8 +199,6 @@ public void testX86OnlyCxxLibrary() throws IOException {
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_x86-only.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libgnustl_shared.so");
zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_x86-only.so");
zipInspector.assertFileDoesNotExist("lib/armeabi/libgnustl_shared.so");
zipInspector.assertFileExists("lib/x86/libnative_cxx_x86-only.so");
zipInspector.assertFileExists("lib/x86/libgnustl_shared.so");
}
Expand Down
12 changes: 6 additions & 6 deletions test/com/facebook/buck/android/AndroidBinaryIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void testNonExopackageHasSecondary() throws IOException {
zipInspector.assertFileDoesNotExist("classes2.dex");

zipInspector.assertFileExists("classes.dex");
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
}

@Test
Expand All @@ -124,7 +124,7 @@ public void testProguardBuild() throws IOException {
zipInspector.assertFileDoesNotExist("classes2.dex");

zipInspector.assertFileExists("classes.dex");
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
}

@Test
Expand All @@ -143,29 +143,29 @@ public void testRawSplitDexHasSecondary() throws IOException {
zipInspector.assertFileExists("classes2.dex");

zipInspector.assertFileExists("classes.dex");
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
}

@Test
public void testDisguisedExecutableIsRenamed() throws IOException {
Path output = workspace.buildAndReturnOutput("//apps/sample:app_with_disguised_exe");
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("lib/armeabi/libmybinary.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libmybinary.so");
}

@Test
public void testNdkLibraryIsIncluded() throws IOException {
Path output = workspace.buildAndReturnOutput("//apps/sample:app_with_ndk_library");
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("lib/armeabi/libfakenative.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libfakenative.so");
}

@Test
public void testEditingNdkLibraryForcesRebuild() throws IOException, InterruptedException {
String apkWithNdkLibrary = "//apps/sample:app_with_ndk_library";
Path output = workspace.buildAndReturnOutput(apkWithNdkLibrary);
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("lib/armeabi/libfakenative.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libfakenative.so");

// Sleep 1 second (plus another half to be super duper safe) to make sure that
// fakesystem.c gets a later timestamp than the fakesystem.o that was produced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public void setUp() throws InterruptedException, IOException {
public void testPrebuiltNativeLibraryIsIncluded() throws IOException {
Path output = workspace.buildAndReturnOutput("//apps/sample:app_with_prebuilt_native_libs");
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("lib/armeabi/libprebuilt.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libprebuilt.so");
}

@Test
public void testPrebuiltNativeLibraryAsAssetIsIncluded() throws IOException {
Path output = workspace.buildAndReturnOutput("//apps/sample:app_with_prebuilt_native_libs");
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("assets/lib/armeabi/libprebuilt_asset.so");
zipInspector.assertFileExists("assets/lib/armeabi-v7a/libprebuilt_asset.so");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testDexExopackageHasNoSecondary() throws IOException {
zipInspector.assertFileDoesNotExist("classes2.dex");

zipInspector.assertFileExists("classes.dex");
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");

// It would be better if we could call getExopackageInfo on the app rule.
Path secondaryDir =
Expand Down Expand Up @@ -130,7 +130,7 @@ public void testNativeExopackageHasNoNativeLibraries() throws IOException {

zipInspector.assertFileExists("classes.dex");

zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_lib.so");
}

@Test
Expand All @@ -145,7 +145,7 @@ public void testDexAndNativeExopackageHasNeitherSecondaryNorNativeLibraries() th

zipInspector.assertFileDoesNotExist("assets/secondary-program-dex-jars/metadata.txt");
zipInspector.assertFileDoesNotExist("classes2.dex");
zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_lib.so");

zipInspector.assertFileExists("classes.dex");
}
Expand Down Expand Up @@ -226,8 +226,8 @@ public void testEditingNativeForcesRebuild() throws IOException {
workspace.getBuildLog().assertTargetBuiltLocally(DEX_EXOPACKAGE_TARGET);
zipInspector =
new ZipInspector(workspace.getPath("buck-out/gen/apps/multidex/app-dex-exo.apk"));
zipInspector.assertFileExists("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("assets/lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("assets/lib/armeabi-v7a/libnative_cxx_lib.so");

// Now convert it into an asset native library and ensure that we re-run apkbuilder.
workspace.replaceFileContents(
Expand All @@ -239,8 +239,8 @@ public void testEditingNativeForcesRebuild() throws IOException {
workspace.getBuildLog().assertTargetBuiltLocally(DEX_EXOPACKAGE_TARGET);
zipInspector =
new ZipInspector(workspace.getPath("buck-out/gen/apps/multidex/app-dex-exo.apk"));
zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("assets/lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileExists("assets/lib/armeabi-v7a/libnative_cxx_lib.so");

// Now edit it again and make sure we re-run apkbuilder.
workspace.replaceFileContents("native/cxx/lib.cpp", "return 4", "return 5");
Expand All @@ -254,8 +254,8 @@ public void testEditingNativeForcesRebuild() throws IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(DEX_EXOPACKAGE_TARGET), "%s.apk")));
zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileExists("assets/lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileExists("assets/lib/armeabi-v7a/libnative_cxx_lib.so");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testApkHasABunchOfThingsNotIncluded() throws IOException {

zipInspector.assertFileDoesNotExist("assets/secondary-program-dex-jars/metadata.txt");
zipInspector.assertFileDoesNotExist("classes2.dex");
zipInspector.assertFileDoesNotExist("lib/armeabi/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("lib/armeabi-v7a/libnative_cxx_lib.so");
zipInspector.assertFileDoesNotExist("assets/hilarity.txt");

zipInspector.assertFileExists("classes.dex");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public void testCxxLibraryDep() throws InterruptedException, IOException {
workspace.getPath(
BuildTargets.getGenPath(
filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileExists("lib/armeabi/libcxx.so");
zipInspector.assertFileExists("lib/armeabi/libgnustl_shared.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libcxx.so");
zipInspector.assertFileExists("lib/armeabi-v7a/libgnustl_shared.so");
zipInspector.assertFileExists("lib/x86/libcxx.so");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ android_binary(
android_binary(
name = "app-native-exo",
cpu_filters = [
"arm",
"armv7",
],
exopackage_modes = ["native_library"],
keystore = "//keystores:debug",
Expand All @@ -228,7 +228,7 @@ android_binary(
android_binary(
name = "app-dex-native-exo",
cpu_filters = [
"arm",
"armv7",
],
exopackage_modes = [
"native_library",
Expand All @@ -251,7 +251,7 @@ android_binary(
android_binary(
name = "app-full-exo",
cpu_filters = [
"arm",
"armv7",
],
exopackage_modes = [
"native_library",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ android_binary(
android_binary(
name = "app_cxx_lib_dep",
cpu_filters = [
"arm",
"armv7",
"x86",
],
Expand Down Expand Up @@ -244,7 +243,6 @@ android_binary(
"//native/cxx:lib",
],
cpu_filters = [
"arm",
"armv7",
"x86",
],
Expand Down Expand Up @@ -312,7 +310,6 @@ android_binary(
android_binary(
name = "app_no_cxx_deps",
cpu_filters = [
"arm",
"armv7",
"x86",
],
Expand Down Expand Up @@ -383,7 +380,6 @@ android_binary(
android_binary(
name = "app_with_native_lib_proguard",
cpu_filters = [
"arm",
"armv7",
"x86",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# buck-out/bin/apps/sample/__native_dex_app_with_native_lib_proguard#copy_native_libs_dex__/libs/armeabi/libgnustl_shared.so
# buck-out/bin/apps/sample/__native_dex_app_with_native_lib_proguard#copy_native_libs_dex__/libs/armeabi/libnative_cxx_lib.so
# buck-out/bin/apps/sample/__native_dex_app_with_native_lib_proguard#copy_native_libs_dex__/libs/armeabi-v7a/libgnustl_shared.so
# buck-out/bin/apps/sample/__native_dex_app_with_native_lib_proguard#copy_native_libs_dex__/libs/armeabi-v7a/libnative_cxx_lib.so
# buck-out/bin/apps/sample/__native_dex_app_with_native_lib_proguard#copy_native_libs_dex__/libs/x86/libgnustl_shared.so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public void changedPlatformTarget() throws InterruptedException, IOException {
workspace.getBuildLog().assertTargetBuiltLocally(linkTarget.toString());

// Change the app platform and verify that our rulekey has changed.
workspace.writeContentsToPath("[ndk]\n app_platform = android-12", ".buckconfig");
workspace.writeContentsToPath(
"[ndk]\n app_platform = android-12\n cpu_abis = arm, armv7, x86", ".buckconfig");
workspace.runBuckCommand("build", target.toString()).assertSuccess();
workspace.getBuildLog().assertTargetBuiltLocally(linkTarget.toString());
}
Expand Down

0 comments on commit b6c985a

Please sign in to comment.