diff --git a/.github/workflows/enforce-pr-labels.yml b/.github/workflows/enforce-pr-labels.yml index 211458ce1e979f..1909bf66da216f 100644 --- a/.github/workflows/enforce-pr-labels.yml +++ b/.github/workflows/enforce-pr-labels.yml @@ -1,18 +1,18 @@ name: Enforce labels on Pull Request on: - pull_request_target: - types: [opened, labeled, unlabeled, synchronize] + pull_request_target: + types: [opened, labeled, unlabeled, synchronize] jobs: - type-related-labels: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: mheap/github-action-required-labels@v5 - with: - mode: exactly - count: 1 - labels: "[Type] Accessibility (a11y), [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket" - add_comment: true - message: "## ⚠️ Type of PR label error\n To merge this PR, it requires {{ errorString }} {{ count }} label indicating the type of PR. Other labels are optional and not being checked here. \n- **Type-related labels to choose from**: {{ provided }}.\n- **Labels found**: {{ applied }}.\n\nYou can learn more about the Type labels in Gutenberg [here](https://github.com/WordPress/gutenberg/labels?q=type)" - exit_type: failure + type-related-labels: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: mheap/github-action-required-labels@v5 + with: + mode: exactly + count: 1 + labels: '[Type] Accessibility (a11y), [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket' + add_comment: true + message: "## ⚠️ Type of PR label error\n To merge this PR, it requires {{ errorString }} {{ count }} label indicating the type of PR. Other labels are optional and not being checked here. \n- **Type-related labels to choose from**: {{ provided }}.\n- **Labels found**: {{ applied }}.\n\nYou can learn more about the Type labels in Gutenberg [here](https://github.com/WordPress/gutenberg/labels?q=type)" + exit_type: failure diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index 8b086a30566448..7b0244b0ec5059 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -28,8 +28,8 @@ jobs: - name: Use desired version of Java uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0 with: - distribution: 'temurin' - java-version: '11' + distribution: 'corretto' + java-version: '17' - name: Setup Node.js and install dependencies uses: ./.github/setup-node diff --git a/package-lock.json b/package-lock.json index c4da75a973bd5b..4cf9a362b07da9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8649,6 +8649,11 @@ "resolved": "https://registry.npmjs.org/@react-native/assets/-/assets-1.0.0.tgz", "integrity": "sha512-KrwSpS1tKI70wuKl68DwJZYEvXktDHdZMG0k2AXD/rJVSlB23/X2CB2cutVR0HwNMJIal9HOUOBB2rVfa6UGtQ==" }, + "@react-native/gradle-plugin": { + "version": "0.72.11", + "resolved": "https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.72.11.tgz", + "integrity": "sha512-P9iRnxiR2w7EHcZ0mJ+fmbPzMby77ZzV6y9sJI3lVLJzF7TLSdbwcQyD3lwMsiL+q5lKUHoZJS4sYmih+P2HXw==" + }, "@react-native/normalize-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@react-native/normalize-color/-/normalize-color-2.0.0.tgz", @@ -18368,6 +18373,7 @@ "@react-native-community/blur": "4.2.0", "@react-native-community/slider": "https://raw.githubusercontent.com/wordpress-mobile/react-native-slider/v3.0.2-wp-4/react-native-community-slider-3.0.2-wp-4.tgz", "@react-native-masked-view/masked-view": "0.2.9", + "@react-native/gradle-plugin": "0.72.11", "@react-navigation/core": "5.12.0", "@react-navigation/native": "6.0.14", "@react-navigation/routers": "5.4.9", diff --git a/packages/react-native-aztec/android/.java-version b/packages/react-native-aztec/android/.java-version new file mode 100644 index 00000000000000..03b6389f32ad57 --- /dev/null +++ b/packages/react-native-aztec/android/.java-version @@ -0,0 +1 @@ +17.0 diff --git a/packages/react-native-aztec/android/build.gradle b/packages/react-native-aztec/android/build.gradle index 5e7d12279cf710..71cb631a6cbf6d 100644 --- a/packages/react-native-aztec/android/build.gradle +++ b/packages/react-native-aztec/android/build.gradle @@ -1,5 +1,6 @@ buildscript { ext { + // node modules supportLibVersion = '29.0.2' tagSoupVersion = '1.2.1' glideVersion = '3.7.0' @@ -7,9 +8,21 @@ buildscript { robolectricVersion = '3.5.1' jUnitVersion = '4.12' jSoupVersion = '1.10.3' - wordpressUtilsVersion = '3.3.0' espressoVersion = '3.0.1' + + // libs aztecVersion = 'v1.6.4' + wordpressUtilsVersion = '3.3.0' + + // main + androidxAppcompatVersion = '1.2.0' + androidxCardviewVersion = '1.0.0' + androidxGridlayoutVersion = '1.0.0' + androidxLegacyVersion = '1.0.0' + androidxRecyclerviewVersion = '1.1.0' + + // test + junitAztecVersion = '4.13' } } @@ -34,6 +47,8 @@ List dirs = [ 'template'] // boilerplate code that is generated by the sample template process android { + namespace "org.wordpress.mobile.ReactNativeAztec" + compileSdkVersion 33 defaultConfig { @@ -59,7 +74,7 @@ android { androidTest.java.srcDirs = ['tests/src'] } - lintOptions { + lint { disable 'GradleCompatible' abortOnError false } @@ -85,12 +100,13 @@ dependencies { api "org.wordpress.aztec:glide-loader:$aztecVersion" implementation "org.wordpress:utils:$wordpressUtilsVersion" - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.gridlayout:gridlayout:1.0.0' - implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.recyclerview:recyclerview:1.1.0' - testImplementation 'junit:junit:4.13' + implementation "androidx.legacy:legacy-support-v4:$androidxLegacyVersion" + implementation "androidx.gridlayout:gridlayout:$androidxGridlayoutVersion" + implementation "androidx.cardview:cardview:$androidxCardviewVersion" + implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion" + implementation "androidx.recyclerview:recyclerview:$androidxRecyclerviewVersion" + + testImplementation "junit:junit:$junitAztecVersion" def rnVersion = readReactNativeVersion('../../../package.json', 'devDependencies') println "react-native version for react-native-aztec: $rnVersion" @@ -105,7 +121,6 @@ project.afterEvaluate { groupId 'org.wordpress-mobile.gutenberg-mobile' artifactId 'react-native-aztec' - artifact tasks.named("androidSourcesJar") // version is set by 'publish-to-s3' plugin addDependenciesToPom(pom) diff --git a/packages/react-native-aztec/android/gradle.properties b/packages/react-native-aztec/android/gradle.properties index ce566007126c27..81529680627fbb 100644 --- a/packages/react-native-aztec/android/gradle.properties +++ b/packages/react-native-aztec/android/gradle.properties @@ -1,5 +1,12 @@ +# Project-wide Gradle settings. + org.gradle.jvmargs=-Xmx2g -XX:+HeapDumpOnOutOfMemoryError + +# React Native Aztec properties. + android.useAndroidX=true android.enableJetifier=false -shouldPublishBinary=false +# React Native Aztec publishing settings. + +shouldPublishBinary=false diff --git a/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.jar b/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.jar index 249e5832f090a2..033e24c4cdf41a 100644 Binary files a/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.jar and b/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.properties index ae04661ee73343..c747538fb38b53 100644 --- a/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-aztec/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-aztec/android/gradlew b/packages/react-native-aztec/android/gradlew index a69d9cb6c20655..fcb6fca147c0cd 100755 --- a/packages/react-native-aztec/android/gradlew +++ b/packages/react-native-aztec/android/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/packages/react-native-aztec/android/gradlew.bat b/packages/react-native-aztec/android/gradlew.bat index 53a6b238d414d9..6689b85beecde6 100644 --- a/packages/react-native-aztec/android/gradlew.bat +++ b/packages/react-native-aztec/android/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/packages/react-native-aztec/android/settings.gradle b/packages/react-native-aztec/android/settings.gradle index 365441bced0ebf..11cf7c1990544b 100644 --- a/packages/react-native-aztec/android/settings.gradle +++ b/packages/react-native-aztec/android/settings.gradle @@ -1,10 +1,12 @@ pluginManagement { gradle.ext.kotlinVersion = '1.6.10' + gradle.ext.agpVersion = '8.1.0' + gradle.ext.automatticPublishToS3Version = '0.8.0' plugins { - id "com.android.library" version "7.2.1" + id "com.android.library" version gradle.ext.agpVersion id "org.jetbrains.kotlin.android" version gradle.ext.kotlinVersion - id "com.automattic.android.publish-to-s3" version "0.7.0" + id "com.automattic.android.publish-to-s3" version gradle.ext.automatticPublishToS3Version } repositories { maven { diff --git a/packages/react-native-aztec/android/src/main/AndroidManifest.xml b/packages/react-native-aztec/android/src/main/AndroidManifest.xml deleted file mode 100644 index d937b1806d40fe..00000000000000 --- a/packages/react-native-aztec/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/packages/react-native-bridge/android/.java-version b/packages/react-native-bridge/android/.java-version new file mode 100644 index 00000000000000..03b6389f32ad57 --- /dev/null +++ b/packages/react-native-bridge/android/.java-version @@ -0,0 +1 @@ +17.0 diff --git a/packages/react-native-bridge/android/gradle.properties b/packages/react-native-bridge/android/gradle.properties index 570019612adf35..eb15f4b384486b 100644 --- a/packages/react-native-bridge/android/gradle.properties +++ b/packages/react-native-bridge/android/gradle.properties @@ -1,4 +1,8 @@ +# Project-wide Gradle settings. + org.gradle.jvmargs=-Xmx2g -XX:+HeapDumpOnOutOfMemoryError + +# React Native Bridge properties. + android.useAndroidX=true android.enableJetifier=false - diff --git a/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.jar b/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.jar index 249e5832f090a2..033e24c4cdf41a 100644 Binary files a/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.jar and b/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.properties index ae04661ee73343..c747538fb38b53 100644 --- a/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-bridge/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-bridge/android/gradlew b/packages/react-native-bridge/android/gradlew index a69d9cb6c20655..fcb6fca147c0cd 100755 --- a/packages/react-native-bridge/android/gradlew +++ b/packages/react-native-bridge/android/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/packages/react-native-bridge/android/gradlew.bat b/packages/react-native-bridge/android/gradlew.bat index 53a6b238d414d9..6689b85beecde6 100644 --- a/packages/react-native-bridge/android/gradlew.bat +++ b/packages/react-native-bridge/android/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/packages/react-native-bridge/android/react-native-bridge/build.gradle b/packages/react-native-bridge/android/react-native-bridge/build.gradle index ac702b760b3637..4c7882ad0ffdba 100644 --- a/packages/react-native-bridge/android/react-native-bridge/build.gradle +++ b/packages/react-native-bridge/android/react-native-bridge/build.gradle @@ -1,3 +1,19 @@ +buildscript { + ext { + // libs + wordpressUtilsVersion = '3.3.0' + + // main + googleMaterialVersion = '1.2.1' + + // react native + facebookFrescoVersion = '2.0.0' + + // test + junitVersion = '4.13' + } +} + plugins { id "com.android.library" id "org.jetbrains.kotlin.android" @@ -14,6 +30,11 @@ group='org.wordpress-mobile.gutenberg-mobile' def buildAssetsFolder = 'build/assets' android { + // IMPORTANT: Any updates to the namespace should be reflected in + // the `package` attribute of the main `AndroidManifest.xml` file. + // File reference: `react-native-bridge/android/react-native-bridge/src/main/AndroidManifest.xml` + namespace "org.wordpress.mobile.ReactNativeGutenbergBridge" + compileSdkVersion 33 defaultConfig { @@ -22,7 +43,7 @@ android { buildConfigField "boolean", "SHOULD_ATTACH_JS_BUNDLE", willPublishReactNativeBridgeBinary.toString() } - lintOptions { + lint { abortOnError false } @@ -41,6 +62,10 @@ android { assets.srcDirs += '../../../../../resources/unsupported-block-editor' } } + + buildFeatures { + buildConfig true + } } repositories { @@ -52,11 +77,11 @@ repositories { dependencies { // For animated GIF support - implementation 'com.facebook.fresco:animated-gif:2.0.0' - implementation 'com.google.android.material:material:1.2.1' - implementation "org.wordpress:utils:3.3.0" + implementation "com.facebook.fresco:animated-gif:$facebookFrescoVersion" + implementation "com.google.android.material:material:$googleMaterialVersion" + implementation "org.wordpress:utils:$wordpressUtilsVersion" - testImplementation "junit:junit:4.13" + testImplementation "junit:junit:$junitVersion" def rnVersion = readReactNativeVersion('../../../../package.json', 'devDependencies') println "react-native version for react-native-bridge: $rnVersion" @@ -100,7 +125,6 @@ project.afterEvaluate { groupId 'org.wordpress-mobile.gutenberg-mobile' artifactId 'react-native-gutenberg-bridge' - artifact tasks.named("androidSourcesJar") // version is set by 'publish-to-s3' plugin addDependenciesToPom(pom) diff --git a/packages/react-native-bridge/android/react-native-bridge/src/debug/AndroidManifest.xml b/packages/react-native-bridge/android/react-native-bridge/src/debug/AndroidManifest.xml index 49ddd2f355c40e..918ee013ea2711 100644 --- a/packages/react-native-bridge/android/react-native-bridge/src/debug/AndroidManifest.xml +++ b/packages/react-native-bridge/android/react-native-bridge/src/debug/AndroidManifest.xml @@ -1,10 +1,7 @@ - + - diff --git a/packages/react-native-bridge/android/react-native-bridge/src/main/AndroidManifest.xml b/packages/react-native-bridge/android/react-native-bridge/src/main/AndroidManifest.xml index 7d31a2d03bd6cf..a26c55b7434e35 100644 --- a/packages/react-native-bridge/android/react-native-bridge/src/main/AndroidManifest.xml +++ b/packages/react-native-bridge/android/react-native-bridge/src/main/AndroidManifest.xml @@ -1,6 +1,9 @@ - - + + diff --git a/packages/react-native-bridge/android/settings.gradle b/packages/react-native-bridge/android/settings.gradle index c7a944de425ae1..32d592f7176160 100644 --- a/packages/react-native-bridge/android/settings.gradle +++ b/packages/react-native-bridge/android/settings.gradle @@ -1,10 +1,12 @@ pluginManagement { gradle.ext.kotlinVersion = '1.6.10' + gradle.ext.agpVersion = '8.1.0' + gradle.ext.automatticPublishToS3Version = '0.8.0' plugins { - id "com.android.library" version "7.2.1" + id "com.android.library" version gradle.ext.agpVersion id "org.jetbrains.kotlin.android" version gradle.ext.kotlinVersion - id "com.automattic.android.publish-to-s3" version "0.7.0" + id "com.automattic.android.publish-to-s3" version gradle.ext.automatticPublishToS3Version } repositories { maven { @@ -22,11 +24,10 @@ pluginManagement { rootProject.name = '@wordpress_react-native-bridge' include ':react-native-bridge' -include ':@wordpress_react-native-aztec' -project(':@wordpress_react-native-aztec').projectDir = new File(rootProject.projectDir, '../../react-native-aztec/android') -include ':react-native-aztec' -project(':react-native-aztec').projectDir = new File(rootProject.projectDir, '../../../packages/react-native-aztec/android') if (hasProperty("willPublishReactNativeBridgeBinary")) { assert file("./react-native-bridge/build/assets/index.android.bundle").exists() : "index.android.bundle is necessary to publish a new version!" +} else { + include ':@wordpress_react-native-aztec' + project(':@wordpress_react-native-aztec').projectDir = new File(rootProject.projectDir, '../../react-native-aztec/android') } diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 293dd686f6cfe2..c1dd2a8a5c3625 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -13,6 +13,7 @@ For each user feature we should also add a importance categorization label to i - [*] Remove visual gap in mobile toolbar when a Gallery block is selected [#52966] - [*] Remove Gallery caption button on mobile [#53010] - [**] Upgrade React Native to 0.71.11 [#51303] +- [*] Upgrade Gradle to 8.2.1 & AGP to 8.1.0 [#52872] ## 1.100.1 - [**] Add WP hook for registering non-core blocks [#52791] diff --git a/packages/react-native-editor/android/.java-version b/packages/react-native-editor/android/.java-version new file mode 100644 index 00000000000000..03b6389f32ad57 --- /dev/null +++ b/packages/react-native-editor/android/.java-version @@ -0,0 +1 @@ +17.0 diff --git a/packages/react-native-editor/android/app/build.gradle b/packages/react-native-editor/android/app/build.gradle index 70eff0b73dab20..5bbb6e560a4916 100644 --- a/packages/react-native-editor/android/app/build.gradle +++ b/packages/react-native-editor/android/app/build.gradle @@ -70,6 +70,10 @@ def reactNativeArchitectures() { } android { + // IMPORTANT: Any updates to the namespace should be reflected in + // the `package` attribute of the main `AndroidManifest.xml` file. + // File reference: `react-native-editor/android/app/src/main/AndroidManifest.xml` + namespace "com.gutenberg" ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion @@ -79,6 +83,10 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } + buildFeatures { + buildConfig true + } + defaultConfig { applicationId "com.gutenberg" minSdkVersion rootProject.ext.minSdkVersion diff --git a/packages/react-native-editor/android/app/src/debug/AndroidManifest.xml b/packages/react-native-editor/android/app/src/debug/AndroidManifest.xml index 1970c1dc4856e4..150f7cd0cc14db 100644 --- a/packages/react-native-editor/android/app/src/debug/AndroidManifest.xml +++ b/packages/react-native-editor/android/app/src/debug/AndroidManifest.xml @@ -1,10 +1,6 @@ - - + + - \ No newline at end of file + diff --git a/packages/react-native-editor/android/app/src/main/AndroidManifest.xml b/packages/react-native-editor/android/app/src/main/AndroidManifest.xml index 3f139808aa706f..8a25e1ad47d1ff 100644 --- a/packages/react-native-editor/android/app/src/main/AndroidManifest.xml +++ b/packages/react-native-editor/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,9 @@ - + + diff --git a/packages/react-native-editor/android/build.gradle b/packages/react-native-editor/android/build.gradle index ace9cf3dfe4d3d..4746f9f3077bee 100644 --- a/packages/react-native-editor/android/build.gradle +++ b/packages/react-native-editor/android/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - gradlePluginVersion = '7.2.1' + gradlePluginVersion = '8.1.0' kotlinVersion = '1.6.10' buildToolsVersion = "33.0.0" minSdkVersion = 24 diff --git a/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.jar b/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.jar index 249e5832f090a2..033e24c4cdf41a 100644 Binary files a/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.jar and b/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.properties index ae04661ee73343..c747538fb38b53 100644 --- a/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-editor/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-editor/android/gradlew b/packages/react-native-editor/android/gradlew index a69d9cb6c20655..fcb6fca147c0cd 100755 --- a/packages/react-native-editor/android/gradlew +++ b/packages/react-native-editor/android/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/packages/react-native-editor/android/gradlew.bat b/packages/react-native-editor/android/gradlew.bat index 53a6b238d414d9..6689b85beecde6 100644 --- a/packages/react-native-editor/android/gradlew.bat +++ b/packages/react-native-editor/android/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/packages/react-native-editor/android/settings.gradle b/packages/react-native-editor/android/settings.gradle index 4fd974817c1e63..1afaaf6df0be3a 100644 --- a/packages/react-native-editor/android/settings.gradle +++ b/packages/react-native-editor/android/settings.gradle @@ -3,4 +3,4 @@ rootProject.name = 'gutenberg' includeBuild("../../react-native-bridge/android") include ':app' -includeBuild('../../../node_modules/react-native-gradle-plugin') +includeBuild('../../../node_modules/@react-native/gradle-plugin') diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index 951d6b2bfea54c..2bb4ec6a570e48 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -34,6 +34,7 @@ "@react-native-community/blur": "4.2.0", "@react-native-community/slider": "https://raw.githubusercontent.com/wordpress-mobile/react-native-slider/v3.0.2-wp-4/react-native-community-slider-3.0.2-wp-4.tgz", "@react-native-masked-view/masked-view": "0.2.9", + "@react-native/gradle-plugin": "0.72.11", "@react-navigation/core": "5.12.0", "@react-navigation/native": "6.0.14", "@react-navigation/routers": "5.4.9", diff --git a/patches/react-native-gradle-plugin+0.71.19.patch b/patches/react-native-gradle-plugin+0.71.19.patch deleted file mode 100644 index 5132c84e17e86b..00000000000000 --- a/patches/react-native-gradle-plugin+0.71.19.patch +++ /dev/null @@ -1,35 +0,0 @@ -@oguzkocer will remove this patch once AGP 8.0+ update is complete - -diff --git a/node_modules/react-native-gradle-plugin/build.gradle.kts b/node_modules/react-native-gradle-plugin/build.gradle.kts -index 5ea92ee..4a4589a 100644 ---- a/node_modules/react-native-gradle-plugin/build.gradle.kts -+++ b/node_modules/react-native-gradle-plugin/build.gradle.kts -@@ -33,7 +33,7 @@ group = "com.facebook.react" - - dependencies { - implementation(gradleApi()) -- implementation("com.android.tools.build:gradle:7.3.1") -+ implementation("com.android.tools.build:gradle:7.2.1") - implementation("com.google.code.gson:gson:2.8.9") - implementation("com.google.guava:guava:31.0.1-jre") - implementation("com.squareup:javapoet:1.13.0") -diff --git a/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt b/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt -index c7db4db..d9a1734 100644 ---- a/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt -+++ b/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt -@@ -52,6 +52,7 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio - - if (!isDebuggableVariant) { - val entryFileEnvVariable = System.getenv("ENTRY_FILE") -+ @Suppress("UNUSED_VARIABLE") - val bundleTask = - tasks.register("createBundle${targetName}JsAndAssets", BundleHermesCTask::class.java) { - it.root.set(config.root) -@@ -76,6 +77,6 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio - // Currently broken inside AGP 7.3 We need to wait for a release of AGP 7.4 in order to use - // the addGeneratedSourceDirectory API. - // variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir) -- variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir) -+ // variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir) - } - }