aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Ramsauer <str@google.com>2018-06-20 13:52:37 -0400
committerJingwen Chen <jingwen@google.com>2019-08-06 19:54:11 -0400
commit1ab62e857bd382dd3298092a211e5754d71be278 (patch)
treeedb2c7caf450e40e5225f329f015fd893c7e7267
parent9ab1134546364c6de84fc6c80b4202fdbebbbb35 (diff)
downloadbazelbuild-rules_android-1ab62e857bd382dd3298092a211e5754d71be278.tar.gz
Format android rules .bzl files according to style guide.
PiperOrigin-RevId: 201378804
-rw-r--r--.bazelci/postsubmit.yml4
-rw-r--r--CONTRIBUTING.md115
-rw-r--r--README.md8
-rw-r--r--android/aar_import.bzl27
-rw-r--r--android/binary.bzl27
-rw-r--r--android/device.bzl27
-rw-r--r--android/instrumentation_test.bzl27
-rw-r--r--android/library.bzl27
-rw-r--r--android/local_test.bzl28
-rw-r--r--android/migration_tag_DONOTUSE.bzl10
-rw-r--r--android/ndk_repository.bzl25
-rw-r--r--android/providers.bzl53
-rw-r--r--android/rules.bzl83
-rw-r--r--android/sdk_repository.bzl25
14 files changed, 96 insertions, 390 deletions
diff --git a/.bazelci/postsubmit.yml b/.bazelci/postsubmit.yml
index c1218a6..a049b01 100644
--- a/.bazelci/postsubmit.yml
+++ b/.bazelci/postsubmit.yml
@@ -1,11 +1,11 @@
---
platforms:
- ubuntu1604:
+ ubuntu1404:
build_targets:
- "//..."
# test_targets:
# - "//..."
- ubuntu1804:
+ ubuntu1604:
build_targets:
- "//..."
# test_targets:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3a10aef..99da6f8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,86 +1,39 @@
-Want to contribute? Great! First, read this page. This document serves as a guide for you to contribute to the Android Starlark Rules productively and efficiently in partnership with Google.
-
-
-### Prerequisite
-
-1. Before we can use your code, you must sign the [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
-(CLA), which you can do online.
-
- 1. The CLA is necessary mainly because you own the copyright to your changes, even after your contribution becomes part of our codebase, so we need your permission to use and distribute your code. We also need to be sure of various other things — for instance that you'll tell us if you know that your code infringes on other people's patents. You don't have to sign the CLA until after you've submitted your code for review and a member has approved it, but you must do it before we can put your code into our codebase.
-
-1. Contributions made by corporations are covered by a different agreement than
+Want to contribute? Great! First, read this page (including the small print at
+the end).
+
+### Before you contribute
+**Before we can use your code, you must sign the
+[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
+(CLA)**, which you can do online.
+
+The CLA is necessary mainly because you own the copyright to your changes,
+even after your contribution becomes part of our codebase, so we need your
+permission to use and distribute your code. We also need to be sure of
+various other things — for instance that you'll tell us if you know that
+your code infringes on other people's patents. You don't have to sign
+the CLA until after you've submitted your code for review and a member has
+approved it, but you must do it before we can put your code into our codebase.
+
+### The small print
+Contributions made by corporations are covered by a different agreement than
the one above, the
[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
### Contribution process
-1. Create a GitHub issue following the steps below for filing bugs and feature requests.
-
-1. Determine whether your contribution requires a lightweight change or a more complex change to the codebase.
-
- 1. Lightweight change: Simple bug fixes, small updates, internal cleanup, etc.
-
- 1. Complex change: New features, large scale bug fixes, major refactoring, etc.
-
-1. If you have determined your change as lightweight, then you can skip to Step 7. You may be asked to follow the full process if your pull request reviewer believes a more thorough design is needed. Follow all steps if you have a more complex change.
-
-1. Author a brief contribution proposal document and submit to android-rules-contrib@google.com for review. Please use the following [template](https://docs.google.com/document/d/14PJfIvFkHQMuQzAovtVGavdsXjxMJ8O7dxDeatX1HLM/edit?usp=sharing) for the document outlining:
-
- 1. Problem Statement
-
- 1. Proposed Solution
-
- 1. Alternative Considerations if any
-
-1. Our team will assign a reviewer and provide questions/comments on the design document.
-
-1. After resolving the comments, the design document reviewer will make a decision on how to move forward. Possible outcomes may include:
-
- 1. Approved - you may move to the next step.
-
- 1. Rejected - there is an alternative pre-existing solution.
-
- 1. Rejected - appropriate solution is not present.
-
-1. Fork the repository to develop and test your code locally.
-
- 1. Don’t forget to add tests. Run the existing tests with bazel test //...
-
- 1. Update any relevant documentation after implementation.
-
-1. Issue a Pull Request and then wait for the upstream developers to review. You may be asked to make some changes before your PR is merged in.
-
-1. All submissions, including submissions by project members, require review.
-Once everything looks good, your changes will be merged. Our continuous integration bots will test your change automatically on supported platforms.
-
-1. Close the corresponding GitHub issue.
-
-### Filing Bugs & Feature Requests
-
-1. Create a new issue on the GitHub repository if you believe you’ve encountered a bug or have a feature request.
-
-1. If you are filing a bug, give it an appropriate title & be sure to include the following in the description:
-
- 1. Expected behavior
-
- 1. Current behavior
-
- 1. Steps to reproduce
-
- 1. Context, logs, failure information
-
-1. If you are filing a feature request, give it an appropriate title & be sure to include the following in the description:
-
- 1. Objective
-
- 1. Goals
-
-1. When you're finished, click Submit new issue.
-
-### Communication Channels
-
-Please feel free to reach out if there are any questions, comments, or feedback you would like to communicate. We will be actively monitoring the following:
-
- 1. Emails to android-rules-contrib@google.com
-
- 1. Messages to #android channel in [Bazel's Slack](https://bazelbuild.slack.com). Sign-up [here](https://bazel-slackin.herokuapp.com).
+1. Explain your idea and discuss your plan with members of the team. The best
+ way to do this is to create
+ an [issue](https://github.com/bazelbuild/rules_android/issues) or comment on
+ an existing issue.
+1. Prepare a git commit with your change. Don't forget to
+ add [tests](https://github.com/bazelbuild/rules_android/tree/master/tests).
+ Run the existing tests with `bazel test //...`. Update
+ [README.md](https://github.com/bazelbuild/rules_android/blob/master/README.md)
+ if appropriate.
+1. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/).
+ This will start the code review process. **All submissions, including
+ submissions by project members, require review.**
+1. You may be asked to make some changes. You'll also need to sign the CLA at
+ this point, if you haven't done so already. Our continuous integration bots
+ will test your change automatically on supported platforms. Once everything
+ looks good, your change will be merged.
diff --git a/README.md b/README.md
index 70a45e6..3ee69c0 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,5 @@
# Android support in Bazel
-## Announcements
-* <b> May 17, 2019.</b> [Android Native to Starlark Migration](https://github.com/bazelbuild/bazel/issues/8391) incompatible change.
-* <b> April 1, 2019.</b> [Roadmap](https://github.com/bazelbuild/rules_android/blob/master/ROADMAP.md) for rules_android published.
-
## Overview
This repository contains the Skylark implementation of Android rules in Bazel.
@@ -19,7 +15,7 @@ To use the new Bazel Android rules, add the following to your WORKSPACE file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
- name = "rules_android",
+ name = "build_bazel_rules_android",
urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"],
sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
strip_prefix = "rules_android-0.1.1",
@@ -27,7 +23,7 @@ To use the new Bazel Android rules, add the following to your WORKSPACE file:
Then, in your BUILD files, import and use the rules:
- load("@rules_android//android:rules.bzl", "android_library")
+ load("@build_bazel_rules_android//android:rules.bzl", "android_library")
android_library(
...
)
diff --git a/android/aar_import.bzl b/android/aar_import.bzl
deleted file mode 100644
index da68d79..0000000
--- a/android/aar_import.bzl
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-"""Bazel rule for Android aar_import."""
-
-load(":migration_tag_DONOTUSE.bzl", _add_migration_tag = "add_migration_tag")
-
-def aar_import(**attrs):
- """Bazel aar_import rule.
-
- https://docs.bazel.build/versions/master/be/android.html#aar_import
-
- Args:
- **attrs: Rule attributes
- """
- native.aar_import(**_add_migration_tag(attrs))
diff --git a/android/binary.bzl b/android/binary.bzl
deleted file mode 100644
index 30fb54f..0000000
--- a/android/binary.bzl
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-"""Bazel rule for Android binary."""
-
-load(":migration_tag_DONOTUSE.bzl", _add_migration_tag = "add_migration_tag")
-
-def android_binary(**attrs):
- """Bazel android_binary rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_binary
-
- Args:
- **attrs: Rule attributes
- """
- native.android_binary(**_add_migration_tag(attrs))
diff --git a/android/device.bzl b/android/device.bzl
deleted file mode 100644
index 3f05df7..0000000
--- a/android/device.bzl
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-"""Bazel rule for Android device."""
-
-load(":migration_tag_DONOTUSE.bzl", _add_migration_tag = "add_migration_tag")
-
-def android_device(**attrs):
- """Bazel android_device rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_device
-
- Args:
- **attrs: Rule attributes
- """
- native.android_device(**_add_migration_tag(attrs))
diff --git a/android/instrumentation_test.bzl b/android/instrumentation_test.bzl
deleted file mode 100644
index bc55cc8..0000000
--- a/android/instrumentation_test.bzl
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-"""Bazel rules for Android instrumentation test."""
-
-load(":migration_tag_DONOTUSE.bzl", _add_migration_tag = "add_migration_tag")
-
-def android_instrumentation_test(**attrs):
- """Bazel android_instrumentation_test rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_instrumentation_test
-
- Args:
- **attrs: Rule attributes
- """
- native.android_instrumentation_test(**_add_migration_tag(attrs))
diff --git a/android/library.bzl b/android/library.bzl
deleted file mode 100644
index 8798ff3..0000000
--- a/android/library.bzl
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-"""Bazel rule for Android library."""
-
-load(":migration_tag_DONOTUSE.bzl", _add_migration_tag = "add_migration_tag")
-
-def android_library(**attrs):
- """Bazel android_library rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_library
-
- Args:
- **attrs: Rule attributes
- """
- native.android_library(**_add_migration_tag(attrs))
diff --git a/android/local_test.bzl b/android/local_test.bzl
deleted file mode 100644
index 9e197dd..0000000
--- a/android/local_test.bzl
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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.
-
-"""Bazel rule for Android local test."""
-
-load(":migration_tag_DONOTUSE.bzl", _add_migration_tag = "add_migration_tag")
-
-def android_local_test(**attrs):
- """Bazel android_local_test rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_local_test
-
- Args:
- **attrs: Rule attributes
- """
- native.android_local_test(**_add_migration_tag(attrs))
-
diff --git a/android/migration_tag_DONOTUSE.bzl b/android/migration_tag_DONOTUSE.bzl
index 97b9c9f..539aca9 100644
--- a/android/migration_tag_DONOTUSE.bzl
+++ b/android/migration_tag_DONOTUSE.bzl
@@ -18,8 +18,8 @@ _MIGRATION_TAG = "__ANDROID_RULES_MIGRATION__"
_TAG_ATTR = "tags"
def add_migration_tag(attrs):
- if _TAG_ATTR in attrs and attrs[_TAG_ATTR] != None:
- attrs[_TAG_ATTR] = attrs[_TAG_ATTR] + [_MIGRATION_TAG]
- else:
- attrs[_TAG_ATTR] = [_MIGRATION_TAG]
- return attrs
+ if _TAG_ATTR in attrs and attrs[_TAG_ATTR] != None:
+ attrs[_TAG_ATTR] = attrs[_TAG_ATTR] + [_MIGRATION_TAG]
+ else:
+ attrs[_TAG_ATTR] = [_MIGRATION_TAG]
+ return attrs
diff --git a/android/ndk_repository.bzl b/android/ndk_repository.bzl
deleted file mode 100644
index d8c64dd..0000000
--- a/android/ndk_repository.bzl
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.
-
-"""Bazel rule for Android ndk repository."""
-
-def android_ndk_repository(**attrs):
- """Bazel android_ndk_repository rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_ndk_repository
-
- Args:
- **attrs: Rule attributes
- """
- native.android_ndk_repository(**attrs)
diff --git a/android/providers.bzl b/android/providers.bzl
new file mode 100644
index 0000000..94ece4f
--- /dev/null
+++ b/android/providers.bzl
@@ -0,0 +1,53 @@
+# 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.
+
+"""Bazel providers for Android rules."""
+
+AndroidDeviceScriptFixtureInfo = provider(
+ doc = "Provides information required to execute the device script fixture.",
+ fields = dict(
+ daemon = "Whether the fixture executes as a daemon.",
+ fixture_script = "The fixture script artifact.",
+ strict_exit = "Whether the a strict exit is required.",
+ support_apps = "List of support app artifacts.",
+ ),
+)
+
+AndroidHostServiceFixtureInfo = provider(
+ doc = "Provides information required to execute the host service fixture.",
+ fields = dict(
+ daemon = "Whether the fixture executes as a daemon.",
+ executable = "The executable artifact.",
+ provides_test_args = "Whether the executable provides test args.",
+ service_names = "List of services, by name, exposed by the fixture.",
+ support_apps = "List of support app artifacts.",
+ ),
+)
+
+SkylarkDeviceBrokerInfo = provider(
+ doc = "Provides information about the device broker.",
+ fields = dict(
+ type = "Type of the device broker.",
+ ),
+)
+
+AndroidDeviceBootActionInfo = provider(
+ doc = "Provides outputs for the Boot phase of AndroidDevice",
+ fields = dict(
+ executable = "Executable Output Script",
+ images = "Tarred images of the files in boot phase",
+ metadata = "Proto information about the device",
+ snapshot = "ram.bin file generated by Snapshot.",
+ ),
+)
diff --git a/android/rules.bzl b/android/rules.bzl
deleted file mode 100644
index 10a3021..0000000
--- a/android/rules.bzl
+++ /dev/null
@@ -1,83 +0,0 @@
-# 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.
-
-"""Skylark rules for building Android apps."""
-load(
- ":binary.bzl",
- _android_binary = "android_binary",
-)
-load(
- ":aar_import.bzl",
- _aar_import = "aar_import",
-)
-load(
- ":library.bzl",
- _android_library = "android_library",
-)
-load(
- ":local_test.bzl",
- _android_local_test = "android_local_test",
-)
-load(
- ":instrumentation_test.bzl",
- _android_instrumentation_test = "android_instrumentation_test",
-)
-load(
- ":device.bzl",
- _android_device = "android_device",
-)
-load(
- ":ndk_repository.bzl",
- _android_ndk_repository = "android_ndk_repository",
-)
-load(
- ":sdk_repository.bzl",
- _android_sdk_repository = "android_sdk_repository",
-)
-
-# Current version. Tools may check this to determine compatibility.
-RULES_ANDROID_VERSION = "0.1.0"
-
-android_binary = _android_binary
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_binary"""
-
-aar_import = _aar_import
-
-"""https://docs.bazel.build/versions/master/be/android.html#aar_import"""
-
-android_library = _android_library
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_library"""
-
-android_local_test = _android_local_test
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_local_test"""
-
-android_instrumentation_test = _android_instrumentation_test
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_instrumentation_test"""
-
-android_ndk_repository = _android_ndk_repository
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_ndk_repository"""
-
-android_sdk_repository = _android_sdk_repository
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_sdk_repository"""
-
-android_device = _android_device
-
-"""https://docs.bazel.build/versions/master/be/android.html#android_device"""
-
diff --git a/android/sdk_repository.bzl b/android/sdk_repository.bzl
deleted file mode 100644
index fdaa020..0000000
--- a/android/sdk_repository.bzl
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.
-
-"""Bazel rule for Android sdk repository."""
-
-def android_sdk_repository(**attrs):
- """Bazel android_sdk_repository rule.
-
- https://docs.bazel.build/versions/master/be/android.html#android_sdk_repository
-
- Args:
- **attrs: Rule attributes
- """
- native.android_sdk_repository(**attrs)