Skip to content

Commit c5b228d

Browse files
Update Gradle versions to 7 (#1650)
* Update gradle versions to 7 * Update Java version and buildToolsVersion * Update integration_tests.yml * Update integration_tests.yml * More fixes * Update google services dependency version * Remove logic to set ANDROID_SDK_HOME * Update minSdkVersion. * Try working around a build tools error on Windows. * Call d8 directly via java instead of by broken shell script. * Add note about minSdkVersion. * Change Java version in CI build too. --------- Co-authored-by: Jon Simantov <[email protected]>
1 parent 06ab3ec commit c5b228d

File tree

71 files changed

+329
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+329
-240
lines changed

.github/workflows/android.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ jobs:
5454
- name: setup Xcode version (macos)
5555
if: runner.os == 'macOS'
5656
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
57-
- name: Force Java 8 (macOS)
58-
if: startsWith(matrix.os, 'macos')
57+
- name: Force Java 11
5958
shell: bash
60-
run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV
59+
run: echo "JAVA_HOME=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
6160
- name: Store git credentials for all git commands
6261
# Forces all git commands to use authenticated https, to prevent throttling.
6362
shell: bash

.github/workflows/cpp-packaging.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ jobs:
248248
strategy:
249249
fail-fast: false
250250
steps:
251+
- name: Force Java 11
252+
shell: bash
253+
run: echo "JAVA_HOME=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
251254
- name: fetch SDK
252255
uses: actions/checkout@v3
253256
with:

.github/workflows/integration_tests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,9 @@ jobs:
426426
with:
427427
ref: ${{needs.check_and_prepare.outputs.github_ref}}
428428
submodules: true
429-
- name: Force Java 8 (macOS)
430-
if: startsWith(matrix.os, 'macos')
429+
- name: Force Java 11
431430
shell: bash
432-
run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV
431+
run: echo "JAVA_HOME=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
433432
- name: Add msbuild to PATH (Windows)
434433
if: startsWith(matrix.os, 'windows')
435434
uses: microsoft/[email protected]
@@ -1058,11 +1057,11 @@ jobs:
10581057
run: |
10591058
echo "device_type=$( python scripts/gha/print_matrix_configuration.py -k ${{ matrix.android_device }} -get_device_type)" >> $GITHUB_OUTPUT
10601059
echo "device=$( python scripts/gha/print_matrix_configuration.py -k ${{ matrix.android_device }} -get_ftl_device_list)" >> $GITHUB_OUTPUT
1061-
- name: Setup java 8 for test_simulator.py
1060+
- name: Setup java 11 for test_simulator.py
10621061
uses: actions/setup-java@v3
10631062
with:
10641063
distribution: 'temurin'
1065-
java-version: '8'
1064+
java-version: '11'
10661065
- name: Run Android integration tests on Emulator locally
10671066
timeout-minutes: 180
10681067
if: steps.device-info.outputs.device_type == 'virtual'

CMakeLists.txt

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ endif()
180180
# Set directories needed by the Firebase subprojects
181181
# Directory to store generated files.
182182
set(FIREBASE_GEN_FILE_DIR ${CMAKE_BINARY_DIR}/generated)
183+
183184
# Directory for any shared scripts.
184185
set(FIREBASE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_DIR})
185186

@@ -227,20 +228,30 @@ set(FIRESTORE_INCLUDE_OBJC OFF CACHE BOOL "Disabled for the CPP SDK")
227228
set(RE2_BUILD_TESTING OFF CACHE BOOL "")
228229

229230
if(FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD)
230-
# Quote meta characters in ${CMAKE_CURRENT_LIST_DIR} so we can
231-
# match it in a regex.
232-
# For example, '/path/with/+meta/char.acters' will become
233-
# '/path/with/\+meta/char\.acters'.
234-
string(REGEX REPLACE
235-
"([][+.*()^])" "\\\\\\1" # Yes, this many \'s is correct.
236-
current_list_dir_regex
237-
"${CMAKE_CURRENT_LIST_DIR}")
238-
# Figure out where app's binary_dir was.
239-
string(REGEX REPLACE
240-
"${current_list_dir_regex}/[^/]+/(.*)"
241-
"${CMAKE_CURRENT_LIST_DIR}/app/\\1"
242-
APP_BINARY_DIR "${FIREBASE_BINARY_DIR}")
243-
231+
# Gradle now adds a random hash to each separate NDK cmake build.
232+
# Scan the previously built directories to find the one containing app's header.
233+
set(header_to_scan_for "generated/app/src/include/firebase/version.h")
234+
set(prev_build_path "${CMAKE_BINARY_DIR}/../../../../../app/.cxx/${CMAKE_BUILD_TYPE}/*/${CMAKE_ANDROID_ARCH_ABI}")
235+
file(GLOB possible_prev_build_dirs "${prev_build_path}")
236+
# In case there are multiple matches, take the one with the newest timestamp.
237+
set(newest_timestamp 0)
238+
foreach(possible_prev_build_dir IN LISTS possible_prev_build_dirs)
239+
if(IS_DIRECTORY ${possible_prev_build_dir})
240+
if(EXISTS "${possible_prev_build_dir}/${header_to_scan_for}")
241+
# Check if it's newer than any other files.
242+
file(TIMESTAMP "${possible_prev_build_dir}/${header_to_scan_for}" timestamp "%s")
243+
if(${timestamp} GREATER ${newest_timestamp})
244+
set(APP_BINARY_DIR ${possible_prev_build_dir})
245+
set(newest_timestamp ${timestamp})
246+
endif()
247+
endif()
248+
endif()
249+
endforeach()
250+
if (IS_DIRECTORY "${APP_BINARY_DIR}")
251+
message(STATUS "Found previous Firebase App build in ${APP_BINARY_DIR}")
252+
else()
253+
message(FATAL_ERROR "Could not find previous Firebase App build under ${prev_build_path}")
254+
endif()
244255
set(FIRESTORE_SOURCE_DIR ${APP_BINARY_DIR}/external/src/firestore)
245256
else()
246257
# Run the CMake build logic that will download all the external dependencies.
@@ -579,6 +590,7 @@ if(NOT FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD)
579590
else()
580591
# Add firebase_app as a target on the previously built app.
581592
add_library(firebase_app STATIC IMPORTED GLOBAL)
593+
582594
file(MAKE_DIRECTORY "${APP_BINARY_DIR}/generated")
583595
file(MAKE_DIRECTORY "${FIREBASE_BINARY_DIR}/generated")
584596
set(app_include_dirs

analytics/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# Analytics generates header files for default events, parameters, and
1818
# properties based on the iOS SDK, that are used across all platforms.
19+
1920
set(analytics_generated_headers_dir
2021
"${FIREBASE_GEN_FILE_DIR}/analytics/src/include/firebase/analytics")
2122
set(event_names_header "${analytics_generated_headers_dir}/event_names.h")

analytics/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildscript {
1818
mavenCentral()
1919
}
2020
dependencies {
21-
classpath 'com.android.tools.build:gradle:4.2.1'
21+
classpath 'com.android.tools.build:gradle:7.4.2'
2222
}
2323
}
2424
allprojects {
@@ -33,7 +33,7 @@ apply plugin: 'com.android.library'
3333
android {
3434
compileSdkVersion 34
3535
ndkPath System.getenv('ANDROID_NDK_HOME')
36-
buildToolsVersion '30.0.2'
36+
buildToolsVersion '32.0.0'
3737

3838
sourceSets {
3939
main {
@@ -48,7 +48,7 @@ android {
4848
}
4949

5050
defaultConfig {
51-
minSdkVersion 23
51+
minSdkVersion 24
5252
targetSdkVersion 34
5353
versionCode 1
5454
versionName "1.0"
@@ -85,4 +85,5 @@ apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
8585
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
8686
project.afterEvaluate {
8787
generateProguardFile('analytics')
88+
preBuild.dependsOn(':app:build')
8889
}

analytics/integration_test/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ buildscript {
2020
mavenCentral()
2121
}
2222
dependencies {
23-
classpath 'com.android.tools.build:gradle:4.2.1'
24-
classpath 'com.google.gms:google-services:4.0.1'
23+
classpath 'com.android.tools.build:gradle:7.4.2'
24+
classpath 'com.google.gms:google-services:4.4.1'
2525
}
2626
}
2727

@@ -37,12 +37,12 @@ apply plugin: 'com.android.application'
3737

3838
android {
3939
compileOptions {
40-
sourceCompatibility 1.8
41-
targetCompatibility 1.8
40+
sourceCompatibility JavaVersion.VERSION_11
41+
targetCompatibility JavaVersion.VERSION_11
4242
}
4343
compileSdkVersion 34
4444
ndkPath System.getenv('ANDROID_NDK_HOME')
45-
buildToolsVersion '30.0.2'
45+
buildToolsVersion '32.0.0'
4646

4747
sourceSets {
4848
main {
@@ -55,7 +55,7 @@ android {
5555

5656
defaultConfig {
5757
applicationId 'com.google.android.analytics.testapp'
58-
minSdkVersion 23
58+
minSdkVersion 24
5959
targetSdkVersion 34
6060
versionCode 1
6161
versionName '1.0'

analytics/integration_test/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
6+
distributionUrl=https://services.gradle.org/distributions/gradle-7.5.1-all.zip

android_build_files/extract_and_dex.gradle

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,11 @@ def defineExtractionTasks(String resourceName, String buildType) {
5858
outputs.file "$outPro"
5959

6060
// Convert the jar format using the dx tool.
61-
String dex_path = "${sdk_dir}/build-tools/${buildToolsVersion}/dx"
62-
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
63-
dex_path = "${dex_path}.bat"
64-
}
65-
66-
commandLine "${dex_path}",
67-
'--dex',
68-
"--output=$dexedJar",
69-
"$buildDir/classes.jar"
61+
String dex_path = "${sdk_dir}/build-tools/${buildToolsVersion}/lib/d8.jar"
62+
commandLine "java", "-cp", "${dex_path}", "com.android.tools.r8.D8",
63+
"$buildDir/classes.jar",
64+
"--output",
65+
"$dexedJar"
7066
}
7167

7268
// Once the dexed jar has been made, generate a proguard file for it.

android_build_files/generate_proguard.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def defineGenerateProguardFile(String subproject, String buildType,
7272
String nativeBuildDir =
7373
project.android.externalNativeBuild.cmake.buildStagingDirectory
7474
if (nativeBuildDir == null || nativeBuildDir.isEmpty()) {
75-
nativeBuildDir = file('.cxx/cmake').absolutePath
75+
nativeBuildDir = file('.cxx').absolutePath
7676
}
7777

7878
// Find the static library that was built. Note that there are multiple

app/app_resources/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ buildscript {
1818
mavenCentral()
1919
}
2020
dependencies {
21-
classpath 'com.android.tools.build:gradle:4.2.1'
22-
classpath 'com.google.gms:google-services:4.2.0'
21+
classpath 'com.android.tools.build:gradle:7.4.2'
22+
classpath 'com.google.gms:google-services:4.4.1'
2323
}
2424
}
2525
allprojects {
@@ -33,10 +33,16 @@ apply plugin: 'com.android.library'
3333

3434
android {
3535
compileOptions {
36-
sourceCompatibility 1.8
37-
targetCompatibility 1.8
36+
sourceCompatibility JavaVersion.VERSION_11
37+
targetCompatibility JavaVersion.VERSION_11
3838
}
3939
compileSdkVersion 34
40+
buildToolsVersion '32.0.0'
41+
42+
defaultConfig {
43+
minSdkVersion 24
44+
targetSdkVersion 34
45+
}
4046

4147
sourceSets {
4248
main {

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildscript {
1818
mavenCentral()
1919
}
2020
dependencies {
21-
classpath 'com.android.tools.build:gradle:4.2.1'
21+
classpath 'com.android.tools.build:gradle:7.4.2'
2222
}
2323
}
2424
allprojects {
@@ -33,7 +33,7 @@ apply plugin: 'com.android.library'
3333
android {
3434
compileSdkVersion 34
3535
ndkPath System.getenv('ANDROID_NDK_HOME')
36-
buildToolsVersion '30.0.2'
36+
buildToolsVersion '32.0.0'
3737

3838
sourceSets {
3939
main {
@@ -48,7 +48,7 @@ android {
4848
}
4949

5050
defaultConfig {
51-
minSdkVersion 23
51+
minSdkVersion 24
5252
targetSdkVersion 34
5353
versionCode 1
5454
versionName "1.0"

app/google_api_resources/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ buildscript {
1818
mavenCentral()
1919
}
2020
dependencies {
21-
classpath 'com.android.tools.build:gradle:4.2.1'
22-
classpath 'com.google.gms:google-services:4.2.0'
21+
classpath 'com.android.tools.build:gradle:7.4.2'
22+
classpath 'com.google.gms:google-services:4.4.1'
2323
}
2424
}
2525
allprojects {
@@ -33,10 +33,16 @@ apply plugin: 'com.android.library'
3333

3434
android {
3535
compileOptions {
36-
sourceCompatibility 1.8
37-
targetCompatibility 1.8
36+
sourceCompatibility JavaVersion.VERSION_11
37+
targetCompatibility JavaVersion.VERSION_11
3838
}
3939
compileSdkVersion 34
40+
buildToolsVersion '32.0.0'
41+
42+
defaultConfig {
43+
minSdkVersion 24
44+
targetSdkVersion 34
45+
}
4046

4147
sourceSets {
4248
main {

app/integration_test/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ buildscript {
2020
mavenCentral()
2121
}
2222
dependencies {
23-
classpath 'com.android.tools.build:gradle:4.2.1'
24-
classpath 'com.google.gms:google-services:4.0.1'
23+
classpath 'com.android.tools.build:gradle:7.4.2'
24+
classpath 'com.google.gms:google-services:4.4.1'
2525
}
2626
}
2727

@@ -37,12 +37,12 @@ apply plugin: 'com.android.application'
3737

3838
android {
3939
compileOptions {
40-
sourceCompatibility 1.8
41-
targetCompatibility 1.8
40+
sourceCompatibility JavaVersion.VERSION_11
41+
targetCompatibility JavaVersion.VERSION_11
4242
}
4343
compileSdkVersion 34
4444
ndkPath System.getenv('ANDROID_NDK_HOME')
45-
buildToolsVersion '30.0.2'
45+
buildToolsVersion '32.0.0'
4646

4747
sourceSets {
4848
main {
@@ -55,7 +55,7 @@ android {
5555

5656
defaultConfig {
5757
applicationId 'com.google.android.analytics.testapp'
58-
minSdkVersion 23
58+
minSdkVersion 24
5959
targetSdkVersion 34
6060
versionCode 1
6161
versionName '1.0'

app/integration_test/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
6+
distributionUrl=https://services.gradle.org/distributions/gradle-7.5.1-all.zip

app/invites_resources/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ buildscript {
1818
mavenCentral()
1919
}
2020
dependencies {
21-
classpath 'com.android.tools.build:gradle:4.2.1'
22-
classpath 'com.google.gms:google-services:4.2.0'
21+
classpath 'com.android.tools.build:gradle:7.4.2'
22+
classpath 'com.google.gms:google-services:4.4.1'
2323
}
2424
}
2525
allprojects {
@@ -33,10 +33,16 @@ apply plugin: 'com.android.library'
3333

3434
android {
3535
compileOptions {
36-
sourceCompatibility 1.8
37-
targetCompatibility 1.8
36+
sourceCompatibility JavaVersion.VERSION_11
37+
targetCompatibility JavaVersion.VERSION_11
3838
}
3939
compileSdkVersion 34
40+
buildToolsVersion '32.0.0'
41+
42+
defaultConfig {
43+
minSdkVersion 24
44+
targetSdkVersion 34
45+
}
4046

4147
sourceSets {
4248
main {

0 commit comments

Comments
 (0)