aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidResourcesInfoApi.java
blob: ea0705a15fa4cfcab755302021aa7529a2e5f2fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// 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.android;

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.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<
        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",
      doc =
          "A txt file containing compiled resource file information for this target. This is a"
              + " stubbed out compiletime file and should not be built into APKs, inherited from"
              + " dependencies, or used at runtime.",
      structField = true)
  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<
          FileT extends FileApi,
          ValidatedAndroidDataT extends ValidatedAndroidDataApi,
          AndroidManifestT extends AndroidManifestApi>
      extends ProviderApi {

    @SkylarkCallable(
        name = "AndroidResourcesInfo",
        documented = false,
        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_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)
    @SkylarkConstructor(objectType = AndroidResourcesInfoApi.class)
    AndroidResourcesInfoApi<FileT, ValidatedAndroidDataT, AndroidManifestT> createInfo(
        Label label,
        AndroidManifestT manifest,
        FileT rTxt,
        SkylarkNestedSet transitiveAndroidResources,
        SkylarkNestedSet directAndroidResources,
        SkylarkNestedSet transitiveResources,
        SkylarkNestedSet transitiveManifests,
        SkylarkNestedSet transitiveAapt2RTxt,
        SkylarkNestedSet transitiveSymbolsBin,
        SkylarkNestedSet transitiveCompiledSymbols,
        SkylarkNestedSet transitiveStaticLib,
        SkylarkNestedSet transitiveRTxt)
        throws EvalException;
  }
}