Skip to content

Commit c547f78

Browse files
hramosfacebook-github-bot
authored andcommittedDec 22, 2017
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 #17313 Differential Revision: D6624899 Pulled By: hramos fbshipit-source-id: 42b8cd708ec2a02399bb6ef30fd73faba2646f79
1 parent 7ff6657 commit c547f78

File tree

3 files changed

+15
-42
lines changed

3 files changed

+15
-42
lines changed
 

‎ContainerShip/Dockerfile.android

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM containership/android-base:latest
22

33
# set default environment variables
4-
ENV GRADLE_OPTS="-Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
4+
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
55
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
66

77
# add ReactAndroid directory
@@ -38,6 +38,7 @@ RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion
3838
RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1
3939

4040
# add all react-native code
41+
# How does this work?
4142
ADD . /app
4243
WORKDIR /app
4344

@@ -46,9 +47,5 @@ RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-
4647

4748
# build node dependencies
4849
RUN npm install
49-
RUN npm install github@0.2.4
50-
51-
WORKDIR /app/website
52-
RUN npm install
5350

5451
WORKDIR /app

‎ContainerShip/Dockerfile.android-base

+12-36
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
FROM library/ubuntu:16.04
22

33
# set default build arguments
4-
ARG ANDROID_VERSION=25.2.3
5-
ARG BUCK_VERSION=f3452a6a7ab15a60e94c962e686293acbe677473
4+
ARG ANDROID_TOOLS_VERSION=25.2.5
5+
ARG BUCK_VERSION=v2017.11.16.01
66
ARG NDK_VERSION=10e
77
ARG NODE_VERSION=6.2.0
88
ARG WATCHMAN_VERSION=4.7.0
@@ -12,7 +12,7 @@ ENV ADB_INSTALL_TIMEOUT=10
1212
ENV PATH=${PATH}:/opt/buck/bin/
1313
ENV ANDROID_HOME=/opt/android
1414
ENV ANDROID_SDK_HOME=${ANDROID_HOME}
15-
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
15+
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
1616
ENV ANDROID_NDK=/opt/ndk/android-ndk-r$NDK_VERSION
1717
ENV PATH=${PATH}:${ANDROID_NDK}
1818

@@ -28,9 +28,8 @@ RUN npm install n -g
2828
RUN n $NODE_VERSION
2929

3030
# download buck
31-
RUN git clone https://github.com/facebook/buck.git /opt/buck
31+
RUN git clone https://github.com/facebook/buck.git /opt/buck --branch $BUCK_VERSION --depth=1
3232
WORKDIR /opt/buck
33-
RUN git checkout $BUCK_VERSION
3433

3534
# build buck
3635
RUN ant
@@ -46,10 +45,11 @@ RUN ./configure
4645
RUN make
4746
RUN make install
4847

48+
# Full reference at https://dl.google.com/android/repository/repository2-1.xml
4949
# download and unpack android
5050
RUN mkdir /opt/android
5151
WORKDIR /opt/android
52-
RUN curl --silent https://dl.google.com/android/repository/tools_r$ANDROID_VERSION-linux.zip > android.zip
52+
RUN curl --silent https://dl.google.com/android/repository/tools_r$ANDROID_TOOLS_VERSION-linux.zip > android.zip
5353
RUN unzip android.zip
5454
RUN rm android.zip
5555

@@ -63,39 +63,15 @@ RUN unzip ndk.zip
6363
RUN rm ndk.zip
6464

6565
# Add android SDK tools
66-
67-
# Android SDK Platform-tools, revision 25.0.4
68-
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/.$//')
69-
70-
# Android SDK Build-tools, revision 23.0.1
71-
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/.$//')
72-
73-
# SDK Platform Android 6.0, API 23, revision 3
74-
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/.$//')
75-
76-
# SDK Platform Android 4.4.2, API 19, revision 4
77-
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/.$//')
78-
79-
# ARM EABI v7a System Image, Android API 19, revision 5
80-
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/.$//')
81-
82-
# Intel x86 Atom System Image, Android API 19, revision 5
83-
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/.$//')
84-
85-
# Google APIs, Android API 23, revision 1
86-
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/.$//')
87-
88-
# Android Support Repository, revision 45
89-
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android Support Repository" | awk '{ print $1 }' | sed 's/.$//')
66+
RUN echo "y" | sdkmanager "system-images;android-19;google_apis;armeabi-v7a"
67+
RUN echo "y" | sdkmanager "platforms;android-23"
68+
RUN echo "y" | sdkmanager "platforms;android-19"
69+
RUN echo "y" | sdkmanager "build-tools;23.0.1"
70+
RUN echo "y" | sdkmanager "add-ons;addon-google_apis-google-23"
71+
RUN echo "y" | sdkmanager "extras;android;m2repository"
9072

9173
# Link adb executable
9274
RUN ln -s /opt/android/platform-tools/adb /usr/bin/adb
9375

94-
# Install google-chrome
95-
RUN curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
96-
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
97-
&& apt-get update \
98-
&& apt-get install -y google-chrome-stable
99-
10076
# clean up unnecessary directories
10177
RUN rm -rf /opt/android/system-images/android-19/default/x86

‎ReactAndroid/DEFS

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
8686
'-XX:MaxPermSize=620m',
8787
'-Drobolectric.offline=true',
8888
]
89-
if os.path.isdir("/dev/shm") and not os.environ['CIRCLECI']:
89+
if os.path.isdir("/dev/shm") and 'CIRCLECI' not in os.environ:
9090
extra_vm_args.append('-Djava.io.tmpdir=/dev/shm')
9191
else:
9292
extra_vm_args.append(

0 commit comments

Comments
 (0)
Please sign in to comment.