mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Requesting a review from a release engineer who is not me and a review from the flutter android team that is not me. ### Issue Link: What is the link to the issue this cherry-pick is addressing? https://github.com/flutter/flutter/issues/177037 ### Changelog Description: [flutter/issue/177037](https://github.com/flutter/flutter/issues/177037) Allows some android apps that use dynamic modules to build from android studio. ### Workaround: Is there a workaround for this issue? Do not build in android studio but instead use the command line. ### Risk: What is the risk level of this cherry-pick? Build change but it is a revert and a removal of a branch of code behind a check for launching from android studio. ### Test Coverage: Are you confident that your fix is well-tested by automated tests? No tests for this feature as it would have required launching android studio. ### Validation Steps: What are the steps to validate that this fix works? Use compileOnly dependencies in an app that also uses dynamic download.
This commit is contained in:
parent
465e421f53
commit
6c0f1cf328
@ -19,11 +19,8 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.UnknownTaskException
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.api.file.Directory
|
||||
import org.gradle.api.plugins.PluginContainer
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.TaskInstantiationException
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
@ -101,7 +98,6 @@ class FlutterPlugin : Plugin<Project> {
|
||||
repositories.maven {
|
||||
url = uri(repository!!)
|
||||
}
|
||||
maybeAddAndroidStudioNativeConfiguration(plugins, dependencies)
|
||||
}
|
||||
|
||||
project.apply {
|
||||
@ -329,23 +325,19 @@ class FlutterPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
private fun addTaskForLockfileGeneration(rootProject: Project) {
|
||||
try {
|
||||
rootProject.tasks.register("generateLockfiles") {
|
||||
doLast {
|
||||
rootProject.subprojects.forEach { subproject ->
|
||||
val gradlew: String =
|
||||
getExecutableNameForPlatform("${rootProject.projectDir}/gradlew")
|
||||
val execOps = rootProject.serviceOf<ExecOperations>()
|
||||
execOps.exec {
|
||||
workingDir(rootProject.projectDir)
|
||||
executable(gradlew)
|
||||
args(":${subproject.name}:dependencies", "--write-locks")
|
||||
}
|
||||
rootProject.tasks.register("generateLockfiles") {
|
||||
doLast {
|
||||
rootProject.subprojects.forEach { subproject ->
|
||||
val gradlew: String =
|
||||
getExecutableNameForPlatform("${rootProject.projectDir}/gradlew")
|
||||
val execOps = rootProject.serviceOf<ExecOperations>()
|
||||
execOps.exec {
|
||||
workingDir(rootProject.projectDir)
|
||||
executable(gradlew)
|
||||
args(":${subproject.name}:dependencies", "--write-locks")
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: TaskInstantiationException) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
@ -821,19 +813,4 @@ class FlutterPlugin : Plugin<Project> {
|
||||
* This property is set by Android Studio when it invokes a Gradle task.
|
||||
*/
|
||||
private fun isInvokedFromAndroidStudio(): Boolean = project?.hasProperty("android.injected.invoked.from.ide") == true
|
||||
|
||||
private fun shouldAddAndroidStudioNativeConfiguration(plugins: PluginContainer): Boolean =
|
||||
plugins.hasPlugin("com.android.application") && isInvokedFromAndroidStudio()
|
||||
|
||||
private fun maybeAddAndroidStudioNativeConfiguration(
|
||||
plugins: PluginContainer,
|
||||
dependencies: DependencyHandler
|
||||
) {
|
||||
if (shouldAddAndroidStudioNativeConfiguration(plugins)) {
|
||||
dependencies.add("compileOnly", "io.flutter:flutter_embedding_debug:$engineVersion")
|
||||
dependencies.add("compileOnly", "io.flutter:armeabi_v7a_debug:$engineVersion")
|
||||
dependencies.add("compileOnly", "io.flutter:arm64_v8a_debug:$engineVersion")
|
||||
dependencies.add("compileOnly", "io.flutter:x86_64_debug:$engineVersion")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user