| Chris Warrington | 1847cb0 | 2017-06-28 05:32:37 -0700 | [diff] [blame] | 1 | # Checkout and build the source code |
| 2 | |
| 3 | Like the Android operating system, Android Studio is open source and free of charge to all. |
| 4 | Android releases source code to the Android Open Source Project (AOSP) after each stable release, |
| 5 | described in detail here. |
| 6 | |
| 7 | As of Android Studio 1.4, Android Studio is aligned to the same model of releasing source code |
| 8 | after each stable release. For those who contribute to Android Studio, |
| 9 | the code contribution process is the same as the Android platform. |
| 10 | |
| 11 | Please continue to submit patches to the Android Studio AOSP branch. |
| 12 | |
| 13 | We will do code-reviews and merge changes into subsequent versions of Android Studio. |
| 14 | We're incredibly grateful to all of you in the community for your collaboration and hard work on |
| 15 | Android Studio. |
| 16 | |
| 17 | ## Doing a checkout |
| 18 | |
| 19 | [Download an install the `repo` tool](https://source.android.com/source/downloading.html) |
| 20 | to checkout the source of Android Studio. |
| 21 | |
| 22 | Check out the latest published source code using the following commands in a shell: |
| 23 | ``` |
| 24 | $ mkdir studio-master-dev |
| 25 | $ cd studio-master-dev |
| 26 | $ repo init -u https://android.googlesource.com/platform/manifest -b studio-master-dev |
| Chris Warrington | 7c4a334 | 2017-08-24 14:20:49 +0100 | [diff] [blame] | 27 | $ repo sync -c -j4 -q |
| Chris Warrington | 1847cb0 | 2017-06-28 05:32:37 -0700 | [diff] [blame] | 28 | ``` |
| 29 | You can call the top level directory whatever you want. |
| 30 | Those of us who check out multiple branches prefer to name the directories after the branches. |
| 31 | |
| 32 | During the `repo init` command, it will ask you for your name and e-mail address which |
| 33 | will be used by git if you commit changes and will be shown if you upload them for review. |
| 34 | |
| Chris Warrington | 7c4a334 | 2017-08-24 14:20:49 +0100 | [diff] [blame] | 35 | To fetch the latest changes re-run the `repo sync -c -j4 -q` command. |
| 36 | |
| 37 | * `-j`, The number of parallel sync threads to start. |
| 38 | |
| 39 | For your first sync, during which your client will be pulling down everything, |
| 40 | we recommend a low value such as `-j4`. |
| 41 | For incremental syncs you can increase it as |
| 42 | most fetch operations will be no-ops. |
| 43 | However, specifying too high a number may decrease performance on machines with slow disks |
| 44 | or slow internet connections. |
| 45 | |
| 46 | * `-c`, Syncs only the current branch to reduce sync time and disk space. |
| 47 | |
| 48 | This means you will not be able to cherry-pick changes from branches you didn't sync. |
| 49 | |
| 50 | * `-q`, Quiet. The normal output is fairly verbose. |
| 51 | |
| 52 | |
| 53 | See https://source.android.com/source/using-repo for more information about how to use repo. |
| 54 | |
| Chris Warrington | 1847cb0 | 2017-06-28 05:32:37 -0700 | [diff] [blame] | 55 | ## Building |
| 56 | |
| Chris Warrington | abbd2e2 | 2017-10-04 11:36:27 +0100 | [diff] [blame] | 57 | To build Android Studio, see [Building Android Studio](studio.md) |
| Chris Warrington | 1847cb0 | 2017-06-28 05:32:37 -0700 | [diff] [blame] | 58 | |
| 59 | To build the Android Gradle plugin, see |
| 60 | [Building the Android Gradle Plugin](build-system/README.md). |
| 61 | |
| 62 | The parts of the SDK that can be built with the `studio-*` branches are only the IDE components and |
| 63 | the SDK Tools. |
| 64 | Each component is built differently due to varying build systems. |
| 65 | |
| 66 | None of them use the make-based build system of the platform. |
| 67 | |
| 68 | Historically, building the Android tools required building the full Android SDK as well. |
| 69 | However, we've been gradually migrating the tools source code over to a more independent setup, |
| 70 | and you can now build the Android Studio IDE without a full Android checkout and without a C |
| 71 | compiler etc. |
| 72 | |
| 73 | ## Check out a specific release |
| 74 | |
| 75 | Releases since Android Studio 2.4 are tagged in git. This means you can use the tag to get the source code for a |
| 76 | specific version. The tags are of this form: |
| 77 | |
| 78 | * Gradle: gradle_x.y.z |
| 79 | * Studio: studio-x.y |
| 80 | |
| 81 | You can see all available tags here: https://android.googlesource.com/platform/manifest/+refs |
| 82 | |
| 83 | For instance you can do a checkout of version 2.3.0 of the Gradle plugin with the following command: |
| 84 | ``` |
| 85 | $ repo init -u https://android.googlesource.com/platform/manifest -b gradle_2.3.0 |
| 86 | $ repo sync |
| 87 | ``` |
| 88 | |
| 89 | Releases before studio-1.4 were developed in AOSP in the following branches |
| 90 | |
| 91 | | development branch | release branch | IntelliJ | Notes | |
| 92 | |--------------------|--------------------|----------------|----------------------------------| |
| 93 | |studio-1.0-dev | studio-1.0-release | idea13-dev | This was the branch for 1.0 work | |
| 94 | |studio-1.1-dev | studio-1.1-release | idea13-1.1-dev | This was the branch for 1.1 work | |
| 95 | |studio-1.2-dev | studio-1.2-release | idea14-1.2-dev | This was the branch for 1.2 work | |
| 96 | |studio-1.3-dev | studio-1.3-release | idea14-1.3-dev | This was the branch for 1.3 work | |
| 97 | |
| 98 | Android Studio does not use the `master` branch. |
| 99 | The branches `ub-tools-idea133` and `ub-tools-master` are deprecated. |