Search in sources :

Example 56 with BuckBuildLog

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

the class AndroidExopackageBinaryIntegrationTest method testEditingSecondaryDexClassGetsAbiHitForExopackage.

@Test
public void testEditingSecondaryDexClassGetsAbiHitForExopackage() throws IOException {
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "package com", "package\ncom");
    workspace.resetBuildLogFile();
    workspace.runBuckBuild(DEX_EXOPACKAGE_TARGET).assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetHadMatchingInputRuleKey(DEX_EXOPACKAGE_TARGET);
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 57 with BuckBuildLog

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

the class AndroidExopackageBinaryIntegrationTest method testEditingSecondaryDexClassGetsAbiHitForDexAndNativeExopackage.

@Test
public void testEditingSecondaryDexClassGetsAbiHitForDexAndNativeExopackage() throws IOException {
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "package com", "package\ncom");
    workspace.resetBuildLogFile();
    workspace.runBuckBuild(DEX_AND_NATIVE_EXOPACKAGE_TARGET).assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetHadMatchingInputRuleKey(DEX_AND_NATIVE_EXOPACKAGE_TARGET);
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 58 with BuckBuildLog

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

the class AndroidBinaryIntegrationTest method testResourcesTrimming.

@Test
public void testResourcesTrimming() throws IOException {
    // Enable trimming.
    workspace.replaceFileContents("apps/multidex/BUCK", "# ARGS_FOR_APP", "trim_resource_ids = True,  # ARGS_FOR_APP");
    workspace.runBuckCommand("build", "//apps/multidex:disassemble_app_r_dot_java").assertSuccess();
    // Make sure we only see what we expect.
    verifyTrimmedRDotJava(ImmutableSet.of("top_layout", "title"));
    // Make a change.
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "R.layout.top_layout", "0 /* NO RESOURCE HERE */");
    // Make sure everything gets rebuilt, and we only see what we expect.
    workspace.resetBuildLogFile();
    workspace.runBuckCommand("build", "//apps/multidex:disassemble_app_r_dot_java").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//apps/multidex:app#compile_uber_r_dot_java");
    buildLog.assertTargetBuiltLocally("//apps/multidex:app#dex_uber_r_dot_java");
    verifyTrimmedRDotJava(ImmutableSet.of("title"));
    // Turn off trimming and turn on exopackage, and rebuilt.
    workspace.replaceFileContents("apps/multidex/BUCK", "trim_resource_ids = True,  # ARGS_FOR_APP", "exopackage_modes = ['secondary_dex'],  # ARGS_FOR_APP");
    workspace.runBuckCommand("build", SIMPLE_TARGET).assertSuccess();
    // Make a change.
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "0 /* NO RESOURCE HERE */", "R.layout.top_layout");
    // rebuilt and verify that we get an ABI hit.
    workspace.resetBuildLogFile();
    workspace.runBuckCommand("build", SIMPLE_TARGET).assertSuccess();
    buildLog = workspace.getBuildLog();
    buildLog.assertTargetHadMatchingInputRuleKey(SIMPLE_TARGET);
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 59 with BuckBuildLog

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

the class AndroidBinaryIntegrationTest method testDexingIsInputBased.

@Test
public void testDexingIsInputBased() throws IOException {
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//java/com/sample/lib:lib#dex");
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "import", "import /* no output change */");
    workspace.runBuckBuild(SIMPLE_TARGET).assertSuccess();
    buildLog = workspace.getBuildLog();
    buildLog.assertNotTargetBuiltLocally("//java/com/sample/lib:lib#dex");
    buildLog.assertTargetHadMatchingInputRuleKey("//java/com/sample/lib:lib#dex");
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "import", "import /* \n some output change */");
    workspace.runBuckBuild(SIMPLE_TARGET).assertSuccess();
    buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//java/com/sample/lib:lib#dex");
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 60 with BuckBuildLog

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

the class AndroidBinaryIntegrationTest method testResourcesTrimmingWithPattern.

@Test
public void testResourcesTrimmingWithPattern() throws IOException {
    // Enable trimming.
    workspace.replaceFileContents("apps/multidex/BUCK", "# ARGS_FOR_APP", "keep_resource_pattern = '^app_.*', trim_resource_ids = True,  # ARGS_FOR_APP");
    workspace.runBuckCommand("build", "//apps/multidex:disassemble_app_r_dot_java").assertSuccess();
    // Make sure we only see what we expect.
    verifyTrimmedRDotJava(ImmutableSet.of("app_icon", "app_name", "top_layout", "title"));
    // Make a change.
    workspace.replaceFileContents("java/com/sample/lib/Sample.java", "R.layout.top_layout", "0 /* NO RESOURCE HERE */");
    // Make sure everything gets rebuilt, and we only see what we expect.
    workspace.resetBuildLogFile();
    workspace.runBuckCommand("build", "//apps/multidex:disassemble_app_r_dot_java").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//apps/multidex:app#compile_uber_r_dot_java");
    buildLog.assertTargetBuiltLocally("//apps/multidex:app#dex_uber_r_dot_java");
    verifyTrimmedRDotJava(ImmutableSet.of("app_icon", "app_name", "title"));
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Aggregations

BuckBuildLog (com.facebook.buck.testutil.integration.BuckBuildLog)88 Test (org.junit.Test)88 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)53 BuildTarget (com.facebook.buck.model.BuildTarget)32 OcamlRuleBuilder.createStaticLibraryBuildTarget (com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget)10 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)9 Path (java.nio.file.Path)8 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)7 ExecutableFinder (com.facebook.buck.io.ExecutableFinder)2 Sha1HashCode (com.facebook.buck.util.sha1.Sha1HashCode)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)2 NSString (com.dd.plist.NSString)1 AssumeAndroidPlatform (com.facebook.buck.android.AssumeAndroidPlatform)1 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)1 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)1 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)1 CxxFlavorSanitizer.sanitize (com.facebook.buck.cxx.CxxFlavorSanitizer.sanitize)1 CxxPlatform (com.facebook.buck.cxx.CxxPlatform)1