Slackbot
06/14/2022, 12:22 AMJavi
06/14/2022, 12:25 AMJavi
06/14/2022, 12:28 AMJavi
06/14/2022, 12:29 AMJavi
06/14/2022, 12:30 AMjava pluginJavi
06/14/2022, 12:30 AMChris Lee
06/14/2022, 12:40 AMJavi
06/14/2022, 12:45 AMproject.tasks.named(ASSEMBLE_TASK_NAME).configure {
it.dependsOn(semverPrintTask)
}Javi
06/14/2022, 12:45 AMconfigure, same issue
project.tasks.named(ASSEMBLE_TASK_NAME) {
it.dependsOn(semverPrintTask)
}Javi
06/14/2022, 12:46 AMChris Lee
06/14/2022, 12:48 AMJavi
06/14/2022, 12:55 AMJavi
06/14/2022, 12:56 AMChris Lee
06/14/2022, 1:02 AMJavi
06/14/2022, 1:12 AMChris Lee
06/14/2022, 1:13 AMJavi
06/14/2022, 1:16 AMJavi
06/14/2022, 1:16 AMChris Lee
06/14/2022, 1:18 AMJavi
06/14/2022, 1:18 AMJavi
06/14/2022, 1:18 AM> Task :semverPrint
semver for semver-plugin-playground: c0.1.0.0+30b28c6+DIRTY
> Task :library-one-a:semverPrint
semver for library-one-a: a2.5.4.4+DIRTYJavi
06/14/2022, 1:19 AMJavi
06/14/2022, 1:20 AM> Task :library-one-a:semverPrint
semver for library-one-a: a0.1.0.0+30b28c6+DIRTYJavi
06/14/2022, 1:20 AMJavi
06/14/2022, 1:20 AMChris Lee
06/14/2022, 1:21 AMJavi
06/14/2022, 1:22 AMprojectTagPrefix)Javi
06/14/2022, 1:22 AMValueSource.obtain methodChris Lee
06/14/2022, 1:24 AMconvention is the default value, usually only used in say an extension constructor, not when passing a value around. There are some corner cases where properties without a set value behave differently.Chris Lee
06/14/2022, 1:24 AMChris Lee
06/14/2022, 1:25 AMsemverExtension.tagPrefix look like?Javi
06/14/2022, 1:26 AMpublic val tagPrefix: Property<String> = objects.property<String>().convention(DefaultTagPrefix)Javi
06/14/2022, 1:26 AMsemver {
tagPrefix.set("a")
}Chris Lee
06/14/2022, 1:27 AMChris Lee
06/14/2022, 1:28 AMsemver { tagPrefix … })Javi
06/14/2022, 1:29 AMChris Lee
06/14/2022, 1:29 AMJavi
06/14/2022, 1:30 AMextensions.create<SemverExtension>(extensionName)Javi
06/14/2022, 1:30 AMJavi
06/14/2022, 1:30 AMJavi
06/14/2022, 1:30 AMChris Lee
06/14/2022, 1:31 AMJavi
06/14/2022, 1:34 AMtarget.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
...
}
the problem is fixed, but I am applying my plugin in the order where it should not be workingJavi
06/14/2022, 1:34 AMChris Lee
06/14/2022, 1:35 AMproject.version , as that would happen well before your configuration stanza is executed. For other version management plugins, they force the order, as in calling project.version = scm.version after the configuration stanza.Javi
06/14/2022, 1:36 AMChris Lee
06/14/2022, 1:36 AMsemver {} configuration block. I’ll find an example of forcing the order, standby…Chris Lee
06/14/2022, 1:37 AMscmVersion {
tag {
prefix = 'my-project-name'
}
}
project.version = scmVersion.version
> Order of definition does matter! First, you need to apply the plugin, then configure it usingextension and only then current version can be set for whole project viascmVersion.scmVersion.version
>
Chris Lee
06/14/2022, 1:37 AMJavi
06/14/2022, 1:38 AMJavi
06/14/2022, 1:38 AMChris Lee
06/14/2022, 1:39 AMChris Lee
06/14/2022, 1:40 AMChris Lee
06/14/2022, 1:40 AMJavi
06/14/2022, 1:40 AMChris Lee
06/14/2022, 1:41 AMJavi
06/14/2022, 1:41 AMJavi
06/14/2022, 1:42 AMproject.version or project.version.toString()Javi
06/14/2022, 1:42 AMproject.version.toString() should be only called inside tasksJavi
06/14/2022, 1:43 AMChris Lee
06/14/2022, 1:43 AM.toString(), often indirectly (e.g. printing out the version). Sometimes running in --info or --debug changes the behaviour, as the simple act of printing out the version resolves it perhaps sooner than intended.Chris Lee
06/14/2022, 1:43 AMJavi
06/14/2022, 1:51 AMVampire
06/14/2022, 2:00 AM> because theWho defines that? I mean, it would be nice if it were the case, but I don't remember this being any rule written somewhere.should be only called inside tasksproject.version.toString()
Chris Lee
06/14/2022, 2:08 AMJavi
06/14/2022, 2:19 AMVampire
06/14/2022, 9:29 AMwhere it was assumed to be static (or externally defined).That's not fully true. If that were the case it would have been a
String field.
It was always meant to be dynamically calculated, by having an Object field where the call to toString() determines the version to be used.Javi
06/14/2022, 9:51 AMVampire
06/14/2022, 9:54 AMString because they did not consider that it actually can be anything.
That the value of version is changed frequentely is indeed not a too well supported case.