Repository navigation
[AGP 9.1.0 Migration #3] Add buildModeFor overloads and wire Flutter dependencies through the new DSL #191218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3240d4a
4aefffe
12de6b5
b55957e
c0d77d3
6c3dd8b
4d11eb1
fdfccbd
08ece37
615bd93
92ddbf9
eeedccf
3d11b6c
5405b90
f9e55f7
14b6a37
ee87670
dd1223a
441340b
0b4b9e7
8d446dc
7d0ddd1
72c595e
4d34a0e
1d3849f
365544e
b140c63
cf603bf
d23ae5f
31905be
3570a7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright 2014 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package com.flutter.gradle | ||
|
|
||
| /** | ||
| * The compile SDK configured on a project's Android extension: either a numeric API level | ||
| * (`compileSdk = 36`) or a preview codename (`compileSdkPreview = "Baklava"`). Both are null | ||
| * when the DSL has not been configured (yet). | ||
| */ | ||
| internal data class CompileSdkVersion( | ||
| val apiLevel: Int?, | ||
| val previewCodename: String? | ||
| ) { | ||
| init { | ||
| require(apiLevel == null || previewCodename == null) { | ||
| "CompileSdkVersion cannot have both apiLevel ($apiLevel) and previewCodename ($previewCodename) set." | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Whether this compile SDK is known to be higher than [other]. | ||
| * | ||
| * - numeric vs numeric: numeric comparison. | ||
| * - preview vs numeric: a preview codename targets an unreleased SDK, so it is | ||
| * considered higher than any numeric API level. | ||
| * - preview vs preview: codenames stopped being alphabetically ordered when the | ||
| * alphabet reset at "Baklava", so distinct codenames are incomparable and this | ||
| * returns false rather than guessing. | ||
| * - if either side is unset, returns false. | ||
| */ | ||
| fun isHigherThan(other: CompileSdkVersion): Boolean { | ||
| if (other.previewCodename != null) { | ||
| return false | ||
| } | ||
| if (previewCodename != null && other.apiLevel != null) { | ||
| return true | ||
| } | ||
| if (apiLevel != null && other.apiLevel != null) { | ||
| return apiLevel > other.apiLevel | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| /** The human-readable form used in log messages, e.g. "35" or "Baklava". */ | ||
| override fun toString(): String = previewCodename ?: apiLevel?.toString() ?: "unknown" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,8 +142,12 @@ object DependencyVersionChecker { | |
| val kgpVersion: Version? = VersionFetcher.getKGPVersion(project) | ||
| if (kgpVersion != null) { | ||
| checkKGPVersion(kgpVersion, project) | ||
| } else { | ||
| project.logger.debug( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is helpful for debugging but also I think it violates our style guidelines. Looking for second opinions. Argument for is that because this uses the debug level you have to pass -d to get these logs.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know mechanically what they would need to pass -d to? I.e. the flutter tool would accept that and print this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You would have to run the assembleDebug task manually with the -d flag from the flutter tool the way to get these logs would be to set |
||
| "Unable to detect project Kotlin Gradle Plugin version. Skipping Kotlin min-version enforcement. " + | ||
| "This is expected if the project uses AGP built-in Kotlin (android.builtInKotlin) or does not apply KGP." | ||
| ) | ||
| } | ||
| // KGP is not required, so don't log any warning if we can't find the version. | ||
| } | ||
|
|
||
| private fun configureMinSdkCheck(project: Project) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably happened in #190957 but as I was reviewing this code I decided it should live in its own file.