Skip to content
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

Warning about grgit usage in Kotlin DSL buid scripts #361

Closed
Vampire opened this issue Feb 17, 2022 · 1 comment
Closed

Warning about grgit usage in Kotlin DSL buid scripts #361

Vampire opened this issue Feb 17, 2022 · 1 comment

Comments

@Vampire
Copy link
Contributor

Vampire commented Feb 17, 2022

The readme should have a warning, or the implementation be adjusted.
Currently if there is a Git repository, there is a grgit accessor generated for the Kotlin DSL.
But if there is no Git repository, the accessor is not generated as it is only generated as you only add an extra property in that case.
So if you usually have a Git repository and use the accessor, and then export the project to an archive without the GIt repository, the build is broken in there, as the build script will not compile anymore due to the missing accessor.

To mitigate that, you need to use some ugly construct like

val grgit = if (extra.has("grgit")) null else the<Grgit>()
@ajoberstar
Copy link
Owner

The existing behavior was kind of a hack a few years back, because it really shouldn't have been a direct project.grgit property, but it was kept around that way for compatibility. The switch to using an extension to get around a different issue required the ext workaround to set it to null if the repo didn't exist.

My gut is that I'll want to work out a solution for #362 and then try to wean people off the org.ajoberstar.grgit approach over to the service plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants