11import com.github.spotbugs.snom.Confidence
22import com.github.spotbugs.snom.Effort
33import java.text.SimpleDateFormat
4+ import java.time.format.DateTimeFormatter
5+ import java.time.Instant
6+ import java.time.ZoneOffset
47import java.util.Date
58import java.util.Locale
69
@@ -23,7 +26,12 @@ val baseVersion = "2.0.1"
2326val isSnapshot = true
2427
2528val isCIServer = System .getenv(" CTHING_CI" ) != null
26- val buildNumber = if (isCIServer) System .currentTimeMillis().toString() else " 0"
29+ val now = System .currentTimeMillis()
30+ val buildNumber = if (isCIServer) now.toString() else " 0"
31+ val buildDate: String = Instant .ofEpochMilli(now)
32+ .atOffset(ZoneOffset .UTC )
33+ .format(DateTimeFormatter .ofPattern(" yyyy-MM-dd'T'HH:mm:ss'Z'" ))
34+
2735version = if (isSnapshot) " $baseVersion -$buildNumber " else baseVersion
2836group = " org.cthing"
2937description = " A version object for C Thing Software projects."
@@ -38,6 +46,17 @@ java {
3846//
3947// This project is a dependency of all C Thing Software projects. Therefore, to avoid circular
4048// dependencies, it should not depend on any C Thing Software project.
49+ configurations.all {
50+ resolutionStrategy {
51+ eachDependency {
52+ val prohibitedGroups = listOf (" org.cthing" , " com.cthing" )
53+ if (requested.group in prohibitedGroups) {
54+ throw GradleException (" A dependency on '${requested.group} :${requested.name} ' is prohibited." )
55+ }
56+ }
57+ }
58+ }
59+
4160dependencies {
4261 api(libs.jspecify)
4362
@@ -181,6 +200,10 @@ publishing {
181200 name = project.name
182201 description = project.description
183202 url = " https://github.com/cthing/${project.name} "
203+ organization {
204+ name = " C Thing Software"
205+ url = " https://www.cthing.com"
206+ }
184207 licenses {
185208 license {
186209 name = " Apache-2.0"
@@ -205,6 +228,12 @@ publishing {
205228 system = " GitHub Issues"
206229 url = " https://github.com/cthing/${project.name} /issues"
207230 }
231+ ciManagement {
232+ url = " https://github.com/cthing/${project.name} /actions"
233+ system = " GitHub Actions"
234+ }
235+ properties.putAll(mapOf (" cthing.build.date" to buildDate,
236+ " cthing.build.number" to buildNumber))
208237 }
209238 }
210239 }
0 commit comments