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
4 changes: 2 additions & 2 deletions .buildkite/commands/gradle-cache-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ bundle exec fastlane run configure_apply

echo "--- :hammer_and_wrench: Building"
if [ "$1" = "wordpress" ]; then
./gradlew assembleWordpressWasabiDebug
./gradlew assembleWordpressDebug
fi

if [ "$1" = "jetpack" ]; then
./gradlew assembleJetpackWasabiDebug
./gradlew assembleJetpackDebug
fi
6 changes: 3 additions & 3 deletions .buildkite/commands/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ bundle exec fastlane check_declared_locales_consistency app:"$1"
echo "--- :microscope: Linting"

if [ "$1" = "wordpress" ]; then
./gradlew lintWordpressVanillaRelease
./gradlew lintWordpressRelease
exit 0
fi

if [ "$1" = "jetpack" ]; then
set +e
./gradlew lintJetpackVanillaRelease
./gradlew lintJetpackRelease
lint_exit_code=$?
set -e

upload_sarif_to_github "WordPress/build/reports/lint-results-jetpackVanillaRelease.sarif"
upload_sarif_to_github "WordPress/build/reports/lint-results-jetpackRelease.sarif"
exit $lint_exit_code
fi

Expand Down
6 changes: 3 additions & 3 deletions .buildkite/commands/run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ fi
echo "+++ 🧪 Testing"
set +e
./gradlew \
testWordpressWasabiDebugUnitTest \
testWordpressDebugUnitTest \
:libs:processors:test \
:libs:image-editor:testDebugUnitTest \
:libs:fluxc:testDebugUnitTest \
:libs:login:testDebugUnitTest \
koverXmlReportWordpressWasabiDebug \
koverXmlReportWordpressDebug \
:libs:processors:koverXmlReportJvm \
:libs:image-editor:koverXmlReportDebug \
:libs:fluxc:koverXmlReportDebug \
Expand Down Expand Up @@ -45,7 +45,7 @@ echo "--- 🚦 Collecting Test Results"

# Define test result directories for each module
declare -A TEST_RESULT_DIRS=(
["WordPress:wordpress"]="WordPress/build/test-results/testWordpressWasabiDebugUnitTest"
["WordPress:wordpress"]="WordPress/build/test-results/testWordpressDebugUnitTest"
["processors"]="libs/processors/build/test-results/test"
["image-editor"]="libs/image-editor/build/test-results/testDebugUnitTest"
["fluxc"]="libs/fluxc/build/test-results/testDebugUnitTest"
Expand Down
11 changes: 8 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,30 @@ steps:
steps:
- label: "Dependency Tree Diff"
command: |
comment_with_dependency_diff 'WordPress' 'wordpressVanillaReleaseRuntimeClasspath'
comment_with_dependency_diff 'WordPress' 'wordpressReleaseRuntimeClasspath'
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/diff/*"
# TODO: Remove soft_fail after this PR merges and trunk
# uses the new variant names (without buildType flavors)
soft_fail: true

- label: "Merged Manifest Diff WordPress"
command: ".buildkite/commands/diff-merged-manifest.sh wordpressVanillaRelease"
command: ".buildkite/commands/diff-merged-manifest.sh wordpressRelease"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/diff_manifest/**/**/*"
soft_fail: true

- label: "Merged Manifest Diff Jetpack"
command: ".buildkite/commands/diff-merged-manifest.sh jetpackVanillaRelease"
command: ".buildkite/commands/diff-merged-manifest.sh jetpackRelease"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/diff_manifest/**/**/*"
soft_fail: true

#################
# Unit Tests
Expand Down
16 changes: 8 additions & 8 deletions .claude/skills/run-app/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: >

# Run App

Build and run the Jetpack wasabi debug variant on a connected Android
Build and run the Jetpack debug variant on a connected Android
device or emulator. By default this skill builds and runs the
**Jetpack** app. Only build the WordPress app if the user explicitly
asks for it.
Expand All @@ -17,16 +17,16 @@ asks for it.

### 1. Build the app

By default, build the Jetpack wasabi debug variant:
By default, build the Jetpack debug variant:

```bash
./gradlew assembleJetpackWasabiDebug
./gradlew assembleJetpackDebug
```

If the user explicitly asks for the WordPress app instead, run:

```bash
./gradlew assembleWordPressWasabiDebug
./gradlew assembleWordPressDebug
```

### 2. Check for connected devices
Expand Down Expand Up @@ -89,14 +89,14 @@ Gradle versions):
**Jetpack (default):**

```bash
APK=$(find WordPress/build/outputs/apk/jetpackWasabi/debug \
APK=$(find WordPress/build/outputs/apk/jetpack/debug \
-name '*.apk' ! -name '*androidTest*' | head -1)
```

**WordPress (only if the user explicitly requested it):**

```bash
APK=$(find WordPress/build/outputs/apk/wordpressWasabi/debug \
APK=$(find WordPress/build/outputs/apk/wordpress/debug \
-name '*.apk' ! -name '*androidTest*' | head -1)
```

Expand All @@ -109,8 +109,8 @@ adb [-s <serial>] install -r "$APK"

Then launch the app:

- **Jetpack**: `adb [-s <serial>] shell am start -n com.jetpack.android.beta/org.wordpress.android.ui.WPLaunchActivity`
- **WordPress**: `adb [-s <serial>] shell am start -n org.wordpress.android.beta/org.wordpress.android.ui.WPLaunchActivity`
- **Jetpack**: `adb [-s <serial>] shell am start -n com.jetpack.android/org.wordpress.android.ui.WPLaunchActivity`
- **WordPress**: `adb [-s <serial>] shell am start -n org.wordpress.android/org.wordpress.android.ui.WPLaunchActivity`

### 6. Report the result

Expand Down
20 changes: 10 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Build and Test Commands

### Main Build Commands
- `./gradlew assembleWordPressVanillaDebug` - Build debug APK for WordPress app
- `./gradlew assembleJetpackVanillaDebug` - Build debug APK for Jetpack app
- `./gradlew installWordPressVanillaDebug` - Install debug APK to connected device
- `./gradlew installJetpackVanillaDebug` - Install debug APK for Jetpack to device
- `./gradlew assembleWordPressDebug` - Build debug APK for WordPress app
- `./gradlew assembleJetpackDebug` - Build debug APK for Jetpack app
- `./gradlew installWordPressDebug` - Install debug APK to connected device
- `./gradlew installJetpackDebug` - Install debug APK for Jetpack to device

### Testing Commands
- `./gradlew :WordPress:testWordPressVanillaDebugUnitTest` - Run unit tests for WordPress app
- `./gradlew :WordPress:connectedWordPressVanillaDebugAndroidTest` - Run instrumented tests for WordPress app
- `./gradlew :WordPress:testWordPressDebugUnitTest` - Run unit tests for WordPress app
- `./gradlew :WordPress:connectedWordPressDebugAndroidTest` - Run instrumented tests for WordPress app
- `bundle exec fastlane build_and_run_instrumented_test app:wordpress` - Build and run WordPress instrumented tests in Firebase Test Lab
- `bundle exec fastlane build_and_run_instrumented_test app:jetpack` - Build and run Jetpack instrumented tests in Firebase Test Lab

### Code Quality Commands
- `./gradlew checkstyle` - Run Checkstyle linter (generates report in `WordPress/build/reports/checkstyle/checkstyle.html`)
- `./gradlew detekt` - Run Detekt linter for Kotlin (generates report in `WordPress/build/reports/detekt/detekt.html`)
- `./gradlew lintWordPressVanillaRelease` - Run Android lint on WordPress release variant
- `./gradlew lintWordPressRelease` - Run Android lint on WordPress release variant

## Architecture Overview

Expand All @@ -30,8 +30,8 @@ This repository builds two apps from shared codebase:

### Product Flavors and Build Types
- **App Flavors**: `wordpress`, `jetpack`
- **Build Type Flavors**: `vanilla` (release/beta), `wasabi` (development), `jalapeno` (CI/prototype)
- Common development variant: `jetpackWasabiDebug`
- **Build Types**: `debug`, `release`
- Common development variant: `jetpackDebug`

### Module Architecture
```
Expand Down Expand Up @@ -121,7 +121,7 @@ WordPress/src/main/java/org/wordpress/android/
other members (properties, init blocks, constructors, functions)

### Development Workflow
- Default development flavor: `jetpackWasabi` (Jetpack app with beta suffix)
- Default development variant: `jetpackDebug`
- Remote build cache available for faster builds (requires setup)
- Fastlane used for release automation and testing
- Secrets managed via `secrets.properties` file (not in repo)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Notes:

To build, install, and test the project from the command line:

$ ./gradlew assembleWordPressVanillaDebug # assemble the debug .apk
$ ./gradlew installWordPressVanillaDebug # install the debug .apk if you have an
$ ./gradlew assembleWordPressDebug # assemble the debug .apk
$ ./gradlew installWordPressDebug # install the debug .apk if you have an
# emulator or an Android device connected
$ ./gradlew :WordPress:testWordPressVanillaDebugUnitTest # assemble, install and run unit tests
$ ./gradlew :WordPress:connectedWordPressVanillaDebugAndroidTest # assemble, install and run Android tests
$ ./gradlew :WordPress:testWordPressDebugUnitTest # assemble, install and run unit tests
$ ./gradlew :WordPress:connectedWordPressDebugAndroidTest # assemble, install and run Android tests

## Running the app ##

Expand All @@ -49,7 +49,7 @@ Note: Access to WordPress.com features is temporarily disabled in the developmen
│   │   ├── java # main project java code
│   │   └── res # main project resources
│   ├── debug # debug variant
│   └── wasabi # wasabi variant specific resources and manifest
│   └── release # release variant

## Google Configuration ##

Expand Down
31 changes: 5 additions & 26 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ fladle {
}

String appPathForVariant(String app) {
String path = "outputs/apk/${app}Vanilla/debug"
String path = "outputs/apk/${app}/debug"
return new File(layout.buildDirectory.dir(path).get().asFile, '*.apk').absolutePath
}
String testPathForVariant(String app) {
String path = "outputs/apk/androidTest/${app}Vanilla/debug"
String path = "outputs/apk/androidTest/${app}/debug"
return new File(layout.buildDirectory.dir(path).get().asFile, '*.apk').absolutePath
}

Expand Down Expand Up @@ -195,7 +195,7 @@ android {
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}

flavorDimensions = ['app', 'buildType']
flavorDimensions = ['app']


productFlavors {
Expand Down Expand Up @@ -242,29 +242,6 @@ android {
resourceConfigurations += ["in", "iw"]
}

// Used for release/beta testing builds. Usually shouldn't be build locally.
// AppName: WordPress/Jetpack
vanilla {
dimension "buildType"

buildConfigField "boolean", "ENABLE_DEBUG_SETTINGS", "false"
}

// Used for local development - preferred variant for developers.
// AppName: WordPress Beta/Jetpack Beta
wasabi {
isDefault true
applicationIdSuffix ".beta"
dimension "buildType"
}

// Used for CI builds on PRs (aka "Prototype Builds"). Can be used locally when a developer needs to install multiple versions of the app on the same device.
// AppName: WordPress Pre-Alpha/Jetpack Pre-Alpha
jalapeno {
applicationIdSuffix ".prealpha"
dimension "buildType"
}

// Also dynamically add additional `buildConfigFields` to our app flavors from any `wp.`/`jp.`-prefixed property in `secrets.properties`
addBuildConfigFieldsFromPrefixedProperties(wordpress, gradle.ext.secretProperties, ['wp'])
addBuildConfigFieldsFromPrefixedProperties(jetpack, gradle.ext.secretProperties, ['wp', 'jp']) // Inherit same properties used from WP first then overwrite with JP-specific ones
Expand All @@ -276,9 +253,11 @@ android {
// but we don't obfuscate the bytecode.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
buildConfigField "boolean", "ENABLE_DEBUG_SETTINGS", "false"
}

debug {
applicationIdSuffix ".prealpha"
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Any special reason why debug variant is adding prealpha now? Is it just a preference, or maybe to avoid CI conflicts, since it seems to be using that in jalapeño?
Just a nitpick, but we don't really have alpha or beta. So, it looks a bit strange.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good question @adalpari , and I'll try to answer for @jkmassel (if I might, and until he adds his answer)... 😊 🙏

  • Ideally we would have that applicationIdSuffix set to .debug, this is the default way of doing that, so that we have two apps installed on the same device side-by-side, both, the debug and release apps.
  • With Jetpack/WordPress, this debug version of the app was either the .beta (for Wasabi) or the .prealpha (for Jalapeno), so we could have chosen either one or the other, same result.
  • Choosing .prealpha (or .beta) instead of going for a new .debug suffix is (IMHO) the right call as it will prevent us from (possibly) breaking something Firebase related (see google-services.json). This is because otherwise, we would need to add such new .debug Firebase project(s), for both Jetpack and WordPress, and then go through the hoops-and-loops of this process, possibly breaking things in-between (of course, until we then fix them). For example, see the Jetpack configuration in Firebase:
image

As such, and having said that, I think Jeremy make the right call here, doing what he did. 💯 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choosing .prealpha (or .beta) instead of going for a new .debug suffix is (IMHO) the right call as it will prevent us from (possibly) breaking something Firebase related

This was the reasoning – I wanted to be able to continue to upload to Firebase for PR builds without needing to modify remote configuration.

If we want to squash this down too I'm good with it, but maybe a subsequent PR?

minifyEnabled false
pseudoLocalesEnabled true
}
Expand Down
84 changes: 0 additions & 84 deletions WordPress/google-services.json-example
Original file line number Diff line number Diff line change
Expand Up @@ -88,48 +88,6 @@
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:123:android:abc",
"android_client_info": {
"package_name": "org.wordpress.android.beta"
}
},
"oauth_client": [
{
"client_id": "123-abc.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "",
"client_type": 1,
"android_info": {
"package_name": "org.wordpress.android.beta",
"certificate_hash": ""
}
}
],
"api_key": [
{
"current_key": ""
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": ""
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:123:android:abc",
Expand Down Expand Up @@ -213,48 +171,6 @@
"status": 1
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:123:android:abc",
"android_client_info": {
"package_name": "com.jetpack.android.beta"
}
},
"oauth_client": [
{
"client_id": "123-abc.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "",
"client_type": 1,
"android_info": {
"package_name": "com.jetpack.android.beta",
"certificate_hash": ""
}
}
],
"api_key": [
{
"current_key": ""
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": ""
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LoginFlow {

// Follow the magic link to continue login
// Intent is invoked directly rather than through a browser as WireMock is unavailable once in the background
val appVariant = BuildConfig.FLAVOR_app
val appVariant = BuildConfig.FLAVOR
val intent =
Intent(Intent.ACTION_VIEW, Uri.parse("$appVariant://magic-login?token=valid_token"))
.setPackage(ApplicationProvider.getApplicationContext<Context>().packageName)
Expand Down
Loading