|
1 |
| -import java.util.* |
| 1 | +import de.marcphilipp.gradle.nexus.NexusPublishPlugin |
| 2 | +import java.time.Duration |
| 3 | + |
| 4 | +val libVersion: String by project |
| 5 | +val poi_ooxmlVersion: String by project |
| 6 | +val ooxml_schemasVersion: String by project |
| 7 | +val sonatypeUsername: String? = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypeUsername") |
| 8 | +val sonatypePassword: String? = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypePassword") |
2 | 9 |
|
3 | 10 | plugins {
|
4 |
| - kotlin("jvm") version "1.4.10" |
5 |
| - id("com.jfrog.bintray") version "1.8.4" |
6 |
| - `maven-publish` |
| 11 | + kotlin("jvm") version "1.6.10" |
| 12 | + id("org.jetbrains.dokka") version "1.5.0" |
| 13 | + id("io.codearte.nexus-staging") version "0.21.2" |
| 14 | + id("de.marcphilipp.nexus-publish") version "0.4.0" |
| 15 | + id("com.github.ben-manes.versions") version "0.38.0" |
| 16 | + signing |
| 17 | + jacoco |
7 | 18 | }
|
8 | 19 |
|
9 | 20 | group = "com.apurebase"
|
10 |
| -version = "1.1.2" |
| 21 | +version = libVersion |
11 | 22 |
|
12 | 23 | repositories {
|
13 |
| - jcenter() |
| 24 | + mavenCentral() |
14 | 25 | }
|
15 | 26 |
|
16 | 27 | dependencies {
|
17 | 28 | implementation(kotlin("stdlib"))
|
18 | 29 |
|
19 |
| - api("org.apache.poi:poi-ooxml:4.1.2") |
20 |
| - implementation("org.apache.poi:ooxml-schemas:1.4") |
| 30 | + api("org.apache.pozi:poi-ooxml:${poi_ooxmlVersion}") |
| 31 | + implementation("org.apache.poi:ooxml-schemas:$ooxml_schemasVersion") |
21 | 32 | }
|
22 | 33 |
|
23 |
| -val sourcesJar by tasks.creating(Jar::class) { |
24 |
| - archiveClassifier.set("sources") |
25 |
| - from(sourceSets.getByName("main").allSource) |
26 |
| - from("LICENCE") { |
27 |
| - into("META-INF") |
| 34 | +kotlin { |
| 35 | + apply<NexusPublishPlugin>() |
| 36 | + |
| 37 | + nexusPublishing { |
| 38 | + repositories { |
| 39 | + sonatype() |
| 40 | + } |
| 41 | + clientTimeout.set(Duration.parse("PT10M")) // 10 minutes |
28 | 42 | }
|
29 |
| -} |
30 | 43 |
|
31 | 44 |
|
| 45 | + explicitApi() |
32 | 46 |
|
33 |
| -val githubUrl = "https://github.com/aPureBase/ExcelDSL" |
34 |
| - |
35 |
| -publishing { |
36 |
| - publications { |
37 |
| - create<MavenPublication>("excel-dsl") { |
38 |
| - groupId = project.group.toString() |
39 |
| - artifactId = project.name |
40 |
| - version = project.version.toString() |
41 |
| - from(components["java"]) |
42 |
| - artifact(sourcesJar) |
43 |
| - |
44 |
| - pom { |
45 |
| - packaging = "jar" |
46 |
| - name.set(rootProject.name) |
47 |
| - url.set(githubUrl) |
48 |
| - scm { url.set(githubUrl) } |
49 |
| - issueManagement { url.set("$githubUrl/issues") } |
50 |
| - licenses { |
51 |
| - license { |
52 |
| - name.set("MIT") |
53 |
| - url.set("$githubUrl/blob/master/LICENSE") |
54 |
| - } |
55 |
| - } |
56 |
| - developers { |
57 |
| - developer { |
58 |
| - id.set("jeggy") |
59 |
| - name.set("Jógvan Olsen") |
60 |
| - } |
| 47 | + tasks { |
| 48 | + test { |
| 49 | + useJUnitPlatform() |
| 50 | + doFirst { |
| 51 | + jvmArgs = listOf( |
| 52 | + "-javaagent:${classpath.find { it.name.contains("jmockit") }!!.absolutePath}" |
| 53 | + ) |
| 54 | + } |
| 55 | + } |
| 56 | + dokkaHtml { |
| 57 | + outputDirectory.set(buildDir.resolve("javadoc")) |
| 58 | + dokkaSourceSets { |
| 59 | + configureEach { |
| 60 | + jdkVersion.set(8) |
| 61 | + reportUndocumented.set(true) |
| 62 | + platform.set(org.jetbrains.dokka.Platform.jvm) |
61 | 63 | }
|
62 | 64 | }
|
63 | 65 | }
|
| 66 | + wrapper { |
| 67 | + distributionType = Wrapper.DistributionType.ALL |
| 68 | + } |
| 69 | + closeRepository { |
| 70 | + mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) |
| 71 | + } |
| 72 | + closeAndReleaseRepository { |
| 73 | + mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + val sourcesJar by tasks.creating(Jar::class) { |
| 82 | + classifier = "sources" |
| 83 | + from(sourceSets.main.get()) |
| 84 | + } |
| 85 | + val dokkaJar by tasks.creating(Jar::class) { |
| 86 | + group = JavaBasePlugin.DOCUMENTATION_GROUP |
| 87 | + classifier = "javadoc" |
| 88 | + from(tasks.dokkaHtml) |
64 | 89 | }
|
65 |
| -} |
66 |
| -kotlin { |
67 |
| - explicitApi() |
68 | 90 |
|
69 |
| - bintray { |
70 |
| - user = System.getenv("BINTRAY_USER") |
71 |
| - key = System.getenv("BINTRAY_KEY") |
72 |
| - |
73 |
| - publish = true |
74 |
| - setPublications("excel-dsl") |
75 |
| - pkg.apply { |
76 |
| - repo = "apurebase" |
77 |
| - name = project.name |
78 |
| - setLicenses("MIT") |
79 |
| - setLabels("kotlin", "excel", "apache", "poi", "dsl") |
80 |
| - vcsUrl = githubUrl |
81 |
| - websiteUrl = githubUrl |
82 |
| - issueTrackerUrl = "$githubUrl/issues" |
83 |
| - version.apply { |
84 |
| - name = "${project.version}" |
85 |
| - released = "${Date()}" |
| 91 | + publishing { |
| 92 | + publications { |
| 93 | + create<MavenPublication>("maven") { |
| 94 | + artifactId = project.name |
| 95 | + from(components["java"]) |
| 96 | + artifact(sourcesJar) |
| 97 | + artifact(dokkaJar) |
| 98 | + pom { |
| 99 | + name.set("ExcelDSL") |
| 100 | + description.set("A easy to use Kotlin DSL to build Excel documents") |
| 101 | + organization { |
| 102 | + name.set("aPureBase") |
| 103 | + url.set("https://apurebase.com/") |
| 104 | + } |
| 105 | + licenses { |
| 106 | + license { |
| 107 | + name.set("The Apache License, Version 2.0") |
| 108 | + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") |
| 109 | + } |
| 110 | + } |
| 111 | + developers { |
| 112 | + developer { |
| 113 | + id.set("jeggy") |
| 114 | + name.set("Jógvan Olsen") |
| 115 | + |
| 116 | + } |
| 117 | + } |
| 118 | + scm { |
| 119 | + connection.set("scm:git:https://github.com/aPureBase/ExcelDSL.git") |
| 120 | + developerConnection.set("scm:git:https://github.com/aPureBase/ExcelDSL.git") |
| 121 | + url.set("https://github.com/aPureBase/ExcelDSL/") |
| 122 | + tag.set("HEAD") |
| 123 | + } |
| 124 | + } |
86 | 125 | }
|
87 | 126 | }
|
88 | 127 | }
|
|
0 commit comments