Skip to content

Commit 4f27ec9

Browse files
authored
Merge pull request #23 from BGMSound/develop
[Refactor] Extract vannitech dependency and add test cases
2 parents 9675961 + 51117b9 commit 4f27ec9

File tree

8 files changed

+78
-60
lines changed

8 files changed

+78
-60
lines changed

.github/workflows/deploy-to-mavencentral.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ jobs:
3737
export GPG_TTY=$(tty)
3838
echo "gpg.secret=$GPG_SECRET" >> gradle.properties
3939
echo "gpg.passphrase=$GPG_PASSPHRASE" >> gradle.properties
40-
echo "mavenCentralUsername=$MAVEN_CENTRAL_USERNAME" >> gradle.properties
41-
echo "mavenCentralPassword=$MAVEN_CENTRAL_PASSWORD" >> gradle.properties
4240
./gradlew --stacktrace documentify-project:documentify-core:publish
4341
./gradlew --stacktrace documentify-project:documentify-gradle-plugin:publish
4442
./gradlew --stacktrace documentify-project:documentify-mvc:publish

build.gradle.kts

Lines changed: 68 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ val publicModulePathSet = setOf(
2626
rootProject.projects.documentifyStarters.documentifyStarterReactive.identityPath.path
2727
)
2828

29+
repositories {
30+
mavenCentral()
31+
}
32+
2933
subprojects {
3034
group = rootProject.group
3135
version = rootProject.version
@@ -51,6 +55,7 @@ subprojects {
5155
useJUnitPlatform()
5256
}
5357
}
58+
5459
if (publicModulePathSet.contains(project.path)) {
5560
with(pluginManager) {
5661
apply(rootProject.libs.plugins.gradle.mavenCentral.publish.get().pluginId)
@@ -64,63 +69,78 @@ subprojects {
6469
useInMemoryPgpKeys(gpgSecret, gpgPassphrase)
6570
sign(publishing.publications)
6671
}
67-
configure<MavenPublishBaseExtension> {
68-
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
69-
70-
val artifactId = name.replace("-gradle-plugin", ".gradle.plugin")
71-
val projectGroup = property("project.group").toString()
72-
val projectName = property("project.name").toString()
73-
val projectVersion = property("project.version.id").toString()
74-
val projectDescription = property("project.description").toString()
75-
val projectUrl = property("project.url").toString()
76-
val projectUrlScm = property("project.url.scm").toString()
77-
val projectLicense = property("project.license").toString()
78-
val projectLicenseUrl = property("project.license.url").toString()
79-
val projectDeveloperId = property("project.developer.id").toString()
80-
val projectDeveloperName = property("project.developer.name").toString()
81-
val projectDeveloperEmail = property("project.developer.email").toString()
82-
val projectDeveloperUrl = property("project.developer.url").toString()
83-
84-
coordinates(
85-
groupId = projectGroup,
86-
artifactId = artifactId,
87-
version = projectVersion
88-
)
89-
90-
pom {
91-
name = projectName
92-
description = projectDescription
93-
inceptionYear = "${Year.now().value}"
94-
url = projectUrl
95-
licenses {
96-
license {
97-
name = projectLicense
98-
url = projectLicenseUrl
99-
distribution = projectUrl
72+
tasks.withType<Jar> {
73+
archiveClassifier.set("")
74+
}
75+
tasks.withType(PublishToMavenRepository::class.java) {
76+
dependsOn(tasks.withType<Sign>())
77+
}
78+
extensions.getByType<JavaPluginExtension>().apply {
79+
withSourcesJar()
80+
withJavadocJar()
81+
}
82+
publishing {
83+
repositories {
84+
maven {
85+
name = "sonatype"
86+
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
87+
credentials {
88+
username = System.getenv("MAVEN_CENTRAL_USERNAME")
89+
password = System.getenv("MAVEN_CENTRAL_PASSWORD")
10090
}
10191
}
102-
developers {
103-
developer {
104-
id = projectDeveloperId
105-
name = projectDeveloperName
106-
email = projectDeveloperEmail
107-
url = projectDeveloperUrl
92+
}
93+
publications {
94+
create<MavenPublication>("mavenCentral") {
95+
from(components["java"])
96+
groupId = property("project.group").toString()
97+
artifactId = name.replace("-gradle-plugin", ".gradle.plugin")
98+
version = property("project.version.id").toString()
99+
100+
pom {
101+
val projectName = property("project.name").toString()
102+
val projectDescription = property("project.description").toString()
103+
val projectUrl = property("project.url").toString()
104+
val projectUrlScm = property("project.url.scm").toString()
105+
val projectLicense = property("project.license").toString()
106+
val projectLicenseUrl = property("project.license.url").toString()
107+
val projectDeveloperId = property("project.developer.id").toString()
108+
val projectDeveloperName = property("project.developer.name").toString()
109+
val projectDeveloperEmail = property("project.developer.email").toString()
110+
val projectDeveloperUrl = property("project.developer.url").toString()
111+
112+
name = projectName
113+
description = projectDescription
114+
inceptionYear = "${Year.now().value}"
115+
url = projectUrl
116+
licenses {
117+
license {
118+
name = projectLicense
119+
url = projectLicenseUrl
120+
distribution = projectUrl
121+
}
122+
}
123+
developers {
124+
developer {
125+
id = projectDeveloperId
126+
name = projectDeveloperName
127+
email = projectDeveloperEmail
128+
url = projectDeveloperUrl
129+
}
130+
}
131+
scm {
132+
url = projectUrlScm
133+
connection = "scm:git:git://github.com/${projectDeveloperId}"
134+
developerConnection = "scm:git:ssh://git@github.com/${projectDeveloperId}"
135+
}
108136
}
109-
}
110-
scm {
111-
url = projectUrlScm
112-
connection = "scm:git:git://github.com/${projectDeveloperId}"
113-
developerConnection = "scm:git:ssh://git@github.com/${projectDeveloperId}"
137+
signing.sign(this@publications)
114138
}
115139
}
116140
}
117141
}
118142
}
119143

120-
repositories {
121-
mavenCentral()
122-
}
123-
124144
kover {
125145
merge {
126146
projects(

documentify-project/documentify-core/src/main/kotlin/io/github/bgmsound/documentify/core/specification/element/header/Header.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.springframework.restdocs.headers.HeaderDocumentation
66
import org.springframework.restdocs.snippet.Attributes
77

88
class Header(
9-
private val descriptor: HeaderDescriptor,
9+
private val descriptor: HeaderDescriptor
1010
) : SpecElement(descriptor) {
1111
override val key: String get() = descriptor.name
1212

documentify-project/documentify-core/src/main/kotlin/io/github/bgmsound/documentify/core/specification/element/parameter/PathVariable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.springframework.restdocs.request.RequestDocumentation
55
import org.springframework.restdocs.snippet.Attributes
66

77
class PathVariable(
8-
descriptor: ParameterDescriptor,
8+
descriptor: ParameterDescriptor
99
) : Parameter(descriptor) {
1010
companion object {
1111
fun newPathVariable(

documentify-project/documentify-core/src/main/kotlin/io/github/bgmsound/documentify/core/specification/element/parameter/QueryParameter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.springframework.restdocs.request.RequestDocumentation
55
import org.springframework.restdocs.snippet.Attributes
66

77
class QueryParameter(
8-
descriptor: ParameterDescriptor,
8+
descriptor: ParameterDescriptor
99
) : Parameter(descriptor) {
1010
companion object {
1111
fun newQueryParameter(

documentify-project/documentify-core/src/main/kotlin/io/github/bgmsound/documentify/core/specification/schema/ResourceSpec.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ class ResourceSpec(
2929
}
3030

3131
fun link(rel: String): Link {
32-
val link = Link.Companion.newLink(rel)
32+
val link = Link.newLink(rel)
3333
this.links.add(link)
3434
return link
3535
}
3636

3737
fun links(vararg links: String) {
38-
this.links.addAll(links.map { Link.Companion.newLink(it) })
38+
this.links.addAll(links.map { Link.newLink(it) })
3939
}
4040

4141
fun links(links: Collection<String>) {
42-
this.links.addAll(links.map { Link.Companion.newLink(it) })
42+
this.links.addAll(links.map { Link.newLink(it) })
4343
}
4444

4545
fun tag(tag: String) {
@@ -94,13 +94,13 @@ class ResourceSpec(
9494
}
9595
if (request.fields.isNotEmpty()) {
9696
if (request.schema != null) {
97-
resourceBuilder.requestSchema(Schema.Companion.schema(request.schema!!))
97+
resourceBuilder.requestSchema(Schema.schema(request.schema!!))
9898
}
9999
resourceBuilder.requestFields(buildFields(request.fields))
100100
}
101101
if (response.fields.isNotEmpty()) {
102102
if (response.schema != null) {
103-
resourceBuilder.responseSchema(Schema.Companion.schema(response.schema!!))
103+
resourceBuilder.responseSchema(Schema.schema(response.schema!!))
104104
}
105105
resourceBuilder.responseFields(buildFields(response.fields))
106106
}

documentify-sample/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id("io.github.bgmsound.documentify") version "1.2.5" apply false
2+
id("io.github.bgmsound.documentify") version "1.3.6" apply false
33
}
44

55
subprojects {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project.name=documentify
22

33
project.group=io.github.bgmsound
4-
project.version.id=1.3.6
4+
project.version.id=1.3.7
55
project.artifact=documentify
66

77
project.description=Documentify is a tool to generate API documentation from source code.

0 commit comments

Comments
 (0)