Closed Legion2 closed 2 years ago
Thank you, and i also have to apologize for the rather poor kotlin support so far. Just to be on the save side - i am curious what exactly would be the desired outcome :) - always easier to meet expectations with examples.
currently i am testing against https://github.com/aepfli/gradle-gitlab-repositories/blob/main/src/functionalTest/resources/build.gradle.kts
what would be the desired look of it? i will try to take care of this as soon as possible (also the tokens are currently reworked, just had no time to merge it so far :), it should increase the usability for tokens at least like https://github.com/aepfli/gradle-gitlab-repositories/blob/a5de003f8a7515043b1d8025c9346d61a7bb61f3/src/functionalTest/resources/build.gradle.kts)
something like this?
gitLab {
tokens {
create("tokenIgnoredNoValue") {
type.set("private")
value.set("")
}
}
}
or
gitLabTokens {
create("tokenIgnoredNoValue") {
type.set("private")
value.set("")
}
}
Yes, your examples look good. Maybe the type is a second parameter in the create function, because it must always be provided. This parameter could also be optional and set in the action block.
I also encountered a problem when I tried to configure the repositories for all projects or all subprojects using the allprojects {}
subprojects {}
blocks in the root project. I applied and configured the plugin in the settings.gradle.kts:
plugins {
id("at.schrottner.gitlab-repositories") version "0.5.0"
}
and then tried to use val gitLab = the<at.schrottner.gradle.GitlabRepositoriesExtension>()
in the subprojects.repositories
block and get Extension of type 'GitlabRepositoriesExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension]
error. If I apply the plugin also in the sub projects I get Cannot add extension with name 'gitLab', as there is an extension already registered with that name.
@aepfli should I open a second issue for my problems with allprojects
and subprojects
?
i think this would be a good idea - to keep those separate and reduce the amount of changes for one.
Just as a headsup - i am currently a little bit short on free time, so i will be most likely end of january february that i can start on those topics. but i will try my best to squeeze them in earlier - at least i will focus on Tests first, so somebody can work easier on them.
Thank you for the input!
in the first iteration i removed the classes and we do have strings now, for easier handling
I tested 0.6.1 and the following works in the gradle.build.kts
:
plugins {
id("at.schrottner.gitlab-repositories") version "0.6.1"
}
gitLab {
token("private") {
val gitLabPrivateToken: String? by project
key = "gitLabPrivateToken"
value = gitLabPrivateToken
}
}
I will close this, because all my points of the kotlin support are improved.
The gitlab extension cannot directly be used in build.gradle.kts files,
configure<>()
must be used. also the dls function which get aclass
type as argument should support kotlin reified type parameter.