)]}'
{
  "commit": "22b4dbcaf05756d506de346728db3846da56b775",
  "tree": "0117207eb12f17749bd88663ba3d56ee53a73ffd",
  "parents": [
    "8dbcc8f3ac6f096c8c6ffb9e8edc65e85c639806"
  ],
  "author": {
    "name": "Philipp Schrader",
    "email": "philipp.schrader@gmail.com",
    "time": "Tue Oct 27 07:17:41 2020 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Tue Oct 27 07:18:44 2020 -0700"
  },
  "message": "Add basic incompatible target skipping\n\nThis patch aims to implement a basic version of incompatible target\nskipping outlined here:\nhttps://docs.google.com/document/d/12n5QNHmFSkuh5yAbdEex64ot4hRgR-moL1zRimU7wHQ/edit?usp\u003dsharing\n\nThe implementation in this patch supports target skipping based\non the target platform. In a `BUILD` file you can now add constraints\nthat the target platform must satisfy in order for the target to be\nbuilt and/or tested. For example, use the following snippet to declare\na target to be compatible with Windows platforms only:\n\n    cc_binary(\n        name \u003d \"bin\",\n        srcs \u003d [\"bin.cc\"],\n        target_compatible_with \u003d [\n            \"@platforms//os:windows\",\n        ],\n    )\n\nBuilds triggered with `:all` or `...` on a non-Windows platform will\nsimply skip the incompatible target. An appropriate note is shown on\nthe command line if the `--show_result` threshold is high enough.\nTargets that transitively depend on incompatible targets are\nthemselves considered incompatible and will also be skipped.\n\nExplicitly requesting an incompatible target on the command line is an\nerror and will cause the build to fail. Bazel will print out an\nappropriate error message and inform the user what constraint could\nnot be satisfied.\n\nSee the new documentation in this patch for more information. In\nparticular, https://docs.bazel.build/versions/master/platforms.html\nshould be a good bit more informative.\n\nThis implementation does not make any effort to support expressing\ncompatibility with toolchains. It is possible that using `select()`\n(commented on below) already makes this possible, but it\u0027s not\nvalidated or explicitly supported in this patch.\n\nDuring implementation we noticed that `select()` can be quite powerful\nin combination with `target_compatible_with`. A basic summary of this\nis also documented on the Platforms page.\n\nIt may be useful to create helper functions in, say, skylib to help\nmake complex `select()` statements more readable. For example, we\ncould replace the following:\n\n    target_compatible_with \u003d select({\n        \"@platforms//os:linux\": [],\n        \"@platforms//os:macos\": [],\n        \"//conditions:default\": [\":not_compatible\"],\n    })\n\nwith something like:\n\n    target_compatible_with \u003d constraints.any_of([\n        \"@platforms//os:linux\",\n        \"@platforms//os:macos\",\n    ])\n\nThat, however, is work for follow-up patches.\n\nMany thanks to Austin Schuh (@AustinSchuh) and Greg Estren\n(@gregestren) for working on the proposal and helping a ton on this\npatch itself. Also thanks to many others who provided feedback on the\nimplementation.\n\nRELNOTES: Bazel skips incompatible targets based on target platform\nand `target_compatible_with` contents. See\nhttps://docs.bazel.build/versions/master/platforms.html for more\ndetails.\n\nCloses #10945.\n\nPiperOrigin-RevId: 339243111\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ca35b23ac9c29c83aa0402a7a35ee73eccd1e759",
      "old_mode": 33188,
      "old_path": "site/docs/platforms-intro.md",
      "new_id": "f8a5e9d8adb1dae8251a0436d33472fb073ca421",
      "new_mode": 33188,
      "new_path": "site/docs/platforms-intro.md"
    },
    {
      "type": "modify",
      "old_id": "a6dfb112494b997da3909b293abd8487b62cd082",
      "old_mode": 33188,
      "old_path": "site/docs/platforms.md",
      "new_id": "515d05254cc6343f141ffce2edf6ebc57b628f3a",
      "new_mode": 33188,
      "new_path": "site/docs/platforms.md"
    },
    {
      "type": "modify",
      "old_id": "2c6629fd9eb504ecbfc6fa6d3e0a2d5c9bb26416",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/docgen/PredefinedAttributes.java",
      "new_id": "48dbbddcf4d07004e178d5d87a7fbd097069a9d2",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/docgen/PredefinedAttributes.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c65186acb52806cea43491a9d46500930dcef65a",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/docgen/templates/attributes/common/target_compatible_with.html"
    },
    {
      "type": "modify",
      "old_id": "6399623492d20aee601c6ed0658a7b842a164af2",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/analysis/BUILD",
      "new_id": "daf24dfc5c3aa33ac378f7ae3b3eb55115f5c293",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/BUILD"
    },
    {
      "type": "modify",
      "old_id": "3eace72a2180afa0ff5f4d24486795fd5a95ada4",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java",
      "new_id": "12a54a0d5c68c1f9e087c371d62b39656fd6593e",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java"
    },
    {
      "type": "modify",
      "old_id": "7dd75d0467eecee52e7963026d4c79635592e4f6",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/analysis/BuildView.java",
      "new_id": "cac212e481ef5ae3b5a53399781c1d3e151e7846",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/BuildView.java"
    },
    {
      "type": "modify",
      "old_id": "52c24aaf9d28ae8c130486b929af9fed0fd642a9",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/analysis/ConfiguredTargetFactory.java",
      "new_id": "ee92dce2ef4079659969ee2f463570992188b299",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/ConfiguredTargetFactory.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "da72929f6c384c848ed44b468a92fbd725613f13",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/IncompatiblePlatformProvider.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "420cbd9b46064fb7a75e6cc8373b813c51a5dc76",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/constraints/PlatformRestrictionsResult.java"
    },
    {
      "type": "modify",
      "old_id": "a6de0362a5fc7497db53a6991096cc7593d16b7c",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/analysis/constraints/RuleContextConstraintSemantics.java",
      "new_id": "321f7cde50fd23209ec9b166fbb256ad1c8b91be",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/constraints/RuleContextConstraintSemantics.java"
    },
    {
      "type": "modify",
      "old_id": "f8ea49fd1043a43ecac812d70a158e4e0be5dbd8",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/analysis/constraints/TopLevelConstraintSemantics.java",
      "new_id": "29e91224c2d214796c61a36b19475438fbf6fe24",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/analysis/constraints/TopLevelConstraintSemantics.java"
    },
    {
      "type": "modify",
      "old_id": "b2b0c43216648982180ad94fddb24d113075c2eb",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/buildtool/AnalysisPhaseRunner.java",
      "new_id": "6270462693108d74aa1572c45a66004b323c2202",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/buildtool/AnalysisPhaseRunner.java"
    },
    {
      "type": "modify",
      "old_id": "d4a0e89ba553e87fba380a19e481b25041ec19b1",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/buildtool/BuildResultPrinter.java",
      "new_id": "f3bcdbd59f6ab78137c80dc5f74bf708be4526d4",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/buildtool/BuildResultPrinter.java"
    },
    {
      "type": "modify",
      "old_id": "d8e8876493a186fa4ebbd45f7f3033a4f4ea9b3a",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/buildtool/buildevent/TestFilteringCompleteEvent.java",
      "new_id": "febb37cdb0f57a4d8fb46de55aacd76b8c78d1bd",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/buildtool/buildevent/TestFilteringCompleteEvent.java"
    },
    {
      "type": "modify",
      "old_id": "715d6baf7aaa0aae1735627691a7a8261c4c7a19",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/RuleClass.java",
      "new_id": "5890fc2e5707cbd06a9afaf325eba88379e69990",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/RuleClass.java"
    },
    {
      "type": "modify",
      "old_id": "62be54b78015d72161745f99c12ad0dc85a31878",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java",
      "new_id": "63d8c5af0fe58cb37cc6e2810ee1f564c65dcc71",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java"
    },
    {
      "type": "modify",
      "old_id": "c51819432c13110361504991fcb1e89fe4566983",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifier.java",
      "new_id": "b72ca55b808896cdc55387ddf3123dbec61d2c02",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifier.java"
    },
    {
      "type": "modify",
      "old_id": "6650bcb2ec1a171ff9eb250e3886f60c9b3d9ee4",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/runtime/TestResultAggregator.java",
      "new_id": "6c6452270a30c951f0bf5a960f416c38bb71b79e",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/runtime/TestResultAggregator.java"
    },
    {
      "type": "modify",
      "old_id": "6b2845ad79f6358bca93c64a27f578275c6a5f04",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java",
      "new_id": "fe0a79cef5b46992ca60e42cba842c74e9bc72fe",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java"
    },
    {
      "type": "modify",
      "old_id": "ce7052a1cc5032f59950ca9021350f48e934e544",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java",
      "new_id": "adb74cefad0747ad42e7d1abfa8a435473f43fb7",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java"
    },
    {
      "type": "modify",
      "old_id": "47e88064df102fe0cc8405bc684432b74aa2756c",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAnalysisResult.java",
      "new_id": "933a7da386821175310cf8186ff4a80bb8d72990",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/skyframe/SkyframeAnalysisResult.java"
    },
    {
      "type": "modify",
      "old_id": "797540b62c21b25b0fe6bef42e2cc1712c797bb0",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java",
      "new_id": "5b87ff938fe722fede038722835bf1f0109f0cd2",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java"
    },
    {
      "type": "modify",
      "old_id": "8eb219e0bbc5e9a5a38c8d1cedc8ffddfdc26957",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java",
      "new_id": "8154db43347f0f24ea2ffdb9295fcee046fd9f43",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java"
    },
    {
      "type": "modify",
      "old_id": "dd14c81d54b5226a93bf65644c17d6406748da13",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java",
      "new_id": "a35d746993f2541bd0435aa7b80d8636a5170630",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java"
    },
    {
      "type": "modify",
      "old_id": "68719d359686a1ad9351a558346474ef9d166a6f",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/runtime/TestResultAggregatorTest.java",
      "new_id": "a582a9e3668582e2e066fedbf414a2e468f5f397",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/runtime/TestResultAggregatorTest.java"
    },
    {
      "type": "modify",
      "old_id": "ea6567caf38a1553807214268ee98f11675299e2",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleContextTest.java",
      "new_id": "c558dd8b68e0548a8bb6e195c3aea152580c7735",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleContextTest.java"
    },
    {
      "type": "modify",
      "old_id": "12a69453a14f1ccfeded81e268316decdcde12b7",
      "old_mode": 33188,
      "old_path": "src/test/shell/integration/BUILD",
      "new_id": "5bb5dbdf6729cf09bcce938df6b0346bbdafa918",
      "new_mode": 33188,
      "new_path": "src/test/shell/integration/BUILD"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c89eb111a69af8d5b5f8d2307e9b7fbe748201bf",
      "new_mode": 33261,
      "new_path": "src/test/shell/integration/target_compatible_with_test.sh"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "eb10e826330b5be847f590f2d8d0a398287227e1",
      "new_mode": 33261,
      "new_path": "src/test/shell/integration/target_compatible_with_test_external_repo.sh"
    },
    {
      "type": "modify",
      "old_id": "e0687519c9208ce0bbf30ffadcd78afd6eace7c1",
      "old_mode": 33261,
      "old_path": "src/test/shell/testenv.sh",
      "new_id": "6cc7f787a88fe2240283c6b867f5c41e43966728",
      "new_mode": 33261,
      "new_path": "src/test/shell/testenv.sh"
    }
  ]
}
