Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README_DEBUGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This downloads the latest sdk to the folder `defoldsdk/<sha1>/defoldsdk`; sets t
# Environment variables

* **DM_DEBUG_COMMANDS** - Prints the command line and result for each command in a build
* **DM_DEBUG_DISABLE_PROGUARD** - Disables building with ProGuard (Android only)
* **DM_DEBUG_DISABLE_R8** - Disables shrinking with R8 and uses D8 directly (Android only)
* **DM_DEBUG_JOB_FOLDER** - The uploaded job (and build) will always end up in this folder
* **DM_DEBUG_KEEP_JOB_FOLDER** - Always keep the job folders
* **DM_DEBUG_JOB_UPLOAD** - Output the file names in the received payload
Expand Down
12 changes: 12 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ configurations.all {

repositories {
mavenCentral()
exclusiveContent {
forRepository {
maven {
name = 'GoogleR8'
url = uri('https://dl.google.com/dl/android/maven2/')
}
}
filter {
includeModule('com.android.tools', 'r8')
}
}
}

dependencies {
Expand Down Expand Up @@ -102,6 +113,7 @@ dependencies {
testImplementation('org.springframework.security:spring-security-test')

testImplementation('org.smali:dexlib2:2.5.2')
testImplementation('com.android.tools:r8:8.13.19')
testImplementation project(':client')
testImplementation('org.wiremock:wiremock-standalone:3.13.2')
}
Expand Down
16 changes: 6 additions & 10 deletions server/docker/Dockerfile.android.ndk25_sdk36-env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARG ANDROID_NDK_PATH=${ANDROID_ROOT}/android-ndk-r${ANDROID_NDK_VERSION}
ARG ANDROID_SDK_HOME=${ANDROID_ROOT}/.android
ARG ANDROID_NDK_BIN_PATH=${ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin
ARG ANDROID_SDK_BUILD_TOOLS_PATH=${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS_VERSION}
ARG R8_VERSION=8.13.19

FROM europe-west1-docker.pkg.dev/extender-426409/extender-public-registry/extender-build-env:1.1.0 AS build

Expand All @@ -29,7 +30,7 @@ ARG ANDROID_NDK_VERSION
ARG ANDROID_NDK_API_VERSION
ARG ANDROID_64_NDK_API_VERSION
ARG ANDROID_NDK_FILENAME=android-ndk-r${ANDROID_NDK_VERSION}-linux.tar.gz
ARG R8_VERSION=8.13.19
ARG R8_VERSION

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN --mount=type=secret,id=DM_PACKAGES_URL,required=true \
Expand Down Expand Up @@ -77,6 +78,7 @@ ARG ANDROID_SDK_BUILD_TOOLS_PATH
ARG ANDROID_NDK_VERSION
ARG ANDROID_NDK_API_VERSION
ARG ANDROID_64_NDK_API_VERSION
ARG R8_VERSION

ENV ANDROID_ROOT=${ANDROID_ROOT} \
# ANDROID_HOME has been replaced with ANDROID_SDK_ROOT
Expand All @@ -101,21 +103,15 @@ ENV ANDROID_ROOT=${ANDROID_ROOT} \
ANDROID_NDK_SYSROOT=${ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/sysroot \
# We specify it in build_input.yml by setting it the first in PATH
PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_SDK_BUILD_TOOLS_PATH}:${ANDROID_NDK_BIN_PATH} \
ANDROID_PROGUARD=/usr/share/java/proguard.jar
ANDROID_R8=${ANDROID_SDK_BUILD_TOOLS_PATH}/lib/d8.jar \
ANDROID_R8_VERSION=${R8_VERSION}

COPY --from=build ${ANDROID_ROOT} ${ANDROID_ROOT}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# android proguard was version 4.7, this is at least 5.2.1 which seems to work with OpenJDK 11
RUN \
apt-get update && \
apt-get install -y --no-install-recommends proguard && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Since dotnet cannot really cross compile, we need to create a "ar" shim for "llvm-ar"
# As long as it's in the path, it will be picked up
echo '#!/usr/bin/env bash' > /usr/bin/ar && \
RUN echo '#!/usr/bin/env bash' > /usr/bin/ar && \
LLVM_AR=$(find /opt/platformsdk/android -iname "llvm-ar" | tail -1) && \
echo "${LLVM_AR} \$*" >> /usr/bin/ar && \
chmod +x /usr/bin/ar
4 changes: 2 additions & 2 deletions server/docker/common-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
environment:
- DYNAMO_HOME${DYNAMO_HOME:+=/dynamo_home}
- DM_DEBUG_COMMANDS
- DM_DEBUG_DISABLE_PROGUARD
- DM_DEBUG_DISABLE_R8
- DM_DEBUG_JOB_FOLDER
- DM_DEBUG_KEEP_JOB_FOLDER
- DM_DEBUG_JOB_UPLOAD
Expand All @@ -37,4 +37,4 @@ services:
command: ["--spring.config.additional-location=file:/etc/defold/extender/", "--spring.profiles.active=local-dev,prometheus${STRUCTURED_LOGGING+,logging}"]
test_remote_builder:
extends: test_builder
command: ["--spring.config.additional-location=file:/etc/defold/extender/", "--spring.profiles.active=local-dev"]
command: ["--spring.config.additional-location=file:/etc/defold/extender/", "--spring.profiles.active=local-dev"]
4 changes: 4 additions & 0 deletions server/src/main/java/com/defold/extender/AsyncBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class AsyncBuilder {
private GradleService gradleService;
private CocoaPodsService cocoaPodsService;
private BuildProgressService buildProgressService;
private R8Configuration r8Configuration;
private File jobResultLocation;
private long resultLifetime;
private boolean keepJobDirectory = false;
Expand All @@ -47,12 +48,14 @@ public AsyncBuilder(DefoldSdkService defoldSdkService,
GradleService gradleService,
Optional<CocoaPodsService> cocoaPodsService,
BuildProgressService buildProgressService,
R8Configuration r8Configuration,
@Value("${extender.job-result.location}") String jobResultLocation,
@Value("${extender.job-result.lifetime:1200000}") long jobResultLifetime) {
this.defoldSdkService = defoldSdkService;
this.gradleService = gradleService;
cocoaPodsService.ifPresent(val -> { this.cocoaPodsService = val; });
this.buildProgressService = buildProgressService;
this.r8Configuration = r8Configuration;
this.jobResultLocation = new File(jobResultLocation);
this.keepJobDirectory = System.getenv("DM_DEBUG_KEEP_JOB_FOLDER") != null || System.getenv("DM_DEBUG_JOB_FOLDER") != null;
this.resultLifetime = jobResultLifetime;
Expand Down Expand Up @@ -114,6 +117,7 @@ public void asyncBuildEngine(MetricsWriter metricsWriter, String platform, Strin
.setBuildDirectory(buildDirectory)
.setMetricsWriter(metricsWriter)
.setProgressReporter(progressReporter)
.setR8Configuration(r8Configuration)
.build();

// Resolve Gradle dependencies and .aar files shipped inside the extensions
Expand Down
Loading