Skip to content

Commit

Permalink
Further changes as done in 3.x branch (to squash)
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed May 24, 2023
1 parent ccee0ad commit d266a51
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 68 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# User-specific configuration and signing key
# User-specific configuration and signing keys
config.sh
*.jks
*.pfx
*.pkcs12

Expand Down
52 changes: 34 additions & 18 deletions build-android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,54 @@ mkdir godot
cd godot
tar xf /root/godot.tar.gz --strip-components=1

# Environment variables and keystore needed for signing store editor build,
# as well as signing and publishing to MavenCentral.
source /root/keystore/config.sh

store_release="yes"
if [ -z "${GODOT_ANDROID_SIGN_KEYSTORE}" ]; then
echo "No keystore provided to sign the Android release editor build, using debug build instead."
store_release="no"
fi

# Classical

dnf -y install gettext

if [ "${CLASSICAL}" == "1" ]; then
echo "Starting classical build for Android..."

$SCONS platform=android arch=arm32 $OPTIONS target=editor store_release=no
$SCONS platform=android arch=arm32 $OPTIONS target=editor store_release=yes
$SCONS platform=android arch=arm32 $OPTIONS target=editor store_release=${store_release}
$SCONS platform=android arch=arm32 $OPTIONS target=editor store_release=${store_release}

$SCONS platform=android arch=arm64 $OPTIONS target=editor store_release=no
$SCONS platform=android arch=arm64 $OPTIONS target=editor store_release=yes
$SCONS platform=android arch=arm64 $OPTIONS target=editor store_release=${store_release}
$SCONS platform=android arch=arm64 $OPTIONS target=editor store_release=${store_release}

$SCONS platform=android arch=x86_32 $OPTIONS target=editor store_release=no
$SCONS platform=android arch=x86_32 $OPTIONS target=editor store_release=yes
$SCONS platform=android arch=x86_32 $OPTIONS target=editor store_release=${store_release}
$SCONS platform=android arch=x86_32 $OPTIONS target=editor store_release=${store_release}

$SCONS platform=android arch=x86_64 $OPTIONS target=editor store_release=no
$SCONS platform=android arch=x86_64 $OPTIONS target=editor store_release=yes
$SCONS platform=android arch=x86_64 $OPTIONS target=editor store_release=${store_release}
$SCONS platform=android arch=x86_64 $OPTIONS target=editor store_release=${store_release}

pushd platform/android/java
./gradlew generateGodotEditor
popd

mkdir -p /root/out/tools
# Copy the generated Android editor binaries (apk & aab).
if [ ! -e bin/android_editor_builds/android_editor-release.apk ]; then
echo "No signed release builds, using debug builds instead."
cp bin/android_editor_builds/android_editor-debug.apk /root/out/tools/android_editor.apk
cp bin/android_editor_builds/android_editor-debug.aab /root/out/tools/android_editor.aab
else
if [ "$store_release" == "yes" ]; then
cp bin/android_editor_builds/android_editor-release.apk /root/out/tools/android_editor.apk
cp bin/android_editor_builds/android_editor-release.aab /root/out/tools/android_editor.aab
else
cp bin/android_editor_builds/android_editor-debug.apk /root/out/tools/android_editor.apk
cp bin/android_editor_builds/android_editor-debug.aab /root/out/tools/android_editor.aab
fi

# Restart from a clean tarball, as we'll copy all the contents
# outside the container for the MavenCentral upload.
rm -rf /root/godot/*
tar xf /root/godot.tar.gz --strip-components=1

$SCONS platform=android arch=arm32 $OPTIONS target=template_debug
$SCONS platform=android arch=arm32 $OPTIONS target=template_release

Expand All @@ -63,11 +77,13 @@ if [ "${CLASSICAL}" == "1" ]; then
pushd platform/android/java
./gradlew generateGodotTemplates

# Push (but don't release) the Godot Android library to MavenCentral
./gradlew publishTemplateReleasePublicationToSonatypeRepository --max-workers 1 closeSonatypeStagingRepository
# Copy the godot archive, it'll be used to release the Godot Android library to MavenCentral
cp /root/godot.tar.gz /root/out/tools/

if [ "$store_release" == "yes" ]; then
# Copy source folder with compiled libs so we can optionally use it
# in a separate script to upload the templates to MavenCentral.
cp -r /root/godot /root/out/source/
# Backup ~/.gradle too so we can reuse all the downloaded stuff.
cp -r /root/.gradle /root/out/source/.gradle
fi
popd

mkdir -p /root/out/templates
Expand Down
19 changes: 19 additions & 0 deletions build-android/upload-mavencentral.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#/bin/bash

basedir="$(pwd)"

if [ ! -d "${basedir}/deps/keystore" ]; then
echo "Couldn't find ${basedir}/deps/keystore. Make sure to run this from the root folder of the Git repository."
fi

source ${basedir}/deps/keystore/config.sh

# Release the Godot Android library to MavenCentral
${PODMAN} run -it --rm \
-v ${basedir}/out/android/source:/root/godot -v ${basedir}/deps/keystore:/root/keystore \
localhost/godot-android:${IMAGE_VERSION} bash -c \
"source /root/keystore/config.sh && \
cp -r /root/godot/.gradle /root && \
cd /root/godot/platform/android/java && \
./gradlew publishTemplateReleasePublicationToSonatypeRepository --max-workers 1 closeSonatypeStagingRepository && \
./gradlew findSonatypeStagingRepository --max-workers 1 releaseSonatypeStagingRepository"
11 changes: 0 additions & 11 deletions build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,6 @@ if [ "${build_classical}" == "1" ]; then

# Lib for direct download
cp out/android/templates/godot-lib.template_release.aar ${reldir}/godot-lib.${templates_version}.template_release.aar
# Release the Godot Android library to MavenCentral
cp out/android/tools/godot.tar.gz ${tmpdir}/
pushd ${tmpdir}
rm -rf godot
mkdir godot
cd godot
tar xf ../godot.tar.gz --strip-components=1
pushd platform/android/java
./gradlew findSonatypeStagingRepository --max-workers 1 releaseSonatypeStagingRepository
popd
popd

# Editor
binname="${godot_basename}_android_editor.apk"
Expand Down
28 changes: 15 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,7 @@ while getopts "h?r:u:p:v:g:b:fsc" opt; do
esac
done

export podman=none
if which podman > /dev/null; then
export podman=podman
elif which docker > /dev/null; then
export podman=docker
fi

if [ "${podman}" == "none" ]; then
echo "Either podman or docker needs to be installed"
exit 1
fi
export podman=${PODMAN}

if [ $UID != 0 ]; then
echo "WARNING: Running as non-root may cause problems for the uwp build"
Expand Down Expand Up @@ -150,6 +140,18 @@ if [ ! -d "deps/vulkansdk-macos" ]; then
echo "Missing Vulkan SDK for macOS, we're going to run into issues!"
fi

# Keystore for Android editor signing
# Optional - the config.sh will be copied but if it's not filled in,
# it will do an unsigned build.
if [ ! -d "deps/keystore" ]; then
mkdir -p deps/keystore
cp config.sh deps/keystore/
if [ ! -z "$GODOT_ANDROID_SIGN_KEYSTORE" ]; then
cp "$GODOT_ANDROID_SIGN_KEYSTORE" deps/keystore/
sed -i deps/keystore/config.sh -e "s@$GODOT_ANDROID_SIGN_KEYSTORE@/root/keystore/$GODOT_ANDROID_SIGN_KEYSTORE@"
fi
fi

if [ "${skip_git_checkout}" == 0 ]; then
git clone https://github.com/godotengine/godot git || /bin/true
pushd git
Expand Down Expand Up @@ -183,7 +185,7 @@ mkdir -p ${basedir}/out/logs
mkdir -p ${basedir}/mono-glue

export podman_run="${podman} run -it --rm --env BUILD_NAME --env GODOT_VERSION_STATUS --env NUM_CORES --env CLASSICAL=${build_classical} --env MONO=${build_mono} -v ${basedir}/godot-${godot_version}.tar.gz:/root/godot.tar.gz -v ${basedir}/mono-glue:/root/mono-glue -w /root/"
export img_version=4.x-f36
export img_version=$IMAGE_VERSION

mkdir -p ${basedir}/mono-glue
${podman_run} -v ${basedir}/build-mono-glue:/root/build localhost/godot-linux:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/mono-glue
Expand All @@ -201,7 +203,7 @@ mkdir -p ${basedir}/out/macos
${podman_run} -v ${basedir}/build-macos:/root/build -v ${basedir}/out/macos:/root/out -v ${basedir}/deps/vulkansdk-macos:/root/vulkansdk localhost/godot-osx:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/macos

mkdir -p ${basedir}/out/android
${podman_run} -v ${basedir}/build-android:/root/build -v ${basedir}/out/android:/root/out localhost/godot-android:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/android
${podman_run} -v ${basedir}/build-android:/root/build -v ${basedir}/out/android:/root/out -v ${basedir}/deps/keystore:/root/keystore localhost/godot-android:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/android

mkdir -p ${basedir}/out/ios
${podman_run} -v ${basedir}/build-ios:/root/build -v ${basedir}/out/ios:/root/out localhost/godot-ios:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/ios
Expand Down
62 changes: 37 additions & 25 deletions config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@
# Configuration file for user-specific details.
# This file is gitignore'd and will be sourced by build scripts.

# Note: For passwords or GPG keys, make sure that special characters such
# as $ won't be expanded, by using single quotes to enclose the string,
# or escaping with \$.

# These scripts are designed and tested against podman. They may also work
# with docker, but it's not guaranteed. You can set this variable to the
# relevant tool in your PATH or an absolute path to run it from.
export PODMAN='podman'

# Registry for build containers.
# The default registry is the one used for official Godot builds.
# Note that some of its images are private and only accessible to selected
# contributors.
# You can build your own registry with scripts at
# https://github.com/godotengine/build-containers
export REGISTRY="registry.prehensile-tales.com"
export REGISTRY='registry.prehensile-tales.com'

# Version string of the images to use in build.sh.
export IMAGE_VERSION='4.x-f36'

# Default build name used to distinguish between official and custom builds.
export BUILD_NAME="custom_build"
export BUILD_NAME='custom_build'

# Default number of parallel cores for each build.
export NUM_CORES=16
Expand All @@ -21,50 +33,50 @@ export NUM_CORES=16
# If you do not fill all SIGN_* fields, signing will be skipped.

# Path to pkcs12 archive.
export SIGN_KEYSTORE=""
export SIGN_KEYSTORE=''

# Password for the private key.
export SIGN_PASSWORD=""
export SIGN_PASSWORD=''

# Name and URL of the signed application.
# Use your own when making a thirdparty build.
export SIGN_NAME=""
export SIGN_URL=""
export SIGN_NAME=''
export SIGN_URL=''

# Hostname or IP address of an macOS host (Needed for signing)
# eg "user@10.1.0.10"
export OSX_HOST=""
# Hostname or IP address of an OSX host (Needed for signing)
# eg 'user@10.1.0.10'
export OSX_HOST=''
# ID of the Apple certificate used to sign
export OSX_KEY_ID=""
export OSX_KEY_ID=''
# Bundle id for the signed app
export OSX_BUNDLE_ID=""
export OSX_BUNDLE_ID=''
# Username/password for Apple's signing APIs (used for atltool)
export APPLE_ID=""
export APPLE_ID_PASSWORD=""
export APPLE_ID=''
export APPLE_ID_PASSWORD=''

# NuGet source for publishing .NET packages
export NUGET_SOURCE="nuget.org"
export NUGET_SOURCE='nuget.org'
# API key for publishing NuGet packages to nuget.org
export NUGET_API_KEY=""
export NUGET_API_KEY=''

# MavenCentral (sonatype) credentials
export OSSRH_GROUP_ID=""
export OSSRH_USERNAME=""
export OSSRH_PASSWORD=""
export OSSRH_GROUP_ID=''
export OSSRH_USERNAME=''
export OSSRH_PASSWORD=''
# Sonatype assigned ID used to upload the generated artifacts
export SONATYPE_STAGING_PROFILE_ID=""
export SONATYPE_STAGING_PROFILE_ID=''
# Used to sign the artifacts after they're built
# ID of the GPG key pair, the last eight characters of its fingerprint
export SIGNING_KEY_ID=""
export SIGNING_KEY_ID=''
# Passphrase of the key pair
export SIGNING_PASSWORD=""
export SIGNING_PASSWORD=''
# Base64 encoded private GPG key
export SIGNING_KEY=""
export SIGNING_KEY=''

# Android signing configs
# Path to the Android keystore file used to sign the release build
export GODOT_ANDROID_SIGN_KEYSTORE=""
export GODOT_ANDROID_SIGN_KEYSTORE=''
# Key alias used for signing the release build
export GODOT_ANDROID_KEYSTORE_ALIAS=""
export GODOT_ANDROID_KEYSTORE_ALIAS=''
# Password for the key used for signing the release build
export GODOT_ANDROID_SIGN_PASSWORD=""
export GODOT_ANDROID_SIGN_PASSWORD=''

0 comments on commit d266a51

Please sign in to comment.