use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidBinaryIntegrationTest method testCompressAssetLibsNoPackageModular.
@Test
public void testCompressAssetLibsNoPackageModular() throws IOException {
String target = "//apps/sample:app_cxx_lib_asset_no_package_modular";
workspace.runBuckCommand("build", target).assertSuccess();
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
zipInspector.assertFileExists("assets/native.cxx.libasset/libs.xzs");
zipInspector.assertFileExists("assets/native.cxx.libasset/libs.txt");
zipInspector.assertFileExists("lib/x86/libnative_cxx_libasset2.so");
zipInspector.assertFileExists("lib/x86/libnative_cxx_foo1.so");
zipInspector.assertFileExists("lib/x86/libnative_cxx_foo2.so");
zipInspector.assertFileDoesNotExist("assets/lib/libs.xzs");
zipInspector.assertFileDoesNotExist("assets/lib/metadata.txt");
zipInspector.assertFileDoesNotExist("lib/x86/libnative_cxx_libasset.so");
zipInspector.assertFileDoesNotExist("assets/lib/x86/libnative_cxx_libasset.so");
zipInspector.assertFileDoesNotExist("assets/lib/x86/libnative_cxx_libasset2.so");
zipInspector.assertFileDoesNotExist("assets/lib/x86/libnative_cxx_foo1.so");
zipInspector.assertFileDoesNotExist("assets/lib/x86/libnative_cxx_foo2.so");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidAarIntegrationTest method testNativeLibraryDependent.
@Test
public void testNativeLibraryDependent() throws IOException {
AssumeAndroidPlatform.assumeNdkIsAvailable();
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "android_aar_native_deps/ndk_deps", tmp);
workspace.setUp();
String target = "//:app";
workspace.runBuckBuild(target).assertSuccess();
Path aar = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), AndroidAar.AAR_FORMAT));
ZipInspector zipInspector = new ZipInspector(aar);
zipInspector.assertFileExists("AndroidManifest.xml");
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");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidAarIntegrationTest method testBuildPrebuiltAndroidAar.
@Test
public void testBuildPrebuiltAndroidAar() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "android_aar_build/caseB", tmp);
workspace.setUp();
String target = "//:app";
workspace.runBuckBuild(target).assertSuccess();
Path aar = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), AndroidAar.AAR_FORMAT));
ZipInspector zipInspector = new ZipInspector(aar);
zipInspector.assertFileExists("AndroidManifest.xml");
zipInspector.assertFileExists("classes.jar");
zipInspector.assertFileExists("R.txt");
zipInspector.assertFileExists("res/");
zipInspector.assertFileExists("res/values/");
zipInspector.assertFileExists("res/values/values.xml");
zipInspector.assertFileContents("res/values/values.xml", "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<resources>\n" + " <string name=\"app_name\">Hello World</string>\n" + "</resources>");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidExopackageBinaryIntegrationTest method testEditingNativeForcesRebuild.
@Test
public void testEditingNativeForcesRebuild() throws IOException, InterruptedException {
// 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
// during the build in setUp. If we don't do this, there's a chance that the
// ndk-build we run during the upcoming build will not rebuild it (on filesystems
// that have 1-second granularity for last modified).
// To verify this, create a Makefile with the following rule (don't forget to use a tab):
// out: in
// cat $< > $@
// Run: echo foo > in ; make ; cat out ; echo bar > in ; make ; cat out
// On a filesystem with 1-second mtime granularity, the last "cat" should print "foo"
// (with very high probability).
Thread.sleep(1500);
ZipInspector zipInspector;
// Change the binary and ensure that we re-run apkbuilder.
workspace.replaceFileContents("native/fakenative/jni/fakesystem.c", "exit(status)", "exit(1+status)");
workspace.resetBuildLogFile();
workspace.runBuckBuild(DEX_EXOPACKAGE_TARGET).assertSuccess();
workspace.getBuildLog().assertTargetBuiltLocally(DEX_EXOPACKAGE_TARGET);
zipInspector = new ZipInspector(workspace.getPath("buck-out/gen/apps/multidex/app-dex-exo.apk"));
zipInspector.assertFileExists("lib/armeabi/libfakenative.so");
zipInspector.assertFileDoesNotExist("assets/lib/armeabi/libfakenative.so");
// Now convert it into an asset native library and ensure that we re-run apkbuilder.
workspace.replaceFileContents("native/fakenative/jni/BUCK", "name = 'fakenative',", "name = 'fakenative',\nis_asset=True,");
workspace.resetBuildLogFile();
workspace.runBuckBuild(DEX_EXOPACKAGE_TARGET).assertSuccess();
workspace.getBuildLog().assertTargetBuiltLocally(DEX_EXOPACKAGE_TARGET);
zipInspector = new ZipInspector(workspace.getPath("buck-out/gen/apps/multidex/app-dex-exo.apk"));
zipInspector.assertFileDoesNotExist("lib/armeabi/libfakenative.so");
zipInspector.assertFileExists("assets/lib/armeabi/libfakenative.so");
// Now edit it again and make sure we re-run apkbuilder.
Thread.sleep(1500);
workspace.replaceFileContents("native/fakenative/jni/fakesystem.c", "exit(1+status)", "exit(2+status)");
workspace.resetBuildLogFile();
workspace.runBuckBuild(DEX_EXOPACKAGE_TARGET).assertSuccess();
workspace.getBuildLog().assertTargetBuiltLocally(DEX_EXOPACKAGE_TARGET);
zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(DEX_EXOPACKAGE_TARGET), "%s.apk")));
zipInspector.assertFileDoesNotExist("lib/armeabi/libfakenative.so");
zipInspector.assertFileExists("assets/lib/armeabi/libfakenative.so");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidExopackageBinaryIntegrationTest method testAllExopackageHasNeitherSecondaryNorNativeLibraries.
@Test
public void testAllExopackageHasNeitherSecondaryNorNativeLibraries() throws IOException {
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(DEX_AND_NATIVE_EXOPACKAGE_TARGET), "%s.apk")));
zipInspector.assertFileDoesNotExist("assets/secondary-program-dex-jars/metadata.txt");
zipInspector.assertFileDoesNotExist("classes2.dex");
zipInspector.assertFileExists("classes.dex");
assertNativeLibrariesDontExist(zipInspector);
}
Aggregations