Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jobs:
steps:
- checkout
- run: *build-docker
- run:
name: Check if Emulator (Headless) starts
command: docker run --rm -v "$(pwd)/scripts/":/scripts react-native-community/react-native /bin/sh -c "/scripts/test-emulator-headless.sh"
- run:
name: Checkout React Native
command: git clone https://github.com/facebook/react-native.git
Expand Down
59 changes: 5 additions & 54 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,26 @@ LABEL Description="This image provides a base Android development environment fo

ENV DEBIAN_FRONTEND=noninteractive

# Keep the previous SDK as a fallback until we've finished the migration.
ARG ANDROID_BUILD_VERSION_FALLBACK=31
ARG ANDROID_TOOLS_VERSION_FALLBACK=31.0.0

# set default build arguments
# https://developer.android.com/studio#command-tools
ARG SDK_VERSION=commandlinetools-linux-8512546_latest.zip
ARG ANDROID_BUILD_VERSION=33
ARG ANDROID_TOOLS_VERSION=33.0.0
ARG BUCK_VERSION=2022.05.05.01
# Buck doesn't support versions beyond NDK 21
# Therefore we need to diverge the NDK version and set NDK_HOME
# for Buck to pick it up correctly.
ARG NDK_VERSION_BUCK=21.4.7075529
ARG NDK_VERSION_GRADLE=23.1.7779620
ARG NDK_VERSION=23.1.7779620
ARG NODE_VERSION=16
ARG WATCHMAN_VERSION=4.9.0
# For comaptibilites we install both CMake 3.18.x and 3.22.x, as AGP 7.3 autodownloads 3.18.x
# Once we bump to AGP 7.4, we can remove 3.18.x and use only 3.22.x
ARG CMAKE_VERSION=3.22.1
ARG OLD_CMAKE_VERSION=3.18.1

# set default environment variables, please don't remove old env for compatibilty issue
ENV ADB_INSTALL_TIMEOUT=10
ENV ANDROID_HOME=/opt/android
ENV ANDROID_SDK_ROOT=${ANDROID_HOME}
ENV ANDROID_NDK_BUCK=${ANDROID_HOME}/ndk/$NDK_VERSION_BUCK
ENV ANDROID_NDK_GRADLE=${ANDROID_HOME}/ndk/$NDK_VERSION_GRADLE
# this is needed for Buck to be able to recognize NDK 21
ENV NDK_HOME=${ANDROID_HOME}/ndk/$NDK_VERSION_BUCK
ENV ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/$NDK_VERSION_GRADLE
ENV ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/$NDK_VERSION

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV CMAKE_BIN_PATH=${ANDROID_HOME}/cmake/$CMAKE_VERSION/bin

ENV PATH=${CMAKE_BIN_PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:/opt/buck/bin/:${PATH}
ENV PATH=${CMAKE_BIN_PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${PATH}

# Install system dependencies
RUN apt update -qq && apt install -qq -y --no-install-recommends \
Expand Down Expand Up @@ -69,26 +53,6 @@ RUN apt update -qq && apt install -qq -y --no-install-recommends \
zip \
# Dev libraries requested by Hermes
libicu-dev \
# Emulator & video bridge dependencies
libc6 \
libdbus-1-3 \
libfontconfig1 \
libgcc1 \
libpulse0 \
libtinfo5 \
libx11-6 \
libxcb1 \
libxdamage1 \
libnss3 \
libxcomposite1 \
libxcursor1 \
libxi6 \
libxext6 \
libxfixes3 \
zlib1g \
libgl1 \
pulseaudio \
socat \
# Dev dependencies required by linters
jq \
shellcheck \
Expand All @@ -102,31 +66,18 @@ RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \
&& npm install -g n \
&& npm install -g yarn

# download and install buck using the java11 pex from Jitpack
RUN curl -L https://jitpack.io/com/github/facebook/buck/v${BUCK_VERSION}/buck-v${BUCK_VERSION}-java11.pex -o /tmp/buck.pex \
&& mv /tmp/buck.pex /usr/local/bin/buck \
&& chmod +x /usr/local/bin/buck

# Full reference at https://dl.google.com/android/repository/repository2-1.xml
# download and unpack android
# workaround buck clang version detection by symlinking
RUN curl -sS https://dl.google.com/android/repository/${SDK_VERSION} -o /tmp/sdk.zip \
&& mkdir -p ${ANDROID_HOME}/cmdline-tools \
&& unzip -q -d ${ANDROID_HOME}/cmdline-tools /tmp/sdk.zip \
&& mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest \
&& rm /tmp/sdk.zip \
&& yes | sdkmanager --licenses \
&& yes | sdkmanager "platform-tools" \
"emulator" \
"platforms;android-$ANDROID_BUILD_VERSION" \
"platforms;android-$ANDROID_BUILD_VERSION_FALLBACK" \
"build-tools;$ANDROID_TOOLS_VERSION" \
"build-tools;$ANDROID_TOOLS_VERSION_FALLBACK" \
"cmake;$CMAKE_VERSION" \
"cmake;$OLD_CMAKE_VERSION" \
"system-images;android-21;google_apis;armeabi-v7a" \
"ndk;$NDK_VERSION_BUCK" \
"ndk;$NDK_VERSION_GRADLE" \
"ndk;$NDK_VERSION" \
&& rm -rf ${ANDROID_HOME}/.android \
&& chmod 777 -R /opt/android \
&& ln -s ${ANDROID_NDK_BUCK}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9 ${ANDROID_NDK_BUCK}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8
&& chmod 777 -R /opt/android
12 changes: 0 additions & 12 deletions scripts/test-emulator-headless.sh

This file was deleted.

14 changes: 1 addition & 13 deletions scripts/test-react-native-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

set -e

export KOTLIN_HOME="third-party/kotlin"

echo "Download Buck dependencies"
./scripts/buck/buck_fetch.sh

echo "Build React Native via Buck"
buck build ReactAndroid/src/main/java/com/facebook/react
buck build ReactAndroid/src/main/java/com/facebook/react/shell

echo "Build React Native via Gradle"
yarn install
./gradlew --no-daemon :ReactAndroid:packageReactNdkLibsForBuck -PreactNativeArchitectures=arm64-v8a

echo "Assemble RNTester Release arm64-v8a"
./gradlew --no-daemon :packages:rn-tester:android:app:assembleRelease -PreactNativeArchitectures=arm64-v8a
./gradlew --no-daemon build -PreactNativeArchitectures=arm64-v8a