-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
137 lines (116 loc) · 4.09 KB
/
build.gradle.kts
File metadata and controls
137 lines (116 loc) · 4.09 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
plugins {
id("com.gradle.plugin-publish") version "1.3.1"
id("com.diffplug.spotless") version "8.1.0"
signing
id("org.spdx.sbom") version "0.11.0"
}
group = "org.spdx"
description = "A gradle plugin generating spdx sboms"
repositories {
mavenCentral()
}
dependencies {
compileOnly(platform("org.immutables:bom:2.10.1"))
annotationProcessor(platform("org.immutables:bom:2.10.1"))
compileOnly("org.immutables:serial")
compileOnly("org.immutables:value-annotations")
annotationProcessor("org.immutables:value")
implementation("org.spdx:java-spdx-library:1.1.12")
implementation("org.spdx:spdx-jackson-store:1.1.9.1")
implementation("org.apache.maven:maven-model-builder:3.9.9")
implementation("org.apache.maven:maven-model:3.9.9")
implementation("com.google.guava:guava:33.4.6-jre")
testImplementation(platform("org.junit:junit-bom:5.12.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // https://github.com/junit-team/junit5/issues/4374
testImplementation("org.hamcrest:hamcrest-library:3.0")
testImplementation("org.spdx:tools-java:1.1.8")
}
gradlePlugin {
website.set("https://github.com/spdx/spdx-gradle-plugin")
vcsUrl.set("https://github.com/spdx/spdx-gradle-plugin.git")
plugins {
create("spdxSbom") {
id = "org.spdx.sbom"
implementationClass = "org.spdx.sbom.gradle.SpdxSbomPlugin"
displayName = "Generate sboms in spdx format"
description = "This plugin generates json formatted spdx sboms for gradle projects"
tags.set(listOf("spdx", "sbom"))
}
create("spdxSbomSettings") {
id = "org.spdx.sbom.settings"
implementationClass = "org.spdx.sbom.gradle.SpdxSbomSettingsPlugin"
displayName = "Collect project info for SPDX SBOMS"
description = "This plugin collects project information needed for SPDX SBOMS in project-isolated builds"
tags.set(listOf("spdx", "sbom"))
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
val functionalTestSourceSet = sourceSets.create("functionalTest") {}
configurations["functionalTestImplementation"].extendsFrom(configurations["testImplementation"])
configurations["functionalTestRuntimeOnly"].extendsFrom(configurations["testRuntimeOnly"])
val functionalTest by tasks.registering(Test::class) {
testClassesDirs = functionalTestSourceSet.output.classesDirs
classpath = functionalTestSourceSet.runtimeClasspath
useJUnitPlatform()
}
gradlePlugin.testSourceSets(functionalTestSourceSet)
tasks.named<Task>("check") {
// Run the functional tests as part of `check`
dependsOn(functionalTest)
}
tasks.named<Test>("test") {
// Use JUnit Jupiter for unit tests.
useJUnitPlatform()
}
tasks.named<Javadoc>("javadoc") {
(options as StandardJavadocDocletOptions).apply {
addBooleanOption("Xdoclint:all,-missing", true)
}
}
spotless {
kotlinGradle {
target("*.gradle.kts") // default target for kotlinGradle
ktlint()
}
format("misc") {
target("*.md", ".gitignore", "**/*.yaml")
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
java {
googleJavaFormat()
licenseHeaderFile("$rootDir/config/licenseHeader")
}
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
tasks.withType<Sign> {
onlyIf("skip.signing is not set") { !project.hasProperty("skip.signing") }
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
}
spdxSbom {
targets {
create("example") {
scm {
uri.set("github.com/spdx/spdx-gradle-plugin")
revision.set("dev")
}
}
}
}
tasks.register("updateExample", Copy::class) {
from(tasks.named("spdxSbomForExample"))
into(layout.projectDirectory)
}