diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java | 7 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PythonSourcesProvider.java | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java index 5f3a3ad9c9..73deb8360f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java @@ -120,13 +120,15 @@ public final class PyCommon { public void addCommonTransitiveInfoProviders(RuleConfiguredTargetBuilder builder, PythonSemantics semantics, NestedSet<Artifact> filesToBuild) { + PythonSourcesProvider sourcesProvider = + new PythonSourcesProvider(transitivePythonSources, usesSharedLibraries()); builder .add(InstrumentedFilesProvider.class, new InstrumentedFilesProviderImpl( new InstrumentedFilesCollector(ruleContext, semantics.getCoverageInstrumentationSpec(), METADATA_COLLECTOR, filesToBuild))) - .add(PythonSourcesProvider.class, new PythonSourcesProvider( - transitivePythonSources, usesSharedLibraries())) + .add(PythonSourcesProvider.class, sourcesProvider) + .addSkylarkTransitiveInfo(PythonSourcesProvider.SKYLARK_NAME, sourcesProvider) // Python targets are not really compilable. The best we can do is make sure that all // generated source files are ready. .addOutputGroup(OutputGroupProvider.FILES_TO_COMPILE, transitivePythonSources) @@ -401,4 +403,3 @@ public final class PyCommon { } } } - diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonSourcesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonSourcesProvider.java index 7df4609db8..fcdb8cfb89 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonSourcesProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonSourcesProvider.java @@ -27,6 +27,8 @@ import com.google.devtools.build.lib.syntax.SkylarkModule; @Immutable @SkylarkModule(name = "PythonSourcesProvider", doc = "") public final class PythonSourcesProvider implements TransitiveInfoProvider { + /** The name of the field in Skylark used to access this class. */ + public static final String SKYLARK_NAME = "py"; private final NestedSet<Artifact> transitivePythonSources; private final boolean usesSharedLibraries; @@ -40,7 +42,8 @@ public final class PythonSourcesProvider implements TransitiveInfoProvider { /** * Returns the Python sources in the transitive closure of this target. */ - @SkylarkCallable(name = "transitive_srcs", doc = "", structField = true) + @SkylarkCallable( + name = "transitive_sources", doc = "The transitive set of Python sources", structField = true) public NestedSet<Artifact> getTransitivePythonSources() { return transitivePythonSources; } |