use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidResourceFilterIntegrationTest method testAsset.
@Test
public void testAsset() throws IOException {
workspace.enableDirCache();
String target = "//apps/sample:app";
workspace.runBuckBuild(target).assertSuccess();
Path apkFile = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk"));
ZipInspector zipInspector = new ZipInspector(apkFile);
long firstCrc = zipInspector.getCrc("assets/asset_file.txt");
workspace.replaceFileContents("res/com/sample/asset_only/assets/asset_file.txt", "Hello", "Bye");
workspace.runBuckBuild(target).assertSuccess();
apkFile = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance(target), "%s.apk"));
zipInspector = new ZipInspector(apkFile);
long secondCrc = zipInspector.getCrc("assets/asset_file.txt");
assertNotEquals("Rebuilt APK file must include the new asset file.", firstCrc, secondCrc);
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class BuiltinApplePackageIntegrationTest method packageHasProperStructure.
@Test
public void packageHasProperStructure() throws IOException, InterruptedException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_no_debug", tmp);
workspace.setUp();
workspace.enableDirCache();
BuildTarget appTarget = BuildTargetFactory.newInstance("//:DemoApp#no-debug,no-include-frameworks");
workspace.runBuckCommand("build", appTarget.getUnflavoredBuildTarget().getFullyQualifiedName()).assertSuccess();
workspace.getBuildLog().assertTargetBuiltLocally(appTarget.getFullyQualifiedName());
workspace.runBuckCommand("clean").assertSuccess();
BuildTarget packageTarget = BuildTargetFactory.newInstance("//:DemoAppPackage");
workspace.runBuckCommand("build", packageTarget.getFullyQualifiedName()).assertSuccess();
workspace.getBuildLog().assertTargetWasFetchedFromCache(appTarget.getFullyQualifiedName());
workspace.getBuildLog().assertTargetBuiltLocally(packageTarget.getFullyQualifiedName());
Path templateDir = TestDataHelper.getTestDataScenario(this, "simple_application_bundle_no_debug");
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, packageTarget, "%s.ipa")));
zipInspector.assertFileExists("Payload/DemoApp.app/DemoApp");
zipInspector.assertFileDoesNotExist("WatchKitSupport");
zipInspector.assertFileDoesNotExist("WatchKitSupport2");
zipInspector.assertFileContents("Payload/DemoApp.app/PkgInfo", new String(Files.readAllBytes(templateDir.resolve("DemoApp_output.expected/DemoApp.app/PkgInfo.expected")), UTF_8));
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class BuildCommandIntegrationTest method buckBuildAndCopyOutputFileWithBuildTargetThatSupportsIt.
@Test
public void buckBuildAndCopyOutputFileWithBuildTargetThatSupportsIt() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "build_into", tmp);
workspace.setUp();
Path externalOutputs = tmp.newFolder("into-output");
Path output = externalOutputs.resolve("the_example.jar");
assertFalse(output.toFile().exists());
workspace.runBuckBuild("//:example", "--out", output.toString()).assertSuccess();
assertTrue(output.toFile().exists());
ZipInspector zipInspector = new ZipInspector(output);
zipInspector.assertFileExists("com/example/Example.class");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class GwtBinaryIntegrationTest method shouldBeAbleToBuildAGwtBinary.
@Test(timeout = (2 * 60 * 1000))
public void shouldBeAbleToBuildAGwtBinary() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "gwt_binary", tmp);
workspace.setUp();
ProjectWorkspace.ProcessResult result = workspace.runBuckBuild("//:binary");
result.assertSuccess();
Path zip = workspace.buildAndReturnOutput("//:binary");
ZipInspector inspector = new ZipInspector(zip);
inspector.assertFileExists("a/a.devmode.js");
inspector.assertFileExists("a/a.nocache.js");
inspector.assertFileExists("a/clear.cache.gif");
inspector.assertFileExists("a/compilation-mappings.txt");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidReactNativeLibraryIntegrationTest method testAaptPackageDependsOnReactNativeBundle.
@Test
public void testAaptPackageDependsOnReactNativeBundle() throws IOException {
workspace.enableDirCache();
BuildTarget target = BuildTargetFactory.newInstance("//apps/sample:app-without-rn-res");
workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s.apk")));
zipInspector.assertFileExists("assets/SampleBundle.js");
workspace.runBuckCommand("clean");
workspace.replaceFileContents("apps/sample/BUCK", "#REPLACE_ME_WITH_ANOTHER_RES", "'//res/com/sample/unused:unused'");
workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s.apk")));
zipInspector.assertFileExists("assets/SampleBundle.js");
}
Aggregations