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.
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
Upgrade AGP to 7.3.0, Gradle to 7.6 #1075
Upgrade AGP to 7.3.0, Gradle to 7.6 #1075
Changes from 4 commits
a5442a3
35bf66a
f230f4d
288418f
378f45c
dbcd5a2
5084bd9
f2e9e42
68f683d
adca7c4
048bb6e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
To be verified if this test/implementation for it should be rewritten
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.
The check for this is here:
gradle-play-publisher/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/GenerateResources.kt
Lines 102 to 107 in 4273731
This test absolutely has to pass because we rely on it for correctness. The way we pick which resource to use for a particular flavor is dependent on the parent of the
play
directory being a valid flavor name:gradle-play-publisher/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/GenerateResources.kt
Line 449 in 4273731
Anyway, off the top of my head I think you can fix
name != PLAY_PATH
by combining two climbUpTos and if both of them are non-null then you have two play directories. There might be a cleaner way though.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.
@SUPERCILEX could you please elaborate more on what this test is supposed to verify? 🙏
Looking at those two it seems like those test are identical except for different flavor name - it says "
play
file name is not allowed", but I can't grasp my head around it - it sounds like only "play" flavor is allowed and others are not (which is unexpected I guess)?Please read my PR's description on how now parameters provided to
have changed with the recent version.
I'm happy to improve it but would really appreciate your explanation in here 😄
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.
Shoot, forgot about that, makes life more complicated. For understanding the tests, it's easiest to look at the fixtures: https://github.com/Triple-T/gradle-play-publisher/tree/master/play/plugin/src/test/fixtures/GenerateResourcesIntegrationTest/src. Every directory in there is a flavor, so you'll find the play and illegalPlay dirs in there.
I've looked at this some more and I think we might be able to fix this by replacing
it.asFile == this
withit.asFile == climbUpTo(PLAY_PATH)
. That check is looking for file names that areplay
, but not part of the root input dirs. So if we look through every input file and find its parent play dir, it should always be a root play dir (I think).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.
@SUPERCILEX please take a look at dbcd5a2.
My confusion came from this test's name being a little bit misleading I think.
From what I understand now is that those two cases are illegal:
One is not allowed to have any files named "play"
project/my-project/src/flavorName/play/**/play.txt
One is not allowed to have any child directories named play - only root directory can have "play" name:
project/my-project/src/flavorName/play/**/play/*.*
Even if the flavor is named
play
, this would be the root directory:src/play/play
- my changes made it look only at the child directories of the subdirectory.So
src/play/play/default-listing.txt
is ok,src/play/play/**/play/file.txt
is not.I tested this change with both old Gradle version and new one and in both cases it now passes.
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.
Yes to the sentence, no to the example.
/play.txt
should be fine,/play
isn't. On that note, can you add two test cases for this: one allowingplay.foo
and one disallowing plainplay
files? Then check that the tests pass pre-PR and we'll be in the clear for behavior changes.I like the simplicity of your approach, but I'm a little bothered by the performance implications. Previously, we only did validation on changed files (since the input files are incremental). Now, we always run a full directory expansion. I think just because of that'd I'd still prefer the "climb up every file's path and see if its root play dir is contained in the input dir set" approach.
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 - I was so focused on 'file' that I forgot that you could actually have a file
play
without an extension.Got actually a little bit misled because
GenerateResourcesIntegrationTest
fixture does not contain a file namedplay
but only a directory namedplay
(listings/en-US/play/.keep
).This is the reason why the test would start to fail, as there was no file
play
in the input anymore with newer Gradle version (previously there was a a list of files and also directories, which were then treatedasFile
)..keep
got ignored.Is this also valid?
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.
Sorry, which part? Or do you mean in general? If so, then yeah your understanding is correct.