1#!/bin/bash
2set -e
3
4echo "Starting $0 at $(date)"
5
6cd "$(dirname $0)/.."
7
8# This target is for testing that clean builds work correctly
9# We disable the remote cache for this target unless it was already enabled
10if [ "$USE_ANDROIDX_REMOTE_BUILD_CACHE" == "" ]; then
11  export USE_ANDROIDX_REMOTE_BUILD_CACHE=false
12fi
13
14EXIT_VALUE=0
15
16# Validate translation exports, if present
17if ! busytown/impl/check_translations.sh; then
18  EXIT_VALUE=1
19else
20  # Run Gradle
21  # If/when we enable desktop, enable VerifyDependencyVersionsTask.kt/shouldVerifyConfiguration
22  if ! busytown/impl/build.sh buildOnServer createAllArchives checkExternalLicenses listTaskOutputs exportSboms \
23      -Pandroidx.enableComposeCompilerMetrics=true \
24      -Pandroidx.enableComposeCompilerReports=true \
25      --no-daemon "$@"; then
26    EXIT_VALUE=1
27  else
28    # Run merge-kzips only if Gradle succeeds. Script merges kzips outputted by bOS task
29    busytown/impl/merge-kzips.sh || EXIT_VALUE=1
30  fi
31
32  # Parse performance profile reports (generated with the --profile option) and re-export
33  # the metrics in an easily machine-readable format for tracking
34  busytown/impl/parse_profile_data.sh
35fi
36
37echo "Completing $0 at $(date) with exit value $EXIT_VALUE"
38
39exit "$EXIT_VALUE"
40