11import com.gradle.enterprise.gradleplugin.GradleEnterpriseExtension
22import io.github.flaxoos.ktor.extensions.mcPassword
33import io.github.flaxoos.ktor.extensions.mcUsername
4+ import org.eclipse.jgit.api.Git
45import org.gradle.api.tasks.testing.logging.TestExceptionFormat.SHORT
56import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
67import org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED
@@ -41,9 +42,7 @@ scmVersion {
4142
4243 // Custom version incrementer based on conventional commits
4344 versionIncrementer { context ->
44- val git =
45- org.eclipse.jgit.api.Git
46- .open(project.rootDir)
45+ val git = Git .open(project.rootDir)
4746 try {
4847 val lastTagDesc =
4948 try {
@@ -52,25 +51,25 @@ scmVersion {
5251 null
5352 }
5453 val lastTagName = lastTagDesc?.substringBefore(" -" )
55- logger.info( " Git describe result: $lastTagDesc " )
56- logger.info( " Last tag name: $lastTagName " )
54+ logger.quiet( " [VersionIncrementer] Git describe result: $lastTagDesc " )
55+ logger.quiet( " [VersionIncrementer] Last tag name: $lastTagName " )
5756
5857 // Check if we have any tags at all
5958 val allTags = git.tagList().call()
60- logger.info( " Total tags in repository: ${allTags.size} " )
59+ logger.quiet( " [VersionIncrementer] Total tags in repository: ${allTags.size} " )
6160 if (allTags.isNotEmpty()) {
62- logger.info( " Available tags: ${allTags.map { it.name.substringAfterLast(" /" ) }} " )
61+ logger.quiet( " [VersionIncrementer] Available tags: ${allTags.map { it.name.substringAfterLast(" /" ) }} " )
6362 }
6463 val repo = git.repository
6564 val head = repo.resolve(" HEAD" )
6665 val lastTagCommit = lastTagName?.let { repo.resolve(" refs/tags/$it ^{commit}" ) }
6766
68- logger.info( " HEAD commit: $head " )
69- logger.info( " Last tag commit: $lastTagCommit " )
67+ logger.quiet( " [VersionIncrementer] HEAD commit: $head " )
68+ logger.quiet( " [VersionIncrementer] Last tag commit: $lastTagCommit " )
7069
7170 val commits =
7271 if (lastTagCommit != null && head != null ) {
73- logger.info( " Getting commits between tag $lastTagName and HEAD" )
72+ logger.quiet( " [VersionIncrementer] Getting commits between tag $lastTagName and HEAD" )
7473 git
7574 .log()
7675 .addRange(lastTagCommit, head)
@@ -79,7 +78,7 @@ scmVersion {
7978 } else if (allTags.isEmpty()) {
8079 // If no tags exist at all, this is likely the first release
8180 // Only look at commits since project started being versioned conventionally
82- logger.info( " No tags found - treating as first release, analyzing recent commits only" )
81+ logger.quiet( " [VersionIncrementer] No tags found - treating as first release, analyzing recent commits only" )
8382 if (head != null ) {
8483 git
8584 .log()
@@ -88,27 +87,29 @@ scmVersion {
8887 .call()
8988 .toList()
9089 } else {
91- logger.info( " No HEAD found, repository appears empty" )
90+ logger.quiet( " [VersionIncrementer] No HEAD found, repository appears empty" )
9291 emptyList()
9392 }
9493 } else {
9594 // Tags exist but we couldn't resolve the last one
96- logger.info( " Tags exist but couldn't resolve last tag, getting all commits from HEAD" )
95+ logger.quiet( " [VersionIncrementer] Tags exist but couldn't resolve last tag, getting all commits from HEAD" )
9796 if (head != null ) {
9897 git
9998 .log()
10099 .add(head)
101100 .call()
102101 .toList()
103102 } else {
104- logger.info( " No HEAD found, repository appears empty" )
103+ logger.quiet( " [VersionIncrementer] No HEAD found, repository appears empty" )
105104 emptyList()
106105 }
107106 }
108107
109- logger.info( " Found ${commits.size} commits since last tag" )
108+ logger.quiet( " [VersionIncrementer] Found ${commits.size} commits since last tag" )
110109 if (commits.isNotEmpty()) {
111- logger.info(" Commit range: ${commits.last().name.substring(0 , 7 )} ..${commits.first().name.substring(0 , 7 )} " )
110+ logger.quiet(
111+ " [VersionIncrementer] Commit range: ${commits.last().name.substring(0 , 7 )} ..${commits.first().name.substring(0 , 7 )} " ,
112+ )
112113 }
113114
114115 var hasMajor = false
@@ -131,17 +132,17 @@ scmVersion {
131132 val bang = m?.groups?.get(" bang" ) != null
132133 val breaking = bang || breakingFooter.containsMatchIn(full)
133134
134- logger.info( " Analyzing commit: [${ofEpochSecond(commit.commitTime.toLong())} ] $subject " )
135- logger.info( " Type: $type , Breaking: $breaking " )
135+ logger.quiet( " [VersionIncrementer] Analyzing commit: [${ofEpochSecond(commit.commitTime.toLong())} ] $subject " )
136+ logger.quiet( " [VersionIncrementer] Type: $type , Breaking: $breaking " )
136137
137138 when {
138139 breaking -> {
139140 hasMajor = true
140- logger.info( " → Triggers MAJOR version bump (breaking change)" )
141+ logger.quiet( " [VersionIncrementer] → Triggers MAJOR version bump (breaking change)" )
141142 }
142143 type == " feat" -> {
143144 hasMinor = true
144- logger.info( " → Triggers MINOR version bump (new feature)" )
145+ logger.quiet( " [VersionIncrementer] → Triggers MINOR version bump (new feature)" )
145146 }
146147 type in
147148 setOf (
@@ -159,42 +160,46 @@ scmVersion {
159160 )
160161 -> {
161162 hasPatch = true
162- logger.info( " → Triggers PATCH version bump ($type )" )
163+ logger.quiet( " [VersionIncrementer] → Triggers PATCH version bump ($type )" )
163164 }
164165 else -> {
165- logger.info( " → No version impact" )
166+ logger.quiet( " [VersionIncrementer] → No version impact" )
166167 }
167168 }
168169 }
169170
170171 val v = context.currentVersion
171172 if (commits.isEmpty()) {
172- logger.info( " No commits since last tag → keeping version $v " )
173+ logger.quiet( " [VersionIncrementer] No commits since last tag → keeping version $v " )
173174 return @versionIncrementer v
174175 }
175176
176- logger.info( " Version bump analysis: major=$hasMajor , minor=$hasMinor , patch=$hasPatch " )
177+ logger.quiet( " [VersionIncrementer] Version bump analysis: major=$hasMajor , minor=$hasMinor , patch=$hasPatch " )
177178
178179 val newVersion =
179180 when {
180181 hasMajor -> {
181182 val next = if (v.majorVersion() == 0L ) v.nextMinorVersion() else v.nextMajorVersion()
182- logger.info(" MAJOR version bump: $v → $next (0.x special handling: ${v.majorVersion() == 0L } )" )
183+ logger.quiet(
184+ " [VersionIncrementer] MAJOR version bump: $v → $next (0.x special handling: ${v.majorVersion() == 0L } )" ,
185+ )
183186 next
184187 }
185188 hasMinor -> {
186189 val next = v.nextMinorVersion()
187- logger.info( " MINOR version bump: $v → $next " )
190+ logger.quiet( " [VersionIncrementer] MINOR version bump: $v → $next " )
188191 next
189192 }
190193 hasPatch -> {
191194 val next = v.nextPatchVersion()
192- logger.info( " PATCH version bump: $v → $next " )
195+ logger.quiet( " [VersionIncrementer] PATCH version bump: $v → $next " )
193196 next
194197 }
195198 else -> {
196199 val next = v.nextPatchVersion()
197- logger.info(" Default PATCH version bump (commits present but no conventional signal): $v → $next " )
200+ logger.quiet(
201+ " [VersionIncrementer] Default PATCH version bump (commits present but no conventional signal): $v → $next " ,
202+ )
198203 next
199204 }
200205 }
0 commit comments