-
Notifications
You must be signed in to change notification settings - Fork 29
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
Partially refactor to use more idiomatic Gradle (part 2) #242
Conversation
invalidateDescriptor has existed since Gradle 4.10 gradle/gradle@cea96d4 Side effect of this is that it'll throw NoSuchMethodException if the method is not found so the warning will show instead of just silently (?.) ignoring it.
…group and description.
Note: Gradle gets confused about a mutable property when generating the decorated code. Renaming the setters detaches it from the real property. Example clash: AbstractTransitionNexusStagingRepositoryTask.stagingRepositoryId -> getStagingRepositoryId: Property<String> ReleaseNexusStagingRepository.setStagingRepositoryId -> setStagingRepositoryId(String) together these two form a broken property.
…side of the task.
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.
Few notes for reviewers.
src/main/kotlin/io/github/gradlenexus/publishplugin/ReleaseNexusStagingRepository.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/CloseNexusStagingRepository.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/ReleaseNexusStagingRepository.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPlugin.kt
Show resolved
Hide resolved
val findStagingRepository = rootProject.tasks.register<FindStagingRepository>( | ||
"find${capitalizedName}StagingRepository", | ||
rootProject.objects, | ||
extension, | ||
repository, | ||
registry | ||
) | ||
findStagingRepository { |
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.
My goal was to merge each of these into:
val name = rootProject.tasks.register<T>("name") {
...
}
but these last two I can't figure out how to remove the registry.
I think the answer is using the build service (injecting it inside the task), but that's only possible from Gradle 6.1 (see NexusPublishPlugin.createRegistry
) and the current minimum is 6.0.
@3flex any ideas?
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 moved from unannotated constructor property to @Internal
managed property: e964697
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPlugin.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPlugin.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/CloseNexusStagingRepository.kt
Show resolved
Hide resolved
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.
Thanks @TWiStErRob. It looks good, I've just made a few nitpicking.
Btw, as my other plugins are still at the Gradle 6 level of "idiomaticity", @3flex maybe you could also take a look?
src/main/kotlin/io/github/gradlenexus/publishplugin/CloseNexusStagingRepository.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPlugin.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishExtension.kt
Show resolved
Hide resolved
...github/gradlenexus/publishplugin/internal/InvalidatingStagingRepositoryDescriptorRegistry.kt
Show resolved
Hide resolved
src/main/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPlugin.kt
Show resolved
Hide resolved
Btw, this is motivated by gradle/gradle#22348 and https://docs.google.com/document/d/1iZHN5mcN56IQtGOoR5GyH9NQLSOQLQ1SHN5ulNheDjc which is going towards "managed everything". |
@szpak Ok, so in the end there were no changes necessary, the only finding you flagged was in uncommitted code 😅. |
I consider this ready, pending a word from @3flex. Btw, that word could be "go ahead, I'm not going to review" too if you don't have time. |
Ugh, should I rebase and squash a few next time to not get so many random small commits to master? |
No, I did it purposely. I wanted to keep some of those smaller changes (to maybe replicate in my other plugins ;) ). Sure, some commits could be squashed/rebased, but I didn't want to bother you. |
Following #241
Recommended to look at the changes commit by commit so the changes make more sense. In the general the goals were:
Breaking changes:
ReleaseNexusStagingRepository.setStagingRepositoryId
renamed tosetStagingRepositoryIdToRelease
CloseNexusStagingRepository.setStagingRepositoryId
renamed tosetStagingRepositoryIdToClose
AbstractNexusStagingRepositoryTask
have different constructors.