2019-01-18 00:31:07 +00:00
|
|
|
__toolversion = $(shell $(GIT_ROOT)/scripts/toolversion $(1))
|
|
|
|
|
2018-12-09 14:58:03 +00:00
|
|
|
GIT_COMMIT = $(shell git rev-parse --short HEAD)
|
|
|
|
GIT_ROOT = $(shell git rev-parse --show-toplevel)
|
|
|
|
|
2019-01-18 00:31:07 +00:00
|
|
|
ANDROID_NDK_VERSION = $(call __toolversion, android-ndk)
|
|
|
|
ANDROID_NDK_CHECKSUM = $(call __toolversion, android-ndk_md5)
|
2018-12-09 14:58:03 +00:00
|
|
|
ANDROID_NDK_ARCHIVE = android-ndk-$(ANDROID_NDK_VERSION)-linux-x86_64.zip
|
|
|
|
ANDROID_NDK_URL = https://dl.google.com/android/repository/$(ANDROID_NDK_ARCHIVE)
|
|
|
|
|
2019-01-18 00:31:07 +00:00
|
|
|
ANDROID_SDK_VERSION = $(call __toolversion, android-sdk)
|
|
|
|
ANDROID_SDK_CHECKSUM = $(call __toolversion, android-sdk_md5)
|
2018-12-09 14:58:03 +00:00
|
|
|
ANDROID_SDK_URL = https://dl.google.com/android/repository/sdk-tools-linux-$(ANDROID_SDK_VERSION).zip
|
|
|
|
ANDROID_SDK_ARCHIVE = sdk-tools-linux-$(ANDROID_SDK_VERSION).zip
|
|
|
|
|
2019-01-18 00:31:07 +00:00
|
|
|
SDK_PLATFORM_VERSION=$(call __toolversion, android-sdk-platform)
|
|
|
|
SDK_BUILD_TOOLS_VERSION=$(call __toolversion, android-sdk-build-tools)
|
|
|
|
|
2018-12-09 14:58:03 +00:00
|
|
|
# WARNING: Remember to change the tag when updating the image
|
2019-01-23 10:11:31 +00:00
|
|
|
BASE_IMAGE_TAG = $(shell cd ../base && make get-image-tag)
|
|
|
|
DEPS_HASH = $(shell $(GIT_ROOT)/scripts/gen-deps-hash.sh -b $(BASE_IMAGE_TAG) -d android-ndk -d android-sdk -d android-sdk-platform -d android-sdk-build-tools)
|
|
|
|
IMAGE_TAG = 1.1.0-$(DEPS_HASH)
|
2018-12-09 14:58:03 +00:00
|
|
|
IMAGE_NAME = statusteam/status-build-android:$(IMAGE_TAG)
|
|
|
|
|
|
|
|
build: $(ANDROID_NDK_ARCHIVE) $(ANDROID_SDK_ARCHIVE)
|
|
|
|
docker build \
|
2019-01-26 15:36:12 +00:00
|
|
|
--build-arg="ANDROID_NDK_VERSION=$(ANDROID_NDK_VERSION)" \
|
|
|
|
--build-arg="ANDROID_SDK_VERSION=$(ANDROID_SDK_VERSION)" \
|
|
|
|
--build-arg="SDK_PLATFORM_VERSION=$(SDK_PLATFORM_VERSION)" \
|
|
|
|
--build-arg="SDK_BUILD_TOOLS_VERSION=$(SDK_BUILD_TOOLS_VERSION)" \
|
|
|
|
--label="commit=$(GIT_COMMIT)" \
|
|
|
|
-t $(IMAGE_NAME) .
|
2018-12-09 14:58:03 +00:00
|
|
|
|
|
|
|
$(ANDROID_NDK_ARCHIVE):
|
|
|
|
wget -q "$(ANDROID_NDK_URL)" -O "$(ANDROID_NDK_ARCHIVE)"
|
|
|
|
echo "$(ANDROID_NDK_CHECKSUM) $(ANDROID_NDK_ARCHIVE)" | md5sum --check
|
|
|
|
|
|
|
|
$(ANDROID_SDK_ARCHIVE):
|
|
|
|
wget -q "$(ANDROID_SDK_URL)" -O "$(ANDROID_SDK_ARCHIVE)"
|
|
|
|
echo "$(ANDROID_SDK_CHECKSUM) $(ANDROID_SDK_ARCHIVE)" | md5sum --check
|
|
|
|
|
|
|
|
test: ## Run build inside the image as a test
|
|
|
|
docker run -u $(shell id -u):$(shell id -g) \
|
2019-01-26 15:36:12 +00:00
|
|
|
--name android-test --rm \
|
|
|
|
--tmpfs /var/tmp:rw,size=1G,exec,mode=1777 \
|
|
|
|
-v $(GIT_ROOT):/repo:rw \
|
|
|
|
-w /repo $(IMAGE_NAME) \
|
|
|
|
docker/android/build.sh
|
2018-12-09 14:58:03 +00:00
|
|
|
|
|
|
|
push: build
|
|
|
|
docker push $(IMAGE_NAME)
|