Skip to content

Commit 5356151

Browse files
committed
Merge branch 'update_android_docker_container' into origin_master
2 parents f8551f0 + f3ae9be commit 5356151

File tree

6 files changed

+94
-72
lines changed

6 files changed

+94
-72
lines changed

.github/workflows/android-dockerimage.disabled renamed to .github/workflows/android-dockerimage

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
name: Android Docker Image CI
22

3-
# -- disabled for now, as the resulting image is HUGE and causes our
4-
# Android builds to fail
5-
#on:
6-
# push:
7-
# paths:
8-
# - scripts/docker/android-build-container/Dockerfile
9-
# - .github/workflows/android-docker*
10-
11-
# this is here to prevent errors about not having an on: clause
123
on:
13-
repository_dispatch:
14-
types:
15-
- unused
4+
- workflow_dispatch
5+
- push:
6+
paths:
7+
- scripts/docker/android-build-container
8+
- .github/workflows/android-docker*
9+
- packaging/android/android-build-setup.sh
10+
- packaging/android/variables.sh
1611

1712
jobs:
1813
android-build-container:
1914
runs-on: ubuntu-latest
2015
env:
21-
VERSION: ${{ '5.13.10' }} # the version numbers here is based on the Qt version, the third digit is the rev of the docker image
16+
VERSION: ${{ '5.15.2' }} # the version numbers here is based on the Qt version, the third digit is the rev of the docker image
2217

2318
steps:
2419
- uses: actions/checkout@v1
2520

2621
- name: Get our pre-reqs
2722
run: |
2823
cd scripts/docker/android-build-container
29-
bash download.sh
30-
sed -ie 's/^sudo/#sudo/' setup-docker.sh
3124
bash setup-docker.sh
3225

3326
- name: set env

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ packaging/ios/Info.plist
4242
packaging/ios/Qt
4343
packaging/ios/asset_catalog_compiler.Info.plist
4444
appdata/subsurface.appdata.xml
45+
scripts/docker/android-build-container/android-build-setup.sh
46+
scripts/docker/android-build-container/variables.sh
47+

packaging/android/README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,24 @@ CONTAINER_ID=$(docker container ls -a -q -f name=${CONTAINER_NAME})
1919

2020
# Create the image if it does not exist
2121
if [[ -z "${CONTAINER_ID}" ]]; then
22-
docker create -v ${SUBSURFACE_ROOT}:/android/subsurface -w /android --name=${CONTAINER_NAME} subsurface/android-build-container:5.15.1 sleep infinity
22+
docker create -v ${SUBSURFACE_ROOT}:/android/subsurface --name=${CONTAINER_NAME} subsurface/android-build:5.15.1 sleep infinity
2323
fi
2424

2525
docker start ${CONTAINER_NAME}
2626

2727
BUILD_PARAMETERS=""
2828
if [[ -n "${CONTAINER_ID}" ]]; then
29-
BUILD_PARAMETERS="-quick"
29+
BUILD_PARAMETERS="-quick"
3030
else
31-
# Prepare the image for first use
32-
docker exec -t ${CONTAINER_NAME} rm /android/5.15.1/android/lib/cmake/Qt5Test/Qt5TestConfig.cmake
33-
docker exec -t ${CONTAINER_NAME} apt-get install --reinstall cpp-7 gcc-7-base libgcc-7-dev libcc1-0 gcc-7
31+
# Prepare the image for first use
3432

35-
# Set the git id
36-
docker exec -t ${CONTAINER_NAME} git config --global user.name "${GIT_NAME}"
37-
docker exec -t ${CONTAINER_NAME} git config --global user.email "${GIT_EMAIL}"
33+
# Set the git id
34+
docker exec -t ${CONTAINER_NAME} git config --global user.name "${GIT_NAME}"
35+
docker exec -t ${CONTAINER_NAME} git config --global user.email "${GIT_EMAIL}"
3836
fi
3937

4038
# Build. Do not rebuild the dependencies if this is not the first build
41-
docker exec -t ${CONTAINER_NAME} /bin/bash -x ./subsurface/packaging/android/qmake-build.sh ${BUILD_PARAMETERS}
42-
43-
# Copy the output files into the 'android-debug' directory in the source directory
44-
docker cp ${CONTAINER_NAME}:/android/subsurface-mobile-build/android-build/build/outputs/apk/debug/. ${SUBSURFACE_ROOT}/android-debug/
39+
docker exec -e OUTPUT_DIR="/android/subsurface/android-debug" -t ${CONTAINER_NAME} /bin/bash -x ./subsurface/packaging/android/qmake-build.sh ${BUILD_PARAMETERS}
4540

4641
# Stop the container
4742
docker stop ${CONTAINER_NAME}
Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,34 @@
1-
From ubuntu:18.04
1+
FROM subsurface/android-build-container:5.15.1 as base
2+
3+
FROM ubuntu:22.04 as build
24

35
RUN apt-get update && \
46
apt-get upgrade -y && \
57
apt-get install -y \
6-
autoconf \
7-
automake \
8-
cmake \
8+
unzip \
99
git \
10+
cmake \
11+
autoconf \
1012
libtool-bin \
11-
make \
12-
wget \
13-
unzip \
14-
python \
15-
python3-pip \
16-
bzip2 \
17-
pkg-config \
18-
libx11-xcb1 \
19-
libgl1-mesa-glx \
20-
libglib2.0-0 \
2113
openjdk-8-jdk \
22-
curl \
23-
coreutils \
24-
p7zip-full
14+
wget
15+
16+
WORKDIR /android
17+
18+
# Scrape the manually curated Qt install from the previous build image
19+
COPY --from=base /android/5.15.1 5.15.1
2520

26-
# create our working directory and place the local copies of the Qt
2721
# install, NDK and SDK there, plus the three files from the Subsurface
2822
# sources that we need to get the prep routines to run
29-
RUN mkdir -p /android
30-
ADD commandlinetools-linux-*.zip /android/
31-
RUN cd /android && unzip commandlinetools-linux-*.zip
32-
ADD android-build-setup.sh variables.sh /android/
23+
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip && \
24+
unzip commandlinetools-linux-*.zip
25+
ADD android-build-setup.sh variables.sh .
3326

3427
# run the build setup
35-
RUN ls -l /android
36-
RUN cd /android && bash -x /android/android-build-setup.sh
28+
RUN bash -x android-build-setup.sh
3729

3830
# clean up the files that we don't need to keep the container smaller
39-
RUN cd /android && \
40-
rm -rf \
31+
RUN rm -rf \
4132
5*/android/lib/*x86* \
4233
5*/android/doc \
4334
5*/android/include/QtHelp \
@@ -48,6 +39,7 @@ RUN cd /android && \
4839
5*/android/include/QtTest \
4940
5*/android/include/QtXml \
5041
5*/android/plugins/geoservices/libqtgeoservices_mapboxgl.so \
42+
5*/android/lib/cmake/Qt5Test/Qt5TestConfig.cmake \
5143
commandlinetools-linux-*.zip \
5244
$( find platforms -name arch-mips -o -name arch-x86 ) \
5345
toolchains/x86-* android-ndk*/toolchains/llvm/prebuilt/x86-* \
@@ -69,10 +61,51 @@ RUN cd /android && \
6961
emulator \
7062
platform-tools-2 \
7163
variables.sh \
72-
android-build-setup.sh
73-
/usr/lib/gcc && \
74-
ls -l && \
75-
du -sh *
76-
RUN apt-get clean
77-
#RUN cd /android/android-ndk-r18b/toolchains && ln -s x86_64-4.9 x86-64-4.9
78-
RUN touch /android/finished-"`date`"
64+
android-build-setup.sh \
65+
/usr/lib/gcc
66+
67+
FROM ubuntu:22.04
68+
69+
# Repeat exactly the same step as in the 'build' image above, so it can be reused
70+
RUN apt-get update && \
71+
apt-get upgrade -y && \
72+
apt-get install -y \
73+
unzip \
74+
git \
75+
cmake \
76+
autoconf \
77+
libtool-bin \
78+
openjdk-8-jdk \
79+
wget
80+
81+
RUN apt-get install -y \
82+
autoconf \
83+
automake \
84+
cmake \
85+
git \
86+
make \
87+
wget \
88+
zip \
89+
unzip \
90+
python3 \
91+
python3-pip \
92+
bzip2 \
93+
pkg-config \
94+
libx11-xcb1 \
95+
libgl1-mesa-glx \
96+
libglib2.0-0 \
97+
openjdk-8-jdk \
98+
curl \
99+
coreutils \
100+
p7zip-full && \
101+
apt-get clean
102+
103+
WORKDIR /android
104+
105+
COPY --from=build /android/ .
106+
107+
RUN git config --global --add safe.directory /android/subsurface && \
108+
git config --global --add safe.directory /android/subsurface/libdivecomputer && \
109+
git config --global --add safe.directory /android/subsurface/nightly-builds
110+
111+
RUN touch finished-"`date`"

scripts/docker/android-build-container/download.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

scripts/docker/android-build-container/setup-docker.sh

100644100755
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55
# Google makes it intentionally very hard to download the command line tools
66
# the URL is constantly changing and the website requires you to click through
77
# a license.
8+
#
89
# Today this URL works:
9-
if [ ! -f commandlinetools-linux-6858069_latest.zip ] ; then
10-
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
11-
fi
12-
# if this fails, go to https://developer.android.com/studio#cmdline-tools and click through
13-
# for yourself...
10+
# https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
11+
#
12+
# If this fails, go to https://developer.android.com/studio#cmdline-tools and
13+
# click through for yourself, and then update the URL in the Dockerfile
1414

1515
# copy the dependency script into this folder
1616
cp ../../../packaging/android/android-build-setup.sh .
1717
cp ../../../packaging/android/variables.sh .
1818

19+
if [ $1 == "-no-docker-build" ]; then
20+
exit 0
21+
fi
22+
1923
# create the container (this takes a while)
20-
sudo docker build -t android-builder --squash .
24+
docker build -t android-build .

0 commit comments

Comments
 (0)