|
| 1 | +plugins { |
| 2 | + `java-library` |
| 3 | + `maven-publish` |
| 4 | + signing |
| 5 | + kotlin("jvm") version "1.5.31" |
| 6 | + id("org.jlleitschuh.gradle.ktlint") version "10.0.0" |
| 7 | +} |
| 8 | + |
| 9 | +group = "io.github.g0dkar" |
| 10 | +version = "1.0.0" |
| 11 | +java.sourceCompatibility = JavaVersion.VERSION_1_8 |
| 12 | + |
| 13 | +repositories { |
| 14 | + mavenCentral() |
| 15 | +} |
| 16 | + |
| 17 | +dependencies { |
| 18 | + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") |
| 19 | + |
| 20 | + testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1") |
| 21 | + testImplementation("org.junit.jupiter:junit-jupiter-engine:5.3.1") |
| 22 | +} |
| 23 | + |
| 24 | +tasks { |
| 25 | + test { useJUnitPlatform() } |
| 26 | + |
| 27 | + compileKotlin { |
| 28 | + kotlinOptions { |
| 29 | + freeCompilerArgs = listOf("-Xjsr305=strict") |
| 30 | + jvmTarget = "1.8" |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + jar { |
| 35 | + manifest { |
| 36 | + attributes( |
| 37 | + mapOf( |
| 38 | + "Implementation-Title" to project.name, |
| 39 | + "Implementation-Version" to project.version |
| 40 | + ) |
| 41 | + ) |
| 42 | + } |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +java { |
| 47 | + withSourcesJar() |
| 48 | + withJavadocJar() |
| 49 | +} |
| 50 | + |
| 51 | +ktlint { |
| 52 | + outputToConsole.set(true) |
| 53 | + coloredOutput.set(true) |
| 54 | + additionalEditorconfigFile.set(file("${project.projectDir}/../.editorconfig")) |
| 55 | + |
| 56 | + filter { |
| 57 | + exclude("**.gradle.kts") |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +publishing { |
| 62 | + publications { |
| 63 | + create<MavenPublication>("mavenCentral") { |
| 64 | + from(components["java"]) |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + repositories { |
| 69 | + maven { |
| 70 | + name = "external" |
| 71 | + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") |
| 72 | + credentials(PasswordCredentials::class) |
| 73 | + } |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +signing { |
| 78 | + val signingKey: String? by project |
| 79 | + val signingPassword: String? by project |
| 80 | + useInMemoryPgpKeys(signingKey, signingPassword) |
| 81 | + sign(publishing.publications) |
| 82 | +} |
| 83 | + |
| 84 | +// uploadArchives { |
| 85 | +// repositories { |
| 86 | +// mavenDeployer { |
| 87 | +// beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } |
| 88 | +// |
| 89 | +// repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { |
| 90 | +// authentication(userName: ossrhUsername, password: ossrhPassword) |
| 91 | +// } |
| 92 | +// |
| 93 | +// snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") { |
| 94 | +// authentication(userName: ossrhUsername, password: ossrhPassword) |
| 95 | +// } |
| 96 | +// |
| 97 | +// pom.project { |
| 98 | +// name 'Example Application' |
| 99 | +// packaging 'jar' |
| 100 | +// // optionally artifactId can be defined here |
| 101 | +// description 'A application used as an example on how to set up |
| 102 | +// pushing its components to the Central Repository.' |
| 103 | +// url 'http://www.example.com/example-application' |
| 104 | +// |
| 105 | +// scm { |
| 106 | +// connection 'scm:svn:http://foo.googlecode.com/svn/trunk/' |
| 107 | +// developerConnection 'scm:svn:https://foo.googlecode.com/svn/trunk/' |
| 108 | +// url 'http://foo.googlecode.com/svn/trunk/' |
| 109 | +// } |
| 110 | +// |
| 111 | +// licenses { |
| 112 | +// license { |
| 113 | +// name 'The Apache License, Version 2.0' |
| 114 | +// url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 115 | +// } |
| 116 | +// } |
| 117 | +// |
| 118 | +// developers { |
| 119 | +// developer { |
| 120 | +// id 'manfred' |
| 121 | +// name 'Manfred Moser' |
| 122 | + |
| 123 | +// } |
| 124 | +// } |
| 125 | +// } |
| 126 | +// } |
| 127 | +// } |
| 128 | +// } |
0 commit comments