Skip to content

Commit 0e1d4ba

Browse files
authored
Merge branch 'main' into feature/xr/creation-screen
2 parents 9f5c213 + 635be59 commit 0e1d4ba

13 files changed

+329
-51
lines changed

build_presubmit.sh renamed to build_presubmit_mobile.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ echo "INFO: Cleaning the project..."
9898
echo "INFO: Building the Android production release bundle..."
9999
./gradlew app:bundleRelease app:spdxSbomForRelease -x test -x uploadCrashlyticsMappingFileRelease -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
100100

101-
echo "INFO: Building the Wear OS production release bundle..."
102-
./gradlew wear:bundleRelease -x test -x uploadCrashlyticsMappingFileRelease -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
103-
104101
# --- Artifact Collection ---
105102
echo "INFO: Preparing artifacts for Kokoro..."
106103

@@ -125,21 +122,6 @@ collect_artifacts() {
125122
cp "${aab_path}" "${artifact_dest_dir}/${aab_dest_file}"
126123
echo "SUCCESS: AAB copied to ${artifact_dest_dir}"
127124

128-
# Find and list the files before copying
129-
# Store the find results in a variable to avoid running find twice
130-
# and to handle the case where no files are found gracefully.
131-
local intoto_files
132-
intoto_files=$(find . -type f -name "*.intoto.jsonl")
133-
134-
if [ -n "$intoto_files" ]; then
135-
echo "INFO: Found the following .intoto.jsonl files:"
136-
echo "$intoto_files" # This will list each file on a new line
137-
echo "INFO: Copying .intoto.jsonl files to ${artifact_dest_dir}/"
138-
# Use print0 and xargs -0 for safe handling of filenames with spaces or special characters
139-
find . -type f -name "*.intoto.jsonl" -print0 | xargs -0 -I {} cp {} "${artifact_dest_dir}/"
140-
else
141-
echo "INFO: No .intoto.jsonl files found."
142-
fi
143125
else
144126
echo "FAILURE: AAB not found at ${aab_path}"
145127
exit 1
@@ -153,7 +135,4 @@ collect_artifacts "app/build/outputs/bundle/release" "app-release.aab" "app-rele
153135
echo "INFO: Copying SPDX SBOM..."
154136
cp app/build/spdx/release.spdx.json "${KOKORO_ARTIFACTS_DIR}/artifacts/app-release.spdx.json"
155137

156-
# Collect the Wear OS application artifacts
157-
collect_artifacts "wear/build/outputs/bundle/release" "wear-release.aab" "wear-release-unsigned.aab"
158-
159138
exit 0

build_presubmit_wear.sh

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2025 The Android Open Source Project
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# IGNORE this file, it's only used in the internal Google release process
19+
# Fail on any error to ensure the script stops if a step fails.
20+
set -e
21+
22+
# --- Configuration ---
23+
# Get the script's directory.
24+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25+
echo DIR
26+
# Define the Android SDK version you want to target.
27+
ANDROID_SDK_VERSION="36"
28+
ANDROID_BUILD_TOOLS_VERSION="36.0.0"
29+
30+
# Switched from 'google_apis' to 'google_atd' (Google Automated Test Device).
31+
# This system image is designed for headless, automated testing in CI environments
32+
# and is more compatible with software rendering. It will be installed but may not
33+
# be used by the new build command.
34+
# 36 not available yet as per b/432143095
35+
EMULATOR_IMAGE="system-images;android-35;google_atd;x86_64"
36+
37+
# --- Environment Setup ---
38+
39+
# Step 1: Check for essential command-line tools.
40+
echo "INFO: Checking for prerequisites (wget, unzip, tar)..."
41+
for cmd in wget unzip tar; do
42+
if ! command -v $cmd &> /dev/null; then
43+
echo "ERROR: Command '$cmd' not found. Please install it using your system's package manager (e.g., 'sudo apt-get install $cmd') and try again."
44+
exit 1
45+
fi
46+
done
47+
echo "INFO: Prerequisites are installed."
48+
49+
50+
# Step 2: Install and configure Java 17 system-wide.
51+
echo "INFO: Setting up Java 17..."
52+
# The build needs Java 17, set it as the default Java version.
53+
sudo apt-get update
54+
sudo apt-get install -y openjdk-17-jdk
55+
sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
56+
java -version
57+
58+
# Also clear JAVA_HOME variable so java -version is used instead
59+
export JAVA_HOME=
60+
61+
# Add the local SDK and emulator tools to the PATH for this session.
62+
# The system-wide Java will already be in the PATH.
63+
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator"
64+
echo "INFO: Local tools added to PATH."
65+
66+
# Now, accept licenses and install packages.
67+
# It's best practice to accept licenses *after* the tools are in place.
68+
echo "INFO: Accepting all pending SDK licenses..."
69+
yes | sdkmanager --licenses
70+
71+
echo "INFO: Installing Android SDK packages, including emulator and system image..."
72+
# This single command will install/update all necessary packages.
73+
sdkmanager "platforms;android-${ANDROID_SDK_VERSION}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "${EMULATOR_IMAGE}" "emulator"
74+
75+
# Run license acceptance AGAIN after installing new packages. This is crucial.
76+
echo "INFO: Accepting licenses for newly installed packages..."
77+
yes | sdkmanager --licenses
78+
79+
echo "Copying google-services.json"
80+
cp /tmpfs/src/git/androidify-prebuilts/google-services.json ${DIR}/app
81+
82+
echo "Copying gradle.properties"
83+
echo "" >> ${DIR}/gradle.properties # add a new line to the file
84+
cat /tmpfs/src/git/androidify-prebuilts/gradle.properties >> ${DIR}/gradle.properties
85+
ls
86+
87+
# --- Build Process ---
88+
89+
# This script assembles the release build of the Android application.
90+
# Ensure gradlew is executable
91+
chmod +x ./gradlew
92+
93+
# Clean the project (optional, but good for a fresh release build)
94+
echo "INFO: Cleaning the project..."
95+
./gradlew clean -Pandroid.sdk.path=$ANDROID_HOME
96+
97+
echo "INFO: Building the Wear OS production release bundle..."
98+
./gradlew wear:bundleRelease -x test -x uploadCrashlyticsMappingFileRelease -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
99+
100+
# --- Artifact Collection ---
101+
echo "INFO: Preparing artifacts for Kokoro..."
102+
103+
# This function collects a specific AAB and its associated in-toto files.
104+
# Arguments:
105+
# $1: Source directory for the AAB (e.g., "app/build/outputs/bundle/release")
106+
# $2: Source filename for the AAB (e.g., "app-release.aab")
107+
# $3: Destination filename for the AAB (e.g., "app-release-unsigned.aab")
108+
collect_artifacts() {
109+
local aab_src_dir="$1"
110+
local aab_file="$2"
111+
local aab_dest_file="$3"
112+
local aab_path="${aab_src_dir}/${aab_file}"
113+
114+
# Check if the AAB exists
115+
if [[ -f "$aab_path" ]]; then
116+
# Create a directory within Kokoro's artifact collection area
117+
local artifact_dest_dir="${KOKORO_ARTIFACTS_DIR}/artifacts"
118+
mkdir -p "${artifact_dest_dir}"
119+
120+
# Copy the AAB
121+
cp "${aab_path}" "${artifact_dest_dir}/${aab_dest_file}"
122+
echo "SUCCESS: AAB copied to ${artifact_dest_dir}"
123+
124+
125+
else
126+
echo "FAILURE: AAB not found at ${aab_path}"
127+
exit 1
128+
fi
129+
}
130+
131+
# Collect the Wear OS application artifacts
132+
collect_artifacts "wear/build/outputs/bundle/release" "wear-release.aab" "wear-release-unsigned.aab"
133+
134+
exit 0

build.sh renamed to build_release_mobile.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ echo "INFO: Cleaning the project..."
9696
echo "INFO: Building the Android production release bundle..."
9797
./gradlew app:bundleRelease app:spdxSbomForRelease -x test -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
9898

99-
echo "INFO: Building the Wear OS production release bundle..."
100-
./gradlew wear:bundleRelease -x test -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
101-
10299
# --- Artifact Collection ---
103100
echo "INFO: Preparing artifacts for Kokoro..."
104101

@@ -123,21 +120,6 @@ collect_artifacts() {
123120
cp "${aab_path}" "${artifact_dest_dir}/${aab_dest_file}"
124121
echo "SUCCESS: AAB copied to ${artifact_dest_dir}"
125122

126-
# Find and list the files before copying
127-
# Store the find results in a variable to avoid running find twice
128-
# and to handle the case where no files are found gracefully.
129-
local intoto_files
130-
intoto_files=$(find . -type f -name "*.intoto.jsonl")
131-
132-
if [ -n "$intoto_files" ]; then
133-
echo "INFO: Found the following .intoto.jsonl files:"
134-
echo "$intoto_files" # This will list each file on a new line
135-
echo "INFO: Copying .intoto.jsonl files to ${artifact_dest_dir}/"
136-
# Use print0 and xargs -0 for safe handling of filenames with spaces or special characters
137-
find . -type f -name "*.intoto.jsonl" -print0 | xargs -0 -I {} cp {} "${artifact_dest_dir}/"
138-
else
139-
echo "INFO: No .intoto.jsonl files found."
140-
fi
141123
else
142124
echo "FAILURE: AAB not found at ${aab_path}"
143125
exit 1
@@ -151,7 +133,4 @@ collect_artifacts "app/build/outputs/bundle/release" "app-release.aab" "app-rele
151133
echo "INFO: Copying SPDX SBOM..."
152134
cp app/build/spdx/release.spdx.json "${KOKORO_ARTIFACTS_DIR}/artifacts/app-release.spdx.json"
153135

154-
# Collect the Wear OS application artifacts
155-
collect_artifacts "wear/build/outputs/bundle/release" "wear-release.aab" "wear-release-unsigned.aab"
156-
157136
exit 0

build_release_wear.sh

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2025 The Android Open Source Project
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# IGNORE this file, it's only used in the internal Google release process
19+
# Fail on any error to ensure the script stops if a step fails.
20+
set -e
21+
22+
# --- Configuration ---
23+
# Get the script's directory.
24+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25+
# Define the Android SDK version you want to target.
26+
ANDROID_SDK_VERSION="36"
27+
ANDROID_BUILD_TOOLS_VERSION="36.0.0"
28+
29+
# Switched from 'google_apis' to 'google_atd' (Google Automated Test Device).
30+
# This system image is designed for headless, automated testing in CI environments
31+
# and is more compatible with software rendering. It will be installed but may not
32+
# be used by the new build command.
33+
# 36 not available yet as per b/432143095
34+
EMULATOR_IMAGE="system-images;android-35;google_atd;x86_64"
35+
36+
# --- Environment Setup ---
37+
38+
# Step 1: Check for essential command-line tools.
39+
echo "INFO: Checking for prerequisites (wget, unzip, tar)..."
40+
for cmd in wget unzip tar; do
41+
if ! command -v $cmd &> /dev/null; then
42+
echo "ERROR: Command '$cmd' not found. Please install it using your system's package manager (e.g., 'sudo apt-get install $cmd') and try again."
43+
exit 1
44+
fi
45+
done
46+
echo "INFO: Prerequisites are installed."
47+
48+
49+
# Step 2: Install and configure Java 17 system-wide.
50+
echo "INFO: Setting up Java 17..."
51+
# The build needs Java 17, set it as the default Java version.
52+
sudo apt-get update
53+
sudo apt-get install -y openjdk-17-jdk
54+
sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
55+
java -version
56+
57+
# Also clear JAVA_HOME variable so java -version is used instead
58+
export JAVA_HOME=
59+
60+
# Add the local SDK and emulator tools to the PATH for this session.
61+
# The system-wide Java will already be in the PATH.
62+
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator"
63+
echo "INFO: Local tools added to PATH."
64+
65+
# Now, accept licenses and install packages.
66+
# It's best practice to accept licenses *after* the tools are in place.
67+
echo "INFO: Accepting all pending SDK licenses..."
68+
yes | sdkmanager --licenses
69+
70+
echo "INFO: Installing Android SDK packages, including emulator and system image..."
71+
# This single command will install/update all necessary packages.
72+
sdkmanager "platforms;android-${ANDROID_SDK_VERSION}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "${EMULATOR_IMAGE}" "emulator"
73+
74+
# Run license acceptance AGAIN after installing new packages. This is crucial.
75+
echo "INFO: Accepting licenses for newly installed packages..."
76+
yes | sdkmanager --licenses
77+
78+
echo "Copying google-services.json"
79+
cp /tmpfs/src/git/androidify-prebuilts/google-services.json ${DIR}/app
80+
81+
echo "Copying gradle.properties"
82+
echo "" >> ${DIR}/gradle.properties # add a new line to the file
83+
cat /tmpfs/src/git/androidify-prebuilts/gradle.properties >> ${DIR}/gradle.properties
84+
85+
# --- Build Process ---
86+
87+
# This script assembles the release build of the Android application.
88+
# Ensure gradlew is executable
89+
chmod +x ./gradlew
90+
91+
# Clean the project (optional, but good for a fresh release build)
92+
echo "INFO: Cleaning the project..."
93+
./gradlew clean -Pandroid.sdk.path=$ANDROID_HOME
94+
95+
echo "INFO: Building the Wear OS production release bundle..."
96+
./gradlew wear:bundleRelease -x test -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
97+
98+
# --- Artifact Collection ---
99+
echo "INFO: Preparing artifacts for Kokoro..."
100+
101+
# This function collects a specific AAB and its associated in-toto files.
102+
# Arguments:
103+
# $1: Source directory for the AAB (e.g., "app/build/outputs/bundle/release")
104+
# $2: Source filename for the AAB (e.g., "app-release.aab")
105+
# $3: Destination filename for the AAB (e.g., "app-release-unsigned.aab")
106+
collect_artifacts() {
107+
local aab_src_dir="$1"
108+
local aab_file="$2"
109+
local aab_dest_file="$3"
110+
local aab_path="${aab_src_dir}/${aab_file}"
111+
112+
# Check if the AAB exists
113+
if [[ -f "$aab_path" ]]; then
114+
# Create a directory within Kokoro's artifact collection area
115+
local artifact_dest_dir="${KOKORO_ARTIFACTS_DIR}/artifacts"
116+
mkdir -p "${artifact_dest_dir}"
117+
118+
# Copy the AAB
119+
cp "${aab_path}" "${artifact_dest_dir}/${aab_dest_file}"
120+
echo "SUCCESS: AAB copied to ${artifact_dest_dir}"
121+
122+
else
123+
echo "FAILURE: AAB not found at ${aab_path}"
124+
exit 1
125+
fi
126+
}
127+
128+
# Collect the Wear OS application artifacts
129+
collect_artifacts "wear/build/outputs/bundle/release" "wear-release.aab" "wear-release-unsigned.aab"
130+
131+
exit 0

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
# build
3-
appVersionCode = "6"
4-
appVersionName = "1.1.4"
3+
appVersionCode = "7"
4+
appVersionName = "1.2.0"
55
agp = "8.11.1"
66
bcpkixJdk18on = "1.81"
77
compileSdk = "36"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Fail on any error.
4+
set -e
5+
6+
# Display commands being run.
7+
# WARNING: please only enable 'set -x' if necessary for debugging, and be very
8+
# careful if you handle credentials (e.g. from Keystore) with 'set -x':
9+
# statements like "export VAR=$(cat /tmp/keystore/credentials)" will result in
10+
# the credentials being printed in build logs.
11+
# Additionally, recursive invocation with credentials as command-line
12+
# parameters, will print the full command, with credentials, in the build logs.
13+
# set -x
14+
15+
# Code under repo is checked out to ${KOKORO_ARTIFACTS_DIR}/github.
16+
# The final directory name in this path is determined by the scm name specified
17+
# in the job configuration.
18+
cd "${KOKORO_ARTIFACTS_DIR}/github/androidify"
19+
./build_presubmit_mobile.sh

kokoro/gcp_ubuntu_docker/kokoro_presubmit_build.sh renamed to kokoro/gcp_ubuntu_docker/kokoro_build_mobile_release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ set -e
1616
# The final directory name in this path is determined by the scm name specified
1717
# in the job configuration.
1818
cd "${KOKORO_ARTIFACTS_DIR}/github/androidify"
19-
./build_presubmit.sh
19+
./build_release_mobile.sh

0 commit comments

Comments
 (0)