Merged
Conversation
josh-burton
reviewed
Jun 28, 2019
josh-burton
reviewed
Jun 28, 2019
This was referenced Jul 18, 2019
| // Next ID: cd33 | ||
|
|
||
| const String kCommandBuildAarTargetPlatform = 'cd33'; | ||
| const String kCommandBuildAarProjectType = 'cd34'; |
Contributor
There was a problem hiding this comment.
I think we might have just used this cd value
zanderso
approved these changes
Jul 19, 2019
| } | ||
| final Status status = logger.startProgress('Resolving dependencies...', timeout: timeoutConfiguration.slowOperation); | ||
| GradleProject project; | ||
| try { |
Member
There was a problem hiding this comment.
The logic in this function could use some explanation in comments. For example, it's hard to tell whether gradle failing under this 'try', and falling back on the default is expected/okay, or whether something is probably going to go wrong later on.
| printError(''); | ||
| printError('The Gradle project does not define a task suitable for the requested build.'); | ||
| if (!project.buildTypes.contains(buildInfo.modeName)) { | ||
| printError('Review the android/app/build.gradle file and ensure it defines a ${buildInfo.modeName} build type.'); |
| // Next ID: cd33 | ||
|
|
||
| const String kCommandBuildAarTargetPlatform = 'cd33'; | ||
| const String kCommandBuildAarProjectType = 'cd34'; |
Member
|
Still LGTM |
blasten
pushed a commit
that referenced
this pull request
Jul 23, 2019
Merged
johnsonmh
pushed a commit
to johnsonmh/flutter
that referenced
this pull request
Jul 30, 2019
`flutter build aar`
This new build command works just like `flutter build apk` or `flutter build appbundle`, but for plugin and module projects.
This PR also refactors how plugins are included in app or module projects. By building the plugins as AARs, the Android Gradle plugin is able to use Jetifier to translate support libraries into AndroidX libraries for all the plugin's native code. Thus, reducing the error rate when using AndroidX in apps.
This change also allows to build modules as AARs, so developers can take these artifacts and distribute them along with the native host app without the need of the Flutter tool. This is a requirement for add to app.
`flutter build aar` generates POM artifacts (XML files) which contain metadata about the native dependencies used by the plugin. This allows Gradle to resolve dependencies at the app level. The result of this new build command is a single build/outputs/repo, the local repository that contains all the generated AARs and POM files.
In a Flutter app project, this local repo is used by the Flutter Gradle plugin to resolve the plugin dependencies. In add to app case, the developer needs to configure the local repo and the dependency manually in `build.gradle`:
repositories {
maven {
url "<path-to-flutter-module>build/host/outputs/repo"
}
}
dependencies {
implementation("<package-name>:flutter_<build-mode>:1.0@aar") {
transitive = true
}
}
johnsonmh
pushed a commit
to johnsonmh/flutter
that referenced
this pull request
Jul 30, 2019
This reverts commit 11460b8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
flutter build aarThis new build command works just like
flutter build apkorflutter build appbundle, but for plugins and module projects.This PR also refactors how plugins are included in app or module projects. By building the plugins as AARs, the Android Gradle plugin is able to use Jetifier to translate support libraries into AndroidX libraries for all the plugin's native code. Thus, reducing the error rate when using AndroidX in apps.
This change also allows to build modules as AARs, so developers can take these artifacts and distribute them along with the native host app without the need of the Flutter tool. This is a requirement for add to app.
flutter build aargenerates POM artifacts (XML files) which contain metadata about the native dependencies used by the plugin. This allows Gradle to resolve dependencies at the app level. The result of this new build command is a singlebuild/outputs/repo, the local repository that contains all the generated AARs and POM files.In a Flutter app project, this local repo is used by the Flutter Gradle plugin to resolve the plugin dependencies. In add to app case, the developer needs to configure the local repo and the dependency manually in
build.gradle:Related Issues
#23586
#29328
#26099
#25979
#28805
#27254
#24859
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?