-
Notifications
You must be signed in to change notification settings - Fork 72
/
build.gradle.kts
105 lines (92 loc) · 3.33 KB
/
build.gradle.kts
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
import com.diffplug.gradle.spotless.SpotlessExtension
import com.diffplug.gradle.spotless.SpotlessPlugin
import com.github.vlsi.gradle.dsl.configureEach
plugins {
`maven-publish`
id("java")
id("idea")
id("com.github.vlsi.gradle-extensions") version "1.74"
id("com.diffplug.spotless") version "6.19.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("org.cyclonedx.bom") version "1.8.2"
}
var IMMUTABLES_VERSION = properties.get("immutables.version")
var JUNIT_VERSION = properties.get("junit.version")
var SLF4J_VERSION = properties.get("slf4j.version")
repositories { mavenCentral() }
java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } }
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:${JUNIT_VERSION}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${JUNIT_VERSION}")
implementation("org.slf4j:slf4j-api:${SLF4J_VERSION}")
annotationProcessor("org.immutables:value:${IMMUTABLES_VERSION}")
compileOnly("org.immutables:value-annotations:${IMMUTABLES_VERSION}")
annotationProcessor("com.github.bsideup.jabel:jabel-javac-plugin:0.4.2")
compileOnly("com.github.bsideup.jabel:jabel-javac-plugin:0.4.2")
}
val submodulesUpdate by
tasks.creating(Exec::class) {
group = "Build Setup"
description = "Updates (and inits) substrait git submodule"
commandLine = listOf("git", "submodule", "update", "--init", "--recursive")
}
allprojects {
repositories { mavenCentral() }
tasks.configureEach<Test> {
val javaToolchains = project.extensions.getByType<JavaToolchainService>()
useJUnitPlatform()
javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(11)) })
}
tasks.withType<JavaCompile> {
sourceCompatibility = "17"
if (project.name != "core") {
options.release.set(11)
} else {
options.release.set(8)
}
dependsOn(submodulesUpdate)
}
group = "io.substrait"
version = "${version}"
plugins.withType<SpotlessPlugin>().configureEach {
configure<SpotlessExtension> {
kotlinGradle { ktfmt().googleStyle() }
java {
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
targetExclude("**/build/**")
}
}
}
if (listOf("core", "isthmus", "isthmus-cli").contains(project.name)) {
apply(plugin = "org.cyclonedx.bom")
tasks.cyclonedxBom {
setIncludeConfigs(listOf("runtimeClasspath"))
setSkipConfigs(listOf("compileClasspath", "testCompileClasspath"))
setProjectType("library")
setSchemaVersion("1.5")
setDestination(project.file("build/reports"))
setOutputName("bom")
setOutputFormat("json")
setIncludeBomSerialNumber(false)
setIncludeLicenseText(false)
}
}
}
nexusPublishing {
repositories {
create("sonatype") {
val sonatypeUser =
System.getenv("SONATYPE_USER").takeUnless { it.isNullOrEmpty() }
?: extra["SONATYPE_USER"].toString()
val sonatypePassword =
System.getenv("SONATYPE_PASSWORD").takeUnless { it.isNullOrEmpty() }
?: extra["SONATYPE_PASSWORD"].toString()
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(sonatypeUser)
password.set(sonatypePassword)
}
}
}