Skip to content

Commit 8d3d533

Browse files
committed
[publish] add publish maven configuration
1 parent e52b0fe commit 8d3d533

File tree

9 files changed

+76
-10
lines changed

9 files changed

+76
-10
lines changed

annotation/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
kotlin("jvm")
3+
id("maven-publish")
34
}
45

56
group = "com.tobrun.datacompat"
@@ -12,4 +13,8 @@ repositories {
1213

1314
dependencies {
1415
implementation(kotlin("stdlib"))
16+
}
17+
18+
project.apply {
19+
from("$rootDir/gradle/publish.gradle")
1520
}

annotation/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POM_ARTIFACT_ID=annotation
2+
POM_ARTIFACT_TITLE=Kotlin Data Compat
3+
POM_DESCRIPTION=Library producing Kolin binary compatible data structures

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ plugins {
55
repositories {
66
mavenCentral()
77
google()
8+
maven(url = "https://jitpack.io")
89
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
kotlin.code.style=official
1+
kotlin.code.style=official
2+
VERSION_NAME=0.1.0
3+
POM_GROUP_ID=com.tobrun.datacompat

gradle/artifact-settings.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ext {
2+
artifactGroupId = project.property('POM_GROUP_ID')
3+
artifactId = project.property('POM_ARTIFACT_ID')
4+
artifactTitle = project.property('POM_ARTIFACT_TITLE')
5+
artifactDescription = project.property('POM_DESCRIPTION')
6+
developerName = 'Tobrun'
7+
developerId = 'tobrun'
8+
artifactUrl = 'https://github.com/tobrun/data-compat'
9+
artifactVcsUrl = 'https://github.com/tobrun/data-compat.git'
10+
artifactScmUrl = 'scm:git@github.com/tobrun/data-compat.git'
11+
artifactLicenseName = 'Apache-2.0'
12+
artifactLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0'
13+
versionName = project.property('VERSION_NAME')
14+
}

gradle/publish.gradle

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apply plugin: 'maven-publish'
2+
apply from: file('../gradle/artifact-settings.gradle')
3+
4+
afterEvaluate {
5+
publishing {
6+
publications {
7+
// Creates a Maven publication called "release".
8+
release(MavenPublication) {
9+
// Applies the component for the release build variant.
10+
from components.kotlin
11+
12+
// You can then customize attributes of the publication as shown below.
13+
groupId = project.ext.artifactGroupId
14+
artifactId = project.ext.artifactId
15+
version = project.ext.versionName
16+
17+
pom.withXml {
18+
final mainNode = asNode()
19+
mainNode.appendNode('name', project.ext.artifactTitle)
20+
mainNode.appendNode('description', project.ext.artifactTitle)
21+
mainNode.appendNode('url', project.ext.artifactUrl)
22+
23+
final licenseNode = mainNode.appendNode('licenses').appendNode('license')
24+
licenseNode.appendNode('name', project.ext.artifactLicenseName)
25+
licenseNode.appendNode('url', project.ext.artifactLicenseUrl)
26+
licenseNode.appendNode('distribution', "repo")
27+
28+
final developerNode = mainNode.appendNode('developers').appendNode('developer')
29+
developerNode.appendNode('id', project.ext.developerId)
30+
developerNode.appendNode('name', project.ext.developerName)
31+
32+
final scmNode = mainNode.appendNode("scm")
33+
scmNode.appendNode("connection", project.ext.artifactScmUrl)
34+
scmNode.appendNode("developerConnection", project.ext.artifactScmUrl)
35+
scmNode.appendNode("url", project.ext.artifactUrl)
36+
}
37+
}
38+
}
39+
}
40+
}

processor/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
kotlin("jvm")
33
id("com.google.devtools.ksp")
44
id("io.gitlab.arturbosch.detekt") version "1.19.0"
5+
id("maven-publish")
56
}
67

78
group = "com.tobrun.datacompat"
@@ -28,6 +29,8 @@ dependencies {
2829

2930
testImplementation("io.kotest:kotest-runner-junit5:5.1.0")
3031
testImplementation("com.github.tschuchortdev:kotlin-compile-testing-ksp:1.4.7")
32+
33+
implementation(project(":annotation"))
3134
}
3235

3336
sourceSets.main {
@@ -40,4 +43,8 @@ tasks.getByName<Test>("test") {
4043

4144
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
4245
kotlinOptions.freeCompilerArgs += "-Xopt-in=com.squareup.kotlinpoet.ksp.KotlinPoetKspPreview"
46+
}
47+
48+
project.apply {
49+
from("$rootDir/gradle/publish.gradle")
4350
}

processor/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POM_ARTIFACT_ID=processor
2+
POM_ARTIFACT_TITLE=Kotlin Data Compat
3+
POM_DESCRIPTION=Library producing Kolin binary compatible data structures

processor/src/main/kotlin/com/tobrun/datacompat/annotation/DataCompat.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)