aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/proto
diff options
context:
space:
mode:
authorGravatar cparsons <cparsons@google.com>2018-06-11 13:15:43 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-11 13:17:22 -0700
commitc7eef96da80ace358e1d19c7b090765747281cfd (patch)
treee1deefb8baf4b10d19cf2b25df06c8982457d6ee /src/main/java/com/google/devtools/build/lib/rules/proto
parent8c666d999699f788d4ff286a4a30c9dab0beb5b0 (diff)
Migrate remaining assorted skylark types to skylarkbuildapi
RELNOTES: None. PiperOrigin-RevId: 200100871
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/proto')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourcesProvider.java55
2 files changed, 12 insertions, 53 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java
index a5706d9bc2..353d9038af 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java
@@ -26,8 +26,7 @@ import com.google.devtools.build.lib.analysis.config.InvalidConfigurationExcepti
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.ProtoConfigurationApi;
import com.google.devtools.common.options.Converters;
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
@@ -40,12 +39,7 @@ import java.util.List;
@Immutable
// This module needs to be exported to Skylark so it can be passed as a mandatory host/target
// configuration fragment in aspect definitions.
-@SkylarkModule(
- name = "proto",
- category = SkylarkModuleCategory.CONFIGURATION_FRAGMENT,
- doc = "A configuration fragment representing protocol buffers."
-)
-public class ProtoConfiguration extends Fragment {
+public class ProtoConfiguration extends Fragment implements ProtoConfigurationApi {
/** Command line options. */
@AutoCodec(strategy = AutoCodec.Strategy.PUBLIC_FIELDS)
public static class Options extends FragmentOptions {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourcesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourcesProvider.java
index 48158ba420..26075cf07f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourcesProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourcesProvider.java
@@ -21,8 +21,7 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
+import com.google.devtools.build.lib.skylarkbuildapi.ProtoSourcesProviderApi;
// TODO(carmi): Rename the class to ProtoInfoProvider.
/**
@@ -31,9 +30,9 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
*/
@AutoValue
@Immutable
-@SkylarkModule(name = "ProtoSourcesProvider", doc = "")
@AutoCodec
-public abstract class ProtoSourcesProvider implements TransitiveInfoProvider {
+public abstract class ProtoSourcesProvider
+ implements TransitiveInfoProvider, ProtoSourcesProviderApi<Artifact> {
/** The name of the field in Skylark used to access this class. */
public static final String SKYLARK_NAME = "proto";
@@ -60,30 +59,18 @@ public abstract class ProtoSourcesProvider implements TransitiveInfoProvider {
* Transitive imports including weak dependencies This determines the order of "-I" arguments to
* the protocol compiler, and that is probably important
*/
- @SkylarkCallable(
- name = "transitive_imports",
- doc = "Transitive imports including weak dependencies.",
- structField = true
- )
+ @Override
public abstract NestedSet<Artifact> getTransitiveImports();
/** Returns the proto sources for this rule and all its dependent protocol buffer rules. */
- @SkylarkCallable(
- name = "transitive_sources",
- doc = "Proto sources for this rule and all its dependent protocol buffer rules.",
- structField = true
- )
+ @Override
// TODO(bazel-team): The difference between transitive imports and transitive proto sources
// should never be used by Skylark or by an Aspect. One of these two should be removed,
// preferably soon, before Skylark users start depending on them.
public abstract NestedSet<Artifact> getTransitiveProtoSources();
/** Returns the proto sources from the 'srcs' attribute. */
- @SkylarkCallable(
- name = "direct_sources",
- doc = "Proto sources from the 'srcs' attribute.",
- structField = true
- )
+ @Override
public abstract ImmutableList<Artifact> getDirectProtoSources();
/**
@@ -93,14 +80,7 @@ public abstract class ProtoSourcesProvider implements TransitiveInfoProvider {
* <p>This must be a set to avoid collecting the same source twice when depending on 2 proxy
* proto_library's that depend on the same proto_library.
*/
- @SkylarkCallable(
- name = "check_deps_sources",
- doc =
- "Proto sources from the 'srcs' attribute. If the library is a proxy library "
- + "that has no sources, it contains the check_deps_sources "
- + "from this library's direct deps.",
- structField = true
- )
+ @Override
public abstract NestedSet<Artifact> getCheckDepsProtoSources();
/**
@@ -109,11 +89,7 @@ public abstract class ProtoSourcesProvider implements TransitiveInfoProvider {
* (remember that proto-compiler reads all transitive .proto files, even when producing the
* direct-srcs descriptor set)
*/
- @SkylarkCallable(
- name = "direct_descriptor_set",
- doc = "The FileDescriptorSet of the direct sources. If no srcs, contains an empty file. ",
- structField = true
- )
+ @Override
public abstract Artifact directDescriptorSet();
/**
@@ -122,25 +98,14 @@ public abstract class ProtoSourcesProvider implements TransitiveInfoProvider {
* (remember that proto-compiler reads all transitive .proto files, even when producing the
* direct-srcs descriptor set)
*/
- @SkylarkCallable(
- name = "transitive_descriptor_sets",
- doc =
- "A set of FileDescriptorSet files of all dependent proto_library rules, and this one's. "
- + "This is not the same as passing --include_imports to proto-compiler. "
- + "Will be empty if no dependencies. ",
- structField = true
- )
+ @Override
public abstract NestedSet<Artifact> transitiveDescriptorSets();
/**
* Directories of .proto sources collected from the transitive closure. These flags will be passed
* to {@code protoc} in the specified order, via the {@code --proto_path} flag.
*/
- @SkylarkCallable(
- name = "transitive_proto_path",
- doc = "A set of proto source roots collected from the transitive closure of this rule.",
- structField = true
- )
+ @Override
public abstract NestedSet<String> getTransitiveProtoPathFlags();
ProtoSourcesProvider() {}