Android Studio Release Process

These changes (except for step 1) are typically only done in a release branch (e.g. studio-1.4-release), and only for release candidate and stable builds (not the release branch for milestones and betas.)

  1. Make sure the version number is correct in ../adt/idea/adt-branding/src/idea/AndroidStudioApplicationInfo.xml

    Example:

      <version major="1" minor="4" micro="0" patch="7" full="{0}.{1} RC 1" eap="false" />
                     ~~~       ~~~       ~~~       ~~~      ~~~~~~~~~~~~~~
    
  2. Also make sure that the eap= flag in the same file is correct.

     <version major="1" minor="4" micro="0" patch="7" full="{0}.{1} RC 1" eap="false" />
                                                                          ~~~~~~~~~~~
    
  3. Make sure the major/minor version is correctly encoded in the build number listed in build.txt file. It is the second number from the end. If major version is X and minor version is Y, the number is simply XY. For example, 31, 32, 33 for 3.1, 3.2, 3.3 respectively.

    181.2784.17.32.SNAPSHOT
                ~~
    
  4. If necessary, update the “selector name”; this is the name used in settings directories (such as ~/.AndroidStudioPreview1.6 on Linux, or ~/Library/Preferences/AndroidStudioPreview1.6 on OSX, etc.

    This directory name used to be hardcoded, but is now derived from the version numbers specified in the branding files. If you want to tweak it, edit build/groovy/org/jetbrains/intellij/build/AndroidStudioProperties.groovy and tweak the string returned by the getSystemSelector() method.

    The convention we have been using is the following for previews: AndroidStudioPreviewX.Y and for release builds: AndroidStudioX.Y.

  5. Update the settings importer.

    5.1 Edit platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java such that it imports from the previous few versions (e.g. previous stable versions, as well as most recent preview.)

    Example CL: https://android-review.googlesource.com/#/c/161783/

    5.2 Edit the settings importer to remove the section which skips importing the preferred update channel. In stable builds we should respect whatever update channel (canary/dev/beta/stable) the user has chosen, but in canary or other preview builds we deliberately don‘t import these settings since we want to make sure that for example a user of a canary build who imports settings from a stable channel don’t import a stable channel setting where they can't notice/update to the next canary. The relevant change to disable it is:

    -private static final boolean SKIP_UPDATE_CHANNEL_IMPORT = true;
    +private static final boolean SKIP_UPDATE_CHANNEL_IMPORT = false;
    
  6. Make sure assertions are turned off and -OmitStackTraceInFastThrow is removed.

    This is controlled by platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/VmOptionsGenerator.groovy:

    if (isEAP) {
      options += "... -XX:-OmitStackTraceInFastThrow -ea"
    } else {
      options += " -da"
    }
                  ~~~~~
    

    This should be set to -da in production builds. (You normally do not have to touch anything since this is already controlled by an EAP flag.)

  7. Turn off null checking.

    Edit .idea/compiler.xml and make sure null assertions are disabled by adding the following line:

         <option name="BUILD_PROCESS_HEAP_SIZE" value="1100" />
    +    <addNotNullAssertions enabled="false" />
         <excludeFromCompile>
    

    (We don't leave it in with enabled=“true” because the IDE will automatically remove it and then leave the .idea/compiler.xml file in an edited state for all developers who open the project.)

    Edit .idea/kotlinc.xml and make sure null assertions are disabled by adding the following lines:

    diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
    index 894c2d2f197..8f910907aee 100644
    --- a/.idea/kotlinc.xml
    +++ b/.idea/kotlinc.xml
    @@ -7,8 +7,11 @@
       <component name="Kotlin2JvmCompilerArguments">
         <option name="jvmTarget" value="1.8" />
       </component>
    +  <component name="KotlinCompilerSettings">
    +    <option name="additionalArguments" value="-version -Xno-param-assertions -Xno-call-assertions -Xno-receiver-assertions" />
    +  </component>
       <component name="KotlinCommonCompilerArguments">
         <option name="apiVersion" value="1.1"/>
         <option name="languageVersion" value="1.1"/>
    
  8. Turn off CLASS retention in platform/annotations/java8/src/org/jetbrains/annotations (Sadly, we can't also do this in platform/annotations/java5/src/org/jetbrains/annotations because the Kotlin compiler seems to require class retention; without it Kotlin compilation fails.)

    --- a/platform/annotations/src/org/jetbrains/annotations/NotNull.java
    +++ b/platform/annotations/src/org/jetbrains/annotations/NotNull.java
    @@ -27,7 +27,7 @@ import java.lang.annotation.*;
      * @author max
      */
     @Documented
    -@Retention(RetentionPolicy.CLASS)
    +@Retention(RetentionPolicy.SOURCE)
     @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
     public @interface NotNull {
       /**
    

For stable, RC, beta builds :

  1. Ensure that the default update channel is set to RELEASE for stable build, or BETA for beta or RC builds. This is so that new users of beta, RC, stable builds are not prompted to upgrade to canary by default.

    Edit platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateOptions.kt to make sure updateChannelType is set to:

    • ChannelStatus.RELEASE.code for stable releases, or
    • ChannelStatus.BETA.code for beta, RC releases, or
    • ChannelStatus.EAP.code otherwise.

For AOSP push:

  1. Update the build scripts such that they no longer reference any of the closed source plugins such as the C++ support; this means removing the vendor/ plugin references from .idea/modules.xml, community-main.xml, build/groovy/org/jetbrains/intellij/build/AndroidStudioProperties.groovy, .idea/runConfigurations/OneStudio.xml and the reference in .idea/ant.xml to vendor/google3.

    There are many other smaller tasks to handle as well - updating vcs.xml to not reference unavailable git repositories, etc etc.

    There are three basic tasks: (1) Build the IDE from the command line, and copy the profiler prebuilts

    $ cp tools/idea/out/studio/dist.all/plugins/android/lib/studio-profiler-grpc-1.0-jarjar.jar \
         tools/adt/idea/android/lib/
    
    $ cp-recursive tools/idea/out/studio/dist.all/plugins/android/resources/ \
            prebuilts/tools/common/profiler/$VERSION/
    

    Also add in a README and license file in the new profiler prebuilts folder.

    Then remove the references from build.xml and .idea/build.xml to the adt build.xml file which would run profiler prebuild steps.

    (2) Open the project in IntelliJ, and fix all warnings in the project structure dialog, then make sure the project builds and runs; for this you may have to fix up source code in case there are any dependencies on closed source code that shouldn't be there. For example, right now the appindexing plugin depends on the url-assistant

    (3) Make the build_studio.sh script compile. This involves removing the various cidr plugins and closed source plugins, as well as removing compilation/copy tasks for the gradle offline repository, lldb, etc. Also add a copy task to place the profiler prebuilts into place.

    (4) Ensure that the branch names for the tools/idea and tools/base projects are sensible:

    diff --git a/.idea/.name b/.idea/.name
    index 310ac3d20a3..8a1a9797418 100644
    --- a/.idea/.name
    +++ b/.idea/.name
    @@ -1 +1 @@
    -Android Studio (studio-master-dev)
    \ No newline at end of file
    +Android Studio 3.1
    \ No newline at end of file
    

Relevant CLs from the 3.1 push: Change-Id: I8ca078c08a4fff0a6ebeae8c6ba7a6fa55bec490 Change-Id: I15c8e3ce46099d54e77c17fff0f0d42d11238e3b Change-Id: Ia656d3e023d9887da7aa0486ca934388e75436db

Relevant CLs from the 3.0 AOSP push: https://android-review.googlesource.com/#/q/topic:studio-30

Relevant CLs from the 2.3 AOSP push (though they'll need to be adjusted to account for the big build script changes in 2.4) : Change-Id: I364ee67262524aa27f71831e6ed01164826e54ad Change-Id: I9298c7319ce55fb64c29e38636808e57f2a84209 Change-Id: Ic60a95a21ea0e483d82f6013539d112b89a7d0c0 (AOSP) Change-Id: I42bcad10589b8172a46a3f74aa1e7a5826ea52fc (AOSP)