-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from smidf/patch/buildscript
Buildscript improvements
- Loading branch information
Showing
2 changed files
with
51 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
import com.jfrog.bintray.gradle.BintrayExtension | ||
import org.gradle.kotlin.dsl.* | ||
import org.gradle.api.tasks.bundling.Jar | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("java-library") | ||
id("java-gradle-plugin") | ||
kotlin("jvm") | ||
id("org.jetbrains.dokka") | ||
id("java-gradle-plugin") | ||
id("maven-publish") | ||
id("maven") | ||
id("com.jfrog.bintray") | ||
} | ||
|
||
dependencies { | ||
// implementation(fileTree(args = *arrayOf(Pair("dir", "libs"), Pair("include", arrayOf("*.jar"))))) | ||
implementation(gradleApi()) | ||
|
||
// Kotlin | ||
implementation(Dependencies.Kotlin.kotlinStbLib) | ||
|
||
// OpenAPI | ||
implementation(Dependencies.Libs.openApiCodegen) | ||
|
||
// Tests | ||
testImplementation(Dependencies.TestLibs.junit) | ||
testImplementation(Dependencies.TestLibs.kotlinTest) | ||
implementation(kotlin("stdlib-jdk8")) | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
|
@@ -37,21 +26,21 @@ tasks.withType<KotlinCompile> { | |
} | ||
|
||
val dokka by tasks.getting(DokkaTask::class) { | ||
outputFormat = "html" // html, md, javadoc, | ||
outputFormat = "html" | ||
outputDirectory = "$buildDir/dokka/html" | ||
configuration { | ||
moduleName = "lib" | ||
moduleName = Artifact.artifactId | ||
} | ||
} | ||
|
||
tasks.create<Jar>("sourcesJar") { | ||
from(files("src/main/kotlin")) | ||
val sourcesJar by tasks.creating(Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(files("src/main/kotlin")) | ||
} | ||
|
||
tasks.create<Jar>("dokkaHtmlJar") { | ||
val dokkaHtmlJar by tasks.creating(Jar::class) { | ||
archiveClassifier.set("kdoc-html") | ||
from("$buildDir/dokka/html") | ||
from(dokka.outputDirectory) | ||
dependsOn(dokka) | ||
} | ||
|
||
|
@@ -64,16 +53,53 @@ gradlePlugin { | |
} | ||
} | ||
|
||
group = Artifact.groupId | ||
version = "${project.version}" | ||
val releasePublication = "release" | ||
publishing { | ||
publications { | ||
create<MavenPublication>(releasePublication) { | ||
artifactId = Artifact.artifactId | ||
from(components["java"]) | ||
artifact(sourcesJar) | ||
artifact(dokkaHtmlJar) | ||
|
||
pom { | ||
name.set("Swagger Codegen") | ||
description.set("A fork of the swagger-codegen by eMan") | ||
url.set("https://github.com/eManPrague/swagger-codegen") | ||
|
||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
name.set("eMan a.s.") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("scm:git:git://github.com/eManPrague/swagger-codegen.git") | ||
developerConnection.set("scm:git:ssh://[email protected]/eManPrague/swagger-codegen.git") | ||
url.set("https://github.com/eManPrague/swagger-codegen") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val productionPublicName = "production" | ||
repositories { | ||
maven(url = "https://dl.bintray.com/emanprague/maven") { name = "bintray" } | ||
} | ||
} | ||
|
||
bintray { | ||
user = findPropertyOrNull("bintray.user") | ||
key = findPropertyOrNull("bintray.apikey") | ||
publish = true | ||
setPublications(productionPublicName) | ||
setPublications(releasePublication) | ||
pkg(delegateClosureOf<BintrayExtension.PackageConfig> { | ||
repo = "maven" | ||
name = "cz.eman.swagger.codegen" | ||
|
@@ -96,23 +122,3 @@ bintray { | |
desc = description | ||
}) | ||
} | ||
|
||
publishing { | ||
publications { | ||
register("production", MavenPublication::class) { | ||
artifactId = Artifact.artifactId | ||
from(components["java"]) | ||
artifact(tasks["sourcesJar"]) | ||
artifact(tasks["dokkaHtmlJar"]) | ||
//artifact(sourcesJar.get()) | ||
} | ||
} | ||
|
||
repositories { | ||
maven(url = "http://dl.bintray.com/emanprague/maven") | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |