// Copyright 2018 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.skylarkbuildapi; import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.skylarkinterface.Param; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; import com.google.devtools.build.lib.skylarkinterface.SkylarkConstructor; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory; import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.SkylarkNestedSet; /** A provider that gives general information about a target's direct and transitive files. */ @SkylarkModule( name = "DefaultInfo", category = SkylarkModuleCategory.PROVIDER, doc = "A provider that gives general information about a target's direct and transitive files. " + "Every rule type has this provider, even if it is not returned explicitly by the " + "rule's implementation function." + "Each DefaultInfo instance has the following fields: " + "" + "See the rules page for more information." ) public interface DefaultInfoApi extends StructApi { @SkylarkCallable( name = "files", doc = "A depset of " + "File objects representing the default " + "outputs to build when this target is specified on the blaze command line. By " + "default it is all predeclared outputs.", structField = true, allowReturnNones = true ) SkylarkNestedSet getFiles(); @SkylarkCallable( name = "files_to_run", doc = "A FilesToRunProvider object " + "containing information about the executable and runfiles of the target.", structField = true, allowReturnNones = true ) FilesToRunProviderApi getFilesToRun(); @SkylarkCallable( name = "data_runfiles", doc = "the files that are added to the runfiles of a " + "target that depend on the rule via the data attribute.", structField = true, allowReturnNones = true ) RunfilesApi getDataRunfiles(); @SkylarkCallable( name = "default_runfiles", doc = "the files that are added to the runfiles of " + "a target that depend on the rule via anything but the data " + "attribute.", structField = true, allowReturnNones = true ) RunfilesApi getDefaultRunfiles(); /** * Provider for {@link DefaultInfoApi}. */ @SkylarkModule(name = "Provider", documented = false, doc = "") public static interface DefaultInfoApiProvider extends ProviderApi { @SkylarkCallable( name = "DefaultInfo", doc = "

The DefaultInfo constructor.", parameters = { @Param( name = "files", type = SkylarkNestedSet.class, named = true, positional = false, defaultValue = "None", noneable = true, doc = "A depset of " + "File objects representing the default " + "outputs to build when this target is specified on the blaze command line. By " + "default it is all predeclared outputs." ), @Param( name = "runfiles", type = RunfilesApi.class, named = true, positional = false, defaultValue = "None", noneable = true, doc = "set of files acting as both the " + "data_runfiles and default_runfiles." ), @Param( name = "data_runfiles", type = RunfilesApi.class, named = true, positional = false, defaultValue = "None", noneable = true, doc = "the files that are added to the runfiles of a " + "target that depend on the rule via the data attribute." ), @Param( name = "default_runfiles", type = RunfilesApi.class, named = true, positional = false, defaultValue = "None", noneable = true, doc = "the files that are added to the runfiles of " + "a target that depend on the rule via anything but the data " + "attribute." ), @Param( name = "executable", type = FileApi.class, named = true, positional = false, defaultValue = "None", noneable = true, doc = "If this rule is marked " + "executable or " + "test, this is a " + "File object representing the file that " + "should be executed to run the target. By default it is the predeclared output " + "ctx.outputs.executable." )}, useLocation = true, selfCall = true) @SkylarkConstructor(objectType = DefaultInfoApi.class, receiverNameForDoc = "DefaultInfo") public DefaultInfoApi constructor( // TODO(cparsons): Use stricter types when Runfiles.NONE is passed as null. Object files, Object runfiles, Object dataRunfiles, Object defaultRunfiles, Object executable, Location loc) throws EvalException; } }