merge changes from 2018.07 including versioning gomobile

This commit is contained in:
Dan Ballard 2021-03-22 22:59:43 -07:00
parent da18b4e8ff
commit 662f10bde6
2 changed files with 35 additions and 8 deletions

View File

@ -24,8 +24,9 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO
"platform-tools" "platform-tools"
# Install NDK # Install NDK
RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" ENV NDK_VER="21.0.6113669"
ENV ANDROID_NDK_ROOT $ANDROID_HOME/ndk-bundle RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk;$NDK_VER"
RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle
# Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile # Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile
# Adapted from alpine apk to debian apt # Adapted from alpine apk to debian apt
@ -35,8 +36,8 @@ ENV ANDROID_NDK_ROOT $ANDROID_HOME/ndk-bundle
## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf ## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN echo 'hosts: files dns' > /etc/nsswitch.conf RUN echo 'hosts: files dns' > /etc/nsswitch.conf
ENV GOLANG_VERSION 1.15.10 ENV GOLANG_VERSION=1.15.10
ENV GOLANG_SHA256 c1dbca6e0910b41d61a95bf9878f6d6e93d15d884c226b91d9d4b1113c10dd65 ENV GOLANG_SHA256=c1dbca6e0910b41d61a95bf9878f6d6e93d15d884c226b91d9d4b1113c10dd65
RUN set -eux; \ RUN set -eux; \
apt-get update; \ apt-get update; \
@ -78,17 +79,24 @@ RUN set -eux; \
go version go version
# persist new go in PATH # persist new go in PATH
ENV PATH /usr/local/go/bin:$PATH ENV PATH=/usr/local/go/bin:$PATH
ENV GOMOBILEPATH /gomobile ENV GOMOBILEPATH=/gomobile
# Setup /workspace # Setup /workspace
RUN mkdir $GOMOBILEPATH RUN mkdir $GOMOBILEPATH
# Set up GOPATH in /workspace # Set up GOPATH in /workspace
ENV GOPATH $GOMOBILEPATH ENV GOPATH=$GOMOBILEPATH
ENV PATH $GOMOBILEPATH/bin:$PATH ENV PATH=$GOMOBILEPATH/bin:$PATH
RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH" RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH"
# install gomobile # install gomobile
RUN cd $GOMOBILEPATH/src; \
mkdir -p golang.org/x; \
cd golang.org/x; \
git clone https://github.com/golang/mobile.git; \
cd mobile; \
git checkout bdb1ca9a1e083af5929a8214e8a056d638ebbf2d;
RUN go get golang.org/x/mobile/cmd/gomobile RUN go get golang.org/x/mobile/cmd/gomobile
RUN go get golang.org/x/mobile/cmd/gobind RUN go get golang.org/x/mobile/cmd/gobind
RUN go get golang.org/x/mobile/bind RUN go get golang.org/x/mobile/bind

View File

@ -7,9 +7,11 @@ Versions are:
- 2021.03 - 2021.03
- Go 1.15.10 - Go 1.15.10
- Android API 29 - Android API 29
- NDK 21.0.6113669
- 2018.07 - 2018.07
- Go 1.10.3 - Go 1.10.3
- Android API 28 - Android API 28
- NDK 17.2.4988734
## Install and Use ## Install and Use
@ -31,3 +33,20 @@ This container has its own GOPATH with only gomobile in it, so to use, you'll ne
- gomobile init - gomobile init
- make - make
### Version 2018.07
This image includes:
- Android SDK, NDK, tools, and API version 28 at `/usr/local/android-sdk`
- Go lang 1.10.3 at `/usr/local/go`
- $GOPATH set to `/workspace/go`
- A go directory with an initialized gomobile installed at `/go`
This image comes with gomobile checkedout and preinitialized (time and space consuming). In order to install this predone work from the image into your Drone CI workspace (a docker volume mounted to `/workspace`), you will want your first pipeline step to be:
go-link:
image: openpriv/android-go-mobile
commands:
- cp -as /go /workspace/go
`cp -as` recreates the directory structure from /go in /workspace/go but for each file, it just creates a symlink. This is the quickest and most efficent way to mirror the work supplied with the image into your workspace.