blob: d824742def606dcfd33187834a9beaffff0b5ac3 [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
Chris Craik5d6680342018-07-20 16:39:25 -07003* Bug fixes - needs a corresponding bug report in the [Android Issue Tracker](https://issuetracker.google.com/issues/new?component=192731&template=842428)
Aurimas Liutikase2fa3862017-02-01 13:24:41 -08004* 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 -070017 repo init -u https://android.googlesource.com/platform/manifest -b androidx-master-dev
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080018
Dake Gua40c6652018-07-23 11:36:12 -070019The first time you initialize the repository, it will ask for user name and email.
20
Chris Craik5d6680342018-07-20 16:39:25 -070021Now your repository is set to pull only what you need for building and running AndroidX libraries. Download the code (and grab a coffee while we pull down 3GB):
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080022
23 repo sync -j8 -c
24
25You will use this command to sync your checkout in the future - its similar to `git fetch`
26
27
28## Using Android Studio
29Open `path/to/checkout/frameworks/support/` in Android Studio. Now you're ready edit, run, and test!
30
31If you get “Unregistered VCS root detected” click “Add root” to enable git integration for Android Studio.
32
33If you see any warnings (red underlines) run `Build > Clean Project`.
34
Jeff Gastone3be4aa2018-01-17 19:11:11 -050035## Builds
36### Full Build (Optional)
Aurimas Liutikasa8417542018-07-19 17:12:32 -070037You 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 -080038
39 cd path/to/checkout/frameworks/support/
40 ./gradlew createArchive
41
Chris Craik5d6680342018-07-20 16:39:25 -070042### Testing modified AndroidX Libraries to in your App
43You can build maven artifacts locally, and test them directly in your app:
44
45 ./gradlew createArchive
46
47And put in your **project** `build.gradle` file:
48
49 handler.maven { url '/path/to/checkout/out/host/gradle/frameworks/support/build/support_repo' }
Jeff Gastone3be4aa2018-01-17 19:11:11 -050050
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080051## Running Tests
52
53### Single Test Class or Method
541. Open the desired test file in Android Studio.
552. Right-click on a test class or @Test method name and select `Run FooBarTest`
56
57### Full Test Package
581. In the project side panel open the desired module.
592. Find the directory with the tests
Aurimas Liutikasa8417542018-07-19 17:12:32 -0700603. Right-click on the directory and select `Run androidx.foobar`
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080061
62## Running Sample Apps
Chris Craik5d6680342018-07-20 16:39:25 -070063The AndroidX repository 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 -080064
Chris Craik5d6680342018-07-20 16:39:25 -070065These applications are named either `<libraryname>-integration-tests-testapp`, or `support-\*-demos` (e.g. `support-4v-demos` or `support-leanback-demos`). You can run them by clicking `Run > Run ...` and choosing the desired application.
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080066
Dake Gua40c6652018-07-23 11:36:12 -070067## Password and Contributor Agreement before making a change
68Before uploading your first contribution, you will need setup a password and agree to the contribution agreement:
69
70Generate a HTTPS password:
71https://android-review.googlesource.com/new-password
72
73Agree to the Google Contributor Licenses Agreement:
74https://android-review.googlesource.com/settings/new-agreement
75
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080076## Making a change
77 cd path/to/checkout/frameworks/support/
78 repo start my_branch_name .
79 (make needed modifications)
80 git commit -a
81 repo upload --current-branch .
82
83If you see the following prompt, choose `always`:
84
85 Run hook scripts from https://android.googlesource.com/platform/manifest (yes/always/NO)?
86
Chris Craik5d6680342018-07-20 16:39:25 -070087If the upload succeeds, you'll see output like:
88
89 remote:
90 remote: New Changes:
91 remote: https://android-review.googlesource.com/c/platform/frameworks/support/+/720062 Further README updates
92 remote:
93
94To edit your change, use `git commit --amend`, and re-upload.
95
Aurimas Liutikase2fa3862017-02-01 13:24:41 -080096## Getting reviewed
97* After you run repo upload, open [r.android.com](http://r.android.com)
98* Sign in into your account (or create one if you do not have one yet)
Aurimas Liutikasa8417542018-07-19 17:12:32 -070099* 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 -0800100
Aurimas Liutikasc0f9d5b2018-08-21 11:40:59 -0700101## Handling binary dependencies
102AndroidX uses git to store all the binary Gradle dependencies. They are stored in `prebuilts/androidx/internal` and `prebuilts/androidx/external` directories in your checkout. All the dependencies in these directories are also available from `google()`, `jcenter()`, or `mavenCentral()`. We store copies of these dependencies to have hermetic builds. You can pull in [a new dependency using our importMaven tool](development/importMaven/README.md).