Skip to content

Commit

Permalink
Add Data Safety CSV processing
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvire committed Apr 3, 2023
1 parent c88dfaf commit 2aea1b0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions application/common/models/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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$/");
}

/**
*
Expand Down
11 changes: 11 additions & 0 deletions application/console/views/cron/scripts/upload/default/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2aea1b0

Please sign in to comment.