Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .github/autobuild/android-dependencies_qt5-play-store.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# shellcheck disable=SC2034
COMMANDLINETOOLS_VERSION=6858069
ANDROID_NDK_VERSION=r21d
ANDROID_PLATFORM=android-36
ANDROID_BUILD_TOOLS=36.0.0
AQTINSTALL_VERSION=3.3.0
ANDROID_JAVA_VERSION=17
QT_VERSION=5.15.2
13 changes: 13 additions & 0 deletions .github/autobuild/android-dependencies_qt5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# The following version pinnings are semi-automatically checked for updates.
# Verify .github/workflows/bump-dependencies.yml when changing those manually:

# Values are consumed by android.sh and the dependency cache key.
# shellcheck disable=SC2034
COMMANDLINETOOLS_VERSION=6858069
ANDROID_NDK_VERSION=r21d
ANDROID_PLATFORM=android-30
ANDROID_BUILD_TOOLS=30.0.2
AQTINSTALL_VERSION=3.3.0
ANDROID_JAVA_VERSION=8
QT_VERSION=5.15.2
13 changes: 13 additions & 0 deletions .github/autobuild/android-dependencies_qt6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# The following version pinnings are semi-automatically checked for updates.
# Verify .github/workflows/bump-dependencies.yml when changing those manually:

# Values are consumed by android.sh and the dependency cache key.
# shellcheck disable=SC2034
COMMANDLINETOOLS_VERSION=6858069
ANDROID_NDK_VERSION=r27d
ANDROID_PLATFORM=android-36
ANDROID_BUILD_TOOLS=36.0.0
AQTINSTALL_VERSION=3.3.0
ANDROID_JAVA_VERSION=17
QT_VERSION=6.10.2
92 changes: 92 additions & 0 deletions .github/autobuild/android-output-paths.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash
##############################################################################
# Copyright (c) 2026
#
# Author(s):
# Peter L Jones <peter.l.jones.dymlyd@gmail.com>
# The Jamulus Development Team
#
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################

# Sourced by android.sh and tools/android-build.sh. Requires PROJECT_DIR to be set.

absolute_path() {
realpath -m -- "$1"
}

BUILD_ROOT="$(absolute_path "${JAMULUS_ANDROID_BUILD_DIR:-${PROJECT_DIR}/android-build}")"
readonly BUILD_ROOT
DEPLOY_DIR="$(absolute_path "${JAMULUS_ANDROID_DEPLOY_DIR:-${PROJECT_DIR}/deploy}")"
readonly DEPLOY_DIR
readonly -a LEGACY_ANDROID_OUTPUTS=(
"${PROJECT_DIR}/debug"
"${PROJECT_DIR}/release"
"${PROJECT_DIR}/build"
"${PROJECT_DIR}/qmake_qmake_qm_files.qrc"
"${PROJECT_DIR}/.qm"
)

path_is_within() {
local path="$1"
local root="$2"
[[ "$path" == "$root" || "$path" == "$root/"* ]]
}

validate_android_output_paths() {
local generated_path
local output_path
local signing_path
local canonical_path
local -a output_paths=("$BUILD_ROOT" "$DEPLOY_DIR")

for output_path in "${output_paths[@]}"; do
[[ "$output_path" != / && "$output_path" != "$PROJECT_DIR" && "$PROJECT_DIR" != "$output_path/"* ]] || {
echo "Refusing unsafe Android output path: $output_path" >&2
exit 1
}
for generated_path in "${LEGACY_ANDROID_OUTPUTS[@]}"; do
canonical_path="$(absolute_path "$generated_path")" || {
echo "Failed to resolve Android output path: $generated_path" >&2
exit 1
}
if path_is_within "$output_path" "$canonical_path"; then
echo "Android output path overlaps legacy generated output: $output_path" >&2
exit 1
fi
done
done

if path_is_within "$BUILD_ROOT" "$DEPLOY_DIR" || path_is_within "$DEPLOY_DIR" "$BUILD_ROOT"; then
echo "Android build and deploy output paths must not overlap" >&2
exit 1
fi

for signing_path in "${JAMULUS_ANDROID_KEYSTORE:-}" "${JAMULUS_ANDROID_DEV_KEYSTORE:-}" "${JAMULUS_ANDROID_DEBUG_KEYSTORE:-}"; do
[[ -n "$signing_path" ]] || continue
canonical_path="$(absolute_path "$signing_path")" || {
echo "Failed to resolve Android signing file path: $signing_path" >&2
exit 1
}
for output_path in "${output_paths[@]}" "${LEGACY_ANDROID_OUTPUTS[@]}" "${PROJECT_DIR}/play-store" "${PROJECT_DIR}/android/play-store/build" "${PROJECT_DIR}/android/play-store/.gradle"; do
if path_is_within "$canonical_path" "$output_path"; then
echo "Android signing file must not be inside a generated output path: $signing_path" >&2
exit 1
fi
done
done
}
42 changes: 42 additions & 0 deletions .github/autobuild/android-package-default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
##############################################################################
# Copyright (c) 2026
#
# Author(s):
# Peter L Jones <peter.l.jones.dymlyd@gmail.com>
# The Jamulus Development Team
#
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################

# Sourced by .github/workflows/autobuild.yml and tools/android-build.sh so
# both derive the same default Android application ID.

# Lower-cases one segment, replaces characters invalid in a Java package
# segment with "_" and prefixes "x" when it does not start with a letter.
android_package_name_segment() {
local s
s="$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')"
s="${s//[^a-z0-9_]/_}"
[[ "$s" =~ ^[a-z] ]] || s="x${s}"
printf '%s' "$s"
}

# Usage: android_default_package_name OWNER REPO
android_default_package_name() {
printf 'app.%s.%s' "$(android_package_name_segment "$1")" "$(android_package_name_segment "$2")"
}
56 changes: 56 additions & 0 deletions .github/autobuild/android-play-store.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
##############################################################################
# Copyright (c) 2026
#
# Author(s):
# The Jamulus Development Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
#
# Select the single Qt 5 release App Bundle for Google Play upload.
# Usage: android-play-store.sh [INPUT_DIR [OUTPUT_DIR]] (default: deploy play-store)

set -eu

set -o pipefail

PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
readonly PROJECT_DIR
readonly INPUT_DIR="${1:-${JAMULUS_ANDROID_DEPLOY_DIR:-${PROJECT_DIR}/deploy}}"
readonly OUTPUT_DIR="${2:-${PROJECT_DIR}/play-store}"

[[ -d "$INPUT_DIR" ]] || {
echo "Input directory does not exist: $INPUT_DIR" >&2
exit 1
}

# Debug bundles and the Qt 6 APK ZIPs are never uploadable.
mapfile -t BUNDLES < <(find "$INPUT_DIR" -maxdepth 1 -type f -name 'jamulus_*_android_release_qt5.aab' -print)
if [[ ${#BUNDLES[@]} -ne 1 ]]; then
echo "Expected exactly one Qt 5 release Android App Bundle in ${INPUT_DIR}, found ${#BUNDLES[@]}" >&2
exit 1
fi

mkdir -p "$OUTPUT_DIR"
rm -f -- "${OUTPUT_DIR}"/*.aab
cp -- "${BUNDLES[0]}" "${OUTPUT_DIR}/"
release_file="${OUTPUT_DIR}/$(basename "${BUNDLES[0]}")"

if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
echo "release_file=${release_file}" >> "$GITHUB_OUTPUT"
else
echo "$release_file"
fi
Loading
Loading