From 640a2e191869365dd5cdb1ffa248addab5746db6 Mon Sep 17 00:00:00 2001 From: idk Date: Fri, 7 May 2021 02:00:36 -0400 Subject: [PATCH] Add Docker release instructions, since it takes a bunch of the toolchain-management difficulty and automates it --- DOCKER.md | 55 ++++++++++++++++++++++++--- Dockerfile | 23 ++++++++--- RELEASE-PROCESS.md | 10 ++++- etc/docker.signing.example.properties | 4 ++ 4 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 etc/docker.signing.example.properties diff --git a/DOCKER.md b/DOCKER.md index ba4c6df39..e7e1d4730 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -30,19 +30,62 @@ a while to complete. Run an Android build in the container ------------------------------------- +Copy the `etc/docker.signing.example.proprties` file to `etc/docker.signing.proprties`, +edit it to match your key information and rebuild the container. + Run: - docker run -it --rm --name i2p.android.base \ + docker run -it \ + -u $(id -u):$(id -g) \ + --name i2p.android.base \ -v $HOME/.gnupg/:/.gnupg/:ro \ + -v $HOME/.i2p-plugin-keys/:/.i2p-plugin-keys/:ro \ -v /run/user/$(id -u)/:/run/user/$(id -u)/:ro \ - -v $(pwd)/app/build:/opt/workspace/i2p.android.base/app/build:rw \ - -v $(pwd)/app/pkg-temp:/opt/workspace/i2p.i2p/pkg-temp-copy/:rw \ i2p.android.base +To get the build artifacts for uploading to Maven out of the container, use: + + docker cp i2p.android.base:/opt/workspace/i2p.i2p/pkg-mavencentral app/pkg-mavencentral + docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-i2p.jar app/pkg-mavencentral + docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-mstreaming.jar app/pkg-mavencentral + docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-router.jar app/pkg-mavencentral + docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-servlet-i2p.jar app/pkg-mavencentral + docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-streaming.jar app/pkg-mavencentral + +To get the Android build artifacts out of the container, use: + + docker cp i2p.android.base:/opt/workspace/i2p.android.base/app/build/ app/build + And your android applications will appear in the `app/build` directory, in the same place where non-container builds would go. -If you encounter a permissions error when rebuilding, delete the `app/build` and -`app/pkg-temp` path. +If you encounter a permissions error when rebuilding, delete the `app/build`, +`app/pkg-mavencentral` and `app/pkg-temp` path. - rm -rf app/pkg-temp app/build + rm -rf app/pkg-temp app/build app/pkg-mavencentral + +Copypasta +--------- + +Once you have set up builds for the first time, from then on you can update the container and +build a fresh set of Maven jars and a new I2P for Android app by copy-pasting the following +commands: + +``` sh +rm -rf app/pkg-temp app/build app/pkg-mavencentral +docker build -t i2p.android.base . +docker run -it \ + -u $(id -u):$(id -g) \ + --name i2p.android.base \ + -v $HOME/.gnupg/:/.gnupg/:ro \ + -v $HOME/.i2p-plugin-keys/:/.i2p-plugin-keys/:ro \ + -v /run/user/$(id -u)/:/run/user/$(id -u)/:ro \ + i2p.android.base +docker cp i2p.android.base:/opt/workspace/i2p.i2p/pkg-mavencentral app/pkg-mavencentral +docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-i2p.jar app/pkg-mavencentral +docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-mstreaming.jar app/pkg-mavencentral +docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-router.jar app/pkg-mavencentral +docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-servlet-i2p.jar app/pkg-mavencentral +docker cp i2p.android.base:/opt/workspace/i2p.i2p/mavencentral-streaming.jar app/pkg-mavencentral +docker cp i2p.android.base:/opt/workspace/i2p.android.base/app/build/ app/build +``` diff --git a/Dockerfile b/Dockerfile index d7cc49574..572c220bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ FROM menny/android_ndk ENV VERSION=0.9.49 ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ -#ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/platform-tools RUN echo 'deb https://deb.i2p2.de/ sid main' >> /etc/apt/sources.list RUN echo 'deb-src https://deb.i2p2.de/ sid main' >> /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty universe' >> /etc/apt/sources.list RUN wget -O /etc/apt/trusted.gpg.d/i2p-debian-repo.key.asc https://geti2p.net/_static/i2p-debian-repo.key.asc -RUN mkdir -p /opt/packages && \ - wget -O /opt/packages/openjdk-7-jre-headless.deb http://security.debian.org/debian-security/pool/updates/main/o/openjdk-7/openjdk-7-jre-headless_7u261-2.6.22-1~deb8u1_amd64.deb -RUN cd /opt/packages && dpkg -x openjdk-7-jre-headless.deb /opt/packages/openjdk-7-jre +COPY etc/debian-jessie-repo.key.asc /etc/apt/trusted.gpg.d +RUN mkdir -p /opt/packages && wget -O /opt/packages/openjdk-7-jre-headless.deb http://security.debian.org/debian-security/pool/updates/main/o/openjdk-7/openjdk-7-jre-headless_7u261-2.6.22-1~deb8u1_amd64.deb RUN apt-get update RUN apt-get build-dep -y i2p i2p-router -RUN apt-get install -y ant openjdk-8* libxml2-utils monotone junit4 libhamcrest-java libmockito-java libmaven-ant-tasks-java +RUN apt-get install -y ant openjdk-8* libxml2-utils monotone junit4 libhamcrest-java libmockito-java libmaven-ant-tasks-java dpkg-sig +RUN cd /opt/packages && dpkg-sig -l openjdk-7-jre-headless.deb && dpkg -x openjdk-7-jre-headless.deb /opt/packages/openjdk-7-jre RUN git clone https://i2pgit.org/i2p-hackers/i2p.i2p --depth=1 -b i2p-$VERSION /opt/workspace/i2p.i2p RUN update-java-alternatives --jre-headless --set java-1.8.0-openjdk-amd64 RUN update-java-alternatives --set java-1.8.0-openjdk-amd64 @@ -24,5 +23,17 @@ COPY etc/docker.local.router.properties /opt/workspace/i2p.android.base/routerja COPY etc/docker.local.sdk.properties /opt/workspace/i2p.android.base/local.properties COPY etc/docker.override.properties /opt/workspace/i2p.android.base/override.properties COPY etc/docker.override.properties /opt/workspace/i2p.i2p/override.properties +COPY etc/docker.signing.properties /opt/workspace/i2p.android.base/signing.properties WORKDIR /opt/workspace/i2p.android.base -CMD cd /opt/workspace/i2p.i2p && ant mavenCentral; cp -v mavencentral*.jar pkg-temp-copy/ ; cp -rv pkg-mavencentral/* pkg-temp-copy/; cd /opt/workspace/i2p.android.base && ./gradlew dependencies || true ; ./gradlew assembleRelease +RUN find /opt/android-sdk-linux -type d -print0 | xargs -0 chown -R 1000:1000 +RUN find /opt/android-sdk-linux -type d -print0 | xargs -0 chmod -Rc o+rw +RUN find /opt/android-sdk-linux -type d -print0 | xargs -0 chmod -c 0755 +RUN find /opt/workspace -type d -print0 | xargs -0 chown -R 1000:1000 +RUN find /opt/workspace -type d -print0 | xargs -0 chmod -Rc o+rw +RUN find /opt/workspace -type d -print0 | xargs -0 chmod -c 0755 +CMD cd /opt/workspace/i2p.i2p && \ + ant -k mavenCentral; \ + cp -v *.jar pkg-mavencentral/ && \ + cd /opt/workspace/i2p.android.base && \ + ./gradlew --continue dependencies || true ; \ + ./gradlew --continue assembleRelease diff --git a/RELEASE-PROCESS.md b/RELEASE-PROCESS.md index 4d8a079bb..fd9509b00 100644 --- a/RELEASE-PROCESS.md +++ b/RELEASE-PROCESS.md @@ -40,7 +40,7 @@ the override.properties that is used in the Docker container. - First set `javac.compilerargs=-bootclasspath /path/to/java/7/rt.jar:/path/to/java/7/jce.jar` in override.properties - Build with `ant mavenCentral` -**>> End of Docker-enabled Steps <<** +**>> End of Docker-enabled Steps for Maven <<** 3. Login to http://oss.sonatype.org for uploading the mavencentral-*.jar bundles. 4. In nexus, choose "Staging Upload" and upload all of the files with upload mode set to "Artifacts with POM". @@ -62,12 +62,18 @@ the override.properties that is used in the Docker container. ### Android Common Build +Using Docker: in order to use Docker to generate a new Android apk for release, you will +need to run the build twice, once for the mavenCentral jars, and once for the actual Android +app. After doing the Maven release, follow these steps in the i2p.android.base repository, and re-run +the `docker run` step described in `DOCKER.md` + 1. Edit `routerjars/local.properties` to use the clean i2p.i2p copy. 2. Pull the latest translations with `tx pull -a` and commit them. (If you don't have the `tx` command, do `pip install transifex-client` ) - If there are any new translations, `mtn add` them, and add them to `app/src/main/res/values/arrays.xml` (two places, alphabetical order please) - 3. Ensure that `signing.properties` contains the details of the release key. + 3. Ensure that `signing.properties` contains the details of the release key. If you are using Docker, see + `DOCKER.md` to perform this step for Docker builds by editing `etc/docker.signing.properties` instead. 4. Edit `gradle.properties` to bump the I2P version. 5. Edit `app/build.gradle` to bump the Android version number. 6. Edit `CHANGELOG` to add the release and date. diff --git a/etc/docker.signing.example.properties b/etc/docker.signing.example.properties new file mode 100644 index 000000000..7525471b5 --- /dev/null +++ b/etc/docker.signing.example.properties @@ -0,0 +1,4 @@ +STORE_FILE=/.i2p-plugin-keys/android.keystore +STORE_PASSWORD=store.password +KEY_ALIAS=key.alias +KEY_PASSWORD=key.password \ No newline at end of file