Skip to content

Commit dff4525

Browse files
committed
publish logic
1 parent ee8c6df commit dff4525

File tree

1 file changed

+56
-10
lines changed

1 file changed

+56
-10
lines changed

build.gradle.kts

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
plugins {
22
groovy
33
id("org.jetbrains.kotlin.jvm") version("1.3.60")
4+
id("maven-publish")
5+
id("com.jfrog.bintray") version ("1.8.4")
46
}
57

68
group = "com.github.hauner.openapi"
@@ -15,10 +17,14 @@ repositories {
1517

1618
project.ext {
1719
set("generatrApiVersion", "1.0.0.B2")
20+
21+
set("bintrayUser", project.property("BINTRAY_USER") ?: "n/a")
22+
set("bintrayKey", project.property("BINTRAY_KEY") ?: "n/a")
1823
}
1924

2025
dependencies {
21-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
26+
// implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
27+
implementation(kotlin("stdlib"))
2228

2329
implementation("io.swagger.parser.v3:swagger-parser:2.0.12")
2430
compileOnly("com.github.hauner.openapi:openapi-generatr-api:${project.ext.get("generatrApiVersion")}")
@@ -29,20 +35,60 @@ dependencies {
2935
testImplementation("com.github.hauner.openapi:openapi-generatr-api:${project.ext.get("generatrApiVersion")}")
3036
}
3137

32-
tasks.compileKotlin {
38+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
3339
kotlinOptions.jvmTarget = "1.8"
3440
}
3541

36-
tasks.compileTestKotlin {
37-
kotlinOptions.jvmTarget = "1.8"
38-
}
39-
40-
tasks.compileGroovy {
42+
tasks.withType<GroovyCompile> {
4143
dependsOn("compileKotlin")
4244
classpath += files(tasks.compileKotlin.get().destinationDir)
4345
}
4446

45-
tasks.compileTestGroovy {
46-
dependsOn("compileKotlin")
47-
classpath += files(tasks.compileKotlin.get().destinationDir)
47+
val sourcesJar by tasks.registering(Jar::class) {
48+
archiveClassifier.set("sources")
49+
from(sourceSets.main.get().allSource)
50+
}
51+
52+
val javadocJar by tasks.registering(Jar::class) {
53+
dependsOn("javadoc")
54+
archiveClassifier.set("javadoc")
55+
from(tasks.javadoc.get().destinationDir)
56+
}
57+
58+
artifacts {
59+
archives(sourcesJar)
60+
archives(javadocJar)
61+
}
62+
63+
bintray {
64+
user = project.ext.get("bintrayUser").toString()
65+
key = project.ext.get("bintrayKey").toString()
66+
67+
setPublications("GeneratrJson")
68+
69+
pkg.apply {
70+
repo = "openapi-generatr"
71+
name = "openapi-generatr-json"
72+
//userOrg = 'openapi-generatr'
73+
setLicenses("Apache-2.0")
74+
vcsUrl = "https://github.com/hauner/openapi-generatr-json"
75+
76+
version.apply {
77+
name = project.version.toString()
78+
}
79+
}
80+
}
81+
82+
publishing {
83+
publications {
84+
create<MavenPublication>("GeneratrJson") {
85+
from(components["java"])
86+
artifact(sourcesJar.get())
87+
artifact(javadocJar.get())
88+
89+
groupId = project.group.toString()
90+
artifactId = project.name
91+
version = project.version.toString()
92+
}
93+
}
4894
}

0 commit comments

Comments
 (0)