@@ -95,7 +95,7 @@ echo "INFO: Cleaning the project..."
9595
9696# Build the production release bundle without generating a baseline profile.
9797echo " INFO: Building the production release bundle..."
98- ./gradlew app:bundleRelease -x test -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
98+ ./gradlew app:bundleRelease app:spdxSbomForRelease -x test -Pandroid.sdk.path=$ANDROID_HOME -PCI_BUILD=true
9999
100100# --- Artifact Collection ---
101101echo " INFO: Preparing artifacts for Kokoro..."
@@ -116,17 +116,26 @@ if [[ -f "$AAB_PATH" ]]; then
116116 cp " ${AAB_PATH} " " ${ARTIFACT_DEST_DIR} /app-release-unsigned.aab"
117117 echo " SUCCESS: AAB copied to ${ARTIFACT_DEST_DIR} "
118118
119- # Copy any .intointo.jsonl files to the artifact directory
120- echo " INFO: Searching for and copying .intointo.jsonl files..."
121- ls
122- echo " INFO: Logging output directory contents"
123- ls " $AAB_SRC_DIR /"
124- find . -type f -name " *.intointo.jsonl" -print0 | xargs -0 -I {} cp {} " ${ARTIFACT_DEST_DIR} /"
125- echo " INFO: Finished copying .intointo.jsonl files."
119+ # Find and list the files before copying
120+ # Store the find results in a variable to avoid running find twice
121+ # and to handle the case where no files are found gracefully.
122+ intoto_files=$( find . -type f -name " *.intoto.jsonl" )
123+
124+ if [ -n " $intoto_files " ]; then
125+ echo " INFO: Found the following .intoto.jsonl files:"
126+ echo " $intoto_files " # This will list each file on a new line
127+ echo " INFO: Copying .intoto.jsonl files to ${ARTIFACT_DEST_DIR} /"
128+ # Use print0 and xargs -0 for safe handling of filenames with spaces or special characters
129+ find . -type f -name " *.intoto.jsonl" -print0 | xargs -0 -I {} cp {} " ${ARTIFACT_DEST_DIR} /"
130+ else
131+ echo " INFO: No .intoto.jsonl files found."
132+ fi
126133
127- else
128- echo " FAILURE: AAB not found at ${AAB_PATH} "
129- # Optionally fail the build: exit 1
130- fi
134+ echo " INFO: Copying SPDX SBOM..."
135+ # The output file from app:spdxSbomForRelease is build/spdx/release.spdx.json
136+ cp app/build/spdx/release.spdx.json " ${KOKORO_ARTIFACTS_DIR} /artifacts/app-release.spdx.json"
131137
132- exit 0
138+ else
139+ echo " FAILURE: AAB not found at ${AAB_PATH} "
140+ exit 1
141+ fi
0 commit comments