diff options
author | Laurent Le Brun <laurentlb@google.com> | 2015-05-29 12:37:47 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2015-06-01 15:47:06 +0000 |
commit | 578d055624b76101af5053b6447372d746248597 (patch) | |
tree | b99626b345d8dd04e59eea1a53447d697d5d07c7 /src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java | |
parent | a1c73f9e7c571da6db6fc14ea63ce0b50d36a3cb (diff) |
Expose Python provider to Skylark
It is now possible to access transitive sources from py_binary and py_library
rules with target.py.transitive_sources
--
MOS_MIGRATED_REVID=94751866
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java | 7 |
1 files changed, 4 insertions, 3 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 { } } } - |