blob: 9d6a4be62df96e6f01e8730fecaf4575fbd78bc4 [file] [log] [blame]
// Copyright 2015 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 com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue.RunfileSymlinksMode;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.Map;
import net.starlark.java.eval.StarlarkValue;
/** Convenience wrapper around runfiles allowing lazy expansion. */
// RunfilesSuppliers appear to be Starlark values;
// they are exposed through ctx.resolve_tools[2], for example.
public interface RunfilesSupplier extends StarlarkValue {
/** Lazy wrapper for a single runfiles tree. */
// TODO(bazel-team): Ideally we could refer to Runfiles objects directly here, but current package
// structure makes this difficult. Consider moving things around to make this possible.
//
interface RunfilesTree {
/** Returns the execpath of the root directory of the runfiles tree. */
PathFragment getExecPath();
/** Returns the mapping from the location in the runfiles tree to the artifact that's there. */
Map<PathFragment, Artifact> getMapping();
/**
* Returns artifacts the runfiles tree contain symlinks to.
*
* <p>This includes artifacts that the symlinks and root symlinks point to, not just artifacts
* at their canonical location.
*/
NestedSet<Artifact> getArtifacts();
/** Returns the {@link RunfileSymlinksMode} for this runfiles tree. */
RunfileSymlinksMode getSymlinksMode();
/** Returns whether the runfile symlinks should be materialized during the build. */
boolean isBuildRunfileLinks();
}
/** Returns the runfiles trees to be materialized on the inputs of the action. */
ImmutableList<RunfilesTree> getRunfilesTrees();
}