-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
109 lines (97 loc) · 3.19 KB
/
build.gradle.kts
File metadata and controls
109 lines (97 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.jvm.tasks.Jar
plugins {
`java-library`
`maven-publish`
}
repositories {
mavenCentral()
}
val java8Compiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
val java8Launcher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}
val java8ToolsJar = files(java8Compiler.map { it.metadata.installationPath.file("lib/tools.jar") })
dependencies {
compileOnly(java8ToolsJar)
testCompileOnly(java8ToolsJar)
testRuntimeOnly(java8ToolsJar)
testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withSourcesJar()
}
tasks.named<JavaCompile>("compileJava") {
javaCompiler = java8Compiler
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.named<JavaCompile>("compileTestJava") {
javaCompiler = java8Compiler
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
javaLauncher = java8Launcher
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}
tasks.named<Jar>("jar") {
manifest {
attributes["Automatic-Module-Name"] = "org.ikvm.javarefplugin"
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifactId = rootProject.name
pom {
name = "java-ref-plugin"
description = project.description.toString()
url = "https://github.com/ikvmnet/java-ref-plugin"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "ikvmnet"
name = "IKVM"
}
}
scm {
connection = "scm:git:https://github.com/ikvmnet/java-ref-plugin.git"
developerConnection = "scm:git:ssh://git@github.com/ikvmnet/java-ref-plugin.git"
url = "https://github.com/ikvmnet/java-ref-plugin"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
val repositoryPath = providers.environmentVariable("GITHUB_REPOSITORY")
.orElse("ikvmnet/java-ref-plugin")
url = uri("https://maven.pkg.github.com/${repositoryPath.get()}")
credentials {
username = providers.gradleProperty("githubUsername")
.orElse(providers.environmentVariable("GITHUB_ACTOR"))
.orNull
password = providers.gradleProperty("githubToken")
.orElse(providers.environmentVariable("GITHUB_TOKEN"))
.orNull
}
}
}
}