-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update build info for publish package
- Loading branch information
Showing
4 changed files
with
189 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,142 @@ | ||
plugins { | ||
base | ||
alias(libs.plugins.kotlin.jvm) | ||
alias(libs.plugins.serialization) | ||
|
||
id("java-library") | ||
id("maven-publish") | ||
publishing | ||
signing | ||
|
||
id("jacoco-report-aggregation") | ||
} | ||
|
||
group = "org.unitmesh" | ||
version = "1.0-SNAPSHOT" | ||
jacoco { | ||
toolVersion = "0.8.8" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
google() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.javaparser) | ||
implementation(libs.javaparser.serialization) | ||
implementation(libs.javaparser.symbol.solver.core) | ||
allprojects { | ||
apply(plugin = "java") | ||
apply(plugin = "jacoco") | ||
|
||
testImplementation(kotlin("test")) | ||
testImplementation(libs.bundles.test) | ||
} | ||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
group = "cc.unitmesh" | ||
version = "0.1.0-SNAPSHOT" | ||
|
||
java.sourceCompatibility = JavaVersion.VERSION_11 | ||
java.targetCompatibility = JavaVersion.VERSION_11 | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} | ||
|
||
tasks.test { | ||
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
tasks.jacocoTestReport { | ||
dependsOn(tasks.test) // tests are required to run before generating the report | ||
} | ||
|
||
tasks.jacocoTestReport { | ||
reports { | ||
xml.required.set(true) | ||
csv.required.set(false) | ||
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml")) | ||
} | ||
} | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
configure(allprojects) { | ||
apply(plugin = "java-library") | ||
apply(plugin = "maven-publish") | ||
apply(plugin = "signing") | ||
apply(plugin = "publishing") | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
versionMapping { | ||
usage("java-api") { | ||
fromResolutionOf("runtimeClasspath") | ||
} | ||
usage("java-runtime") { | ||
fromResolutionResult() | ||
} | ||
} | ||
pom { | ||
name.set("Unit Eval") | ||
description.set("Unit Mesh Eval") | ||
url.set("https://github.com/unit-mesh/") | ||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://raw.githubusercontent.com/unit-mesh/unit-eval/master/LICENSE") | ||
} | ||
} | ||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://github.com/unit-mesh/unit-eval/raw/master/LICENSE") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("Unit Mesh") | ||
name.set("UnitMesh Team") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/unit-mesh/unit-eval.git") | ||
developerConnection.set("scm:git:ssh://github.com/unit-mesh/unit-eval.git") | ||
url.set("https://github.com/unit-mesh/unit-eval/") | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") | ||
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl | ||
|
||
credentials { | ||
username = ( | ||
if (project.findProperty("sonatypeUsername") != null) project.findProperty("sonatypeUsername") else System.getenv( | ||
"MAVEN_USERNAME" | ||
)).toString() | ||
password = ( | ||
if (project.findProperty("sonatypePassword") != null) project.findProperty("sonatypePassword") else System.getenv( | ||
"MAVEN_PASSWORD" | ||
)).toString() | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign(publishing.publications["mavenJava"]) | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@Suppress("DSL_SCOPE_VIOLATION") | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
alias(libs.plugins.shadow) | ||
alias(libs.plugins.serialization) | ||
application | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.clikt) | ||
implementation(libs.serialization.json) | ||
|
||
// Logging | ||
implementation(libs.logging.slf4j.api) | ||
implementation(libs.logging.logback.classic) | ||
|
||
testImplementation(kotlin("test")) | ||
|
||
testImplementation(libs.bundles.test) | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
} | ||
|
||
|
||
application { | ||
mainClass.set("cc.unitmesh.eval.checker.MainKt") | ||
} | ||
|
||
tasks { | ||
shadowJar { | ||
manifest { | ||
attributes(Pair("Main-Class", "cc.unitmesh.eval.checker.MainKt")) | ||
} | ||
// minimize() | ||
dependencies { | ||
exclude(dependency("org.junit.jupiter:.*:.*")) | ||
exclude(dependency("org.junit:.*:.*")) | ||
exclude(dependency("junit:.*:.*")) | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.unimesh.eval | ||
|
||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.parameters.options.option | ||
|
||
class Hello : CliktCommand() { | ||
val name by option(help = "your name") | ||
override fun run() { | ||
echo("Hello, $name!") | ||
} | ||
} | ||
|
||
fun main(args: Array<String>) = Hello().main(args) |