Skip to content

Commit f8a7722

Browse files
Reverts "Update gradle lockfiles template" (#142889)
Reverts flutter/flutter#140115 Initiated by: bartekpacia Reason for reverting: broke the tree - [`Linux firebase_abstract_method_smoke_test`](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20firebase_abstract_method_smoke_test/15844/overview) - [`Linux_android android_view_scroll_perf__timeline_summary`](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20android_view_scroll_perf__timeline_summary/13453/overview) - [`Linux_android platform_views Original PR Author: bartekpacia Reviewed By: {gmackall} This change reverts the following previous change: Original Description: This PR updates almost* all Gradle buildscripts in the Flutter repo the `example` and `dev` (in particular, in `dev/integration_tests` and in `dev/benchmarks`) directories to apply Flutter's Gradle plugins using the declarative `plugins {}` block. *almost, because: - add-to-app (aka hybrid) apps are not migrated (related flutter/flutter#138756) - apps that purposefully use build files to ensure backward compatibility (e.g. [`gradle_deprecated_settings`](https://github.com/flutter/flutter/tree/3.16.0/dev/integration_tests/gradle_deprecated_settings))
1 parent 85888bc commit f8a7722

File tree

141 files changed

+1838
-2334
lines changed

Some content is hidden

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

141 files changed

+1838
-2334
lines changed

dev/a11y_assessments/android/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
// To update all the build.gradle files in the Flutter repo,
77
// See dev/tools/bin/generate_gradle_lockfiles.dart.
88

9+
buildscript {
10+
ext.kotlin_version = '1.7.10'
11+
repositories {
12+
google()
13+
mavenCentral()
14+
}
15+
16+
dependencies {
17+
classpath 'com.android.tools.build:gradle:7.3.0'
18+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19+
}
20+
21+
configurations.classpath {
22+
resolutionStrategy.activateDependencyLocking()
23+
}
24+
}
25+
926
allprojects {
1027
repositories {
1128
google()
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# This file is expected to be part of source control.
44
androidx.databinding:databinding-common:7.3.0=classpath
55
androidx.databinding:databinding-compiler-common:7.3.0=classpath
6-
com.android.application:com.android.application.gradle.plugin:7.3.0=classpath
76
com.android.databinding:baseLibrary:7.3.0=classpath
87
com.android.tools.analytics-library:crash:30.3.0=classpath
98
com.android.tools.analytics-library:protos:30.3.0=classpath
@@ -110,7 +109,6 @@ org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
110109
org.glassfish.jaxb:txw2:2.3.2=classpath
111110
org.jdom:jdom2:2.0.6=classpath
112111
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
113-
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.7.10=classpath
114112
org.jetbrains.kotlin:kotlin-android-extensions:1.7.10=classpath
115113
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.7.10=classpath
116114
org.jetbrains.kotlin:kotlin-build-common:1.7.10=classpath

dev/a11y_assessments/android/settings.gradle

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,8 @@ pluginManagement {
1717
settings.ext.flutterSdkPath = flutterSdkPath()
1818

1919
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
20-
21-
repositories {
22-
google()
23-
mavenCentral()
24-
gradlePluginPortal()
25-
}
26-
}
27-
28-
plugins {
29-
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
30-
id "com.android.application" version "7.3.0" apply false
31-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
3220
}
3321

3422
include ":app"
23+
24+
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

dev/benchmarks/complex_layout/android/app/build.gradle

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
plugins {
6-
id "com.android.application"
7-
id "dev.flutter.flutter-gradle-plugin"
8-
}
9-
105
def localProperties = new Properties()
116
def localPropertiesFile = rootProject.file('local.properties')
127
if (localPropertiesFile.exists()) {
@@ -15,15 +10,13 @@ if (localPropertiesFile.exists()) {
1510
}
1611
}
1712

18-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
19-
if (flutterVersionCode == null) {
20-
flutterVersionCode = '1'
13+
def flutterRoot = localProperties.getProperty('flutter.sdk')
14+
if (flutterRoot == null) {
15+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
2116
}
2217

23-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
24-
if (flutterVersionName == null) {
25-
flutterVersionName = '1.0'
26-
}
18+
apply plugin: 'com.android.application'
19+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2720

2821
android {
2922
namespace "com.yourcompany.complexLayout"

dev/benchmarks/complex_layout/android/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
// To update all the build.gradle files in the Flutter repo,
77
// See dev/tools/bin/generate_gradle_lockfiles.dart.
88

9+
buildscript {
10+
ext.kotlin_version = '1.7.10'
11+
repositories {
12+
google()
13+
mavenCentral()
14+
}
15+
16+
dependencies {
17+
classpath 'com.android.tools.build:gradle:7.3.0'
18+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19+
}
20+
21+
configurations.classpath {
22+
resolutionStrategy.activateDependencyLocking()
23+
}
24+
}
25+
926
allprojects {
1027
repositories {
1128
google()

dev/benchmarks/complex_layout/android/buildscript-gradle.lockfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# This file is expected to be part of source control.
44
androidx.databinding:databinding-common:7.3.0=classpath
55
androidx.databinding:databinding-compiler-common:7.3.0=classpath
6-
com.android.application:com.android.application.gradle.plugin:7.3.0=classpath
76
com.android.databinding:baseLibrary:7.3.0=classpath
87
com.android.tools.analytics-library:crash:30.3.0=classpath
98
com.android.tools.analytics-library:protos:30.3.0=classpath
@@ -110,7 +109,6 @@ org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
110109
org.glassfish.jaxb:txw2:2.3.2=classpath
111110
org.jdom:jdom2:2.0.6=classpath
112111
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
113-
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.7.10=classpath
114112
org.jetbrains.kotlin:kotlin-android-extensions:1.7.10=classpath
115113
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.7.10=classpath
116114
org.jetbrains.kotlin:kotlin-build-common:1.7.10=classpath

dev/benchmarks/complex_layout/android/settings.gradle

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,11 @@ pluginManagement {
1818

1919
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
2020

21-
repositories {
22-
google()
23-
mavenCentral()
24-
gradlePluginPortal()
21+
plugins {
22+
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
2523
}
2624
}
2725

28-
buildscript {
29-
dependencyLocking {
30-
lockFile = file("${rootProject.projectDir}/buildscript-gradle.lockfile")
31-
lockAllConfigurations()
32-
}
33-
}
34-
35-
plugins {
36-
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
37-
id "com.android.application" version "7.3.0" apply false
38-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
39-
}
40-
4126
include ":app"
27+
28+
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

dev/benchmarks/macrobenchmarks/android/app/build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
plugins {
6-
id "com.android.application"
7-
id "dev.flutter.flutter-gradle-plugin"
8-
}
9-
105
def localProperties = new Properties()
116
def localPropertiesFile = rootProject.file('local.properties')
127
if (localPropertiesFile.exists()) {
@@ -15,6 +10,11 @@ if (localPropertiesFile.exists()) {
1510
}
1611
}
1712

13+
def flutterRoot = localProperties.getProperty('flutter.sdk')
14+
if (flutterRoot == null) {
15+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
16+
}
17+
1818
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1919
if (flutterVersionCode == null) {
2020
flutterVersionCode = '1'
@@ -25,6 +25,9 @@ if (flutterVersionName == null) {
2525
flutterVersionName = '1.0'
2626
}
2727

28+
apply plugin: 'com.android.application'
29+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
30+
2831
android {
2932
namespace "com.example.macrobenchmarks"
3033
compileSdk flutter.compileSdkVersion

dev/benchmarks/macrobenchmarks/android/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
// To update all the build.gradle files in the Flutter repo,
77
// See dev/tools/bin/generate_gradle_lockfiles.dart.
88

9+
buildscript {
10+
ext.kotlin_version = '1.7.10'
11+
repositories {
12+
google()
13+
mavenCentral()
14+
}
15+
16+
dependencies {
17+
classpath 'com.android.tools.build:gradle:7.3.0'
18+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19+
}
20+
21+
configurations.classpath {
22+
resolutionStrategy.activateDependencyLocking()
23+
}
24+
}
25+
926
allprojects {
1027
repositories {
1128
google()

dev/benchmarks/macrobenchmarks/android/buildscript-gradle.lockfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# This file is expected to be part of source control.
44
androidx.databinding:databinding-common:7.3.0=classpath
55
androidx.databinding:databinding-compiler-common:7.3.0=classpath
6-
com.android.application:com.android.application.gradle.plugin:7.3.0=classpath
76
com.android.databinding:baseLibrary:7.3.0=classpath
87
com.android.tools.analytics-library:crash:30.3.0=classpath
98
com.android.tools.analytics-library:protos:30.3.0=classpath
@@ -110,7 +109,6 @@ org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
110109
org.glassfish.jaxb:txw2:2.3.2=classpath
111110
org.jdom:jdom2:2.0.6=classpath
112111
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
113-
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.7.10=classpath
114112
org.jetbrains.kotlin:kotlin-android-extensions:1.7.10=classpath
115113
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.7.10=classpath
116114
org.jetbrains.kotlin:kotlin-build-common:1.7.10=classpath

dev/benchmarks/macrobenchmarks/android/settings.gradle

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,11 @@ pluginManagement {
1818

1919
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
2020

21-
repositories {
22-
google()
23-
mavenCentral()
24-
gradlePluginPortal()
21+
plugins {
22+
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
2523
}
2624
}
2725

28-
buildscript {
29-
dependencyLocking {
30-
lockFile = file("${rootProject.projectDir}/buildscript-gradle.lockfile")
31-
lockAllConfigurations()
32-
}
33-
}
34-
35-
plugins {
36-
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
37-
id "com.android.application" version "7.3.0" apply false
38-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
39-
}
40-
4126
include ":app"
27+
28+
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

dev/benchmarks/microbenchmarks/android/app/build.gradle

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
plugins {
6-
id "com.android.application"
7-
id "dev.flutter.flutter-gradle-plugin"
8-
}
9-
105
def localProperties = new Properties()
116
def localPropertiesFile = rootProject.file('local.properties')
127
if (localPropertiesFile.exists()) {
@@ -15,15 +10,13 @@ if (localPropertiesFile.exists()) {
1510
}
1611
}
1712

18-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
19-
if (flutterVersionCode == null) {
20-
flutterVersionCode = '1'
13+
def flutterRoot = localProperties.getProperty('flutter.sdk')
14+
if (flutterRoot == null) {
15+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
2116
}
2217

23-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
24-
if (flutterVersionName == null) {
25-
flutterVersionName = '1.0'
26-
}
18+
apply plugin: 'com.android.application'
19+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2720

2821
android {
2922
namespace "com.yourcompany.microbenchmarks"
@@ -37,8 +30,8 @@ android {
3730
defaultConfig {
3831
minSdkVersion flutter.minSdkVersion
3932
targetSdkVersion flutter.targetSdkVersion
40-
versionCode flutterVersionCode.toInteger()
41-
versionName flutterVersionName
33+
versionCode 1
34+
versionName "0.0.1"
4235
}
4336

4437
buildTypes {

dev/benchmarks/microbenchmarks/android/build.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// This file is auto generated.
6+
// To update all the build.gradle files in the Flutter repo,
7+
// See dev/tools/bin/generate_gradle_lockfiles.dart.
8+
9+
buildscript {
10+
ext.kotlin_version = '1.7.10'
11+
repositories {
12+
google()
13+
mavenCentral()
14+
}
15+
16+
dependencies {
17+
classpath 'com.android.tools.build:gradle:7.3.0'
18+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19+
}
20+
21+
configurations.classpath {
22+
resolutionStrategy.activateDependencyLocking()
23+
}
24+
}
25+
526
allprojects {
627
repositories {
728
google()

dev/benchmarks/microbenchmarks/android/settings.gradle

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,20 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
pluginManagement {
6-
def flutterSdkPath = {
7-
def properties = new Properties()
8-
file("local.properties").withInputStream { properties.load(it) }
9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
return flutterSdkPath
12-
}
13-
settings.ext.flutterSdkPath = flutterSdkPath()
5+
// This file is auto generated.
6+
// To update all the build.gradle files in the Flutter repo,
7+
// See dev/tools/bin/generate_gradle_lockfiles.dart.
148

15-
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
9+
include ':app'
1610

17-
repositories {
18-
google()
19-
mavenCentral()
20-
gradlePluginPortal()
21-
}
22-
}
11+
enableFeaturePreview('ONE_LOCKFILE_PER_PROJECT')
2312

24-
plugins {
25-
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
26-
id "com.android.application" version "7.3.0" apply false
27-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
28-
}
13+
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
14+
def properties = new Properties()
2915

30-
include ":app"
16+
assert localPropertiesFile.exists()
17+
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
18+
19+
def flutterSdkPath = properties.getProperty("flutter.sdk")
20+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
21+
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

0 commit comments

Comments
 (0)