convert resolve_dependencies.gradle to resolve_dependencies.gradle.kts (#159399)
converting `resolve_dependencies.gradle` to `resolve_dependencies.gradle.kts` ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> Co-authored-by: Reid Baker <reidbaker@google.com>
This commit is contained in:
committed by
GitHub
parent
128caa701f
commit
571d495ff6
@@ -1,67 +0,0 @@
|
||||
// This script is used to warm the Gradle cache by downloading the Flutter dependencies
|
||||
// used during the build. This script is invoked when `flutter precache` is run.
|
||||
//
|
||||
// Command:
|
||||
// gradle -b <flutter-sdk>packages/flutter_tools/gradle/resolve_dependencies.gradle
|
||||
// resolveDependencies
|
||||
//
|
||||
// This way, Gradle can run with the `--offline` flag later on to eliminate any
|
||||
// network request during the build process.
|
||||
//
|
||||
// This includes:
|
||||
// 1. The embedding
|
||||
// 2. libflutter.so
|
||||
|
||||
import java.nio.file.Paths
|
||||
|
||||
String storageUrl = System.getenv('FLUTTER_STORAGE_BASE_URL') ?: "https://storage.googleapis.com"
|
||||
|
||||
String engineRealm = Paths.get(flutterRoot.absolutePath, "bin", "internal", "engine.realm")
|
||||
.toFile().text.trim()
|
||||
if (engineRealm) {
|
||||
engineRealm += "/"
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "$storageUrl/${engineRealm}download.flutter.io"
|
||||
}
|
||||
}
|
||||
|
||||
File flutterRoot = projectDir.parentFile.parentFile.parentFile
|
||||
|
||||
assert flutterRoot.isDirectory()
|
||||
String engineVersion = Paths.get(flutterRoot.absolutePath, "bin", "internal", "engine.version")
|
||||
.toFile().text.trim()
|
||||
|
||||
configurations {
|
||||
flutterRelease.extendsFrom releaseImplementation
|
||||
flutterDebug.extendsFrom debugImplementation
|
||||
flutterProfile.extendsFrom debugImplementation
|
||||
}
|
||||
|
||||
dependencies {
|
||||
flutterRelease "io.flutter:flutter_embedding_release:1.0.0-$engineVersion"
|
||||
flutterRelease "io.flutter:armeabi_v7a_release:1.0.0-$engineVersion"
|
||||
flutterRelease "io.flutter:arm64_v8a_release:1.0.0-$engineVersion"
|
||||
|
||||
flutterProfile "io.flutter:flutter_embedding_profile:1.0.0-$engineVersion"
|
||||
flutterProfile "io.flutter:armeabi_v7a_profile:1.0.0-$engineVersion"
|
||||
flutterProfile "io.flutter:arm64_v8a_profile:1.0.0-$engineVersion"
|
||||
|
||||
flutterDebug "io.flutter:flutter_embedding_debug:1.0.0-$engineVersion"
|
||||
flutterDebug "io.flutter:armeabi_v7a_debug:1.0.0-$engineVersion"
|
||||
flutterDebug "io.flutter:arm64_v8a_debug:1.0.0-$engineVersion"
|
||||
flutterDebug "io.flutter:x86_debug:1.0.0-$engineVersion"
|
||||
flutterDebug "io.flutter:x86_64_debug:1.0.0-$engineVersion"
|
||||
}
|
||||
|
||||
tasks.register('resolveDependencies') {
|
||||
configurations.each { configuration ->
|
||||
if (configuration.name.startsWith("flutter")) {
|
||||
configuration.resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import java.nio.file.Paths
|
||||
|
||||
// This script is used to warm the Gradle cache by downloading the Flutter dependencies
|
||||
// used during the build. This script is invoked when `flutter precache` is run.
|
||||
//
|
||||
// Command:
|
||||
// gradle -b <flutter-sdk>packages/flutter_tools/gradle/resolve_dependencies.gradle.kts
|
||||
// resolveDependencies
|
||||
//
|
||||
// This way, Gradle can run with the `--offline` flag later on to eliminate any
|
||||
// network request during the build process.
|
||||
//
|
||||
// This includes:
|
||||
// 1. The embedding
|
||||
// 2. libflutter.so
|
||||
|
||||
val storageUrl: String = System.getenv("FLUTTER_STORAGE_BASE_URL") ?: "https://storage.googleapis.com"
|
||||
|
||||
val flutterRoot = projectDir.parentFile?.parentFile?.parentFile
|
||||
requireNotNull(flutterRoot) { "Flutter root directory not found!" }
|
||||
|
||||
require(flutterRoot.isDirectory) { "Flutter root is not a valid directory!" }
|
||||
|
||||
val engineVersion =
|
||||
Paths.get(
|
||||
flutterRoot.absolutePath,
|
||||
"bin",
|
||||
"internal",
|
||||
"engine.version"
|
||||
)
|
||||
.toFile()
|
||||
.readText()
|
||||
.trim()
|
||||
|
||||
var engineRealm =
|
||||
Paths.get(
|
||||
flutterRoot.absolutePath,
|
||||
"bin",
|
||||
"internal",
|
||||
"engine.realm"
|
||||
)
|
||||
.toFile()
|
||||
.readText()
|
||||
.trim()
|
||||
|
||||
if (engineRealm.isNotEmpty()) {
|
||||
engineRealm += "/"
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url = uri("$storageUrl/${engineRealm}download.flutter.io")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
create("flutterRelease") {
|
||||
extendsFrom(configurations.getByName("releaseImplementation"))
|
||||
}
|
||||
create("flutterDebug") {
|
||||
extendsFrom(configurations.getByName("debugImplementation"))
|
||||
}
|
||||
create("flutterProfile") {
|
||||
extendsFrom(configurations.getByName("debugImplementation"))
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"flutterRelease"("io.flutter:flutter_embedding_release:1.0.0-$engineVersion")
|
||||
"flutterRelease"("io.flutter:armeabi_v7a_release:1.0.0-$engineVersion")
|
||||
"flutterRelease"("io.flutter:arm64_v8a_release:1.0.0-$engineVersion")
|
||||
|
||||
"flutterProfile"("io.flutter:flutter_embedding_profile:1.0.0-$engineVersion")
|
||||
"flutterProfile"("io.flutter:armeabi_v7a_profile:1.0.0-$engineVersion")
|
||||
"flutterProfile"("io.flutter:arm64_v8a_profile:1.0.0-$engineVersion")
|
||||
|
||||
"flutterDebug"("io.flutter:flutter_embedding_debug:1.0.0-$engineVersion")
|
||||
"flutterDebug"("io.flutter:armeabi_v7a_debug:1.0.0-$engineVersion")
|
||||
"flutterDebug"("io.flutter:arm64_v8a_debug:1.0.0-$engineVersion")
|
||||
"flutterDebug"("io.flutter:x86_debug:1.0.0-$engineVersion")
|
||||
"flutterDebug"("io.flutter:x86_64_debug:1.0.0-$engineVersion")
|
||||
}
|
||||
|
||||
tasks.register("resolveDependencies") {
|
||||
doLast {
|
||||
configurations.forEach { configuration ->
|
||||
if (configuration.name.startsWith("flutter")) {
|
||||
configuration.resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,7 +403,7 @@ class AndroidMavenArtifacts extends ArtifactSet {
|
||||
'packages',
|
||||
'flutter_tools',
|
||||
'gradle',
|
||||
'resolve_dependencies.gradle',
|
||||
'resolve_dependencies.gradle.kts',
|
||||
),
|
||||
'--project-cache-dir',
|
||||
tempDir.path,
|
||||
|
||||
@@ -1229,7 +1229,7 @@ void main() {
|
||||
command: <String>[
|
||||
'/bin/cache/flutter_gradle_wrapper.rand0/gradlew',
|
||||
'-b',
|
||||
'packages/flutter_tools/gradle/resolve_dependencies.gradle',
|
||||
'packages/flutter_tools/gradle/resolve_dependencies.gradle.kts',
|
||||
'--project-cache-dir',
|
||||
'/bin/cache/flutter_gradle_wrapper.rand0',
|
||||
'resolveDependencies',
|
||||
|
||||
Reference in New Issue
Block a user