aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/android/AndroidAssetsInfoApi.java
blob: 2263fa73f92cb244ccbe25866440d38f9820b019 (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
// 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.common.collect.ImmutableList;
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;
import javax.annotation.Nullable;

/** Provides information about transitive Android assets. */
@SkylarkModule(
    name = "AndroidAssetsInfo",
    doc = "Information about the Android assets provided by a rule.",
    category = SkylarkModuleCategory.PROVIDER)
public interface AndroidAssetsInfoApi<FileT extends FileApi, AssetsT extends ParsedAndroidAssetsApi>
    extends StructApi {

  public static final String NAME = "AndroidAssetsInfo";

  @SkylarkCallable(name = "label", structField = true, doc = "", documented = false)
  Label getLabel();

  @SkylarkCallable(
      name = "validation_result",
      structField = true,
      allowReturnNones = true,
      doc =
          "If not None, represents the output of asset merging and validation for this target. The"
              + " action to merge and validate assets is not run be default; to force it, add this"
              + " artifact to your target's outputs. The validation action is somewhat expensive -"
              + " in native code, this artifact is added to the top-level output group (so"
              + " validation is only done if the target is requested on the command line). The"
              + " contents of this artifact are subject to change and should not be relied upon.")
  @Nullable
  FileApi getValidationResult();

  @SkylarkCallable(name = "direct_parsed_assets", structField = true, doc = "", documented = false)
  NestedSet<AssetsT> getDirectParsedAssets();

  /** Returns the local assets for the target. */
  @SkylarkCallable(
      name = "local_assets",
      doc = "Returns the local assets for the target.",
      allowReturnNones = true,
      structField = true)
  ImmutableList<FileT> getLocalAssets();

  /** Returns the local asset dir for the target. */
  @SkylarkCallable(
      name = "local_asset_dir",
      doc = "Returns the local asset directory for the target.",
      allowReturnNones = true,
      structField = true)
  String getLocalAssetDir();

  @SkylarkCallable(
      name = "transitive_parsed_assets",
      structField = true,
      doc = "",
      documented = false)
  NestedSet<AssetsT> getTransitiveParsedAssets();

  @SkylarkCallable(name = "assets", structField = true, doc = "", documented = false)
  NestedSet<FileT> getAssets();

  @SkylarkCallable(name = "symbols", structField = true, doc = "", documented = false)
  NestedSet<FileT> getSymbols();

  @SkylarkCallable(name = "compiled_symbols", structField = true, doc = "", documented = false)
  NestedSet<FileT> getCompiledSymbols();

  /** The provider implementing this can construct the AndroidAssetsInfo provider. */
  @SkylarkModule(name = "Provider", doc = "", documented = false)
  public interface Provider<FileT extends FileApi, AssetsT extends ParsedAndroidAssetsApi>
      extends ProviderApi {

    @SkylarkCallable(
        name = NAME,
        doc = "The <code>AndroidAssetsInfo</code> constructor.",
        parameters = {
          @Param(
              name = "label",
              doc = "The label of the target.",
              positional = true,
              named = false,
              type = Label.class),
          @Param(
              name = "validation_result",
              doc = "An artifact of the validation result.",
              positional = true,
              named = false,
              noneable = true,
              type = FileApi.class),
          @Param(
              name = "direct_parsed_assets",
              doc = "A depset of all the parsed assets in the target.",
              positional = true,
              named = false,
              type = SkylarkNestedSet.class,
              generic1 = ParsedAndroidAssetsApi.class),
          @Param(
              name = "transitive_parsed_assets",
              doc = "A depset of all the parsed assets in the transitive closure.",
              positional = true,
              named = false,
              type = SkylarkNestedSet.class,
              generic1 = ParsedAndroidAssetsApi.class),
          @Param(
              name = "transitive_assets",
              doc = "A depset of all the assets in the transitive closure.",
              positional = true,
              named = false,
              type = SkylarkNestedSet.class,
              generic1 = FileApi.class),
          @Param(
              name = "transitive_symbols",
              doc = "A depset of all the symbols in the transitive closure.",
              positional = true,
              named = false,
              type = SkylarkNestedSet.class,
              generic1 = FileApi.class),
          @Param(
              name = "transitive_compiled_symbols",
              doc = "A depset of all the compiled symbols in the transitive closure.",
              positional = true,
              named = false,
              type = SkylarkNestedSet.class,
              generic1 = FileApi.class),
        },
        selfCall = true)
    @SkylarkConstructor(objectType = AndroidAssetsInfoApi.class)
    public AndroidAssetsInfoApi<FileT, AssetsT> createInfo(
        Label label,
        FileT validationResult,
        SkylarkNestedSet directParsedAssets,
        SkylarkNestedSet transitiveParsedAssets,
        SkylarkNestedSet transitiveAssets,
        SkylarkNestedSet transitiveSymbols,
        SkylarkNestedSet transitiveCompiledSymbols)
        throws EvalException;
  }
}