-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cross-platform, cross-compile build toolchain #280
Changes from 1 commit
9686139
b57b921
d89202e
9c75430
45e487d
bf02e87
076ffe2
f3e69cc
6d2bbb8
1ff1de4
54fdc43
d0deb23
3954205
18c7b37
9cd7c6a
7f2e8cf
2f66df8
9e45f55
8297dab
63ac9d1
da5d322
de97277
80f16de
9359bb8
d339049
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
start-emulator.sh | ||
supervisord.conf | ||
AndroidManifest.xml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
FROM philcryer/min-jessie:latest | ||
# FROM philcryer/min-jessie:latest | ||
FROM ubuntu:16.04 | ||
|
||
ENV NDK_VERSION r13b | ||
|
||
|
@@ -8,8 +9,10 @@ ENV NDK=/build/android-ndk-$NDK_VERSION \ | |
ENV PATH=$PATH:/build/android-gcc-toolchain:$NDK | ||
ENV PATH=$PATH:/opt/cmake/bin | ||
|
||
# TODO: move to actual build command ?! | ||
ENV CCFLAGS=-fPIC CXXFLAGS=-fPIC | ||
|
||
# TODO: call into shared scripts for installing common build dependencies instead | ||
RUN echo "Preparing Debian packages..." && \ | ||
apt-get -qq update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \ | ||
|
@@ -59,26 +62,81 @@ RUN echo "Preparing Gradle..." && \ | |
ENV GRADLE_HOME=/opt/gradle-3.5 | ||
ENV PATH=$PATH:$GRADLE_HOME/bin | ||
|
||
RUN echo "Preparing Android SDK..." && \ | ||
mkdir -p /opt/android-sdk-linux && \ | ||
cd /opt/android-sdk-linux && \ | ||
curl -L -O https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip && \ | ||
unzip sdk-tools-linux-3859397.zip | ||
# V1 -------------------------------------------------- | ||
|
||
ENV ANDROID_HOME=/opt/android-sdk-linux | ||
# ENV ANDROID_HOME=/opt/android-sdk | ||
# ENV PATH $PATH:$ANDROID_HOME/tools | ||
# ENV PATH $PATH:$ANDROID_HOME/platform-tools | ||
|
||
RUN yes | /opt/android-sdk-linux/tools/bin/sdkmanager --licenses | ||
# RUN echo "Preparing Android SDK..." && \ | ||
# mkdir -p $ANDROID_HOME && \ | ||
# cd $ANDROID_HOME && \ | ||
# curl -L -O https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip && \ | ||
# unzip sdk-tools-linux-3859397.zip && \ | ||
# rm -rf sdk-tools-linux-3859397.zip | ||
|
||
# RUN /opt/android-sdk-linux/tools/bin/sdkmanager --update --verbose | ||
RUN /opt/android-sdk-linux/tools/bin/sdkmanager --verbose "build-tools;24.0.3" "platforms;android-10" | ||
# RUN yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses | ||
|
||
# # RUN $ANDROID_HOME/tools/bin/sdkmanager --update --verbose | ||
# RUN $ANDROID_HOME/tools/bin/sdkmanager --verbose \ | ||
# "platform-tools" \ | ||
# "emulator" \ | ||
# "build-tools;25.0.3" \ | ||
# "platforms;android-19" \ | ||
# "system-images;android-19;default;armeabi-v7a" \ | ||
# "system-images;android-19;default;x86" | ||
|
||
# ENV LD_LIBRARY_PATH=$ANDROID_HOME/emulator/lib64/qt/lib:$ANDROID_HOME/emulator/lib64/gles_mesa | ||
|
||
# RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -y libxdamage1 libxfixes3 qemu-kvm cpu-checker supervisor | ||
|
||
|
||
|
||
# V2 -------------------------------------------------- | ||
|
||
# TODO: move to packages at top | ||
RUN echo "Preparing Debian packages..." && \ | ||
apt-get -qq update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \ | ||
wget supervisor | ||
|
||
RUN wget -qO- http://dl.google.com/android/android-sdk_r23-linux.tgz | \ | ||
tar xvz -C /usr/local/ && \ | ||
mv /usr/local/android-sdk-linux /usr/local/android-sdk && \ | ||
chown -R root:root /usr/local/android-sdk/ | ||
|
||
# Add android tools and platform tools to PATH | ||
ENV ANDROID_HOME /usr/local/android-sdk | ||
ENV PATH $PATH:$ANDROID_HOME/tools | ||
ENV PATH $PATH:$ANDROID_HOME/platform-tools | ||
|
||
RUN ( sleep 4 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --force -a --filter \ | ||
build-tools-24.0.3,tools,platform-tools,android-19,extra-android-m2repository,sys-img-x86-android-19,sys-img-armeabi-v7a-android-19 && \ | ||
echo "y" | android update adb | ||
|
||
# Create fake keymap file | ||
RUN mkdir /usr/local/android-sdk/tools/keymaps && \ | ||
touch /usr/local/android-sdk/tools/keymaps/en-us | ||
|
||
EXPOSE 22 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need all these ports exposed in the docker container? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got those parts from this Dockerfile running the Android emulator. |
||
EXPOSE 5037 | ||
EXPOSE 5554 | ||
EXPOSE 5555 | ||
EXPOSE 5900 | ||
|
||
#RUN android update sdk --no-ui --all --filter "build-tools-24.0.3" | ||
|
||
# RUN yes | /usr/local/android-sdk/tools/bin/sdkmanager --licenses | ||
|
||
# COPY ./android/licenses $ANDROID_HOME/licenses | ||
|
||
# sdk-build-tools require the license to be accepted | ||
RUN mkdir -p $ANDROID_HOME/licenses && echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\n" > $ANDROID_HOME/licenses/android-sdk-license | ||
|
||
RUN mkdir -p /temp | ||
|
||
# download the most critical gradle dependencies for the build beforehand | ||
COPY ./shared/build.gradle /temp | ||
COPY ./android/AndroidManifest.xml /temp/src/main/AndroidManifest.xml | ||
WORKDIR /temp | ||
# RUN export MVN_PLATFORM_NAME=temp && \ | ||
# export MVN_ARCH_NAME=temp && \ | ||
# mvn verify -DskipTests || true | ||
RUN cd /temp && gradle || true | ||
|
||
RUN cd /temp && gradle --dry-run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
import os | ||
import signal | ||
|
||
def write_stdout(s): | ||
sys.stdout.write(s) | ||
sys.stdout.flush() | ||
def write_stderr(s): | ||
sys.stderr.write(s) | ||
sys.stderr.flush() | ||
def main(): | ||
while 1: | ||
write_stdout('READY\n') | ||
line = sys.stdin.readline() | ||
write_stdout('This line kills supervisor: ' + line); | ||
try: | ||
pidfile = open('/var/run/supervisord.pid','r') | ||
pid = int(pidfile.readline()); | ||
os.kill(pid, signal.SIGQUIT) | ||
except Exception as e: | ||
write_stdout('Could not kill supervisor: ' + e.strerror + '\n') | ||
write_stdout('RESULT 2\nOK') | ||
if __name__ == '__main__': | ||
main() | ||
import sys |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
echo no | $ANDROID_HOME/tools/android create avd -f -n test -t android-19 --abi default/$ARCH | ||
echo no | $ANDROID_HOME/tools/emulator64-$ARCH -avd test -noaudio -no-window -gpu off -verbose -qemu -usbdevice tablet -vnc :0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[supervisord] | ||
nodaemon=true | ||
pidfile = /var/run/supervisord.pid | ||
|
||
[program:emulator] | ||
command=/bin/bash -c "/j2v8/docker/android/start-emulator.sh" | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
startsecs = 0 | ||
autorestart = false | ||
startretries = 1 | ||
numprocs=1 | ||
stopasgroup=true | ||
killasgroup=true | ||
|
||
[eventlistener:emulator_exit] | ||
command=/j2v8/docker/android/kill_supervisor.py | ||
process_name=emulator | ||
events=PROCESS_STATE_EXITED,PROCESS_STATE_FATAL | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:tests] | ||
command=/bin/bash -c "/j2v8/docker/android/wait-for-emulator.sh; $TEST_CMDS" | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
startsecs = 0 | ||
autorestart = false | ||
startretries = 1 | ||
numprocs=1 | ||
stopasgroup=true | ||
killasgroup=true | ||
|
||
[eventlistener:tests_exit] | ||
command=/j2v8/docker/android/kill_supervisor.py | ||
process_name=tests | ||
events=PROCESS_STATE_EXITED,PROCESS_STATE_FATAL | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
adb wait-for-device | ||
|
||
A=$(adb shell getprop sys.boot_completed | tr -d '\r') | ||
|
||
echo "Waiting for emulator to boot (this can take several minutes)" | ||
|
||
while [ "$A" != "1" ]; do | ||
sleep 5 | ||
echo "$(date +%T) waiting for emulator to boot..." | ||
A=$(adb shell getprop sys.boot_completed | tr -d '\r') | ||
done | ||
|
||
adb shell input keyevent 82 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why 19? We should try to keep this as low as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at some point while I worked on how I could get the Android emulator testing integration working, it was required by some dependency that might now be gone. If the build & tests work fine with version 10 then we can safely revert it back