Skip to content

Commit 6516353

Browse files
authored
Merge pull request #688 from gantsign/fix-deploy
Fix Maven deploy
2 parents a8b3536 + 34f23b2 commit 6516353

21 files changed

Lines changed: 198 additions & 201 deletions

.github/workflows/maven-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Deploy with Maven
6262
run: |
6363
./mvnw deploy \
64-
-P publish-artifacts,sign-artifacts \
64+
-P publish-artifacts,sign-artifacts,central-deploy \
6565
"-Drevision=${GIT_TAG:-development-SNAPSHOT}" \
6666
-DskipTests \
6767
-Dinvoker.skip=true \

pom.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<parent>
3131
<groupId>com.github.gantsign.parent</groupId>
3232
<artifactId>kotlin-parent</artifactId>
33-
<version>3.7.0</version>
33+
<version>3.8.0</version>
3434
<relativePath/>
3535
</parent>
3636

@@ -51,7 +51,6 @@
5151
<doxia.version>1.12.0</doxia.version>
5252
<guice.version>4.2.0</guice.version>
5353
<jacoco-maven-plugin.version>0.8.7</jacoco-maven-plugin.version>
54-
<central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
5554
<java.require.version>11</java.require.version>
5655
<jdeps.multiRelease>11</jdeps.multiRelease>
5756
<kotlin.version>2.1.0</kotlin.version>
@@ -919,17 +918,6 @@
919918
</execution>
920919
</executions>
921920
</plugin>
922-
<plugin>
923-
<groupId>org.sonatype.central</groupId>
924-
<artifactId>central-publishing-maven-plugin</artifactId>
925-
<version>${central-publishing-maven-plugin.version}</version>
926-
<extensions>true</extensions>
927-
<configuration>
928-
<publishingServerId>central</publishingServerId>
929-
<autoPublish>true</autoPublish>
930-
<waitUntil>published</waitUntil>
931-
</configuration>
932-
</plugin>
933921
</plugins>
934922
</build>
935923
</profile>

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/AbstractBaseMojo.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import org.apache.maven.plugin.AbstractMojo
3030
import org.apache.maven.plugins.annotations.Parameter
3131

3232
abstract class AbstractBaseMojo : AbstractMojo() {
33-
3433
@Parameter(defaultValue = "\${project.basedir}", readonly = true, required = true)
3534
protected lateinit var basedir: File
3635

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/CheckMojo.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import org.apache.maven.plugins.annotations.Parameter
4242
threadSafe = true,
4343
)
4444
class CheckMojo : AbstractBaseMojo() {
45-
4645
/**
4746
* A set of reporters to output the results to.
4847
*/
@@ -87,26 +86,27 @@ class CheckMojo : AbstractBaseMojo() {
8786
log = log,
8887
basedir = basedir,
8988
modulePackaging = packaging,
90-
sources = listOf(
91-
Sources(
92-
isIncluded = includeSources,
93-
sourceRoots = sourceRoots,
94-
includes = sourcesIncludes,
95-
excludes = sourcesExcludes,
96-
),
97-
Sources(
98-
isIncluded = includeTestSources,
99-
sourceRoots = testSourceRoots,
100-
includes = testSourcesIncludes,
101-
excludes = testSourcesExcludes,
102-
),
103-
Sources(
104-
isIncluded = includeScripts,
105-
sourceRoots = scriptRoots,
106-
includes = scriptsIncludes,
107-
excludes = scriptsExcludes,
89+
sources =
90+
listOf(
91+
Sources(
92+
isIncluded = includeSources,
93+
sourceRoots = sourceRoots,
94+
includes = sourcesIncludes,
95+
excludes = sourcesExcludes,
96+
),
97+
Sources(
98+
isIncluded = includeTestSources,
99+
sourceRoots = testSourceRoots,
100+
includes = testSourcesIncludes,
101+
excludes = testSourcesExcludes,
102+
),
103+
Sources(
104+
isIncluded = includeScripts,
105+
sourceRoots = scriptRoots,
106+
includes = scriptsIncludes,
107+
excludes = scriptsExcludes,
108+
),
108109
),
109-
),
110110
android = android,
111111
reporterConfig = reporters ?: emptySet(),
112112
verbose = verbose,

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/FormatMojo.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import org.apache.maven.plugins.annotations.Parameter
4141
threadSafe = true,
4242
)
4343
class FormatMojo : AbstractBaseMojo() {
44-
4544
/**
4645
* Skips automatic code style fixes.
4746
*/
@@ -56,26 +55,27 @@ class FormatMojo : AbstractBaseMojo() {
5655
log = log,
5756
basedir = basedir,
5857
modulePackaging = packaging,
59-
sources = listOf(
60-
Sources(
61-
isIncluded = includeSources,
62-
sourceRoots = sourceRoots,
63-
includes = sourcesIncludes,
64-
excludes = sourcesExcludes,
65-
),
66-
Sources(
67-
isIncluded = includeTestSources,
68-
sourceRoots = testSourceRoots,
69-
includes = testSourcesIncludes,
70-
excludes = testSourcesExcludes,
71-
),
72-
Sources(
73-
isIncluded = includeScripts,
74-
sourceRoots = scriptRoots,
75-
includes = scriptsIncludes,
76-
excludes = scriptsExcludes,
58+
sources =
59+
listOf(
60+
Sources(
61+
isIncluded = includeSources,
62+
sourceRoots = sourceRoots,
63+
includes = sourcesIncludes,
64+
excludes = sourcesExcludes,
65+
),
66+
Sources(
67+
isIncluded = includeTestSources,
68+
sourceRoots = testSourceRoots,
69+
includes = testSourcesIncludes,
70+
excludes = testSourcesExcludes,
71+
),
72+
Sources(
73+
isIncluded = includeScripts,
74+
sourceRoots = scriptRoots,
75+
includes = scriptsIncludes,
76+
excludes = scriptsExcludes,
77+
),
7778
),
78-
),
7979
android = android,
8080
enableExperimentalRules = experimental,
8181
)()

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/KtlintReport.kt

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import org.apache.maven.reporting.AbstractMavenReport
4747
threadSafe = true,
4848
)
4949
class KtlintReport : AbstractMavenReport() {
50-
5150
@Parameter(defaultValue = "\${project.basedir}", readonly = true, required = true)
5251
private lateinit var basedir: File
5352

@@ -168,47 +167,46 @@ class KtlintReport : AbstractMavenReport() {
168167
)
169168
}
170169

171-
override fun getName(locale: Locale): String =
172-
getBundle(locale)["report.ktlint.name"]
170+
override fun getName(locale: Locale): String = getBundle(locale)["report.ktlint.name"]
173171

174-
override fun getDescription(locale: Locale): String =
175-
getBundle(locale)["report.ktlint.description"]
172+
override fun getDescription(locale: Locale): String = getBundle(locale)["report.ktlint.description"]
176173

177174
override fun getOutputName(): String = "ktlint"
178175

179-
override fun canGenerateReport(): Boolean =
180-
!skip && sourceRoots.asSequence().map(::File).any { it.isDirectory }
176+
override fun canGenerateReport(): Boolean = !skip && sourceRoots.asSequence().map(::File).any { it.isDirectory }
181177

182178
override fun executeReport(locale: Locale) {
183-
val results = Report(
184-
log = log,
185-
basedir = basedir,
186-
modulePackaging = packaging,
187-
sources = listOf(
188-
Sources(
189-
isIncluded = includeSources,
190-
sourceRoots = sourceRoots,
191-
includes = sourcesIncludes,
192-
excludes = sourcesExcludes,
193-
),
194-
Sources(
195-
isIncluded = includeTestSources,
196-
sourceRoots = testSourceRoots,
197-
includes = testSourcesIncludes,
198-
excludes = testSourcesExcludes,
199-
),
200-
Sources(
201-
isIncluded = includeScripts,
202-
sourceRoots = scriptRoots,
203-
includes = scriptsIncludes,
204-
excludes = scriptsExcludes,
205-
),
206-
),
207-
android = android,
208-
reporterConfig = reporters ?: emptySet(),
209-
verbose = verbose,
210-
enableExperimentalRules = experimental,
211-
)()
179+
val results =
180+
Report(
181+
log = log,
182+
basedir = basedir,
183+
modulePackaging = packaging,
184+
sources =
185+
listOf(
186+
Sources(
187+
isIncluded = includeSources,
188+
sourceRoots = sourceRoots,
189+
includes = sourcesIncludes,
190+
excludes = sourcesExcludes,
191+
),
192+
Sources(
193+
isIncluded = includeTestSources,
194+
sourceRoots = testSourceRoots,
195+
includes = testSourcesIncludes,
196+
excludes = testSourcesExcludes,
197+
),
198+
Sources(
199+
isIncluded = includeScripts,
200+
sourceRoots = scriptRoots,
201+
includes = scriptsIncludes,
202+
excludes = scriptsExcludes,
203+
),
204+
),
205+
android = android,
206+
reporterConfig = reporters ?: emptySet(),
207+
verbose = verbose,
208+
enableExperimentalRules = experimental,
209+
)()
212210
KtlintReportGenerator(sink, getBundle(locale)).generatorReport(results)
213211
}
214212
}

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/MavenLogReporter.kt

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ class MavenLogReporter(
3838
val groupByFile: Boolean,
3939
val pad: Boolean,
4040
) : ReporterV2 {
41-
4241
private val acc = ConcurrentHashMap<String, MutableList<KtlintCliError>>()
4342

44-
override fun onLintError(file: String, ktlintCliError: KtlintCliError) {
43+
override fun onLintError(
44+
file: String,
45+
ktlintCliError: KtlintCliError,
46+
) {
4547
val line = ktlintCliError.line
4648
val col = ktlintCliError.col
4749
val ruleId = ktlintCliError.ruleId
@@ -52,14 +54,15 @@ class MavenLogReporter(
5254
return
5355
}
5456

55-
val buf = MessageUtils.buffer()
56-
.a(file.dir())
57-
.strong(file.name())
58-
.a(":")
59-
.strong(line)
60-
.a(":$col:".pad(4))
61-
.a(" ")
62-
.failure(detail)
57+
val buf =
58+
MessageUtils.buffer()
59+
.a(file.dir())
60+
.strong(file.name())
61+
.a(":")
62+
.strong(line)
63+
.a(":$col:".pad(4))
64+
.a(" ")
65+
.failure(detail)
6366
if (verbose) {
6467
buf.a(" ($ruleId)")
6568
}
@@ -78,12 +81,13 @@ class MavenLogReporter(
7881
val col = err.col
7982
val ruleId = err.ruleId
8083
val detail = err.detail
81-
val buf = MessageUtils.buffer()
82-
.a(" ")
83-
.strong(line)
84-
.a(":$col".pad(4))
85-
.a(" ")
86-
.failure(detail)
84+
val buf =
85+
MessageUtils.buffer()
86+
.a(" ")
87+
.strong(line)
88+
.a(":$col".pad(4))
89+
.a(" ")
90+
.failure(detail)
8791
if (verbose) {
8892
buf.a(" ($ruleId)")
8993
}
@@ -92,14 +96,11 @@ class MavenLogReporter(
9296
}
9397
}
9498

95-
private fun String.pad(length: Int): String =
96-
if (pad) this.padEnd(length) else this
99+
private fun String.pad(length: Int): String = if (pad) this.padEnd(length) else this
97100

98-
private fun String.dir(): String =
99-
substringBeforeLast(File.separator) + File.separator
101+
private fun String.dir(): String = substringBeforeLast(File.separator) + File.separator
100102

101-
private fun String.name(): String =
102-
substringAfterLast(File.separator)
103+
private fun String.name(): String = substringAfterLast(File.separator)
103104

104105
companion object {
105106
@JvmStatic

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/MavenLogReporterProvider.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ import java.io.PrintStream
3030
import org.apache.maven.plugin.logging.Log
3131

3232
class MavenLogReporterProvider : ReporterProviderV2<MavenLogReporter> {
33-
3433
override val id: String = "maven"
3534

36-
override fun get(out: PrintStream, opt: Map<String, String>): MavenLogReporter =
35+
override fun get(
36+
out: PrintStream,
37+
opt: Map<String, String>,
38+
): MavenLogReporter =
3739
throw UnsupportedOperationException("Use MavenLogReporterProvider.get(Log, Map<String, String>) instead.")
3840

39-
fun get(log: Log, opt: Map<String, String>): MavenLogReporter =
41+
fun get(
42+
log: Log,
43+
opt: Map<String, String>,
44+
): MavenLogReporter =
4045
MavenLogReporter(
4146
log = log,
4247
verbose = opt["verbose"].emptyOrTrue(),

src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/ReporterConfig.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ package com.github.gantsign.maven.plugin.ktlint
2828
import java.io.File
2929
import java.util.Properties
3030

31-
data class ReporterConfig @JvmOverloads constructor(
32-
var name: String? = null,
33-
var output: File? = null,
34-
var properties: Properties? = null,
35-
)
31+
data class ReporterConfig
32+
@JvmOverloads
33+
constructor(
34+
var name: String? = null,
35+
var output: File? = null,
36+
var properties: Properties? = null,
37+
)

0 commit comments

Comments
 (0)