Search in sources :

Example 6 with ZipInspector

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

the class AndroidBinaryIntegrationTest method testCxxLibraryDep.

@Test
public void testCxxLibraryDep() throws IOException {
    String target = "//apps/sample:app_cxx_lib_dep";
    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/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");
    zipInspector.assertFileExists("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 7 with ZipInspector

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

the class AndroidBinaryIntegrationTest method testStaticCxxLibraryDep.

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

Example 8 with ZipInspector

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

the class AndroidExopackageBinaryIntegrationTest method testNativeExopackageHasNoNativeLibraries.

@Test
public void testNativeExopackageHasNoNativeLibraries() throws IOException {
    ZipInspector zipInspector = new ZipInspector(workspace.getPath("buck-out/gen/apps/multidex/app-native-exo.apk"));
    zipInspector.assertFileDoesNotExist("assets/secondary-program-dex-jars/metadata.txt");
    zipInspector.assertFileExists("classes2.dex");
    zipInspector.assertFileExists("classes.dex");
    assertNativeLibrariesDontExist(zipInspector);
}
Also used : ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) Test(org.junit.Test)

Example 9 with ZipInspector

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

the class AndroidPrebuiltAarIntegrationTest method testBuildAndroidPrebuiltAar.

@Test
public void testBuildAndroidPrebuiltAar() throws IOException {
    String target = "//:app";
    workspace.runBuckBuild(target).assertSuccess();
    ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(new ProjectFilesystem(workspace.getDestPath()), BuildTargetFactory.newInstance(target), "%s.apk")));
    zipInspector.assertFileExists("AndroidManifest.xml");
    zipInspector.assertFileExists("resources.arsc");
    zipInspector.assertFileExists("classes.dex");
    zipInspector.assertFileExists("lib/x86/liba.so");
}
Also used : ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) Matchers.containsString(org.hamcrest.Matchers.containsString) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Test(org.junit.Test)

Example 10 with ZipInspector

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

the class AndroidResourceFilterIntegrationTest method testApkWithXhdpiAndHdpiFilter.

@Test
public void testApkWithXhdpiAndHdpiFilter() throws IOException {
    String target = "//apps/sample:app_hdpi_xhdpi";
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target);
    result.assertSuccess();
    Path apkFile = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk"));
    ZipInspector zipInspector = new ZipInspector(apkFile);
    if (isBuildToolsNew) {
        zipInspector.assertFileDoesNotExist("res/drawable-mdpi-v4/app_icon.png");
        zipInspector.assertFileExists("res/drawable-hdpi-v4/app_icon.png");
        zipInspector.assertFileExists("res/drawable-xhdpi-v4/app_icon.png");
    } else {
        zipInspector.assertFileDoesNotExist("res/drawable-mdpi/app_icon.png");
        zipInspector.assertFileExists("res/drawable-hdpi/app_icon.png");
        zipInspector.assertFileExists("res/drawable-xhdpi/app_icon.png");
    }
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) 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