Skip to content

Commit

Permalink
Document aar_import in Bazel.
Browse files Browse the repository at this point in the history
Fixes #564.

RELNOTES: aar_import rule is now documented.

--
PiperOrigin-RevId: 141843994
MOS_MIGRATED_REVID=141843994
  • Loading branch information
aj-michael authored and katre committed Dec 13, 2016
1 parent bf9bbe7 commit efb1411
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,29 @@ public Metadata getMetadata() {
.build();
}
}

/*<!-- #BLAZE_RULE (NAME = aar_import, TYPE = LIBRARY, FAMILY = Android) -->
<p>
This rule allows the use of <code>.aar</code> files as libraries for
<code><a href="${link android_library}">android_library</a></code> and
<code><a href="${link android_binary}">android_binary</a></code> rules.
</p>
<h4 id="aar_import_examples">Examples</h4>
<pre class="code">
aar_import(
name = "google-vr-sdk",
aar = "gvr-android-sdk/libraries/sdk-common-1.10.0.aar",
)
android_binary(
name = "app",
manifest = "AndroidManifest.xml",
srcs = glob(["**.java"]),
deps = [":google-vr-sdk"],
)
</pre>
<!-- #END_BLAZE_RULE -->*/
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ public class AarImportBaseRule implements RuleDefinition {
@Override
public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) {
return builder
.setUndocumented()
/* <!-- #BLAZE_RULE($aar_import_base).ATTRIBUTE(aar) -->
The <code>.aar</code> file to provide to the Android targets that depend on this target.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("aar", LABEL)
.mandatory()
.allowedFileTypes(FileType.of(".aar")))
/* <!-- #BLAZE_RULE(aar_import).ATTRIBUTE(exports) -->
Target to export to rules that depend on this rule.
See <a href="${link java_library.exports}">java_library.exports.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("exports", LABEL_LIST)
.allowedRuleClasses("aar_import", "java_import")
.allowedFileTypes()
Expand Down

0 comments on commit efb1411

Please sign in to comment.