Search in sources :

Example 41 with ZipInspector

use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.

the class AndroidBinaryIntegrationTest method testRawSplitDexHasSecondary.

@Test
public void testRawSplitDexHasSecondary() throws IOException {
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", RAW_DEX_TARGET);
    result.assertSuccess();
    ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(RAW_DEX_TARGET), "%s.apk")));
    zipInspector.assertFileDoesNotExist("assets/secondary-program-dex-jars/metadata.txt");
    zipInspector.assertFileDoesNotExist("assets/secondary-program-dex-jars/secondary-1.dex.jar");
    zipInspector.assertFileExists("classes2.dex");
    zipInspector.assertFileExists("classes.dex");
    zipInspector.assertFileExists("lib/armeabi/libfakenative.so");
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) Test(org.junit.Test)

Example 42 with ZipInspector

use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.

the class AndroidBinaryIntegrationTest method testCxxLibraryDepClang.

@Test
public void testCxxLibraryDepClang() throws IOException {
    String target = "//apps/sample:app_cxx_lib_dep";
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", "-c", "ndk.compiler=clang", "-c", "ndk.cxx_runtime=libcxx", target);
    result.assertSuccess();
    ZipInspector zipInspector = new ZipInspector(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");
    zipInspector.assertFileExists("lib/x86/libc++_shared.so");
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 43 with ZipInspector

use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.

the class AndroidBinaryIntegrationTest method testNoCxxDepsDoesNotIncludeNdkRuntime.

@Test
public void testNoCxxDepsDoesNotIncludeNdkRuntime() throws IOException {
    String target = "//apps/sample:app_no_cxx_deps";
    workspace.runBuckCommand("build", target).assertSuccess();
    ZipInspector zipInspector = new ZipInspector(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");
}
Also used : ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 44 with ZipInspector

use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.

the class AndroidBinaryIntegrationTest method testCxxLibraryDepWithNoFilters.

@Test
public void testCxxLibraryDepWithNoFilters() throws IOException {
    String target = "//apps/sample:app_cxx_lib_dep_no_filters";
    workspace.runBuckCommand("build", target).assertSuccess();
    ZipInspector zipInspector = new ZipInspector(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");
}
Also used : ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 45 with ZipInspector

use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.

the class AndroidBinaryIntegrationTest method testCxxLibraryAsAsset.

@Test
public void testCxxLibraryAsAsset() throws IOException {
    String target = "//apps/sample:app_cxx_lib_asset";
    workspace.runBuckCommand("build", target).assertSuccess();
    ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk")));
    zipInspector.assertFileExists("assets/lib/x86/libnative_cxx_libasset.so");
    zipInspector.assertFileDoesNotExist("lib/x86/libnative_cxx_libasset.so");
    zipInspector.assertFileExists("lib/x86/libnative_cxx_foo1.so");
    zipInspector.assertFileExists("lib/x86/libnative_cxx_foo2.so");
    zipInspector.assertFileDoesNotExist("assets/lib/x86/libnative_cxx_foo1.so");
    zipInspector.assertFileDoesNotExist("assets/lib/x86/libnative_cxx_foo2.so");
}
Also used : ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Aggregations

ZipInspector (com.facebook.buck.testutil.integration.ZipInspector)63 Test (org.junit.Test)62 Path (java.nio.file.Path)34 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)29 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 BuildTarget (com.facebook.buck.model.BuildTarget)10 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)7 TestConsole (com.facebook.buck.testutil.TestConsole)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)3 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)3 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)3 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)3 ProcessResult (com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult)3 Clock (com.facebook.buck.timing.Clock)3 DefaultClock (com.facebook.buck.timing.DefaultClock)3 SymbolGetter (com.facebook.buck.android.AndroidNdkHelper.SymbolGetter)2 SymbolsAndDtNeeded (com.facebook.buck.android.AndroidNdkHelper.SymbolsAndDtNeeded)2 FakeBuildableContext (com.facebook.buck.rules.FakeBuildableContext)2 ExecutionContext (com.facebook.buck.step.ExecutionContext)2