Remove AndroidX workarounds (#86911)
This commit is contained in:
@@ -289,51 +289,8 @@ class FlutterPlugin implements Plugin<Project> {
|
||||
* Finally, the project's `settings.gradle` loads each plugin's android directory as a subproject.
|
||||
*/
|
||||
private void configurePlugins() {
|
||||
if (!buildPluginAsAar()) {
|
||||
getPluginList().each this.&configurePluginProject
|
||||
getPluginDependencies().each this.&configurePluginDependencies
|
||||
return
|
||||
}
|
||||
project.repositories {
|
||||
maven {
|
||||
url "${getPluginBuildDir()}/outputs/repo"
|
||||
}
|
||||
}
|
||||
getPluginList().each { pluginName, pluginPath ->
|
||||
configurePluginAar(pluginName, pluginPath, project)
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pattern GROUP_PATTERN = ~/group\s+\'(.+)\'/
|
||||
private static final Pattern PROJECT_NAME_PATTERN = ~/rootProject\.name\s+=\s+\'(.+)\'/
|
||||
|
||||
// Adds the plugin AAR dependency to the app project.
|
||||
private void configurePluginAar(String pluginName, String pluginPath, Project project) {
|
||||
// Extract the group id from the plugin's build.gradle.
|
||||
// This is `group '<group-id>'`
|
||||
File pluginBuildFile = project.file(Paths.get(pluginPath, "android", "build.gradle"));
|
||||
if (!pluginBuildFile.exists()) {
|
||||
throw new GradleException("Plugin $pluginName doesn't have the required file $pluginBuildFile.")
|
||||
}
|
||||
|
||||
Matcher groupParts = GROUP_PATTERN.matcher(pluginBuildFile.text)
|
||||
assert groupParts.count == 1
|
||||
assert groupParts.hasGroup()
|
||||
String groupId = groupParts[0][1]
|
||||
|
||||
// Extract the artifact name from the plugin's settings.gradle.
|
||||
// This is `rootProject.name = '<artifact-name>'`
|
||||
File pluginSettings = project.file(Paths.get(pluginPath, "android", "settings.gradle"));
|
||||
if (!pluginSettings.exists()) {
|
||||
throw new GradleException("Plugin $pluginName doesn't have the required file $pluginSettings.")
|
||||
}
|
||||
Matcher projectNameParts = PROJECT_NAME_PATTERN.matcher(pluginSettings.text)
|
||||
assert projectNameParts.count == 1
|
||||
assert projectNameParts.hasGroup()
|
||||
String artifactId = "${projectNameParts[0][1]}_release"
|
||||
|
||||
assert !groupId.empty
|
||||
project.dependencies.add("api", "$groupId:$artifactId:+")
|
||||
getPluginList().each this.&configurePluginProject
|
||||
getPluginDependencies().each this.&configurePluginDependencies
|
||||
}
|
||||
|
||||
// Adds the plugin project dependency to the app project .
|
||||
@@ -544,10 +501,6 @@ class FlutterPlugin implements Plugin<Project> {
|
||||
return project.plugins.hasPlugin("com.android.application");
|
||||
}
|
||||
|
||||
private static Boolean buildPluginAsAar() {
|
||||
return System.getProperty('build-plugins-as-aars') == 'true'
|
||||
}
|
||||
|
||||
// Returns true if the build mode is supported by the current call to Gradle.
|
||||
// This only relevant when using a local engine. Because the engine
|
||||
// is built for a specific mode, the call to Gradle must match that mode.
|
||||
|
||||
Reference in New Issue
Block a user