Unverified Commit d6e435a7 authored by Reid Baker's avatar Reid Baker Committed by GitHub

Part 1/n migration steps for kotlin migration (#140452)

Following https://developer.android.com/build/migrate-to-kotlin-dsl
1/n Add parentheses to method calls 

Should be a no-op change. If you see a behavioral change please flag it.
parent 9003f138
...@@ -183,9 +183,9 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -183,9 +183,9 @@ class FlutterPlugin implements Plugin<Project> {
def gradlew = (OperatingSystem.current().isWindows()) ? def gradlew = (OperatingSystem.current().isWindows()) ?
"${rootProject.projectDir}/gradlew.bat" : "${rootProject.projectDir}/gradlew" "${rootProject.projectDir}/gradlew.bat" : "${rootProject.projectDir}/gradlew"
rootProject.exec { rootProject.exec {
workingDir rootProject.projectDir workingDir(rootProject.projectDir)
executable gradlew executable(gradlew)
args ":${subproject.name}:dependencies", "--write-locks" args(":${subproject.name}:dependencies", "--write-locks")
} }
} }
} }
...@@ -217,7 +217,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -217,7 +217,7 @@ class FlutterPlugin implements Plugin<Project> {
rootProject.allprojects { rootProject.allprojects {
repositories { repositories {
maven { maven {
url repository url(repository)
} }
} }
} }
...@@ -233,11 +233,11 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -233,11 +233,11 @@ class FlutterPlugin implements Plugin<Project> {
splits { splits {
abi { abi {
// Enables building multiple APKs per ABI. // Enables building multiple APKs per ABI.
enable true enable(true)
// Resets the list of ABIs that Gradle should create APKs for to none. // Resets the list of ABIs that Gradle should create APKs for to none.
reset() reset()
// Specifies that we do not want to also generate a universal APK that includes all ABIs. // Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false universalApk(false)
} }
} }
} }
...@@ -256,7 +256,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -256,7 +256,7 @@ class FlutterPlugin implements Plugin<Project> {
if (shouldSplitPerAbi()) { if (shouldSplitPerAbi()) {
splits { splits {
abi { abi {
include abiValue include(abiValue)
} }
} }
} }
...@@ -273,12 +273,12 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -273,12 +273,12 @@ class FlutterPlugin implements Plugin<Project> {
project.android { project.android {
buildTypes { buildTypes {
release { release {
multiDexKeepFile project.file(flutterMultidexKeepfile) multiDexKeepFile(project.file(flutterMultidexKeepfile))
} }
} }
} }
project.dependencies { project.dependencies {
implementation "androidx.multidex:multidex:2.0.1" implementation("androidx.multidex:multidex:2.0.1")
} }
} }
// Use Kotlin DSL to handle baseApplicationName logic due to Groovy dynamic dispatch bug. // Use Kotlin DSL to handle baseApplicationName logic due to Groovy dynamic dispatch bug.
...@@ -289,7 +289,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -289,7 +289,7 @@ class FlutterPlugin implements Plugin<Project> {
project.android.buildTypes { project.android.buildTypes {
// Add profile build type. // Add profile build type.
profile { profile {
initWith debug initWith(debug)
if (it.hasProperty("matchingFallbacks")) { if (it.hasProperty("matchingFallbacks")) {
matchingFallbacks = ["debug", "release"] matchingFallbacks = ["debug", "release"]
} }
...@@ -302,13 +302,13 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -302,13 +302,13 @@ class FlutterPlugin implements Plugin<Project> {
release { release {
// Enables code shrinking, obfuscation, and optimization for only // Enables code shrinking, obfuscation, and optimization for only
// your project's release build type. // your project's release build type.
minifyEnabled true minifyEnabled(true)
// Enables resource shrinking, which is performed by the Android Gradle plugin. // Enables resource shrinking, which is performed by the Android Gradle plugin.
// The resource shrinker can't be used for libraries. // The resource shrinker can't be used for libraries.
shrinkResources isBuiltAsApp(project) shrinkResources(isBuiltAsApp(project))
// Fallback to `android/app/proguard-rules.pro`. // Fallback to `android/app/proguard-rules.pro`.
// This way, custom Proguard rules can be configured as needed. // This way, custom Proguard rules can be configured as needed.
proguardFiles project.android.getDefaultProguardFile("proguard-android.txt"), flutterProguardRules, "proguard-rules.pro" proguardFiles(project.android.getDefaultProguardFile("proguard-android.txt"), flutterProguardRules, "proguard-rules.pro")
} }
} }
} }
...@@ -330,7 +330,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -330,7 +330,7 @@ class FlutterPlugin implements Plugin<Project> {
} }
localEngineHost = engineHostOut.name localEngineHost = engineHostOut.name
} }
project.android.buildTypes.all this.&addFlutterDependencies project.android.buildTypes.all(this.&addFlutterDependencies)
} }
private static Boolean shouldShrinkResources(Project project) { private static Boolean shouldShrinkResources(Project project) {
...@@ -394,8 +394,8 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -394,8 +394,8 @@ class FlutterPlugin implements Plugin<Project> {
* Finally, the project's `settings.gradle` loads each plugin's android directory as a subproject. * Finally, the project's `settings.gradle` loads each plugin's android directory as a subproject.
*/ */
private void configurePlugins() { private void configurePlugins() {
getPluginList().each this.&configurePluginProject getPluginList().each(this.&configurePluginProject)
getPluginDependencies().each this.&configurePluginDependencies getPluginDependencies().each(this.&configurePluginDependencies)
} }
/** Adds the plugin project dependency to the app project. */ /** Adds the plugin project dependency to the app project. */
...@@ -407,7 +407,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -407,7 +407,7 @@ class FlutterPlugin implements Plugin<Project> {
} }
// Add plugin dependency to the app project. // Add plugin dependency to the app project.
project.dependencies { project.dependencies {
api pluginProject api(pluginProject)
} }
Closure addEmbeddingDependencyToPlugin = { buildType -> Closure addEmbeddingDependencyToPlugin = { buildType ->
String flutterBuildMode = buildModeFor(buildType) String flutterBuildMode = buildModeFor(buildType)
...@@ -445,7 +445,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -445,7 +445,7 @@ class FlutterPlugin implements Plugin<Project> {
project.logger.quiet("For more information about build configuration, see $kWebsiteDeploymentAndroidBuildConfig.") project.logger.quiet("For more information about build configuration, see $kWebsiteDeploymentAndroidBuildConfig.")
} }
project.android.buildTypes.all addEmbeddingDependencyToPlugin project.android.buildTypes.all(addEmbeddingDependencyToPlugin)
} }
} }
...@@ -544,15 +544,15 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -544,15 +544,15 @@ class FlutterPlugin implements Plugin<Project> {
* making the Gradle plugin project A depend on the Gradle plugin project B. * making the Gradle plugin project A depend on the Gradle plugin project B.
*/ */
private void configurePluginDependencies(Object dependencyObject) { private void configurePluginDependencies(Object dependencyObject) {
assert dependencyObject.name instanceof String assert(dependencyObject.name instanceof String)
Project pluginProject = project.rootProject.findProject(":${dependencyObject.name}") Project pluginProject = project.rootProject.findProject(":${dependencyObject.name}")
if (pluginProject == null || if (pluginProject == null ||
!doesSupportAndroidPlatform(pluginProject.projectDir.parentFile.path)) { !doesSupportAndroidPlatform(pluginProject.projectDir.parentFile.path)) {
return return
} }
assert dependencyObject.dependencies instanceof List assert(dependencyObject.dependencies instanceof List)
dependencyObject.dependencies.each { pluginDependencyName -> dependencyObject.dependencies.each { pluginDependencyName ->
assert pluginDependencyName instanceof String assert(pluginDependencyName instanceof String)
if (pluginDependencyName.empty) { if (pluginDependencyName.empty) {
return return
} }
...@@ -564,7 +564,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -564,7 +564,7 @@ class FlutterPlugin implements Plugin<Project> {
// Wait for the Android plugin to load and add the dependency to the plugin project. // Wait for the Android plugin to load and add the dependency to the plugin project.
pluginProject.afterEvaluate { pluginProject.afterEvaluate {
pluginProject.dependencies { pluginProject.dependencies {
implementation dependencyProject implementation(dependencyProject)
} }
} }
} }
...@@ -578,9 +578,9 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -578,9 +578,9 @@ class FlutterPlugin implements Plugin<Project> {
if (doesSupportAndroidPlatform(path)) { if (doesSupportAndroidPlatform(path)) {
androidPlugins.setProperty(name, path) androidPlugins.setProperty(name, path)
} }
// TODO(amirh): log an error if this plugin was specified to be an Android // TODO(amirh): log an error if this plugin was specified to be an Android
// plugin according to the new schema, and was missing a build.gradle file. // plugin according to the new schema, and was missing a build.gradle file.
// https://github.com/flutter/flutter/issues/40784 // https://github.com/flutter/flutter/issues/40784
} }
return androidPlugins return androidPlugins
} }
...@@ -611,8 +611,8 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -611,8 +611,8 @@ class FlutterPlugin implements Plugin<Project> {
File pluginsDependencyFile = new File(project.projectDir.parentFile.parentFile, '.flutter-plugins-dependencies') File pluginsDependencyFile = new File(project.projectDir.parentFile.parentFile, '.flutter-plugins-dependencies')
if (pluginsDependencyFile.exists()) { if (pluginsDependencyFile.exists()) {
def object = new JsonSlurper().parseText(pluginsDependencyFile.text) def object = new JsonSlurper().parseText(pluginsDependencyFile.text)
assert object instanceof Map assert(object instanceof Map)
assert object.dependencyGraph instanceof List assert(object.dependencyGraph instanceof List)
return object.dependencyGraph return object.dependencyGraph
} }
return [] return []
...@@ -694,7 +694,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -694,7 +694,7 @@ class FlutterPlugin implements Plugin<Project> {
if (!useLocalEngine()) { if (!useLocalEngine()) {
return true; return true;
} }
assert project.hasProperty('local-engine-build-mode') assert(project.hasProperty('local-engine-build-mode'))
// Don't configure dependencies for a build mode that the local engine // Don't configure dependencies for a build mode that the local engine
// doesn't support. // doesn't support.
return project.property('local-engine-build-mode') == flutterBuildMode return project.property('local-engine-build-mode') == flutterBuildMode
...@@ -1066,36 +1066,36 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1066,36 +1066,36 @@ class FlutterPlugin implements Plugin<Project> {
// into a separate variable `verbose verboseValue` or prefix with // into a separate variable `verbose verboseValue` or prefix with
// `this` (`verbose this.isVerbose()`). // `this` (`verbose this.isVerbose()`).
FlutterTask compileTask = project.tasks.create(name: taskName, type: FlutterTask) { FlutterTask compileTask = project.tasks.create(name: taskName, type: FlutterTask) {
flutterRoot this.flutterRoot flutterRoot(this.flutterRoot)
flutterExecutable this.flutterExecutable flutterExecutable(this.flutterExecutable)
buildMode variantBuildMode buildMode(variantBuildMode)
minSdkVersion variant.mergedFlavor.minSdkVersion.apiLevel minSdkVersion(variant.mergedFlavor.minSdkVersion.apiLevel)
localEngine this.localEngine localEngine(this.localEngine)
localEngineHost this.localEngineHost localEngineHost(this.localEngineHost)
localEngineSrcPath this.localEngineSrcPath localEngineSrcPath(this.localEngineSrcPath)
targetPath getFlutterTarget() targetPath(getFlutterTarget())
verbose this.isVerbose() verbose(this.isVerbose())
fastStart this.isFastStart() fastStart(this.isFastStart())
fileSystemRoots fileSystemRootsValue fileSystemRoots(fileSystemRootsValue)
fileSystemScheme fileSystemSchemeValue fileSystemScheme(fileSystemSchemeValue)
trackWidgetCreation trackWidgetCreationValue trackWidgetCreation(trackWidgetCreationValue)
targetPlatformValues = targetPlatforms targetPlatformValues = targetPlatforms
sourceDir getFlutterSourceDirectory() sourceDir(getFlutterSourceDirectory())
intermediateDir project.file("${project.buildDir}/$INTERMEDIATES_DIR/flutter/${variant.name}/") intermediateDir(project.file("${project.buildDir}/$INTERMEDIATES_DIR/flutter/${variant.name}/"))
frontendServerStarterPath frontendServerStarterPathValue frontendServerStarterPath(frontendServerStarterPathValue)
extraFrontEndOptions extraFrontEndOptionsValue extraFrontEndOptions(extraFrontEndOptionsValue)
extraGenSnapshotOptions extraGenSnapshotOptionsValue extraGenSnapshotOptions(extraGenSnapshotOptionsValue)
splitDebugInfo splitDebugInfoValue splitDebugInfo(splitDebugInfoValue)
treeShakeIcons treeShakeIconsOptionsValue treeShakeIcons(treeShakeIconsOptionsValue)
dartObfuscation dartObfuscationValue dartObfuscation(dartObfuscationValue)
dartDefines dartDefinesValue dartDefines(dartDefinesValue)
bundleSkSLPath bundleSkSLPathValue bundleSkSLPath(bundleSkSLPathValue)
performanceMeasurementFile performanceMeasurementFileValue performanceMeasurementFile(performanceMeasurementFileValue)
codeSizeDirectory codeSizeDirectoryValue codeSizeDirectory(codeSizeDirectoryValue)
deferredComponents deferredComponentsValue deferredComponents(deferredComponentsValue)
validateDeferredComponents validateDeferredComponentsValue validateDeferredComponents(validateDeferredComponentsValue)
isAndroidLibrary isAndroidLibraryValue isAndroidLibrary(isAndroidLibraryValue)
flavor flavorValue flavor(flavorValue)
} }
File libJar = project.file("${project.buildDir}/$INTERMEDIATES_DIR/flutter/${variant.name}/libs.jar") File libJar = project.file("${project.buildDir}/$INTERMEDIATES_DIR/flutter/${variant.name}/libs.jar")
Task packFlutterAppAotTask = project.tasks.create(name: "packLibs${FLUTTER_BUILD_PREFIX}${variant.name.capitalize()}", type: Jar) { Task packFlutterAppAotTask = project.tasks.create(name: "packLibs${FLUTTER_BUILD_PREFIX}${variant.name.capitalize()}", type: Jar) {
...@@ -1120,13 +1120,13 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1120,13 +1120,13 @@ class FlutterPlugin implements Plugin<Project> {
name: "copyFlutterAssets${variant.name.capitalize()}", name: "copyFlutterAssets${variant.name.capitalize()}",
type: Copy, type: Copy,
) { ) {
dependsOn compileTask dependsOn(compileTask)
with compileTask.assets with(compileTask.assets)
def currentGradleVersion = project.getGradle().getGradleVersion() def currentGradleVersion = project.getGradle().getGradleVersion()
// See https://docs.gradle.org/current/javadoc/org/gradle/api/file/ConfigurableFilePermissions.html // See https://docs.gradle.org/current/javadoc/org/gradle/api/file/ConfigurableFilePermissions.html
// See https://github.com/flutter/flutter/pull/50047 // See https://github.com/flutter/flutter/pull/50047
if (compareVersionStrings(currentGradleVersion, '8.3') >= 0 ) { if (compareVersionStrings(currentGradleVersion, '8.3') >= 0) {
filePermissions { filePermissions {
user { user {
read = true read = true
...@@ -1136,21 +1136,21 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1136,21 +1136,21 @@ class FlutterPlugin implements Plugin<Project> {
} else { } else {
// See https://docs.gradle.org/8.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:fileMode // See https://docs.gradle.org/8.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:fileMode
// See https://github.com/flutter/flutter/pull/50047 // See https://github.com/flutter/flutter/pull/50047
fileMode 0644 fileMode(0644)
} }
if (isUsedAsSubproject) { if (isUsedAsSubproject) {
dependsOn packageAssets dependsOn(packageAssets)
dependsOn cleanPackageAssets dependsOn(cleanPackageAssets)
into packageAssets.outputDir into(packageAssets.outputDir)
return return
} }
// `variant.mergeAssets` will be removed at the end of 2019. // `variant.mergeAssets` will be removed at the end of 2019.
def mergeAssets = variant.hasProperty("mergeAssetsProvider") ? def mergeAssets = variant.hasProperty("mergeAssetsProvider") ?
variant.mergeAssetsProvider.get() : variant.mergeAssets variant.mergeAssetsProvider.get() : variant.mergeAssets
dependsOn mergeAssets dependsOn(mergeAssets)
dependsOn "clean${mergeAssets.name.capitalize()}" dependsOn("clean${mergeAssets.name.capitalize()}")
mergeAssets.mustRunAfter("clean${mergeAssets.name.capitalize()}") mergeAssets.mustRunAfter("clean${mergeAssets.name.capitalize()}")
into mergeAssets.outputDir into(mergeAssets.outputDir)
} }
if (!isUsedAsSubproject) { if (!isUsedAsSubproject) {
def variantOutput = variant.outputs.first() def variantOutput = variant.outputs.first()
...@@ -1163,12 +1163,12 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1163,12 +1163,12 @@ class FlutterPlugin implements Plugin<Project> {
// See https://docs.gradle.org/8.1/userguide/validation_problems.html#implicit_dependency. // See https://docs.gradle.org/8.1/userguide/validation_problems.html#implicit_dependency.
def compressAssetsTask = project.tasks.findByName("compress${variant.name.capitalize()}Assets") def compressAssetsTask = project.tasks.findByName("compress${variant.name.capitalize()}Assets")
if (compressAssetsTask) { if (compressAssetsTask) {
compressAssetsTask.dependsOn copyFlutterAssetsTask compressAssetsTask.dependsOn(copyFlutterAssetsTask)
} }
def bundleAarTask = project.tasks.findByName("bundle${variant.name.capitalize()}Aar") def bundleAarTask = project.tasks.findByName("bundle${variant.name.capitalize()}Aar")
if (bundleAarTask) { if (bundleAarTask) {
bundleAarTask.dependsOn copyFlutterAssetsTask bundleAarTask.dependsOn(copyFlutterAssetsTask)
} }
return copyFlutterAssetsTask return copyFlutterAssetsTask
...@@ -1224,7 +1224,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1224,7 +1224,7 @@ class FlutterPlugin implements Plugin<Project> {
} }
// Copy the native assets created by build.dart and placed here by flutter assemble. // Copy the native assets created by build.dart and placed here by flutter assemble.
def nativeAssetsDir = "${project.buildDir}/../native_assets/android/jniLibs/lib/" def nativeAssetsDir = "${project.buildDir}/../native_assets/android/jniLibs/lib/"
project.android.sourceSets.main.jniLibs.srcDir nativeAssetsDir project.android.sourceSets.main.jniLibs.srcDir(nativeAssetsDir)
} }
configurePlugins() configurePlugins()
detectLowCompileSdkVersionOrNdkVersion() detectLowCompileSdkVersionOrNdkVersion()
...@@ -1233,10 +1233,10 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1233,10 +1233,10 @@ class FlutterPlugin implements Plugin<Project> {
// Flutter host module project (Add-to-app). // Flutter host module project (Add-to-app).
String hostAppProjectName = project.rootProject.hasProperty('flutter.hostAppProjectName') ? project.rootProject.property('flutter.hostAppProjectName') : "app" String hostAppProjectName = project.rootProject.hasProperty('flutter.hostAppProjectName') ? project.rootProject.property('flutter.hostAppProjectName') : "app"
Project appProject = project.rootProject.findProject(":${hostAppProjectName}") Project appProject = project.rootProject.findProject(":${hostAppProjectName}")
assert appProject != null : "Project :${hostAppProjectName} doesn't exist. To customize the host app project name, set `flutter.hostAppProjectName=<project-name>` in gradle.properties." assert(appProject != null) : "Project :${hostAppProjectName} doesn't exist. To customize the host app project name, set `flutter.hostAppProjectName=<project-name>` in gradle.properties."
// Wait for the host app project configuration. // Wait for the host app project configuration.
appProject.afterEvaluate { appProject.afterEvaluate {
assert appProject.android != null assert(appProject.android != null)
project.android.libraryVariants.all { libraryVariant -> project.android.libraryVariants.all { libraryVariant ->
Task copyFlutterAssetsTask Task copyFlutterAssetsTask
appProject.android.applicationVariants.all { appProjectVariant -> appProject.android.applicationVariants.all { appProjectVariant ->
...@@ -1273,7 +1273,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1273,7 +1273,7 @@ class FlutterPlugin implements Plugin<Project> {
Task mergeAssets = project Task mergeAssets = project
.tasks .tasks
.findByPath(":${hostAppProjectName}:merge${appProjectVariant.name.capitalize()}Assets") .findByPath(":${hostAppProjectName}:merge${appProjectVariant.name.capitalize()}Assets")
assert mergeAssets assert(mergeAssets)
mergeAssets.dependsOn(copyFlutterAssetsTask) mergeAssets.dependsOn(copyFlutterAssetsTask)
} }
} }
...@@ -1303,11 +1303,14 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -1303,11 +1303,14 @@ class FlutterPlugin implements Plugin<Project> {
// If we got this far then all the common indices are identical, so whichever version is longer must be more recent // If we got this far then all the common indices are identical, so whichever version is longer must be more recent
return firstVersion.size() <=> secondVersion.size() return firstVersion.size() <=> secondVersion.size()
} }
} }
class AppLinkSettings { class AppLinkSettings {
String applicationId String applicationId
Set<Deeplink> deeplinks Set<Deeplink> deeplinks
} }
class Deeplink { class Deeplink {
...@@ -1414,9 +1417,9 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -1414,9 +1417,9 @@ abstract class BaseFlutterTask extends DefaultTask {
ruleNames = targetPlatformValues.collect { "android_aot_bundle_${buildMode}_$it" } ruleNames = targetPlatformValues.collect { "android_aot_bundle_${buildMode}_$it" }
} }
project.exec { project.exec {
logging.captureStandardError LogLevel.ERROR logging.captureStandardError(LogLevel.ERROR)
executable flutterExecutable.absolutePath executable(flutterExecutable.absolutePath)
workingDir sourceDir workingDir(sourceDir)
if (localEngine != null) { if (localEngine != null) {
args "--local-engine", localEngine args "--local-engine", localEngine
args "--local-engine-src-path", localEngineSrcPath args "--local-engine-src-path", localEngineSrcPath
...@@ -1429,59 +1432,59 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -1429,59 +1432,59 @@ abstract class BaseFlutterTask extends DefaultTask {
} else { } else {
args "--quiet" args "--quiet"
} }
args "assemble" args("assemble")
args "--no-version-check" args("--no-version-check")
args "--depfile", "${intermediateDir}/flutter_build.d" args("--depfile", "${intermediateDir}/flutter_build.d")
args "--output", "${intermediateDir}" args("--output", "${intermediateDir}")
if (performanceMeasurementFile != null) { if (performanceMeasurementFile != null) {
args "--performance-measurement-file=${performanceMeasurementFile}" args("--performance-measurement-file=${performanceMeasurementFile}")
} }
if (!fastStart || buildMode != "debug") { if (!fastStart || buildMode != "debug") {
args "-dTargetFile=${targetPath}" args("-dTargetFile=${targetPath}")
} else { } else {
args "-dTargetFile=${Paths.get(flutterRoot.absolutePath, "examples", "splash", "lib", "main.dart")}" args("-dTargetFile=${Paths.get(flutterRoot.absolutePath, "examples", "splash", "lib", "main.dart")}")
} }
args "-dTargetPlatform=android" args("-dTargetPlatform=android")
args "-dBuildMode=${buildMode}" args("-dBuildMode=${buildMode}")
if (trackWidgetCreation != null) { if (trackWidgetCreation != null) {
args "-dTrackWidgetCreation=${trackWidgetCreation}" args("-dTrackWidgetCreation=${trackWidgetCreation}")
} }
if (splitDebugInfo != null) { if (splitDebugInfo != null) {
args "-dSplitDebugInfo=${splitDebugInfo}" args("-dSplitDebugInfo=${splitDebugInfo}")
} }
if (treeShakeIcons == true) { if (treeShakeIcons == true) {
args "-dTreeShakeIcons=true" args("-dTreeShakeIcons=true")
} }
if (dartObfuscation == true) { if (dartObfuscation == true) {
args "-dDartObfuscation=true" args("-dDartObfuscation=true")
} }
if (dartDefines != null) { if (dartDefines != null) {
args "--DartDefines=${dartDefines}" args("--DartDefines=${dartDefines}")
} }
if (bundleSkSLPath != null) { if (bundleSkSLPath != null) {
args "-dBundleSkSLPath=${bundleSkSLPath}" args("-dBundleSkSLPath=${bundleSkSLPath}")
} }
if (codeSizeDirectory != null) { if (codeSizeDirectory != null) {
args "-dCodeSizeDirectory=${codeSizeDirectory}" args("-dCodeSizeDirectory=${codeSizeDirectory}")
} }
if (flavor != null) { if (flavor != null) {
args "-dFlavor=${flavor}" args("-dFlavor=${flavor}")
} }
if (extraGenSnapshotOptions != null) { if (extraGenSnapshotOptions != null) {
args "--ExtraGenSnapshotOptions=${extraGenSnapshotOptions}" args("--ExtraGenSnapshotOptions=${extraGenSnapshotOptions}")
} }
if (frontendServerStarterPath != null) { if (frontendServerStarterPath != null) {
args "-dFrontendServerStarterPath=${frontendServerStarterPath}" args("-dFrontendServerStarterPath=${frontendServerStarterPath}")
} }
if (extraFrontEndOptions != null) { if (extraFrontEndOptions != null) {
args "--ExtraFrontEndOptions=${extraFrontEndOptions}" args("--ExtraFrontEndOptions=${extraFrontEndOptions}")
} }
args "-dAndroidArchs=${targetPlatformValues.join(' ')}" args("-dAndroidArchs=${targetPlatformValues.join(' ')}")
args "-dMinSdkVersion=${minSdkVersion}" args("-dMinSdkVersion=${minSdkVersion}")
if (isAndroidLibrary != null) { if (isAndroidLibrary != null) {
args "-dIsAndroidLibrary=${isAndroidLibrary ? "true" : "false"}" args("-dIsAndroidLibrary=${isAndroidLibrary ? "true" : "false"}")
} }
args ruleNames args(ruleNames)
} }
} }
} }
...@@ -1500,19 +1503,19 @@ class FlutterTask extends BaseFlutterTask { ...@@ -1500,19 +1503,19 @@ class FlutterTask extends BaseFlutterTask {
@Internal @Internal
CopySpec getAssets() { CopySpec getAssets() {
return project.copySpec { return project.copySpec {
from "${intermediateDir}" from("${intermediateDir}")
include "flutter_assets/**" // the working dir and its files include("flutter_assets/**") // the working dir and its files
} }
} }
@Internal @Internal
CopySpec getSnapshots() { CopySpec getSnapshots() {
return project.copySpec { return project.copySpec {
from "${intermediateDir}" from("${intermediateDir}")
if (buildMode == 'release' || buildMode == 'profile') { if (buildMode == 'release' || buildMode == 'profile') {
targetPlatformValues.each { targetPlatformValues.each {
include "${PLATFORM_ARCH_MAP[targetArch]}/app.so" include("${PLATFORM_ARCH_MAP[targetArch]}/app.so")
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment