make Makefile.apps generation outsourced bash script
This commit is contained in:
parent
d8d3ffa647
commit
c57affd486
3 changed files with 41 additions and 53 deletions
46
Dockerfile
46
Dockerfile
|
@ -3,50 +3,40 @@ FROM archlinux:latest
|
||||||
ARG YESACCEPT=n
|
ARG YESACCEPT=n
|
||||||
RUN echo "this is $YESACCEPT"
|
RUN echo "this is $YESACCEPT"
|
||||||
RUN pacman -Syu --noconfirm
|
RUN pacman -Syu --noconfirm
|
||||||
RUN pacman -S --noconfirm coreutils bash shadow make unzip zip jdk11-openjdk wget xorg-xclock
|
RUN pacman -S --noconfirm coreutils bash shadow make unzip zip jdk17-openjdk wget
|
||||||
ENV ANDROID_SDK_ROOT="/opt/android"
|
ENV ANDROID_SDK_ROOT="/opt/android"
|
||||||
ENV BUILD_TOOLS_LATEST="$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
ENV BUILD_TOOLS_LATEST="$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
||||||
RUN BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")";\
|
RUN BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")";\
|
||||||
mkdir -p "$BUILD_TOOLS";\
|
mkdir -p "$BUILD_TOOLS";\
|
||||||
cd "$BUILD_TOOLS";\
|
cd "$BUILD_TOOLS";\
|
||||||
pwd;\
|
pwd;\
|
||||||
wget -O cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip;\
|
for LATESTTOOLS in \
|
||||||
unzip cmdline-tools.zip;\
|
"$(curl https://developer.android.com/studio#command-line-tools-only | grep -e 'https://dl.google.com/android/repository/commandlinetools-linux-.*_latest.zip' | cut -f2 -d'"')" \
|
||||||
|
'https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip' ;\
|
||||||
|
do \
|
||||||
|
echo "testing to get '$LATESTTOOLS'";\
|
||||||
|
echo test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" ;\
|
||||||
|
test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" || { echo "unsure of URL $LATESTTOOLS correct, skipping it..." >&2; continue; }; \
|
||||||
|
wget -O cmdline-tools.zip "$LATESTTOOLS" ;\
|
||||||
|
unzip cmdline-tools.zip && break || { echo "error downloading working cmdline-tools.zip"; exit 1; };\
|
||||||
|
done;\
|
||||||
ls ;\
|
ls ;\
|
||||||
ls cmdline-tools;\
|
ls cmdline-tools;\
|
||||||
rm cmdline-tools.zip;\
|
rm cmdline-tools.zip;\
|
||||||
mv -v cmdline-tools "$BUILD_TOOLS_LATEST" || true
|
mv -v cmdline-tools "$BUILD_TOOLS_LATEST" || true
|
||||||
ENV PATH="$PATH:$BUILD_TOOLS_LATEST/bin"
|
ENV PATH="$PATH:$BUILD_TOOLS_LATEST/bin"
|
||||||
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk/"
|
#TODO make this automatic
|
||||||
#ENTRYPOINT bash -c 'sleep 10000'
|
ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk/"
|
||||||
ENV LIBRARY_PATH="$LIBRARY_PATH:$BUILD_TOOLS_LATEST/lib"
|
ENV LIBRARY_PATH="$LIBRARY_PATH:$BUILD_TOOLS_LATEST/lib"
|
||||||
RUN test "$YESACCEPT" = "y" || { printf "\033[31;1;4m%s\n%s\033[0m " "FAILED TO BUILD CONTAINER: You did not ACCEPT THE UPSTREAM LICENSE" " -> export YESACCEPT=y" >&2; exit 1; }
|
RUN test "$YESACCEPT" = "y" || { printf "\033[31;1;4m%s\n%s\033[0m " "FAILED TO BUILD CONTAINER: You did not ACCEPT THE UPSTREAM LICENSE" " -> export YESACCEPT=y" >&2; exit 1; }
|
||||||
RUN echo you selected to accept the licenses/TOS
|
RUN echo you selected to accept the licenses/TOS
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "build-tools;33.0.2"
|
RUN echo "$YESACCEPT" | sdkmanager --install "build-tools;33.0.2"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "platforms;android-33"
|
RUN echo "$YESACCEPT" | sdkmanager --install "platforms;android-33"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "ndk;28.0.12433566"
|
RUN echo "$YESACCEPT" | sdkmanager --install "ndk;28.0.12433566"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "system-images;android-33;aosp_atd;x86_64"
|
#RUN echo "$YESACCEPT" | sdkmanager --install "system-images;android-33;aosp_atd;x86_64"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "emulator"
|
#RUN echo "$YESACCEPT" | sdkmanager --install "emulator"
|
||||||
RUN echo "no" | avdmanager --verbose create avd --force --name "thedevice" --package 'system-images;android-33;aosp_atd;x86_64' --tag "aosp_atd" --abi "x86_64"
|
#RUN echo "no" | avdmanager --verbose create avd --force --name "thedevice" --package 'system-images;android-33;aosp_atd;x86_64' --tag "aosp_atd" --abi "x86_64"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "platform-tools"
|
#RUN echo "$YESACCEPT" | sdkmanager --install "platform-tools"
|
||||||
RUN pacman -S --noconfirm libpulse libdrm libbsd libxi
|
|
||||||
RUN mkdir /tmp/.X11-unix/
|
|
||||||
|
|
||||||
# 10 pacman -Ss pulse
|
|
||||||
# 11 pacman -Ss pulse | grpe lib
|
|
||||||
# 12 pacman -Ss pulse | grep lib
|
|
||||||
# 13 pacman -S libpulse
|
|
||||||
# 15 pacman -S libdrm
|
|
||||||
# 17 pacman -S libXi
|
|
||||||
# 18 pacman -Ss libXi
|
|
||||||
# 19 pacman -Ss libxi
|
|
||||||
# 20 pacman -S libxi
|
|
||||||
# 22 pacman -S libsd
|
|
||||||
# 23 pacman -S libbsd
|
|
||||||
# 24 pacman -S libbsd
|
|
||||||
# 26 history | grep pacman
|
|
||||||
#
|
|
||||||
#RUN apk add setpriv
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chown 0:0 /entrypoint.sh
|
RUN chown 0:0 /entrypoint.sh
|
||||||
RUN chmod 0700 /entrypoint.sh
|
RUN chmod 0700 /entrypoint.sh
|
||||||
|
|
26
Makefile
26
Makefile
|
@ -1,30 +1,8 @@
|
||||||
|
|
||||||
# this includes explicit rules
|
# this includes explicit rules
|
||||||
|
|
||||||
|
|
||||||
include Makefile.apps
|
include Makefile.apps
|
||||||
Makefile.apps: Makefile apps
|
Makefile.apps: Makefile apps
|
||||||
@(\
|
@./Makefile.make.Makefile.apps.sh
|
||||||
cd apps;\
|
|
||||||
for APP in */;\
|
|
||||||
do \
|
|
||||||
test -d "$$APP" || continue;\
|
|
||||||
APP="$${APP%/}";\
|
|
||||||
MFA="\
|
|
||||||
apps/$$APP/app.apk: docker-compose-build.log\n\
|
|
||||||
docker compose run --rm compile $$APP\n\
|
|
||||||
build-$$APP: apps/$$APP/app.apk\n\
|
|
||||||
true\n\
|
|
||||||
apps/$$APP/app.apk.install-log: apps/$$APP/app.apk\n\
|
|
||||||
adb install -r $$< > \$$@ || rm \$$@ \n\
|
|
||||||
install-$$APP: apps/$$APP/app.apk.install-log\n\
|
|
||||||
true\n\
|
|
||||||
run-$$APP: apps/$$APP/app.apk.install-log\n\
|
|
||||||
adb shell am start -n app.example/.ExampleApp\n\
|
|
||||||
";\
|
|
||||||
done;\
|
|
||||||
printf "$$MFA" \
|
|
||||||
) > "$@"
|
|
||||||
|
|
||||||
apps:
|
apps:
|
||||||
mkdir "$@"
|
mkdir "$@"
|
||||||
|
@ -38,5 +16,3 @@ docker-compose-build.log: Dockerfile compose.yml
|
||||||
docker-compose down --remove-orphans --rmi all
|
docker-compose down --remove-orphans --rmi all
|
||||||
BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log
|
BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log
|
||||||
|
|
||||||
some thing:
|
|
||||||
echo was $@
|
|
||||||
|
|
22
Makefile.make.Makefile.apps.sh
Executable file
22
Makefile.make.Makefile.apps.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
(
|
||||||
|
set -xe
|
||||||
|
cd apps
|
||||||
|
for APP in */
|
||||||
|
do
|
||||||
|
test -d "$APP" || continue;
|
||||||
|
APP="${APP%/}";
|
||||||
|
cat << MAKEFILE
|
||||||
|
apps/$APP/app.apk: docker-compose-build.log
|
||||||
|
docker compose run --rm compile $APP
|
||||||
|
build-$APP: apps/$APP/app.apk
|
||||||
|
true
|
||||||
|
apps/$APP/app.apk.install-log: apps/$APP/app.apk
|
||||||
|
adb install -r $< > \$@ || rm \$@
|
||||||
|
install-$APP: apps/$APP/app.apk.install-log
|
||||||
|
true
|
||||||
|
run-$APP: apps/$APP/app.apk.install-log
|
||||||
|
adb shell am start -n app.example/.ExampleApp
|
||||||
|
MAKEFILE
|
||||||
|
done
|
||||||
|
) > Makefile.apps
|
Loading…
Add table
Reference in a new issue