File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,11 @@ kotlin {
50
50
}
51
51
52
52
val generateBuildConfig by tasks.registering {
53
- val outputDir = layout.buildDirectory.dir(" generated/source/buildConfig/com/ctrlhub " )
53
+ val outputDir = layout.buildDirectory.dir(" generated/source/buildConfig" )
54
54
val packageName = " com.ctrlhub"
55
+ val versionName = providers.exec {
56
+ commandLine(" git" , " describe" , " --tags" , " --abbrev=0" )
57
+ }.standardOutput.asText.map { it.trim() }.orElse(" 0.0.0" )
55
58
56
59
outputs.dir(outputDir)
57
60
@@ -64,7 +67,7 @@ val generateBuildConfig by tasks.registering {
64
67
package $packageName
65
68
66
69
object BuildConfig {
67
- const val VERSION_NAME = "$version "
70
+ const val VERSION_NAME = "$versionName "
68
71
}
69
72
""" .trimIndent()
70
73
)
@@ -109,11 +112,11 @@ publishing {
109
112
}
110
113
}
111
114
112
- // tasks.test {
113
- // useJUnitPlatform()
114
- // }
115
-
116
115
tasks.matching { it.name.startsWith(" compileKotlin" ) }
117
116
.configureEach {
118
117
dependsOn(generateBuildConfig)
119
- }
118
+ }
119
+
120
+ tasks.named(" jvmSourcesJar" ) {
121
+ dependsOn(generateBuildConfig)
122
+ }
You can’t perform that action at this time.
0 commit comments