Skip to content

Conversation

@camsim99
Copy link
Contributor

@camsim99 camsim99 commented Jan 25, 2024

This reverts commit f5ac225, i.e. #137115.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jan 25, 2024
@camsim99
Copy link
Contributor Author

@bartekpacia This revert is not clean; I have to merge changes from #140744 in flutter.groovy. Looks like your changes there had to do with configuring legacy plugins, which is removed logic by reverting this PR, so I think it should be fine but would super appreciate your review here! I ended up deleting all of your changes in flutter.groovy from that PR except for the changes to comments you made.

I also had to potentially merge changes from #141692 since I modified flutter.groovy, but I don't think I undid any of those changes.

FYI @Gustl22 to know to re-land this change!

@camsim99 camsim99 requested a review from bartekpacia January 25, 2024 22:47
@bartekpacia
Copy link
Member

bartekpacia commented Jan 25, 2024

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?

Comment on lines 703 to 711
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."
)
}
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g Jan 26, 2024

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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!

Copy link
Member

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.

Copy link
Contributor Author

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 :)

Comment on lines 721 to 731
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
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

@camsim99
Copy link
Contributor Author

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?

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.

@Gustl22
Copy link
Contributor

Gustl22 commented Jan 26, 2024

I'd be glad testing with and without this revert, if the issue is actually fixed, before merging. Until now I'm not able to reproduce the issue with different OS and different stages of beta & main. @camsim99 could you reproduce the steps of stuartmorgan(?) Big thanks :)

@bartekpacia
Copy link
Member

Hey @camsim99:

  • I just checked out this branch and built a Flutter app of mine that is fully migrated to Gradle Kotlin DSL, and it builds fine.
  • I merged this PR of yours with master since I noticed "ci.yaml validation failed" (a new builder was added), so when you wake up CI results should be available. If that's not OK then sorry and I won't do it again.

* In an app project, this is ../.. since the app's Gradle build file is under android/app.
*/
String source = "../.."
String source
Copy link
Member

@bartekpacia bartekpacia Jan 26, 2024

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:

Copy link
Contributor

@Gustl22 Gustl22 Feb 2, 2024

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

@Gustl22
Copy link
Contributor

Gustl22 commented Jan 27, 2024

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(?)
Then I expect, the changes of @bartekpacia should be the same as before.

@reidbaker reidbaker self-requested a review January 29, 2024 16:13
@camsim99
Copy link
Contributor Author

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(?) Then I expect, the changes of @bartekpacia should be the same as before.

This makes sense to me!

@camsim99
Copy link
Contributor Author

I was able to verify this revert does fix the issue. Going to close this in favor of #142464 to make this PR easier to revert since I made some choices here without considering the beta branch cutoff as I should have as noted above.

@camsim99 camsim99 closed this Jan 29, 2024
auto-submit bot pushed a commit that referenced this pull request Jan 29, 2024
…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
camsim99 added a commit to camsim99/flutter that referenced this pull request Jan 29, 2024
)" (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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants