diff --git a/.bazelci/postsubmit.yml b/.bazelci/postsubmit.yml index 078c23321d27d0..04fe8880a9acc2 100644 --- a/.bazelci/postsubmit.yml +++ b/.bazelci/postsubmit.yml @@ -168,7 +168,6 @@ tasks: - build - test macos: - xcode_version: "13.0" shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE @@ -213,7 +212,6 @@ tasks: - build - test macos_arm64: - xcode_version: "13.0" shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index da974e272b3f21..5a2e5f95e8d0d1 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -158,7 +158,6 @@ tasks: # Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162 - "-//src/java_tools/import_deps_checker/..." macos: - xcode_version: "13.0" shards: 5 shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# @@ -203,7 +202,6 @@ tasks: # MacOS does not have cgroups so it can't support hardened sandbox - "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test" macos_arm64: - xcode_version: "13.0" shards: 2 shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# diff --git a/site/en/concepts/visibility.md b/site/en/concepts/visibility.md index b4bbd644bb4d25..e13f5ea92bf18b 100644 --- a/site/en/concepts/visibility.md +++ b/site/en/concepts/visibility.md @@ -250,7 +250,7 @@ private so long as it lives in the same package as the definition of the ## Load visibility {:#load-visibility} **Load visibility** controls whether a `.bzl` file may be loaded from other -`BUILD` or `.bzl` files. +`BUILD` or `.bzl` files outside the current package. In the same way that target visibility protects source code that is encapsulated by targets, load visibility protects build logic that is encapsulated by `.bzl` diff --git a/src/main/java/com/google/devtools/build/lib/BUILD b/src/main/java/com/google/devtools/build/lib/BUILD index fa0c7e732b0fd2..859b7ad9c1cc9a 100644 --- a/src/main/java/com/google/devtools/build/lib/BUILD +++ b/src/main/java/com/google/devtools/build/lib/BUILD @@ -281,6 +281,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/actions:middleman_type", "//src/main/java/com/google/devtools/build/lib/actions:package_roots", "//src/main/java/com/google/devtools/build/lib/actions:resource_manager", + "//src/main/java/com/google/devtools/build/lib/actions:shared_action_event", "//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster", "//src/main/java/com/google/devtools/build/lib/analysis:analysis_options", "//src/main/java/com/google/devtools/build/lib/analysis:analysis_phase_complete_event", diff --git a/src/main/java/com/google/devtools/build/lib/actions/BUILD b/src/main/java/com/google/devtools/build/lib/actions/BUILD index 874846ee3db2a1..23f829c9d1f7c8 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/BUILD +++ b/src/main/java/com/google/devtools/build/lib/actions/BUILD @@ -63,6 +63,7 @@ java_library( "ResourceSet.java", "ResourceSetOrBuilder.java", "RemoteFileStatus.java", + "SharedActionEvent.java", "PackageRootResolver.java", "PackageRoots.java", "ThreadStateReceiver.java", @@ -382,3 +383,13 @@ java_library( "//third_party:jsr305", ], ) + +java_library( + name = "shared_action_event", + srcs = ["SharedActionEvent.java"], + deps = [ + "//src/main/java/com/google/devtools/build/lib/events", + "//src/main/java/com/google/devtools/build/lib/skyframe:action_execution_value", + "//third_party:guava", + ], +) diff --git a/src/main/java/com/google/devtools/build/lib/actions/SharedActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/SharedActionEvent.java new file mode 100644 index 00000000000000..cc50d71daa8c17 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/actions/SharedActionEvent.java @@ -0,0 +1,45 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.actions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable; +import com.google.devtools.build.lib.skyframe.ActionExecutionValue; + +/** Posted during the build when an action was shared. */ +public final class SharedActionEvent implements Postable { + + private final ActionExecutionValue executed; + private final ActionExecutionValue transformed; + + public SharedActionEvent(ActionExecutionValue executed, ActionExecutionValue transformed) { + this.executed = checkNotNull(executed); + this.transformed = checkNotNull(transformed); + } + + /** Returns the {@link ActionExecutionValue} for the action that was actually executed. */ + public ActionExecutionValue getExecuted() { + return executed; + } + + /** + * Returns the {@link ActionExecutionValue} that was derived from calling {@link + * ActionExecutionValue#transformForSharedAction} on {@link #getExecuted}. + */ + public ActionExecutionValue getTransformed() { + return transformed; + } +} diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BUILD b/src/main/java/com/google/devtools/build/lib/analysis/BUILD index 9a3936ed121ea1..5c06889c5a219a 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/BUILD +++ b/src/main/java/com/google/devtools/build/lib/analysis/BUILD @@ -24,7 +24,7 @@ java_library( ":actions/deterministic_writer", ":actions/file_write_action_context", ":actions/launcher_file_write_action", - ":actions/lazy_write_nested_set_of_pair_action", + ":actions/lazy_write_nested_set_of_tuple_action", ":actions/lazy_write_paths_file_action", ":actions/parameter_file_write_action", ":actions/proto_deterministic_writer", @@ -268,7 +268,7 @@ java_library( ":actions/compression", ":actions/custom_command_line", ":actions/deterministic_writer", - ":actions/lazy_write_nested_set_of_pair_action", + ":actions/lazy_write_nested_set_of_tuple_action", ":actions/parameter_file_write_action", ":actions/substitution", ":actions/symlink_action", @@ -1394,8 +1394,8 @@ java_library( ) java_library( - name = "actions/lazy_write_nested_set_of_pair_action", - srcs = ["actions/LazyWriteNestedSetOfPairAction.java"], + name = "actions/lazy_write_nested_set_of_tuple_action", + srcs = ["actions/LazyWriteNestedSetOfTupleAction.java"], deps = [ ":actions/abstract_file_write_action", ":actions/deterministic_writer", @@ -1404,6 +1404,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/actions:commandline_item", "//src/main/java/com/google/devtools/build/lib/collect/nestedset", "//src/main/java/com/google/devtools/build/lib/util", + "//src/main/java/net/starlark/java/eval", "//third_party:jsr305", ], ) @@ -2582,6 +2583,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/packages", "//src/main/java/com/google/devtools/build/lib/starlarkbuildapi/test", "//src/main/java/com/google/devtools/build/lib/util", + "//src/main/java/net/starlark/java/eval", ], ) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/PrerequisiteArtifacts.java b/src/main/java/com/google/devtools/build/lib/analysis/PrerequisiteArtifacts.java index 59204c48f6f945..c584db114d8cc4 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/PrerequisiteArtifacts.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/PrerequisiteArtifacts.java @@ -17,13 +17,12 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.util.FileType; import com.google.devtools.build.lib.util.FileTypeSet; -import java.util.LinkedHashSet; -import java.util.Set; /** * Contains a sequence of prerequisite artifacts and supplies methods for filtering and reporting @@ -55,11 +54,11 @@ static PrerequisiteArtifacts get(RuleContext ruleContext, String attributeName) return new PrerequisiteArtifacts( ruleContext, attributeName, prerequisites.get(0).getFilesToBuild().toList()); } - Set result = new LinkedHashSet<>(); + ImmutableSet.Builder result = ImmutableSet.builder(); for (FileProvider target : prerequisites) { result.addAll(target.getFilesToBuild().toList()); } - return new PrerequisiteArtifacts(ruleContext, attributeName, ImmutableList.copyOf(result)); + return new PrerequisiteArtifacts(ruleContext, attributeName, result.build().asList()); } public static NestedSet nestedSet(RuleContext ruleContext, String attributeName) { diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/LazyWriteNestedSetOfPairAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/LazyWriteNestedSetOfTupleAction.java similarity index 69% rename from src/main/java/com/google/devtools/build/lib/analysis/actions/LazyWriteNestedSetOfPairAction.java rename to src/main/java/com/google/devtools/build/lib/analysis/actions/LazyWriteNestedSetOfTupleAction.java index 39ca5e05d409f2..bd8da23fb2c8a3 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/actions/LazyWriteNestedSetOfPairAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/LazyWriteNestedSetOfTupleAction.java @@ -26,26 +26,28 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.util.Fingerprint; -import com.google.devtools.build.lib.util.Pair; import java.io.IOException; import java.io.OutputStream; import javax.annotation.Nullable; +import net.starlark.java.eval.Tuple; /** - * Lazily writes the content of a nested set of pairsToWrite to an output file. + * Lazily writes the content of a nested set of tuplesToWrite to an output file. * - *

For each pair it writes a line string1:string2 to the output file. + *

Writes delimiter separated Tuple elements to the output file. */ -public final class LazyWriteNestedSetOfPairAction extends AbstractFileWriteAction { +public final class LazyWriteNestedSetOfTupleAction extends AbstractFileWriteAction { - private final NestedSet> pairsToWrite; + private final NestedSet tuplesToWrite; private String fileContents; + private final String delimiter; - public LazyWriteNestedSetOfPairAction( - ActionOwner owner, Artifact output, NestedSet> pairsToWrite) { + public LazyWriteNestedSetOfTupleAction( + ActionOwner owner, Artifact output, NestedSet tuplesToWrite, String delimiter) { super( owner, NestedSetBuilder.emptySet(Order.STABLE_ORDER), output, /* makeExecutable= */ false); - this.pairsToWrite = pairsToWrite; + this.tuplesToWrite = tuplesToWrite; + this.delimiter = delimiter; } @Override @@ -53,7 +55,7 @@ public DeterministicWriter newDeterministicWriter(ActionExecutionContext ctx) { return new DeterministicWriter() { @Override public void writeOutputFile(OutputStream out) throws IOException { - out.write(getContents().getBytes(UTF_8)); + out.write(getContents(delimiter).getBytes(UTF_8)); } }; } @@ -65,18 +67,21 @@ protected void computeKey( @Nullable ArtifactExpander artifactExpander, Fingerprint fp) throws CommandLineExpansionException, InterruptedException { - actionKeyContext.addNestedSetToFingerprint(fp, pairsToWrite); + actionKeyContext.addNestedSetToFingerprint(fp, tuplesToWrite); } - private String getContents() { + private String getContents(String delimiter) { if (fileContents == null) { StringBuilder stringBuilder = new StringBuilder(); - for (Pair pair : pairsToWrite.toList()) { - stringBuilder - .append(pair.first) - .append(":") - .append(pair.second) - .append(System.lineSeparator()); + for (Tuple tuple : tuplesToWrite.toList()) { + if (tuple.isEmpty()) { + continue; + } + stringBuilder.append(tuple.get(0)); + for (int i = 1; i < tuple.size(); i++) { + stringBuilder.append(delimiter).append(tuple.get(i)); + } + stringBuilder.append(System.lineSeparator()); } fileContents = stringBuilder.toString(); } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/CoverageCommon.java b/src/main/java/com/google/devtools/build/lib/analysis/test/CoverageCommon.java index 576697978c58fe..62998c94d2404e 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/CoverageCommon.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/CoverageCommon.java @@ -43,6 +43,7 @@ import net.starlark.java.eval.Sequence; import net.starlark.java.eval.Starlark; import net.starlark.java.eval.StarlarkThread; +import net.starlark.java.eval.Tuple; /** Helper functions for Starlark to access coverage-related infrastructure. */ public class CoverageCommon implements CoverageCommonApi { @@ -57,10 +58,15 @@ public InstrumentedFilesInfoApi instrumentedFilesInfo( Dict environment, // Object extensions, Sequence metadataFiles, // Sequence + Object reportedToActualSourcesObject, StarlarkThread thread) throws EvalException, TypeException { List extensionsList = extensions == Starlark.NONE ? null : Sequence.cast(extensions, String.class, "extensions"); + NestedSet reportedToActualSources = + reportedToActualSourcesObject == Starlark.NONE + ? NestedSetBuilder.create(Order.STABLE_ORDER) + : Depset.cast(reportedToActualSourcesObject, Tuple.class, "reported_to_actual_sources"); List> environmentPairs = Dict.cast(environment, String.class, String.class, "coverage_environment") .entrySet() @@ -97,7 +103,7 @@ public InstrumentedFilesInfoApi instrumentedFilesInfo( if (!supportFilesBuilder.isEmpty() || !environmentPairs.isEmpty()) { BuiltinRestriction.throwIfNotBuiltinUsage(thread); } - if (!metadataFiles.isEmpty()) { + if (!metadataFiles.isEmpty() || !reportedToActualSources.isEmpty()) { BuiltinRestriction.throwIfNotBuiltinUsage(thread); } return createInstrumentedFilesInfo( @@ -107,7 +113,8 @@ public InstrumentedFilesInfoApi instrumentedFilesInfo( supportFilesBuilder.build(), NestedSetBuilder.wrap(Order.COMPILE_ORDER, environmentPairs), extensionsList, - Sequence.cast(metadataFiles, Artifact.class, "metadata_files")); + Sequence.cast(metadataFiles, Artifact.class, "metadata_files"), + reportedToActualSources); } /** @@ -136,7 +143,8 @@ public static InstrumentedFilesInfo createInstrumentedFilesInfo( NestedSetBuilder.emptySet(Order.STABLE_ORDER), NestedSetBuilder.emptySet(Order.STABLE_ORDER), extensions, - null); + null, + NestedSetBuilder.emptySet(Order.STABLE_ORDER)); } private static InstrumentedFilesInfo createInstrumentedFilesInfo( @@ -146,7 +154,8 @@ private static InstrumentedFilesInfo createInstrumentedFilesInfo( NestedSet supportFiles, NestedSet> environment, @Nullable List extensions, - @Nullable List metadataFiles) { + @Nullable List metadataFiles, + NestedSet reportedToActualSources) { FileTypeSet fileTypeSet = FileTypeSet.ANY_FILE; if (extensions != null) { if (extensions.isEmpty()) { @@ -169,7 +178,7 @@ private static InstrumentedFilesInfo createInstrumentedFilesInfo( /* coverageSupportFiles= */ supportFiles, /* coverageEnvironment= */ environment, /* withBaselineCoverage= */ !TargetUtils.isTestRule(ruleContext.getTarget()), - /* reportedToActualSources= */ NestedSetBuilder.create(Order.STABLE_ORDER), + /* reportedToActualSources= */ reportedToActualSources, /* additionalMetadata= */ metadataFiles); } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesCollector.java b/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesCollector.java index 7dca3df13a8663..d2f5926d715c73 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesCollector.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesCollector.java @@ -36,6 +36,7 @@ import java.util.Collection; import java.util.List; import javax.annotation.Nullable; +import net.starlark.java.eval.Tuple; /** * A helper class for collecting instrumented files and metadata for a target. @@ -58,8 +59,7 @@ public static InstrumentedFilesInfo forward( new InstrumentationSpec(FileTypeSet.NO_FILE).withDependencyAttributes(dependencyAttributes), /* localMetadataCollector= */ null, /* rootFiles= */ null, - /* reportedToActualSources= */ NestedSetBuilder.>emptySet( - Order.STABLE_ORDER)); + /* reportedToActualSources= */ NestedSetBuilder.emptySet(Order.STABLE_ORDER)); } public static InstrumentedFilesInfo forwardAll(RuleContext ruleContext) { @@ -80,14 +80,11 @@ public static InstrumentedFilesInfo collect(RuleContext ruleContext, Instrumenta spec, NO_METADATA_COLLECTOR, ImmutableList.of(), - /* reportedToActualSources= */ NestedSetBuilder.>emptySet( - Order.STABLE_ORDER)); + /* reportedToActualSources= */ NestedSetBuilder.emptySet(Order.STABLE_ORDER)); } public static InstrumentedFilesInfo collect( - RuleContext ruleContext, - InstrumentationSpec spec, - NestedSet> reportedToActualSources) { + RuleContext ruleContext, InstrumentationSpec spec, NestedSet reportedToActualSources) { return collect( ruleContext, spec, @@ -109,8 +106,7 @@ public static InstrumentedFilesInfo collect( spec, localMetadataCollector, rootFiles, - /* reportedToActualSources= */ NestedSetBuilder.>emptySet( - Order.STABLE_ORDER)); + /* reportedToActualSources= */ NestedSetBuilder.emptySet(Order.STABLE_ORDER)); } public static InstrumentedFilesInfo collect( @@ -118,7 +114,7 @@ public static InstrumentedFilesInfo collect( InstrumentationSpec spec, LocalMetadataCollector localMetadataCollector, Iterable rootFiles, - NestedSet> reportedToActualSources) { + NestedSet reportedToActualSources) { return collect( ruleContext, spec, @@ -153,8 +149,7 @@ public static InstrumentedFilesInfo collect( coverageSupportFiles, coverageEnvironment, withBaselineCoverage, - /* reportedToActualSources= */ NestedSetBuilder.>emptySet( - Order.STABLE_ORDER)); + /* reportedToActualSources= */ NestedSetBuilder.emptySet(Order.STABLE_ORDER)); } public static InstrumentedFilesInfo collect( @@ -165,7 +160,7 @@ public static InstrumentedFilesInfo collect( NestedSet coverageSupportFiles, NestedSet> coverageEnvironment, boolean withBaselineCoverage, - NestedSet> reportedToActualSources) { + NestedSet reportedToActualSources) { return collect( ruleContext, spec, @@ -186,7 +181,7 @@ public static InstrumentedFilesInfo collect( NestedSet coverageSupportFiles, NestedSet> coverageEnvironment, boolean withBaselineCoverage, - NestedSet> reportedToActualSources, + NestedSet reportedToActualSources, @Nullable Iterable additionalMetadata) { Preconditions.checkNotNull(ruleContext); Preconditions.checkNotNull(spec); @@ -367,13 +362,13 @@ private static class InstrumentedFilesInfoBuilder { NestedSetBuilder baselineCoverageInstrumentedFilesBuilder; NestedSetBuilder coverageSupportFilesBuilder; NestedSetBuilder> coverageEnvironmentBuilder; - NestedSet> reportedToActualSources; + final NestedSet reportedToActualSources; InstrumentedFilesInfoBuilder( RuleContext ruleContext, NestedSet coverageSupportFiles, NestedSet> coverageEnvironment, - NestedSet> reportedToActualSources) { + NestedSet reportedToActualSources) { this.ruleContext = ruleContext; instrumentedFilesBuilder = NestedSetBuilder.stableOrder(); metadataFilesBuilder = NestedSetBuilder.stableOrder(); @@ -390,7 +385,7 @@ private static class InstrumentedFilesInfoBuilder { ruleContext, NestedSetBuilder.emptySet(Order.STABLE_ORDER), NestedSetBuilder.>emptySet(Order.STABLE_ORDER), - NestedSetBuilder.>emptySet(Order.STABLE_ORDER)); + NestedSetBuilder.emptySet(Order.STABLE_ORDER)); } void addFromDependency(TransitiveInfoCollection dep) { diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesInfo.java index 6aa13d926c3fe0..291076d00f25c2 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesInfo.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/InstrumentedFilesInfo.java @@ -22,6 +22,7 @@ import com.google.devtools.build.lib.packages.NativeInfo; import com.google.devtools.build.lib.starlarkbuildapi.test.InstrumentedFilesInfoApi; import com.google.devtools.build.lib.util.Pair; +import net.starlark.java.eval.Tuple; /** An implementation class for the InstrumentedFilesProvider interface. */ public final class InstrumentedFilesInfo extends NativeInfo implements InstrumentedFilesInfoApi { @@ -45,7 +46,7 @@ public final class InstrumentedFilesInfo extends NativeInfo implements Instrumen private final NestedSet baselineCoverageArtifacts; private final NestedSet coverageSupportFiles; private final NestedSet> coverageEnvironment; - private final NestedSet> reportedToActualSources; + private final NestedSet reportedToActualSources; public InstrumentedFilesInfo( NestedSet instrumentedFiles, @@ -54,7 +55,7 @@ public InstrumentedFilesInfo( NestedSet baselineCoverageArtifacts, NestedSet coverageSupportFiles, NestedSet> coverageEnvironment, - NestedSet> reportedToActualSources) { + NestedSet reportedToActualSources) { this.instrumentedFiles = instrumentedFiles; this.instrumentationMetadataFiles = instrumentationMetadataFiles; this.baselineCoverageFiles = baselineCoverageFiles; @@ -135,7 +136,7 @@ public NestedSet> getCoverageEnvironment() { * "bazel-out/k8-fastbuild/bin/include/common/_virtual_includes/strategy/strategy.h", but its * actual source path is "include/common/strategy.h". */ - public NestedSet> getReportedToActualSources() { + public NestedSet getReportedToActualSources() { return reportedToActualSources; } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java index 75c9e0dc23b9db..d4e5d18d678dd7 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java @@ -38,7 +38,7 @@ import com.google.devtools.build.lib.analysis.ShToolchain; import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; -import com.google.devtools.build.lib.analysis.actions.LazyWriteNestedSetOfPairAction; +import com.google.devtools.build.lib.analysis.actions.LazyWriteNestedSetOfTupleAction; import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue; import com.google.devtools.build.lib.analysis.configuredtargets.PackageGroupConfiguredTarget; import com.google.devtools.build.lib.analysis.test.TestProvider.TestParams; @@ -282,10 +282,11 @@ private TestParams createTestAction(int shards) ruleContext.getUniqueDirectoryArtifact( "_coverage_helpers", "reported_to_actual_sources.txt"); ruleContext.registerAction( - new LazyWriteNestedSetOfPairAction( + new LazyWriteNestedSetOfTupleAction( ruleContext.getActionOwner(), reportedToActualSourcesArtifact, - instrumentedFiles.getReportedToActualSources())); + instrumentedFiles.getReportedToActualSources(), + ":")); inputsBuilder.add(reportedToActualSourcesArtifact); extraTestEnv.put( COVERAGE_REPORTED_TO_ACTUAL_SOURCES_FILE, diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java index 53d4c71914f01c..9b202924e9d474 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java @@ -77,6 +77,7 @@ import net.starlark.java.eval.Starlark; import net.starlark.java.eval.StarlarkList; import net.starlark.java.eval.StarlarkValue; +import net.starlark.java.eval.Tuple; /** Common parts of the implementation of cc rules. */ public final class CcCommon implements StarlarkValue { @@ -757,41 +758,10 @@ Artifact getDefParser() { return ruleContext.getPrerequisiteArtifact("$def_parser"); } - @StarlarkMethod( - name = "instrumented_files_info_from_compilation_context", - documented = false, - parameters = { - @Param(name = "files", positional = false, named = true), - @Param(name = "with_base_line_coverage", positional = false, named = true), - @Param(name = "compilation_context", positional = false, named = true), - @Param(name = "additional_metadata", positional = false, named = true), - }) - public InstrumentedFilesInfo getInstrumentedFilesProviderFromCompilationContextForStarlark( - Sequence files, - boolean withBaselineCoverage, - Object compilationContext, - Sequence additionalMetadata) - throws EvalException { - try { - CcCompilationContext ccCompilationContext = (CcCompilationContext) compilationContext; - Sequence metadata = - additionalMetadata == null - ? null - : Sequence.cast(additionalMetadata, Artifact.class, "files"); - return getInstrumentedFilesProvider( - Sequence.cast(files, Artifact.class, "files"), - withBaselineCoverage, - ccCompilationContext.getVirtualToOriginalHeaders(), - metadata); - } catch (RuleErrorException e) { - throw new EvalException(e); - } - } - public InstrumentedFilesInfo getInstrumentedFilesProvider( Iterable files, boolean withBaselineCoverage, - NestedSet> virtualToOriginalHeaders, + NestedSet virtualToOriginalHeaders, @Nullable Iterable additionalMetadata) throws RuleErrorException { return InstrumentedFilesCollector.collect( diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java index 0bd2bbddc8313b..26c8a4a5f4f4de 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationContext.java @@ -42,7 +42,6 @@ import com.google.devtools.build.lib.rules.cpp.IncludeScanner.IncludeScanningHeaderData; import com.google.devtools.build.lib.skyframe.TreeArtifactValue; import com.google.devtools.build.lib.starlarkbuildapi.cpp.CcCompilationContextApi; -import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.skyframe.SkyFunction.Environment; import com.google.devtools.build.skyframe.SkyValue; @@ -61,6 +60,7 @@ import net.starlark.java.eval.EvalException; import net.starlark.java.eval.StarlarkList; import net.starlark.java.eval.StarlarkThread; +import net.starlark.java.eval.Tuple; /** * Immutable store of information needed for C++ compilation that is aggregated across dependencies. @@ -106,7 +106,7 @@ public final class CcCompilationContext implements CcCompilationContextApi> virtualToOriginalHeaders; + private final NestedSet virtualToOriginalHeaders; /** * Caches the actual number of transitive headers reachable through transitiveHeaderInfos. We need * to create maps to store these and so caching this count can substantially help with memory @@ -130,7 +130,7 @@ private CcCompilationContext( CppModuleMap cppModuleMap, boolean propagateModuleMapAsActionInput, CppConfiguration.HeadersCheckingMode headersCheckingMode, - NestedSet> virtualToOriginalHeaders, + NestedSet virtualToOriginalHeaders, NestedSet headerTokens) { Preconditions.checkNotNull(commandLineCcCompilationContext); this.commandLineCcCompilationContext = commandLineCcCompilationContext; @@ -255,6 +255,12 @@ public Depset getStarlarkValidationArtifacts() { return Depset.of(Artifact.TYPE, getHeaderTokens()); } + @Override + public Depset getStarlarkVirtualToOriginalHeaders(StarlarkThread thread) throws EvalException { + CcModule.checkPrivateStarlarkificationAllowlist(thread); + return Depset.of(Depset.ElementType.of(Tuple.class), getVirtualToOriginalHeaders()); + } + /** * Returns the transitive compilation prerequisites consolidated into middlemen prerequisites, or * an empty set if there are no prerequisites. @@ -705,7 +711,7 @@ public static CcCompilationContext merge(Collection ccComp return builder.build(); } - public NestedSet> getVirtualToOriginalHeaders() { + public NestedSet getVirtualToOriginalHeaders() { return virtualToOriginalHeaders; } @@ -774,8 +780,7 @@ public static class Builder { private boolean propagateModuleMapAsActionInput = true; private CppConfiguration.HeadersCheckingMode headersCheckingMode = CppConfiguration.HeadersCheckingMode.STRICT; - private final NestedSetBuilder> virtualToOriginalHeaders = - NestedSetBuilder.stableOrder(); + private final NestedSetBuilder virtualToOriginalHeaders = NestedSetBuilder.stableOrder(); private final NestedSetBuilder headerTokens = NestedSetBuilder.stableOrder(); /** The rule that owns the context */ @@ -1148,8 +1153,7 @@ public Builder setHeadersCheckingMode( } @CanIgnoreReturnValue - public Builder addVirtualToOriginalHeaders( - NestedSet> virtualToOriginalHeaders) { + public Builder addVirtualToOriginalHeaders(NestedSet virtualToOriginalHeaders) { this.virtualToOriginalHeaders.addTransitive(virtualToOriginalHeaders); return this; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java index 588b6763234c42..9fd60ebaf59881 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java @@ -66,6 +66,7 @@ import java.util.TreeMap; import java.util.stream.Collectors; import javax.annotation.Nullable; +import net.starlark.java.eval.Tuple; /** * A class to create C/C++ compile actions in a way that is consistent with cc_library. Rules that @@ -921,13 +922,13 @@ private static class PublicHeaders { private final ImmutableList headers; private final ImmutableList moduleMapHeaders; private final @Nullable PathFragment virtualIncludePath; - private final NestedSet> virtualToOriginalHeaders; + private final NestedSet virtualToOriginalHeaders; private PublicHeaders( ImmutableList headers, ImmutableList moduleMapHeaders, PathFragment virtualIncludePath, - NestedSet> virtualToOriginalHeaders) { + NestedSet virtualToOriginalHeaders) { this.headers = headers; this.moduleMapHeaders = moduleMapHeaders; this.virtualIncludePath = virtualIncludePath; @@ -995,8 +996,7 @@ private PublicHeaders computePublicHeaders(List headers) throws Interr } ImmutableList.Builder moduleHeadersBuilder = ImmutableList.builder(); - NestedSetBuilder> virtualToOriginalHeaders = - NestedSetBuilder.stableOrder(); + NestedSetBuilder virtualToOriginalHeaders = NestedSetBuilder.stableOrder(); for (Artifact originalHeader : headers) { if (!originalHeader.getRepositoryRelativePath().startsWith(stripPrefix)) { ruleErrorConsumer.ruleError( @@ -1027,7 +1027,7 @@ private PublicHeaders computePublicHeaders(List headers) throws Interr moduleHeadersBuilder.add(virtualHeader); if (configuration.isCodeCoverageEnabled()) { virtualToOriginalHeaders.add( - Pair.of(virtualHeader.getExecPathString(), originalHeader.getExecPathString())); + Tuple.of(virtualHeader.getExecPathString(), originalHeader.getExecPathString())); } } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java index a8b7d0f8d176a5..924a0fc371162a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java @@ -669,6 +669,9 @@ public StructureValue build() { */ @Immutable public abstract static class LibraryToLinkValue extends VariableValueAdapter { + + private static final Interner interner = BlazeInterners.newWeakInterner(); + public static final String OBJECT_FILES_FIELD_NAME = "object_files"; public static final String NAME_FIELD_NAME = "name"; public static final String TYPE_FIELD_NAME = "type"; @@ -677,23 +680,27 @@ public abstract static class LibraryToLinkValue extends VariableValueAdapter { private static final String LIBRARY_TO_LINK_VARIABLE_TYPE_NAME = "structure (LibraryToLink)"; public static LibraryToLinkValue forDynamicLibrary(String name) { - return new ForDynamicLibrary(name); + return interner.intern(new ForDynamicLibrary(name)); } public static LibraryToLinkValue forVersionedDynamicLibrary(String name) { - return new ForVersionedDynamicLibrary(name); + return interner.intern(new ForVersionedDynamicLibrary(name)); } public static LibraryToLinkValue forInterfaceLibrary(String name) { - return new ForInterfaceLibrary(name); + return interner.intern(new ForInterfaceLibrary(name)); } public static LibraryToLinkValue forStaticLibrary(String name, boolean isWholeArchive) { - return isWholeArchive ? new ForStaticLibraryWholeArchive(name) : new ForStaticLibrary(name); + return isWholeArchive + ? interner.intern(new ForStaticLibraryWholeArchive(name)) + : interner.intern(new ForStaticLibrary(name)); } public static LibraryToLinkValue forObjectFile(String name, boolean isWholeArchive) { - return isWholeArchive ? new ForObjectFileWholeArchive(name) : new ForObjectFile(name); + return isWholeArchive + ? interner.intern(new ForObjectFileWholeArchive(name)) + : interner.intern(new ForObjectFile(name)); } public static LibraryToLinkValue forObjectFileGroup( @@ -701,8 +708,8 @@ public static LibraryToLinkValue forObjectFileGroup( Preconditions.checkNotNull(objects); Preconditions.checkArgument(!objects.isEmpty()); return isWholeArchive - ? new ForObjectFileGroupWholeArchive(objects) - : new ForObjectFileGroup(objects); + ? interner.intern(new ForObjectFileGroupWholeArchive(objects)) + : interner.intern(new ForObjectFileGroup(objects)); } @Nullable diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java b/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java index 38ebc7205b86af..f4136ebab86069 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java @@ -13,14 +13,15 @@ // limitations under the License. package com.google.devtools.build.lib.runtime; +import static com.google.common.base.Preconditions.checkNotNull; import static java.util.concurrent.TimeUnit.SECONDS; import com.github.luben.zstd.ZstdOutputStream; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; +import com.google.common.collect.Streams; import com.google.common.eventbus.AllowConcurrentEvents; import com.google.common.eventbus.Subscribe; import com.google.common.flogger.GoogleLogger; @@ -34,6 +35,7 @@ import com.google.devtools.build.lib.actions.DiscoveredInputsEvent; import com.google.devtools.build.lib.actions.ExecutionGraph; import com.google.devtools.build.lib.actions.RunfilesSupplier; +import com.google.devtools.build.lib.actions.SharedActionEvent; import com.google.devtools.build.lib.actions.Spawn; import com.google.devtools.build.lib.actions.SpawnExecutedEvent; import com.google.devtools.build.lib.actions.SpawnMetrics; @@ -201,7 +203,7 @@ public void beforeCommand(CommandEnvironment env) { if (env.getCommand().builds()) { ExecutionGraphOptions options = - Preconditions.checkNotNull( + checkNotNull( env.getOptions().getOptions(ExecutionGraphOptions.class), "ExecutionGraphOptions must be present for ExecutionGraphModule"); if (!options.executionGraphLogFile.isBlank()) { @@ -318,6 +320,15 @@ private void actionEvent(Action action, long nanoTimeStart) { } } + @Subscribe + @AllowConcurrentEvents + public void actionShared(SharedActionEvent event) { + ActionDumpWriter localWriter = writer; + if (localWriter != null) { + localWriter.actionShared(event); + } + } + @Subscribe @AllowConcurrentEvents public void spawnExecuted(SpawnExecutedEvent event) { @@ -671,6 +682,28 @@ void shutdown(BuildToolLogCollection logs) throws InterruptedException { } } + void actionShared(SharedActionEvent event) { + copySharedArtifacts( + event.getExecuted().getAllFileValues(), event.getTransformed().getAllFileValues()); + copySharedArtifacts( + event.getExecuted().getAllTreeArtifactValues(), + event.getTransformed().getAllTreeArtifactValues()); + } + + private void copySharedArtifacts(Map executed, Map transformed) { + Streams.forEachPair( + executed.keySet().stream(), + transformed.keySet().stream(), + (existing, shared) -> { + NodeInfo node = outputToNode.get(existing); + if (node != null) { + outputToNode.put(shared, node); + } else { + bugReporter.logUnexpected("No node for %s (%s)", existing, existing.getOwner()); + } + }); + } + protected abstract void updateLogs(BuildToolLogCollection logs); /** Test hook to allow injecting failures in tests. */ @@ -732,9 +765,9 @@ private ActionDumpWriter createActionDumpWriter(CommandEnvironment env) throws InvalidPackagePathSymlinkException, ActionDumpFileCreationException { OptionsParsingResult parsingResult = env.getOptions(); BuildEventProtocolOptions bepOptions = - Preconditions.checkNotNull(parsingResult.getOptions(BuildEventProtocolOptions.class)); + checkNotNull(parsingResult.getOptions(BuildEventProtocolOptions.class)); ExecutionGraphOptions executionGraphOptions = - Preconditions.checkNotNull(parsingResult.getOptions(ExecutionGraphOptions.class)); + checkNotNull(parsingResult.getOptions(ExecutionGraphOptions.class)); if (bepOptions.streamingLogFileUploads) { return new StreamingActionDumpWriter( env.getRuntime().getBugReporter(), diff --git a/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureListener.java b/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureListener.java index f15814599741d1..374b76392d0c9b 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureListener.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureListener.java @@ -19,7 +19,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.common.eventbus.EventBus; -import com.google.common.flogger.GoogleLogger; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.metrics.GarbageCollectionMetricsUtils; import com.sun.management.GarbageCollectionNotificationInfo; @@ -27,6 +26,7 @@ import java.lang.management.ManagementFactory; import java.lang.management.MemoryUsage; import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nullable; @@ -36,8 +36,7 @@ import javax.management.openmbean.CompositeData; @ThreadSafe -class MemoryPressureListener implements NotificationListener { - private static final GoogleLogger logger = GoogleLogger.forEnclosingClass(); +final class MemoryPressureListener implements NotificationListener { private final AtomicReference eventBus = new AtomicReference<>(); private final RetainedHeapLimiter retainedHeapLimiter; @@ -46,26 +45,23 @@ private MemoryPressureListener(RetainedHeapLimiter retainedHeapLimiter) { this.retainedHeapLimiter = retainedHeapLimiter; } - @Nullable static MemoryPressureListener create(RetainedHeapLimiter retainedHeapLimiter) { - return createFromBeans( - ImmutableList.copyOf(ManagementFactory.getGarbageCollectorMXBeans()), retainedHeapLimiter); + return createFromBeans(ManagementFactory.getGarbageCollectorMXBeans(), retainedHeapLimiter); } @VisibleForTesting - @Nullable static MemoryPressureListener createFromBeans( - ImmutableList gcBeans, RetainedHeapLimiter retainedHeapLimiter) { + List gcBeans, RetainedHeapLimiter retainedHeapLimiter) { ImmutableList tenuredGcEmitters = findTenuredCollectorBeans(gcBeans); if (tenuredGcEmitters.isEmpty()) { - logger.atSevere().log( - "Unable to find tenured collector from %s: names were %s.", - gcBeans, + var names = gcBeans.stream() .map(GarbageCollectorMXBean::getMemoryPoolNames) .map(Arrays::asList) - .collect(toImmutableList())); - return null; + .collect(toImmutableList()); + throw new IllegalStateException( + String.format( + "Unable to find tenured collector from %s: names were %s.", gcBeans, names)); } MemoryPressureListener memoryPressureListener = new MemoryPressureListener(retainedHeapLimiter); @@ -75,7 +71,7 @@ static MemoryPressureListener createFromBeans( @VisibleForTesting static ImmutableList findTenuredCollectorBeans( - Iterable gcBeans) { + List gcBeans) { ImmutableList.Builder builder = ImmutableList.builder(); // Examine all collectors and register for notifications from those which collect the tenured // space. Normally there is one such collector. @@ -141,4 +137,4 @@ public void handleNotification(Notification notification, Object handback) { void setEventBus(@Nullable EventBus eventBus) { this.eventBus.set(eventBus); } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureModule.java b/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureModule.java index dfc5abd9c147ec..187b157156e95f 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureModule.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/MemoryPressureModule.java @@ -17,29 +17,25 @@ import com.google.devtools.build.lib.analysis.BlazeDirectories; import com.google.devtools.build.lib.skyframe.HighWaterMarkLimiter; import com.google.devtools.build.lib.util.AbruptExitException; -import javax.annotation.Nullable; /** * A {@link BlazeModule} that installs a {@link MemoryPressureListener} that reacts to memory * pressure events. */ -public class MemoryPressureModule extends BlazeModule { +public final class MemoryPressureModule extends BlazeModule { private RetainedHeapLimiter retainedHeapLimiter; - @Nullable private MemoryPressureListener memoryPressureListener; + private MemoryPressureListener memoryPressureListener; @Override public void workspaceInit( BlazeRuntime runtime, BlazeDirectories directories, WorkspaceBuilder builder) { - retainedHeapLimiter = RetainedHeapLimiter.create(runtime.getBugReporter()); memoryPressureListener = MemoryPressureListener.create(retainedHeapLimiter); } @Override public void beforeCommand(CommandEnvironment env) throws AbruptExitException { - if (memoryPressureListener != null) { - memoryPressureListener.setEventBus(env.getEventBus()); - } + memoryPressureListener.setEventBus(env.getEventBus()); CommonCommandOptions commonOptions = env.getOptions().getOptions(CommonCommandOptions.class); HighWaterMarkLimiter highWaterMarkLimiter = @@ -48,16 +44,13 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException { env.getSyscallCache(), commonOptions.skyframeHighWaterMarkMemoryThreshold); - retainedHeapLimiter.setThreshold( - /*listening=*/ memoryPressureListener != null, commonOptions.oomMoreEagerlyThreshold); + retainedHeapLimiter.setThreshold(commonOptions.oomMoreEagerlyThreshold); env.getEventBus().register(highWaterMarkLimiter); } @Override public void afterCommand() { - if (memoryPressureListener != null) { - memoryPressureListener.setEventBus(null); - } + memoryPressureListener.setEventBus(null); } } diff --git a/src/main/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiter.java b/src/main/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiter.java index 4d558490b08584..489ec0005852da 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiter.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiter.java @@ -57,20 +57,13 @@ private RetainedHeapLimiter(BugReporter bugReporter) { } @ThreadSafety.ThreadCompatible // Can only be called on the logical main Bazel thread. - void setThreshold(boolean listening, int oomMoreEagerlyThreshold) throws AbruptExitException { + void setThreshold(int oomMoreEagerlyThreshold) throws AbruptExitException { if (oomMoreEagerlyThreshold < 0 || oomMoreEagerlyThreshold > 100) { throw createExitException( "--experimental_oom_more_eagerly_threshold must be a percent between 0 and 100 but was " + oomMoreEagerlyThreshold, MemoryOptions.Code.EXPERIMENTAL_OOM_MORE_EAGERLY_THRESHOLD_INVALID_VALUE); } - if (!listening && oomMoreEagerlyThreshold != 100) { - throw createExitException( - "No tenured GC collectors were found: unable to watch for GC events to exit JVM when " - + oomMoreEagerlyThreshold - + "% of heap is used", - MemoryOptions.Code.EXPERIMENTAL_OOM_MORE_EAGERLY_NO_TENURED_COLLECTORS_FOUND); - } this.occupiedHeapPercentageThreshold = oomMoreEagerlyThreshold; } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java index fa51941a17ba56..b9dca2f916a77f 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionState.java @@ -22,6 +22,7 @@ import com.google.devtools.build.lib.actions.ActionLookupData; import com.google.devtools.build.lib.actions.Artifact.OwnerlessArtifactWrapper; import com.google.devtools.build.lib.actions.LostInputsActionExecutionException; +import com.google.devtools.build.lib.actions.SharedActionEvent; import com.google.devtools.build.lib.bugreport.BugReport; import com.google.devtools.build.lib.skyframe.ActionExecutionValue.ActionTransformException; import com.google.devtools.build.skyframe.SkyFunction; @@ -126,12 +127,16 @@ ActionExecutionValue getResultOrDependOnFuture( result = state.get(); } sharedActionCallback.actionCompleted(); + + ActionExecutionValue transformed; try { - return result.transformForSharedAction(action); + transformed = result.transformForSharedAction(action); } catch (ActionTransformException e) { throw new IllegalStateException( String.format("Cannot share %s and %s", this.actionLookupData, actionLookupData), e); } + env.getListener().post(new SharedActionEvent(result, transformed)); + return transformed; } private static void scheduleRestart(Environment env) { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BUILD b/src/main/java/com/google/devtools/build/lib/skyframe/BUILD index 2e2d9ae52edf8b..dfade3ae2eb1e8 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BUILD +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BUILD @@ -438,6 +438,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/actions", "//src/main/java/com/google/devtools/build/lib/actions:action_lookup_data", "//src/main/java/com/google/devtools/build/lib/actions:artifacts", + "//src/main/java/com/google/devtools/build/lib/actions:shared_action_event", "//src/main/java/com/google/devtools/build/lib/bugreport", "//src/main/java/com/google/devtools/build/skyframe", "//third_party:error_prone_annotations", diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java index cdad44e7240100..fd841e3105b375 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcCompilationContextApi.java @@ -151,4 +151,10 @@ public interface CcCompilationContextApi extends Starlark allowedTypes = {@ParamType(type = Boolean.class)}) }) Depset getStarlarkTransitiveModules(boolean usePic, StarlarkThread thread) throws EvalException; + + @StarlarkMethod( + name = "virtual_to_original_headers", + documented = false, + useStarlarkThread = true) + Depset getStarlarkVirtualToOriginalHeaders(StarlarkThread thread) throws EvalException; } diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/test/CoverageCommonApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/test/CoverageCommonApi.java index 6fa1c362dcc2ff..cef27db2dbb8b3 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/test/CoverageCommonApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/test/CoverageCommonApi.java @@ -103,6 +103,16 @@ public interface CoverageCommonApi< defaultValue = "[]", allowedTypes = { @ParamType(type = Sequence.class, generic1 = FileApi.class), + }), + @Param( + name = "reported_to_actual_sources", + documented = false, + positional = false, + named = true, + defaultValue = "None", + allowedTypes = { + @ParamType(type = Depset.class), + @ParamType(type = NoneType.class), }) }, useStarlarkThread = true) @@ -114,6 +124,7 @@ InstrumentedFilesInfoApi instrumentedFilesInfo( Dict environment, // Object extensions, Sequence metadataFiles, + Object reportedToActualSourcesObject, StarlarkThread thread) throws EvalException, TypeException; } diff --git a/src/main/protobuf/failure_details.proto b/src/main/protobuf/failure_details.proto index ea0873c3ea9a12..b12520560818d0 100644 --- a/src/main/protobuf/failure_details.proto +++ b/src/main/protobuf/failure_details.proto @@ -626,8 +626,9 @@ message MemoryOptions { MEMORY_OPTIONS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; EXPERIMENTAL_OOM_MORE_EAGERLY_THRESHOLD_INVALID_VALUE = 1 [(metadata) = { exit_code: 2 }]; - EXPERIMENTAL_OOM_MORE_EAGERLY_NO_TENURED_COLLECTORS_FOUND = 2 - [(metadata) = { exit_code: 2 }]; + // Deprecated: no tenured collectors found is now a crash on startup. + DEPRECATED_EXPERIMENTAL_OOM_MORE_EAGERLY_NO_TENURED_COLLECTORS_FOUND = 2 + [(metadata) = { exit_code: 2 }, deprecated = true]; } Code code = 1; diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl index c8970cc3fc4395..a024473be17c47 100644 --- a/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl @@ -193,11 +193,12 @@ def _add_transitive_info_providers(ctx, cc_toolchain, cpp_config, feature_config ctx.actions.write(output = runtime_objects_list, content = file_content, is_executable = False) additional_meta_data = [runtime_objects_list] - instrumented_files_provider = common.instrumented_files_info_from_compilation_context( - files = instrumented_object_files, - with_base_line_coverage = not ctx.attr._is_test, - compilation_context = compilation_context, - additional_metadata = additional_meta_data, + instrumented_files_provider = cc_helper.create_cc_instrumented_files_info( + ctx = ctx, + cc_config = cpp_config, + cc_toolchain = cc_toolchain, + metadata_files = additional_meta_data + cc_compilation_outputs.gcno_files() + cc_compilation_outputs.pic_gcno_files(), + virtual_to_original_headers = compilation_context.virtual_to_original_headers(), ) output_groups = cc_helper.build_output_groups_for_emitting_compile_providers( cc_compilation_outputs, diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl index 7c2e20865ffd9b..19f20644a5c040 100644 --- a/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl @@ -1110,14 +1110,14 @@ def _get_coverage_environment(ctx, cc_config, cc_toolchain): env["FDO_DIR"] = cc_config.fdo_instrument() return env -def _create_cc_instrumented_files_info(ctx, cc_config, cc_toolchain, metadata_files): +def _create_cc_instrumented_files_info(ctx, cc_config, cc_toolchain, metadata_files, virtual_to_original_headers = None): extensions = CC_SOURCE + \ C_SOURCE + \ CC_HEADER + \ ASSESMBLER_WITH_C_PREPROCESSOR + \ ASSEMBLER coverage_environment = {} - if ctx.coverage_instrumented(): + if ctx.configuration.coverage_enabled: coverage_environment = _get_coverage_environment(ctx, cc_config, cc_toolchain) coverage_support_files = cc_toolchain.coverage_files() if ctx.coverage_instrumented() else depset([]) info = coverage_common.instrumented_files_info( @@ -1128,6 +1128,7 @@ def _create_cc_instrumented_files_info(ctx, cc_config, cc_toolchain, metadata_fi metadata_files = metadata_files, coverage_support_files = coverage_support_files, coverage_environment = coverage_environment, + reported_to_actual_sources = virtual_to_original_headers, ) return info diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl b/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl index d731cf2cc35b5a..929b12334a572a 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl +++ b/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl @@ -1040,7 +1040,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch "]), flag_group( flags = [ @@ -1090,7 +1089,7 @@ def _impl(ctx): ], tools = [ tool( - path = "/wrapped_clang++", + path = "/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1101,7 +1100,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch arm64"]), flag_group( flags = [ @@ -1151,7 +1149,7 @@ def _impl(ctx): ], tools = [ tool( - path = "ios/wrapped_clang++", + path = "ios/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1162,7 +1160,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch arm64"]), flag_group( flags = [ @@ -1212,7 +1209,7 @@ def _impl(ctx): ], tools = [ tool( - path = "tvos/wrapped_clang++", + path = "tvos/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1223,7 +1220,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch armv7"]), flag_group( flags = [ @@ -1273,7 +1269,7 @@ def _impl(ctx): ], tools = [ tool( - path = "ios/wrapped_clang++", + path = "ios/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1284,7 +1280,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch armv7k"]), flag_group( flags = [ @@ -1334,7 +1329,7 @@ def _impl(ctx): ], tools = [ tool( - path = "watchos/wrapped_clang++", + path = "watchos/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1345,7 +1340,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch arm64_32"]), flag_group( flags = [ @@ -1395,7 +1389,7 @@ def _impl(ctx): ], tools = [ tool( - path = "watchos/wrapped_clang++", + path = "watchos/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1406,7 +1400,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch i386"]), flag_group( flags = [ @@ -1456,7 +1449,7 @@ def _impl(ctx): ], tools = [ tool( - path = "iossim/wrapped_clang++", + path = "iossim/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1467,7 +1460,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch i386"]), flag_group( flags = [ @@ -1517,7 +1509,7 @@ def _impl(ctx): ], tools = [ tool( - path = "watchsim/wrapped_clang++", + path = "watchsim/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1528,7 +1520,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch x86_64"]), flag_group( flags = [ @@ -1578,7 +1569,7 @@ def _impl(ctx): ], tools = [ tool( - path = "watchsim/wrapped_clang++", + path = "watchsim/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1589,7 +1580,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch x86_64"]), flag_group( flags = [ @@ -1639,7 +1629,7 @@ def _impl(ctx): ], tools = [ tool( - path = "iossim/wrapped_clang++", + path = "iossim/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1650,7 +1640,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch x86_64"]), flag_group( flags = [ @@ -1700,7 +1689,7 @@ def _impl(ctx): ], tools = [ tool( - path = "mac/wrapped_clang++", + path = "mac/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], @@ -1711,7 +1700,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), flag_group(flags = ["-arch x86_64"]), flag_group( flags = [ @@ -1761,7 +1749,7 @@ def _impl(ctx): ], tools = [ tool( - path = "tvsim/wrapped_clang++", + path = "tvsim/wrapped_clang", execution_requirements = xcode_execution_requirements, ), ], diff --git a/src/test/java/com/google/devtools/build/lib/runtime/MemoryPressureListenerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/MemoryPressureListenerTest.java index 008c50a038e483..9e632333d13459 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/MemoryPressureListenerTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/MemoryPressureListenerTest.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.runtime; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -73,17 +74,18 @@ public void handle(MemoryPressureEvent event) { @Test public void findBeans() { assertThat( - MemoryPressureListener.findTenuredCollectorBeans( - ImmutableList.of(mockUselessBean, mockBean))) + MemoryPressureListener.findTenuredCollectorBeans( + ImmutableList.of(mockUselessBean, mockBean))) .containsExactly(mockBean); } @Test - public void createFromBeans_returnsNullIfNoTenuredSpaceBean() { - assertThat( + public void createFromBeans_throwsIfNoTenuredSpaceBean() { + assertThrows( + IllegalStateException.class, + () -> MemoryPressureListener.createFromBeans( - ImmutableList.of(mockUselessBean), retainedHeapLimiter)) - .isNull(); + ImmutableList.of(mockUselessBean), retainedHeapLimiter)); } @Test @@ -316,4 +318,4 @@ public void retainedHeapLimiter_aboveThreshold_handleCrash() { verify(bugReporter).handleCrash(any(), any()); assertThat(events).containsExactly(event, manualGcEvent); } -} \ No newline at end of file +} diff --git a/src/test/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiterTest.java b/src/test/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiterTest.java index 8ff9505b81a5f3..2456610ed85392 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiterTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/RetainedHeapLimiterTest.java @@ -16,15 +16,12 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import com.google.devtools.build.lib.bugreport.BugReport; import com.google.devtools.build.lib.bugreport.BugReporter; import com.google.devtools.build.lib.bugreport.Crash; -import com.google.devtools.build.lib.server.FailureDetails; -import com.google.devtools.build.lib.util.AbruptExitException; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -40,27 +37,11 @@ public void cleanUp() { BugReport.maybePropagateLastCrashIfInTest(); } - @Test - public void noTenuredSpaceFound() throws AbruptExitException { - RetainedHeapLimiter underTest = RetainedHeapLimiter.create(BugReporter.defaultInstance()); - - AbruptExitException e = - assertThrows( - AbruptExitException.class, () -> underTest.setThreshold(/*listening=*/ false, 80)); - FailureDetails.FailureDetail failureDetail = e.getDetailedExitCode().getFailureDetail(); - assertThat(failureDetail.getMessage()) - .contains("unable to watch for GC events to exit JVM when 80% of heap is used"); - assertThat(failureDetail.getMemoryOptions().getCode()) - .isEqualTo( - FailureDetails.MemoryOptions.Code - .EXPERIMENTAL_OOM_MORE_EAGERLY_NO_TENURED_COLLECTORS_FOUND); - } - @Test public void underThreshold_noOom() throws Exception { RetainedHeapLimiter underTest = RetainedHeapLimiter.create(BugReporter.defaultInstance()); - underTest.setThreshold(/*listening=*/ true, 99); + underTest.setThreshold(99); underTest.handle(percentUsedAfterOtherGc(100)); underTest.handle(percentUsedAfterForcedGc(89)); @@ -71,7 +52,7 @@ public void overThreshold_oom() throws Exception { BugReporter bugReporter = mock(BugReporter.class); RetainedHeapLimiter underTest = RetainedHeapLimiter.create(bugReporter); - underTest.setThreshold(/*listening=*/ true, 90); + underTest.setThreshold(90); // Triggers GC, and tells RetainedHeapLimiter to OOM if too much memory used next time. underTest.handle(percentUsedAfterOtherGc(91)); @@ -90,7 +71,7 @@ public void overThreshold_oom() throws Exception { public void externalGcNoTrigger() throws Exception { RetainedHeapLimiter underTest = RetainedHeapLimiter.create(BugReporter.defaultInstance()); - underTest.setThreshold(/*listening=*/ true, 90); + underTest.setThreshold(90); // No trigger because cause was "System.gc()". underTest.handle(percentUsedAfterForcedGc(91)); @@ -103,7 +84,7 @@ public void externalGcNoTrigger() throws Exception { public void triggerReset() throws Exception { RetainedHeapLimiter underTest = RetainedHeapLimiter.create(BugReporter.defaultInstance()); - underTest.setThreshold(/*listening=*/ true, 90); + underTest.setThreshold(90); underTest.handle(percentUsedAfterOtherGc(91)); @@ -119,7 +100,7 @@ public void triggerRaceWithOtherGc() throws Exception { BugReporter bugReporter = mock(BugReporter.class); RetainedHeapLimiter underTest = RetainedHeapLimiter.create(bugReporter); - underTest.setThreshold(/*listening=*/ true, 90); + underTest.setThreshold(90); underTest.handle(percentUsedAfterOtherGc(91)); underTest.handle(percentUsedAfterOtherGc(91)); @@ -131,11 +112,11 @@ public void triggerRaceWithOtherGc() throws Exception { } private static MemoryPressureEvent percentUsedAfterForcedGc(int percentUsed) { - return percentUsedAfterGc(/*wasManualGc=*/ true, percentUsed); + return percentUsedAfterGc(/* wasManualGc= */ true, percentUsed); } private static MemoryPressureEvent percentUsedAfterOtherGc(int percentUsed) { - return percentUsedAfterGc(/*wasManualGc=*/ false, percentUsed); + return percentUsedAfterGc(/* wasManualGc= */ false, percentUsed); } private static MemoryPressureEvent percentUsedAfterGc(boolean wasManualGc, int percentUsed) { diff --git a/src/test/shell/unittest.bash b/src/test/shell/unittest.bash index b54fa631eeb636..c88ba2ceb85493 100644 --- a/src/test/shell/unittest.bash +++ b/src/test/shell/unittest.bash @@ -52,12 +52,11 @@ # respectively. Similarly, "cleanup" and "timeout" may be redefined, # and these function are called upon exit (of any kind) or a timeout. # -# The user can pass --test_arg to blaze test to select specific tests -# to run. Specifying --test_arg multiple times allows to select several -# tests to be run in the given order. Additionally the user may define -# TESTS=(test_foo test_bar ...) to specify a subset of test functions to -# execute, for example, a working set during debugging. By default, all -# functions called test_* will be executed. +# The user can pass --test_filter to blaze test to select specific tests +# to run with Bash globs. A union of tests matching any of the provided globs +# will be run. Additionally the user may define TESTS=(test_foo test_bar ...) to +# specify a subset of test functions to execute, for example, a working set +# during debugging. By default, all functions called test_* will be executed. # # This file provides utilities for assertions over the output of a # command. The output of the command under test is directed to the diff --git a/third_party/BUILD b/third_party/BUILD index 51e317a6ea96b8..526c1024c4b9a0 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -239,9 +239,9 @@ java_plugin( distrib_java_import( name = "auto_common", + applicable_licenses = [":auto_license"], enable_distributions = ["debian"], jars = ["auto/auto-common-1.1.2.jar"], - applicable_licenses = [":auto_license"], ) license( @@ -312,16 +312,27 @@ java_plugin( ], ) +java_plugin( + name = "auto_value_gson_plugin", + processor_class = "com.ryanharter.auto.value.gson.factory.AutoValueGsonAdapterFactoryProcessor", + deps = [ + "@maven//:com_ryanharter_auto_value_auto_value_gson_extension", + "@maven//:com_ryanharter_auto_value_auto_value_gson_factory", + ], +) + java_library( name = "auto_value", exported_plugins = [ ":auto_annotation_plugin", ":auto_oneof_plugin", ":auto_value_plugin", + ":auto_value_gson_plugin", ], exports = [ ":auto_value_value", ":tomcat_annotations_api", + "@maven//:com_ryanharter_auto_value_auto_value_gson_runtime", ], ) @@ -398,8 +409,8 @@ java_library( distrib_jar_filegroup( name = "error_prone_annotations-jar", srcs = [ - "@maven//:com_google_errorprone_error_prone_annotations_file", "error_prone/threeten-extra-1.5.0.jar", + "@maven//:com_google_errorprone_error_prone_annotations_file", ], enable_distributions = ["debian"], ) @@ -463,13 +474,13 @@ filegroup( java_library( name = "guava", + applicable_licenses = [":guava_license"], exports = [ - "@maven//:com_google_guava_guava", - ":error_prone_annotations", - ":jsr305", - ":jcip_annotations", + ":error_prone_annotations", + ":jcip_annotations", + ":jsr305", + "@maven//:com_google_guava_guava", ], - applicable_licenses = [":guava_license"], ) license( @@ -483,13 +494,13 @@ license( distrib_java_import( name = "flogger", + applicable_licenses = [":flogger_license"], enable_distributions = ["debian"], jars = [ "flogger/flogger-0.5.1.jar", "flogger/flogger-system-backend-0.5.1.jar", "flogger/google-extensions-0.5.1.jar", ], - applicable_licenses = [":flogger_license"], ) license( @@ -748,6 +759,7 @@ java_import( java_import( name = "truth", + applicable_licenses = [":truth_license"], jars = ["truth/truth-1.0.1.jar"], exports = [ ":truth8", @@ -756,7 +768,6 @@ java_import( deps = [ ":diffutils", ], - applicable_licenses = [":truth_license"], ) license( @@ -770,8 +781,8 @@ license( java_import( name = "truth8", - jars = ["truth8/truth-java8-extension-1.0.1.jar"], applicable_licenses = [":truth8_license"], + jars = ["truth8/truth-java8-extension-1.0.1.jar"], ) license( @@ -785,11 +796,11 @@ license( java_import( name = "truth_proto", + applicable_licenses = [":truth_proto_license"], jars = [ "truth_proto/truth-liteproto-extension-1.0.1.jar", "truth_proto/truth-proto-extension-1.0.1.jar", ], - applicable_licenses = [":truth_proto_license"], ) license( @@ -803,9 +814,9 @@ license( distrib_java_import( name = "xz", + applicable_licenses = [":xz_license"], enable_distributions = ["debian"], jars = ["xz/xz-1.9.jar"], - applicable_licenses = [":xz_license"], ) license( diff --git a/third_party/java/javapoet/BUILD b/third_party/java/javapoet/BUILD index 42bc23188676b6..eb985393480754 100644 --- a/third_party/java/javapoet/BUILD +++ b/third_party/java/javapoet/BUILD @@ -13,8 +13,7 @@ filegroup( srcs = glob(["**"]), ) -distrib_java_import( +java_library( name = "javapoet", - enable_distributions = ["debian"], - jars = ["javapoet-1.8.0.jar"], + exports = ["@maven//:com_squareup_javapoet"], ) diff --git a/third_party/java/javapoet/javapoet-1.8.0.jar b/third_party/java/javapoet/javapoet-1.8.0.jar deleted file mode 100644 index 6758b6d73920c4..00000000000000 Binary files a/third_party/java/javapoet/javapoet-1.8.0.jar and /dev/null differ diff --git a/tools/osx/crosstool/cc_toolchain_config.bzl b/tools/osx/crosstool/cc_toolchain_config.bzl index f82ea4348c5999..c7139a7030d685 100644 --- a/tools/osx/crosstool/cc_toolchain_config.bzl +++ b/tools/osx/crosstool/cc_toolchain_config.bzl @@ -245,8 +245,6 @@ def _impl(ctx): flag_sets = [ flag_set( flag_groups = [ - flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), - flag_group(flags = ["-target", target_system_name]), flag_group( flags = [ "-Xlinker", @@ -257,6 +255,12 @@ def _impl(ctx): "-ObjC", ], ), + ], + with_features = [with_feature_set(not_features = ["kernel_extension"])], + ), + flag_set( + flag_groups = [ + flag_group(flags = ["-target", target_system_name]), flag_group( flags = ["-l%{library_names}"], iterate_over = "library_names", @@ -287,7 +291,7 @@ def _impl(ctx): ], tools = [ tool( - path = "wrapped_clang_pp", + path = "wrapped_clang", execution_requirements = xcode_execution_requirements, ), ],