From c547f783c440019a4a87ba55b668b3af5ff8fc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Thu, 21 Dec 2017 17:19:52 -0800 Subject: [PATCH] Update Docker images to latest Android SDK, Buck Summary: Test Plan Rebuilt Docker images locally, confirmed successful image build. Can later be reproed with ``` npm run test-android-setup npm run test-android-build npm run test-android-run-unit-tests ``` Note that unit tests are failing in master, but in this PR we can repro the same failure. Closes https://github.com/facebook/react-native/pull/17313 Differential Revision: D6624899 Pulled By: hramos fbshipit-source-id: 42b8cd708ec2a02399bb6ef30fd73faba2646f79 --- ContainerShip/Dockerfile.android | 7 ++-- ContainerShip/Dockerfile.android-base | 48 +++++++-------------------- ReactAndroid/DEFS | 2 +- 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/ContainerShip/Dockerfile.android b/ContainerShip/Dockerfile.android index 605bb33104d0d1..df71885cafeb3e 100644 --- a/ContainerShip/Dockerfile.android +++ b/ContainerShip/Dockerfile.android @@ -1,7 +1,7 @@ FROM containership/android-base:latest # set default environment variables -ENV GRADLE_OPTS="-Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\"" +ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\"" ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" # add ReactAndroid directory @@ -38,6 +38,7 @@ RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1 # add all react-native code +# How does this work? ADD . /app WORKDIR /app @@ -46,9 +47,5 @@ RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs- # build node dependencies RUN npm install -RUN npm install github@0.2.4 - -WORKDIR /app/website -RUN npm install WORKDIR /app diff --git a/ContainerShip/Dockerfile.android-base b/ContainerShip/Dockerfile.android-base index d83bddf5606263..05caa480f3c827 100644 --- a/ContainerShip/Dockerfile.android-base +++ b/ContainerShip/Dockerfile.android-base @@ -1,8 +1,8 @@ FROM library/ubuntu:16.04 # set default build arguments -ARG ANDROID_VERSION=25.2.3 -ARG BUCK_VERSION=f3452a6a7ab15a60e94c962e686293acbe677473 +ARG ANDROID_TOOLS_VERSION=25.2.5 +ARG BUCK_VERSION=v2017.11.16.01 ARG NDK_VERSION=10e ARG NODE_VERSION=6.2.0 ARG WATCHMAN_VERSION=4.7.0 @@ -12,7 +12,7 @@ ENV ADB_INSTALL_TIMEOUT=10 ENV PATH=${PATH}:/opt/buck/bin/ ENV ANDROID_HOME=/opt/android ENV ANDROID_SDK_HOME=${ANDROID_HOME} -ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools +ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools ENV ANDROID_NDK=/opt/ndk/android-ndk-r$NDK_VERSION ENV PATH=${PATH}:${ANDROID_NDK} @@ -28,9 +28,8 @@ RUN npm install n -g RUN n $NODE_VERSION # download buck -RUN git clone https://github.com/facebook/buck.git /opt/buck +RUN git clone https://github.com/facebook/buck.git /opt/buck --branch $BUCK_VERSION --depth=1 WORKDIR /opt/buck -RUN git checkout $BUCK_VERSION # build buck RUN ant @@ -46,10 +45,11 @@ RUN ./configure RUN make RUN make install +# Full reference at https://dl.google.com/android/repository/repository2-1.xml # download and unpack android RUN mkdir /opt/android WORKDIR /opt/android -RUN curl --silent https://dl.google.com/android/repository/tools_r$ANDROID_VERSION-linux.zip > android.zip +RUN curl --silent https://dl.google.com/android/repository/tools_r$ANDROID_TOOLS_VERSION-linux.zip > android.zip RUN unzip android.zip RUN rm android.zip @@ -63,39 +63,15 @@ RUN unzip ndk.zip RUN rm ndk.zip # Add android SDK tools - -# Android SDK Platform-tools, revision 25.0.4 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android SDK Platform-tools, revision 25.0.4" | awk '{ print $1 }' | sed 's/.$//') - -# Android SDK Build-tools, revision 23.0.1 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android SDK Build-tools, revision 23.0.1" | awk '{ print $1 }' | sed 's/.$//') - -# SDK Platform Android 6.0, API 23, revision 3 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "SDK Platform Android 6.0, API 23" | awk '{ print $1 }' | sed 's/.$//') - -# SDK Platform Android 4.4.2, API 19, revision 4 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "SDK Platform Android 4.4.2, API 19, revision 4" | awk '{ print $1 }' | sed 's/.$//') - -# ARM EABI v7a System Image, Android API 19, revision 5 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "ARM EABI v7a System Image, Android API 19, revision 5" | awk '{ print $1 }' | sed 's/.$//') - -# Intel x86 Atom System Image, Android API 19, revision 5 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Intel x86 Atom System Image, Android API 19, revision 5" | awk '{ print $1 }' | sed 's/.$//') - -# Google APIs, Android API 23, revision 1 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Google APIs, Android API 23, revision 1" | awk '{ print $1 }' | sed 's/.$//') - -# Android Support Repository, revision 45 -RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android Support Repository" | awk '{ print $1 }' | sed 's/.$//') +RUN echo "y" | sdkmanager "system-images;android-19;google_apis;armeabi-v7a" +RUN echo "y" | sdkmanager "platforms;android-23" +RUN echo "y" | sdkmanager "platforms;android-19" +RUN echo "y" | sdkmanager "build-tools;23.0.1" +RUN echo "y" | sdkmanager "add-ons;addon-google_apis-google-23" +RUN echo "y" | sdkmanager "extras;android;m2repository" # Link adb executable RUN ln -s /opt/android/platform-tools/adb /usr/bin/adb -# Install google-chrome -RUN curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \ - && apt-get update \ - && apt-get install -y google-chrome-stable - # clean up unnecessary directories RUN rm -rf /opt/android/system-images/android-19/default/x86 diff --git a/ReactAndroid/DEFS b/ReactAndroid/DEFS index 9c268a4cda5ed9..45fb8ab9e352f7 100644 --- a/ReactAndroid/DEFS +++ b/ReactAndroid/DEFS @@ -86,7 +86,7 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs): '-XX:MaxPermSize=620m', '-Drobolectric.offline=true', ] - if os.path.isdir("/dev/shm") and not os.environ['CIRCLECI']: + if os.path.isdir("/dev/shm") and 'CIRCLECI' not in os.environ: extra_vm_args.append('-Djava.io.tmpdir=/dev/shm') else: extra_vm_args.append(