diff --git a/application/common/models/Build.php b/application/common/models/Build.php index 6353ea9..775ba87 100644 --- a/application/common/models/Build.php +++ b/application/common/models/Build.php @@ -52,6 +52,7 @@ class Build extends BuildBase implements Linkable, ArtifactsProvider const ARTIFACT_ASSET_PACKAGE="asset-package"; const ARTIFACT_ASSET_PREVIEW="asset-preview"; const ARTIFACT_ASSET_NOTIFY="asset-notify"; + const ARTIFACT_DATA_SAFETY_CSV="data-safety-csv"; /** * Array of valid status transitions. The key is the starting @@ -212,6 +213,7 @@ public function artifacts() { } $this->addIfSet($artifacts, self::ARTIFACT_ENCRYPTED_KEY, $this->encryptedKey()); $this->addIfSet($artifacts, self::ARTIFACT_ABOUT, $this->about()); + $this->addIfSet( $artifacts, self::ARTIFACT_DATA_SAFETY_CSV, $this->dataSafetyCsv()); } if (strpos($this->targets, "play-listing") !== false) { @@ -432,6 +434,8 @@ public function artifactType($key) { } else if (preg_match("/play-listing\/manifest.json$/", $key)) { $type = self::ARTIFACT_PLAY_LISTING_MANIFEST; $file = "play-listing/manifest.json"; + } else if (preg_match("/data_safety\.csv$", $key)) { + $type = self::ARTIFACT_DATA_SAFETY_CSV; } return array($type, $file); @@ -479,6 +483,7 @@ public function handleArtifact($fileKey, $contents) { case self::ARTIFACT_ASSET_PREVIEW: case self::ARTIFACT_ASSET_PACKAGE: case self::ARTIFACT_ASSET_NOTIFY: + case self::ARTIFACT_DATA_SAFETY_CSV: break; default: @@ -614,6 +619,9 @@ public function assetPreview() { public function assetNotify() { return $this->getArtifactUrl("/asset-package\/notify\.json$/"); } + public function dataSafetyCsv() { + return $this->getArtifactUrl( "/data_safety\.csv$/"); + } /** * diff --git a/application/console/views/cron/scripts/upload/default/build.sh b/application/console/views/cron/scripts/upload/default/build.sh index 2c2e80a..eb5dfa7 100644 --- a/application/console/views/cron/scripts/upload/default/build.sh +++ b/application/console/views/cron/scripts/upload/default/build.sh @@ -101,6 +101,15 @@ build_apk() { if [[ "${BUILD_SHARE_DOWNLOAD_APP_LINK}" == "1" ]]; then SCRIPT_OPT="${SCRIPT_OPT} -ft share-download-app-link=true -ft share-download-app-link-url=https://app.scriptoria.io/downloads/apk/${APPDEF_PACKAGE_NAME}/published" fi + + # if building APK for Google Play, then include data safety CSV in output + echo "APPBUILDER_SCRIPT_VERSION=${APPBUILDER_SCRIPT_VERSION}" + if dpkg --compare-versions "$APPBUILDER_SCRIPT_VERSION" ge "10.3"; then + if [[ "${TARGETS}" == *"play-listing"* ]]; then + SCRIPT_OPT="${SCRIPT_OPT} -data-safety-csv" + fi + fi + process_audio_sources process_audio_download @@ -477,6 +486,8 @@ prepare_appbuilder_project() { exit 2 fi + APPBUILDER_SCRIPT_VERSION=$($APP_BUILDER_SCRIPT_PATH -? | grep "Version" | cut -d\ -f2) + PROJ_NAME=$(basename -- *.appDef .appDef) PROJ_DIR=$(find . -maxdepth 1 -type d | grep -i -F "${PROJ_NAME}_data") if [[ -f "${PROJ_NAME}.appDef" && -d "${PROJ_DIR}" ]]; then