diff options
author | Googler <noreply@google.com> | 2018-07-25 12:24:57 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-25 12:26:31 -0700 |
commit | beb5530f8c1717976736aaa30c2c8098bf34e845 (patch) | |
tree | 73f6a94673f117382ff8fcd7cbe035404097559a /src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java | |
parent | c8895b5ee40fb10d5596e47ac8a081937b697ee2 (diff) |
Allow the AndroidResourcesInfo to be created from Skylark.
RELNOTES: none.
PiperOrigin-RevId: 206035420
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java | 186 |
1 files changed, 176 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java index e9c6788f32..a723c7f467 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java @@ -13,29 +13,45 @@ // limitations under the License. package com.google.devtools.build.lib.skylarkbuildapi.android; -import com.google.devtools.build.lib.events.Location; +import com.google.devtools.build.lib.cmdline.Label; +import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.skylarkbuildapi.FileApi; import com.google.devtools.build.lib.skylarkbuildapi.ProviderApi; import com.google.devtools.build.lib.skylarkbuildapi.StructApi; 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.SkylarkDict; +import com.google.devtools.build.lib.syntax.SkylarkNestedSet; /** A provider that supplies resource information from its transitive closure. */ @SkylarkModule( name = "AndroidResourcesInfo", doc = "Android resources provided by a rule", category = SkylarkModuleCategory.PROVIDER) -public interface AndroidResourcesInfoApi extends StructApi { +public interface AndroidResourcesInfoApi< + FileT extends FileApi, + ValidatedAndroidDataT extends ValidatedAndroidDataApi, + AndroidManifestT extends AndroidManifestApi> + extends StructApi { /** * Name of this info object. */ public static String NAME = "AndroidResourcesInfo"; + /** Returns the label that is associated with this piece of information. */ + @SkylarkCallable( + name = "label", + doc = "Returns the label that is associated with this piece of information.", + structField = true) + Label getLabel(); + + @SkylarkCallable(name = "manifest", doc = "", documented = false, structField = true) + AndroidManifestT getManifest(); + /** Returns the compiletime r.txt file for the target. */ @SkylarkCallable( name = "compiletime_r_txt", @@ -44,20 +60,170 @@ public interface AndroidResourcesInfoApi extends StructApi { + " stubbed out compiletime file and should not be built into APKs, inherited from" + " dependencies, or used at runtime.", structField = true) - FileApi getRTxt(); + FileT getRTxt(); + + /** Returns the transitive ResourceContainers for the label. */ + @SkylarkCallable( + name = "transitive_android_resources", + doc = "Returns the transitive ResourceContainers for the label.", + structField = true) + NestedSet<ValidatedAndroidDataT> getTransitiveAndroidResources(); + + /** Returns the immediate ResourceContainers for the label. */ + @SkylarkCallable( + name = "direct_android_resources", + doc = "Returns the immediate ResourceContainers for the label.", + structField = true) + NestedSet<ValidatedAndroidDataT> getDirectAndroidResources(); + + @SkylarkCallable(name = "transitive_resources", doc = "", documented = false, structField = true) + NestedSet<FileT> getTransitiveResources(); + + @SkylarkCallable(name = "transitive_resources", doc = "", documented = false, structField = true) + NestedSet<FileT> getTransitiveManifests(); + + @SkylarkCallable( + name = "transitive_aapt2_r_txt", + doc = "", + documented = false, + structField = true) + NestedSet<FileT> getTransitiveAapt2RTxt(); + + @SkylarkCallable( + name = "transitive_symbols_bin", + doc = "", + documented = false, + structField = true) + NestedSet<FileT> getTransitiveSymbolsBin(); + + @SkylarkCallable( + name = "transitive_compiled_symbols", + doc = "", + documented = false, + structField = true) + NestedSet<FileT> getTransitiveCompiledSymbols(); + + @SkylarkCallable(name = "transitive_static_lib", doc = "", documented = false, structField = true) + NestedSet<FileT> getTransitiveStaticLib(); + + @SkylarkCallable(name = "transitive_r_txt", doc = "", documented = false, structField = true) + NestedSet<FileT> getTransitiveRTxt(); /** Provider for {@link AndroidResourcesInfoApi}. */ @SkylarkModule(name = "Provider", doc = "", documented = false) - public interface AndroidResourcesInfoApiProvider extends ProviderApi { + public interface AndroidResourcesInfoApiProvider< + FileT extends FileApi, + ValidatedAndroidDataT extends ValidatedAndroidDataApi, + AndroidManifestT extends AndroidManifestApi> + extends ProviderApi { @SkylarkCallable( name = "AndroidResourcesInfo", - // This is left undocumented as it throws a "not-implemented in Skylark" error when invoked. documented = false, - extraKeywords = @Param(name = "kwargs"), - useLocation = true, + parameters = { + @Param( + name = "label", + doc = "A label of the target.", + positional = true, + named = false, + type = Label.class), + @Param( + name = "manifest", + positional = true, + named = false, + type = AndroidManifestApi.class), + @Param(name = "r_txt", positional = true, named = false, type = FileApi.class), + @Param( + name = "transitive_android_resources", + doc = + "A depset of ValidatedAndroidData of Android Resources in the transitive " + + "closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = ValidatedAndroidDataApi.class), + @Param( + name = "direct_android_resources", + doc = "A depset of ValidatedAndroidData of Android Resources for the target.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = ValidatedAndroidDataApi.class), + @Param( + name = "transitive_resources", + doc = "A depset of Artifacts of Android Resource files in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_assets", + doc = "A depset of Artifacts of Android Assets in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_manifests", + doc = "A depset of Artifacts of Android Manifests in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_aapt2_r_txt", + doc = "A depset of Artifacts of Android AAPT2 R.txt files in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_symbols_bin", + doc = "A depset of Artifacts of Android symbols files in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_compiled_symbols", + doc = + "A depset of Artifacts of Android compiled symbols files in the transitive " + + "closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_static_lib", + doc = "A depset of Artifacts of static lib files in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + @Param( + name = "transitive_r_txt", + doc = "A depset of Artifacts of Android AAPT R.txt files in the transitive closure.", + positional = true, + named = false, + type = SkylarkNestedSet.class, + generic1 = FileApi.class), + }, selfCall = true) - public AndroidResourcesInfoApi createInfo( - SkylarkDict<?, ?> kwargs, Location loc) throws EvalException; + @SkylarkConstructor(objectType = AndroidResourcesInfoApi.class) + AndroidResourcesInfoApi<FileT, ValidatedAndroidDataT, AndroidManifestT> createInfo( + Label label, + AndroidManifestT manifest, + FileT rTxt, + SkylarkNestedSet transitiveAndroidResources, + SkylarkNestedSet directAndroidResources, + SkylarkNestedSet transitiveResources, + SkylarkNestedSet transitiveAssets, + SkylarkNestedSet transitiveManifests, + SkylarkNestedSet transitiveAapt2RTxt, + SkylarkNestedSet transitiveSymbolsBin, + SkylarkNestedSet transitiveCompiledSymbols, + SkylarkNestedSet transitiveStaticLib, + SkylarkNestedSet transitiveRTxt) + throws EvalException; } } |