Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .buildkite/commands/diff-merged-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ BUILD_VARIANT=$1
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply

Comment on lines -17 to -19
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the repo git-crypt-unlocked during the branch dance that is done internally by comment_with_manifest_diff caused Your local changes to the following files would be overwritten by checkoutissues, especially if the git-crypt'd files listed in .gitattributes on the HEAD branch are not the same as the ones in the BASE branch1

Since we don't need any secret in practice to generate the manifest and call process{variant}Manifest, the solution is simple: just don't bother unlocking the repo's secrets for that task.


A better long-term solution to make comment_with_manifest_diff more resilient to situations like this would be to make it use git worktree instead of switching branches in-place:

  1. Generate base manifest: git worktree add $TMP_DIR_FOR_BASE $BASE_BRANCH && cd $TMP_DIR_FOR_BASE then run ./gradlew process{variant}Manifest there
  2. Generate head manifest: cd $CHECKOUT_DIR && rm $TMP_DIR_FOR_BASE && git worktree prune then run ./gradlew process{variant}Manifest there

That way each checkout is done in independent folders, eliminating the risk of conflicts during the branch dance.

Footnotes

  1. like will be the case during that transition to git-crypt, or when we'll add a new secret file, especially if that secret file previously existed unencrypted in the BASE branch as an example file for external contributors I think?

echo "--- 💾 Diff Merged Manifest (Module: WooCommerce, Build Variant: ${BUILD_VARIANT})"
comment_with_manifest_diff "WooCommerce" ${BUILD_VARIANT}

Expand Down
5 changes: 5 additions & 0 deletions .buildkite/commands/git-crypt-unlock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -euo pipefail

echo "$GIT_CRYPT_ENCRYPTION_KEY" | base64 -d | git-crypt unlock -
4 changes: 2 additions & 2 deletions .buildkite/commands/gradle-cache-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fi
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- :closed_lock_with_key: Decrypting Secrets"
.buildkite/commands/git-crypt-unlock.sh

echo "--- :hammer_and_wrench: Building"
./gradlew assembleWasabiDebug
4 changes: 2 additions & 2 deletions .buildkite/commands/prototype-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ APP_TO_BUILD="${1?You need to specify the app to build, WooCommerce or WooCommer
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- :closed_lock_with_key: Decrypting Secrets"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Underrated improvement: now we won't need to start Ruby, initialize the Fastlane runtime to start a lane, etc just for decrypting secrets (admittedly not that slow, but still... 😄) and leave that only once for the main lane.

💭 Which also makes me think we could call .buildkite/commands/git-crypt-unlock.sh before install_gems. I don't see any big advantages, though, other than code organization and potentially early failure on secrets. Anyway, just wanted to mention it while thinking out loud 🙂

.buildkite/commands/git-crypt-unlock.sh

echo "--- :hammer_and_wrench: Building ${APP_TO_BUILD}"
bundle exec fastlane build_and_upload_prototype_build app:"${APP_TO_BUILD}"
4 changes: 2 additions & 2 deletions .buildkite/commands/release-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ APP_TO_BUILD="${1?You need to specify the app to build, WooCommerce or WooCommer
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- :closed_lock_with_key: Decrypting Secrets"
.buildkite/commands/git-crypt-unlock.sh

echo "--- :hammer_and_wrench: Building ${APP_TO_BUILD}"
bundle exec fastlane build_and_upload_google_play app:"${APP_TO_BUILD}"
4 changes: 2 additions & 2 deletions .buildkite/commands/run-instrumented-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ fi
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- :closed_lock_with_key: Decrypting Secrets"
.buildkite/commands/git-crypt-unlock.sh

echo "--- 🧪 Testing"
set +e
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/commands/run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ fi
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- :closed_lock_with_key: Decrypting Secrets"
.buildkite/commands/git-crypt-unlock.sh

echo "+++ 🧪 Testing"
set +e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ steps:
echo '--- :ruby: Setup Ruby Tools'
install_gems

echo '--- :closed_lock_with_key: Decrypting Secrets'
.buildkite/commands/git-crypt-unlock.sh

echo '--- :globe_with_meridians: Download Release Translations'
bundle exec fastlane download_release_translations skip_confirm:true include_wear_app:"${INCLUDE_WEAR_APP:-false}"
agents:
Expand Down
3 changes: 3 additions & 0 deletions .buildkite/release-pipelines/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ steps:
echo '--- :ruby: Setup Ruby Tools'
install_gems

echo '--- :closed_lock_with_key: Decrypting Secrets'
.buildkite/commands/git-crypt-unlock.sh

echo '--- :shipit: Finalize Release'
bundle exec fastlane finalize_release skip_confirm:true include_wear_app:"${INCLUDE_WEAR_APP:-false}"
agents:
Expand Down
3 changes: 2 additions & 1 deletion .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.

export CI_TOOLKIT="automattic/a8c-ci-toolkit#5.4.0"
# "git-crypt-unlock" branch / https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/pull/195
export CI_TOOLKIT="automattic/a8c-ci-toolkit#0a3f10921096cee57c18ac5667fc64c1aaad4a7d"
Comment on lines -6 to +7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎗️ TODO: Revert back to pointing to a tag version once Automattic/a8c-ci-toolkit-buildkite-plugin#195 is merged and we have an official new version of the ci-toolkit

export TEST_COLLECTOR="test-collector#v1.10.1"
export CLAUDE_PLUGIN="claude-summarize#v1.1.0"
43 changes: 0 additions & 43 deletions .configure

This file was deleted.

Binary file removed .configure-files/automattic_upload.jks.enc
Binary file not shown.
Binary file removed .configure-files/debug.keystore.enc
Binary file not shown.
Binary file removed .configure-files/firebase.secrets.json.enc
Binary file not shown.
Binary file removed .configure-files/google-services.json.enc
Binary file not shown.
Binary file removed .configure-files/google-upload-credentials.json.enc
Binary file not shown.
Binary file removed .configure-files/gradle.properties.enc
Binary file not shown.
Binary file removed .configure-files/secrets.properties.enc
Binary file not shown.
Binary file removed .configure-files/sentry.properties.enc
Binary file not shown.
12 changes: 11 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
RELEASE-NOTES.txt merge=union

.configure-files/*.enc binary
#########################################
# Secrets files encrypted with git-crypt
#########################################

secrets.properties filter=git-crypt diff=git-crypt
sentry.properties filter=git-crypt diff=git-crypt
google-services.json filter=git-crypt diff=git-crypt
firebase.secrets.json filter=git-crypt diff=git-crypt
google-upload-credentials.json filter=git-crypt diff=git-crypt
*.keystore filter=git-crypt diff=git-crypt
*.jks filter=git-crypt diff=git-crypt
18 changes: 0 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ developer.properties

# Crash Logging Configuration
fabric.properties
# Sentry
sentry.properties

# Local configuration file (sdk path, etc)
local.properties
Expand Down Expand Up @@ -66,15 +64,9 @@ captures/
# Android Studio backup files
projectFilesBackup/

# Keystore files
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Silver Searcher ignore file
.agignore

Expand All @@ -88,7 +80,6 @@ google-services.json
fastlane/README.md
fastlane/report.xml
fastlane/.env
google-upload-credentials.json
fastlane/screenshots
fastlane/promo_sceenshots
# This is a byproduct of the screenshots composition process
Expand All @@ -102,15 +93,6 @@ default.profraw

local-builds.gradle

# All secrets should be stored under .configure-files
# Everything without a .enc extension is ignored
.configure-files/*
!.configure-files/*.enc
# This secret is not part of the repository anymore, but we keep it in the
# gitignore for retrocompatibility, so that it won't appear as a new file and
# be accidentally checked in the repository.
google-upload-credentials.json

# Kotlin
.kotlin/

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@
$ cd woocommerce-android
```

1. Copy `defaults.properties` to the secrets directory: `cp defaults.properties ~/.configure/woocommerce-android/secrets/secrets.properties`. See the [Configuration Files](docs/project-overview.md#configuration-files) section for a breakdown of the properties.
1. Generate the developer oauth2 tokens. These values get copied into the `~/.configure/woocommerce-android/secrets.properties` file in the next step. See the [OAuth2 Authentication](docs/project-overview.md#oauth2-authentication) section for details.
1. If you are a developer at Automattic:
1. Make sure you have `git-crypt` installed (`brew install git-crypt`)
1. Search for "WooCommerce Android git-crypt encryption key" in our Secret Store, and copy the Base64 value in your clipboard
1. Run `pbpaste | base64 -d | git-crypt unlock -` to decrypt the encrypted files (including `secrets.properties` and `WooCommerce/google-services.json`)
1. If you are an external contributor:
1. Generate developer OAuth2 tokens. See the [OAuth2 Authentication](docs/project-overview.md#oauth2-authentication) section for details.
1. Edit `defaults.properties` and adjust the values as needed—especiallyincluding `wp.oauth.*` ones. See the [Configuration Files](docs/project-overview.md#configuration-files) section for a breakdown of the properties.
Copy link
Contributor

@iangmaia iangmaia Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Edit `defaults.properties` and adjust the values as needed—especiallyincluding `wp.oauth.*` ones. See the [Configuration Files](docs/project-overview.md#configuration-files) section for a breakdown of the properties.
1. Edit `defaults.properties` and adjust the values as needed — especially including `wp.oauth.*` ones. See the [Configuration Files](docs/project-overview.md#configuration-files) section for a breakdown of the properties.

1. `cp WooCommerce/google-services.json-example WooCommerce/google-services.json` (to replace that encrypted file with placeholder content)
1. In Android Studio, open the project from the local repository. This will auto-generate `local.properties` with the SDK location.
1. Optional: Go to Tools → Device Manager and create an emulated device.
1. Run. (Creates a default virtual device if you skipped the previous step)
Expand Down
14 changes: 11 additions & 3 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {

fladle {
variant = "vanillaDebug"
serviceAccountCredentials = rootProject.file(".configure-files/firebase.secrets.json")
serviceAccountCredentials = rootProject.file("firebase.secrets.json")
testTargets = [
"notPackage com.woocommerce.android.e2e.tests.screenshot",
"notClass com.woocommerce.android.e2e.tests.ui.OrdersRealAPI",
Expand Down Expand Up @@ -496,12 +496,13 @@ android.buildTypes.all { buildType ->
}

// If Google services file doesn't exist, copy example file.
if (!file("google-services.json").exists()) {
def googleServicesFile = file("google-services.json")
if (!googleServicesFile.exists() || isFileEncrypted(googleServicesFile)) {
tasks.copyGoogleServicesExampleFile.copy()
}
Comment on lines +500 to 502
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If google-services.json is encrypted, we'll copy the example file. Then why do we require to

  1. cp WooCommerce/google-services.json-example WooCommerce/google-services.json (to replace that encrypted file with placeholder content)

in the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I updated the docs before first, then later realized I had to update the .gradle file to make CI work… and didn't get back to review the docs again after doing the .gradle change 😅

Good point then, we should indeed remove that extra step from the docs.


// Print warning message if example Google services file is used.
if ((file("google-services.json").text) == (file("google-services.json-example").text)) {
if ((googleServicesFile.text) == (file("google-services.json-example").text)) {
println("WARNING: You're using the example google-services.json file. Google login will fail.")
}
}
Expand All @@ -514,6 +515,13 @@ static def loadPropertiesFromFile(inputFile) {
return properties
}

static def isFileEncrypted(File file) {
def gitcryptHeader = [0x00, 0x47, 0x49, 0x54, 0x43, 0x52, 0x59, 0x50, 0x54] as byte[] // GITCRYPT header
def header = new byte[gitcryptHeader.length]
file.withInputStream { stream -> stream.read(header) }
return Arrays.equals(header, gitcryptHeader)
}

def isLeakCanaryEnabled() {
return developerProperties.get("enable_leak_canary") ?: true
}
Expand Down
Binary file added WooCommerce/google-services.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 Again thinking out loud, not sure if it's worth the trouble: what do you think of grouping encrypted / secret files in the same folder and making a convention out of this for all projects (well, kinda similar to what we had before but making it more obvious)?
The main advantage is added clarity and creating a pattern where we can build things on top (e.g. validation to make sure everything under that folder is encrypted). Of course, it wouldn't completely prevent mistakes, but it would be a way to keep things clear.

Binary file not shown.
Binary file added WooCommerce/upload.jks
Copy link
Contributor

@iangmaia iangmaia Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 I was wondering if there could be a way to be sure, in reviews, that this has in fact been encrypted or not specially given files like this are binary files. Then I've noticed all git-crypt encrypted files start with GITCRYPT so perhaps this could be a simple way to check for that in an automated way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like I do here? 😛

Indeed maybe we can write a Dangermattic plugin to detect which file in the PR are encrypted and add an inline comment on the file if so as an extra information? Is that what you meant?

As for manually testing locally if a file is properly encrypted before pushing a commit to the remote, one can use git-crypt status -e <file> directly to check that (or, alternatively, print the raw content of the file with git show :<file>—e.g. git show :secrets.properties, with leading :colon—and confirm that row content is some binary garbage starting with\0GITCRYPT\0`.

Copy link
Contributor

@iangmaia iangmaia Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like I do here? 😛

Ha, yes, I realized that function was doing that after I posted the comment 😂

Indeed maybe we can write a Dangermattic plugin to detect which file in the PR are encrypted and add an inline comment on the file if so as an extra information? Is that what you meant?

Yeah, though at the same time I find it a bit difficult to do that in a systemic way that will be useful (as we don't add secrets that often)...
And without a clear pattern on the secret files, it's also not clear how to generalize a check without knowing all files in advance (defeating the purpose of warning when that new file has been added without encryption, there's still some value for updates...) 🤔

As for manually testing locally if a file is properly encrypted before pushing a commit to the remote, one can use git-crypt status -e <file> directly to check that (or, alternatively, print the raw content of the file with git show :<file>—e.g. git show :secrets.properties, with leading :colon—and confirm that row content is some binary garbage starting with\0GITCRYPT\0`.

👍

Binary file not shown.
Binary file added debug.keystore
Binary file not shown.
17 changes: 11 additions & 6 deletions docs/project-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ When creating your application, you should select "**Native client**" for the ap
The "**Website URL**", "**Redirect URLs**", and "**Javascript Origins**" fields are required but not used for
the mobile apps. Just use "**[https://localhost](https://localhost)**".

Once you've created your application in the [applications manager][wp-com-apps], you'll
need to update the `wc.oauth.app_id` and `wc.oauth.app_secret` fields in `secrets.properties`.
See [setup instructions][setup] for more details about secrets file. Then you can compile and run the app on a device or an emulator and
try to login with a WordPress.com account. Note that authenticating to WordPress.com via Google is
not supported in development builds of the app, only in the official release.
Once you've created your application in the [applications manager][wp-com-apps], you'll need to update the `wc.oauth.app_id` and `wc.oauth.app_secret` fields in `defaults.properties` (copied from `defaults-example.properties`). See [setup instructions][setup] for more details.
Then you can compile and run the app on a device or an emulator and try to login with a WordPress.com account. Note that authenticating to WordPress.com via Google is not supported in development builds of the app, only in the official release.

Note that credentials created with our [WordPress.com applications manager][wp-com-apps]
allow login only and not signup. New accounts must be created using the [official app][wp-app]
Expand All @@ -35,7 +32,15 @@ Read more about [OAuth2][oauth] and the [WordPress.com REST endpoint][wp-api].

#### `secrets.properties`

The `secrets.properties` file is used to store sensitive information that should not be checked into version control. This file is located at `~/.configure/woocommerce-android/secrets/secrets.properties`.
The `secrets.properties` file is used to store sensitive information that should not be checked into version control in clear text.
This file is encrypted (using `git-crypt`), and only developers working at Automattic have the decryption key.

If you are a developer working at Automattic, ensure you followed those instructions once after cloning the repo:
1. Make sure you have `git-crypt` installed (`brew install git-crypt`)
1. Search for "WooCommerce Android git-crypt encryption key" in our Secret Store, and copy the Base64 value in your clipboard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I wonder, is it okay to provide a direct link to Secret Store? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I hesistated on this too. It's probably OK I guess because it's just a link that won't be accessible by anyone outside Automattic, and those links just contain ?id=<number> so it doesn't really reveal anything in the link URL either…

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also had second thoughts before suggesting this, but actually our security doesn't rely on obscurity of a url. I think it's fine to share the link here, MC requires multpile security measures anyway to get anything from it.

1. Run `pbpaste | base64 -d | git-crypt unlock -` to decrypt the encrypted files (including `secrets.properties`)

If you are an external contributor, provide those variables in your `defaults.properties` instead:

| Property | Description |
|:---------------------------|:------------|
Expand Down
15 changes: 7 additions & 8 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ GLOTPRESS_APP_STRINGS_PROJECT_URL = 'https://translate.wordpress.com/projects/wo
GLOTPRESS_PLAYSTORE_METADATA_PROJECT_URL = "#{GLOTPRESS_APP_STRINGS_PROJECT_URL}/release-notes/".freeze

APP_PACKAGE_NAME = 'com.woocommerce.android'
GOOGLE_FIREBASE_SECRETS_PATH = File.join(PROJECT_ROOT_FOLDER, '.configure-files', 'firebase.secrets.json')
GOOGLE_FIREBASE_SECRETS_PATH = File.join(PROJECT_ROOT_FOLDER, 'firebase.secrets.json')

# Instantiate versioning classes
VERSION_CALCULATOR = Fastlane::Wpmreleasetoolkit::Versioning::MarketingVersionCalculator.new
Expand All @@ -80,7 +80,7 @@ DEFAULT_BRANCH = 'trunk'
REPOSITORY_NAME = 'woocommerce-android'
GH_ORG_NAME = 'woocommerce'

UPLOAD_TO_PLAY_STORE_JSON_KEY = File.join(Dir.home, '.configure', 'woocommerce-android', 'secrets', 'google-upload-credentials.json')
UPLOAD_TO_PLAY_STORE_JSON_KEY = File.join(PROJECT_ROOT_FOLDER, 'google-upload-credentials.json')

SUPPORTED_LOCALES = [
{ glotpress: 'ar', android: 'ar', google_play: 'ar', promo_config: {} },
Expand Down Expand Up @@ -458,8 +458,6 @@ platform :android do
UI.important("Downloading latest translations for release: #{release_version_current}")
UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?')

configure_apply(force: is_ci)

# Don't check translation coverage in CI
check_translation_progress_all unless is_ci
download_translations
Expand Down Expand Up @@ -493,8 +491,6 @@ platform :android do
UI.important("Finalizing release: #{release_version_current}")
UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?')

configure_apply(force: is_ci)

# Bump the release version and build code
UI.message 'Bumping final release version and build code...'
VERSION_FILE.write_version(
Expand Down Expand Up @@ -1250,8 +1246,11 @@ platform :android do
end

def firebase_secret(name:)
UI.user_error!('Unable to locale Firebase Secrets File – did you run `configure apply`?') unless File.file? GOOGLE_FIREBASE_SECRETS_PATH
key_file_secrets = JSON.parse(File.read(GOOGLE_FIREBASE_SECRETS_PATH))
begin
key_file_secrets = JSON.parse(File.read(GOOGLE_FIREBASE_SECRETS_PATH))
rescue StandardError
UI.user_error!('Unable to read Firebase Secrets File – did you run `echo "…encryption-key…" | base64 -d | git-crypt unlock -` on the repo?')
end
UI.user_error!("Unable to find key `#{name}` in #{GOOGLE_FIREBASE_SECRETS_PATH}") if key_file_secrets[name].nil?
key_file_secrets[name]
end
Expand Down
Binary file added firebase.secrets.json
Binary file not shown.
Binary file added google-upload-credentials.json
Binary file not shown.
Binary file added secrets.properties
Binary file not shown.
Binary file added sentry.properties
Binary file not shown.
19 changes: 15 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ext {

gradle.ext {
isCi = System.getenv('CI')?.toBoolean() ?: false
secretsPath = "${System.getProperty("user.home")}/.configure/woocommerce-android/secrets/secrets.properties"
secretsPath = "secrets.properties"
secretProperties = loadPropertiesWithFallback(
logger,
file("${rootDir}/defaults.properties"),
Expand All @@ -40,7 +40,12 @@ static def loadPropertiesWithFallback(Logger logger, File fallbackFile, File pri
def defaultProperties = readPropertiesFromFile(fallbackFile)
def primaryProperties
if (primaryFile.exists()) {
primaryProperties = readPropertiesFromFile(primaryFile)
try {
primaryProperties = readPropertiesFromFile(primaryFile)
} catch (Exception e) {
logger.warn("Failed to parse primary properties file: ${primaryFile}. Using fallback: ${fallbackFile}. Error: ${e}")
primaryProperties = new Properties()
}
} else {
logger.warn("Primary properties file not found: ${primaryFile}. Using fallback: ${fallbackFile}.")
primaryProperties = new Properties()
Expand Down Expand Up @@ -93,8 +98,14 @@ def checkForRemoteBuildCacheOptimizedExperience() {
}

def assertSecretsApplied() {
if (!file(gradle.ext.secretsPath).exists()) {
throw new GradleException("The build requested remote build cache, but secrets file is not found. Please run `bundle exec fastlane run configure_apply` to apply secrets.")
def secretsFile = file(gradle.ext.secretsPath)
if (!secretsFile.exists()) {
throw new GradleException("The build requested remote build cache, but the `secrets.properties` file is not found. See README.md for instructions on how to set those up.")
}
try {
readPropertiesFromFile(secretsFile)
} catch (Exception ex) {
throw new GradleException("The `secrets.properties` file exists but could not be read as a valid `.properties` file. This likely means it is still encrypted (git-crypt locked). Please decrypt it before building. See README.md for instructions.", ex)
}
}

Expand Down
Loading