blob: 968cbda16e0c9d66ca9f836e90c58f7bd2f93c76 [file] [log] [blame] [view]
Aurimas Liutikasa8417542018-07-19 17:12:32 -07001# AOSP AndroidX Contribution Guide
Aurimas Liutikase2fa3862017-02-01 13:24:41 -08002## Accepted Types of Contributions
3* Bug fixes (needs a corresponding bug report in b.android.com)
4* Each bug fix is expected to come with tests
5* Fixing spelling errors
6* Updating documentation
7* Adding new tests to the area that is not currently covered by tests
Aurimas Liutikasa8417542018-07-19 17:12:32 -07008* New features to existing libraries if the feature request bug has been approved by an AndroidX team member.
Aurimas Liutikase2fa3862017-02-01 13:24:41 -08009
Aurimas Liutikasa8417542018-07-19 17:12:32 -070010We **are not** currently accepting new modules.
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080011
12## Checking Out the Code
Aurimas Liutikasdad83692017-02-10 09:37:37 -080013**NOTE: You will need to use Linux or Mac OS. Building under Windows is not currently supported.**
14
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080015Follow the [“Downloading the Source”](https://source.android.com/source/downloading.html) guide to install and set up `repo` tool, but instead of running the listed `repo` commands to initialize the repository, run the folowing:
16
Aurimas Liutikasa8417542018-07-19 17:12:32 -070017repo init -u https://android.googlesource.com/platform/manifest -b androidx-master-dev
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080018
Aurimas Liutikasa8417542018-07-19 17:12:32 -070019Now your repository is set to pull only what you need for building and running Androix libraries. Download the code (and grab a coffee while we pull down 3GB):
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080020
21repo sync -j8 -c
22
23You will use this command to sync your checkout in the future - its similar to `git fetch`
24
25
26## Using Android Studio
27Open `path/to/checkout/frameworks/support/` in Android Studio. Now you're ready edit, run, and test!
28
29If you get “Unregistered VCS root detected” click “Add root” to enable git integration for Android Studio.
30
31If you see any warnings (red underlines) run `Build > Clean Project`.
32
Jeff Gastone3be4aa2018-01-17 19:11:11 -050033## Builds
34### Full Build (Optional)
Aurimas Liutikasa8417542018-07-19 17:12:32 -070035You can do most of your work from Android Studio, however you can also build the full AndroidX library from command line:
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080036
37cd path/to/checkout/frameworks/support/
38./gradlew createArchive
39
Aurimas Liutikasa8417542018-07-19 17:12:32 -070040### Building AndroidX Libraries as part of your App build
41If you intend to repeatedly make changes to AndroidX Libraries and to wish to see
Jeff Gastone3be4aa2018-01-17 19:11:11 -050042the results in your app, and you don't want to have to repeatedly build them as
43separate Gradle projects, you can
Aurimas Liutikasa8417542018-07-19 17:12:32 -070044[configure your app build to build AndroidX Libraries too](adding-support-library-as-included-build.md)
Jeff Gastone3be4aa2018-01-17 19:11:11 -050045
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080046## Running Tests
47
48### Single Test Class or Method
491. Open the desired test file in Android Studio.
502. Right-click on a test class or @Test method name and select `Run FooBarTest`
51
52### Full Test Package
531. In the project side panel open the desired module.
542. Find the directory with the tests
Aurimas Liutikasa8417542018-07-19 17:12:32 -0700553. Right-click on the directory and select `Run androidx.foobar`
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080056
57## Running Sample Apps
Aurimas Liutikasa8417542018-07-19 17:12:32 -070058AndroidX libraries has a set of Android applications that exercise AndroidX code. These applications can be useful when you want to debug a real running application, or reproduce a problem interactively, before writing test code.
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080059
60These applications are named support-\*-demos (e.g. support-4v-demos or support-leanback-demos. You can run them by clicking `Run > Run ...` and choosing the desired application.
61
62## Making a change
63cd path/to/checkout/frameworks/support/
64repo start my_branch_name .
65(make needed modifications)
66git commit -a
67repo upload --current-branch .
68
69If you see the following prompt, choose `always`:
70
71Run hook scripts from https://android.googlesource.com/platform/manifest (yes/always/NO)?
72
73## Getting reviewed
74* After you run repo upload, open [r.android.com](http://r.android.com)
75* Sign in into your account (or create one if you do not have one yet)
Aurimas Liutikasa8417542018-07-19 17:12:32 -070076* Add an appropriate reviewer (use git log to find who did most modifications on the file you are fixing or check the OWNERS file in the project's directory)
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080077