-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Revert "Reland: "Fix how Gradle resolves Android plugin" (#137115)" #142266
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
Conversation
)" This reverts commit f5ac225.
…relevant to legacy plugins
|
@bartekpacia This revert is not clean; I have to merge changes from #140744 in I also had to potentially merge changes from #141692 since I modified FYI @Gustl22 to know to re-land this change! |
|
Hi @camsim99, overall this looks good, I understand the need to revert this fast. However I'd (what a surprise, heh) prefer not to have my "Add support for Gradle Kotlin DSL" PR reverted. Will you reland my changes from #140744 in this PR, or in a different PR, or will they also be reverted and I'll have to make them again? |
| private Boolean doesSupportAndroidPlatform(String path) { | ||
| File buildGradle = new File(path, 'android' + File.separator + 'build.gradle') | ||
| File buildGradleKts = new File(path, 'android' + File.separator + 'build.gradle.kts') | ||
| if (buildGradle.exists() && buildGradleKts.exists()) { | ||
| logger.error( | ||
| "Both build.gradle and build.gradle.kts exist, so " + | ||
| "build.gradle.kts is ignored. This is likely a mistake." | ||
| ) | ||
| } |
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.
removing this also effectively reverts #140744
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.
I see this implementation
private Boolean doesSupportAndroidPlatform(String path) {
File editableAndroidProject = new File(path, 'android' + File.separator + 'build.gradle')
return editableAndroidProject.exists()
}below. Does replacing your implementation with this one help keep your change?
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.
yup, let's try that
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.
It looks like that PR landed after the 3.19 branch point? Keep in mind that the more complex this revert is in terms of mixing pre- and post-branch code, the harder making a cherry-pick will be.
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.
Right ok that makes sense. This was part of #140744. The other option would be removing it. If I do that to make the cherry-pick easier, @bartekpacia will your entire PR have to be reverted?
If not, we could potentially remove it for this revert to cherry-pick and then we can land adding back in a follow-up PR so it at least lives in the master branch.
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.
Depending on the answer here, I'm thinking either also revert that PR or just delete this newer code for now to get this landed.
@Gustl22 could you try reading #141940 (comment) and trying again? It may help you repro. I will also try to repro with/without this PR!
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.
@camsim99 do whatever is best for you, I can always reland my contribution later! If reverting my whole PR is easier for you then go for it.
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.
It's definitely easier just to delete this implementation of the method for now, so I'll go ahead with that. I will file an issue to put it back so we can track the removal, but I will try to follow this up immediately with that :)
| private File settingsGradleFile(Project project) { | ||
| File settingsGradle = new File(project.projectDir.parentFile, "settings.gradle") | ||
| File settingsGradleKts = new File(project.projectDir.parentFile, "settings.gradle.kts") | ||
| if (settingsGradle.exists() && settingsGradleKts.exists()) { | ||
| logger.error( | ||
| "Both settings.gradle and settings.gradle.kts exist, so " + | ||
| "settings.gradle.kts is ignored. This is likely a mistake." | ||
| ) | ||
| } | ||
|
|
||
| return settingsGradle.exists() ? settingsGradle : settingsGradleKts |
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.
removing this also effectively reverts #140744
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.
I see this was used above in
try {
if (!settingsGradleFile(project).text.contains("'.flutter-plugins'")) {
return
}
} catch (FileNotFoundException ignored) {
throw new GradleException("settings.gradle/settings.gradle.kts does not exist: ${settingsGradleFile(project).absolutePath}")
}Do I need to add the method back + add these checks to the all configurePlugins method to keep your changes? Trying to determine what exactly you need here (and above) and if it's possible to not trigger the regression.
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.
Ah I think I see. If the only usage of the settingsGradleFile() method was in the code that is now being removed, I think it's fine to remove settingsGradleFile() as well.
Ideally, I'd like to keep your changes in this PR if it's possible! I probably will need your guidance, though; I'll leave comments inline. |
|
Hey @camsim99:
|
| * In an app project, this is ../.. since the app's Gradle build file is under android/app. | ||
| */ | ||
| String source = "../.." | ||
| String source |
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.
just a note:
If we want to have a default value, we should also have a test that checks that the app builds fine if flutter { source "../.." } is missing from android/app/build.gradle
fyi @Gustl22
See also:
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.
Thank you @bartekpacia. I actually don't propose to remove the source property from the build.gradle. I propose to test and/or remove it in a separate step. Should I open an issue? (We also discussed the possibilities in Discord)
https://discord.com/channels/608014603317936148/1186378330178601000
|
Thank you for ya help. I am currently moving so I have time on Monday again. Would it be a valid approach after reverting my PR (with this PR) to revert the revert and add the fix and tests on top of it(?) |
This makes sense to me! |
…142464) This reverts commit f5ac225, i.e. #137115. This is a continuation of #142266 that was redone based on feedback to make this easier to revert in the future. The exact steps I took to create this revert: 1. Revert commit noted above 2. Fix merge conflicts, that notably involved reverting some changes in #140744 ~and #141417 (fixed my merge to avoid the second PR from being affected) 3. Delete `packages/flutter_tools/test/integration.shard/android_plugin_skip_unsupported_test.dart` as this was added in the commit noted above cc @Gustl22 since I couldn't tag as a reviewer
)" (flutter#142464) This reverts commit f5ac225, i.e. flutter#137115. This is a continuation of flutter#142266 that was redone based on feedback to make this easier to revert in the future. The exact steps I took to create this revert: 1. Revert commit noted above 2. Fix merge conflicts, that notably involved reverting some changes in flutter#140744 ~and flutter#141417 (fixed my merge to avoid the second PR from being affected) 3. Delete `packages/flutter_tools/test/integration.shard/android_plugin_skip_unsupported_test.dart` as this was added in the commit noted above cc @Gustl22 since I couldn't tag as a reviewer
This reverts commit f5ac225, i.e. #137115.
Pre-launch Checklist
///).