diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/AlwaysBuiltArtifactsProvider.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/AlwaysBuiltArtifactsProvider.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AlwaysBuiltArtifactsProvider.java b/src/main/java/com/google/devtools/build/lib/analysis/AlwaysBuiltArtifactsProvider.java new file mode 100644 index 0000000000..e4d40fc265 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/analysis/AlwaysBuiltArtifactsProvider.java @@ -0,0 +1,46 @@ +// Copyright 2014 Google Inc. 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.analysis; + +import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.collect.nestedset.NestedSet; +import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; + +/** + * Artifacts that should be built when a target is mentioned in the command line, but are neither in + * the {@code filesToBuild} nor in the runfiles. + * + * <p> + * Link actions, may not run a link for their transitive dependencies, so it does not force the + * source files in the transitive closure to be built by default. However, users expect builds to + * fail when there is an error in a dependent library, so we use this mechanism to force their + * compilation. + */ +@Immutable +public final class AlwaysBuiltArtifactsProvider implements TransitiveInfoProvider { + + private final NestedSet<Artifact> artifactsToAlwaysBuild; + + public AlwaysBuiltArtifactsProvider(NestedSet<Artifact> artifactsToAlwaysBuild) { + this.artifactsToAlwaysBuild = artifactsToAlwaysBuild; + } + + /** + * Returns the collection of artifacts to be built. + */ + public NestedSet<Artifact> getArtifactsToAlwaysBuild() { + return artifactsToAlwaysBuild; + } +} |