-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
110 lines (97 loc) · 3.62 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
106
107
108
109
110
@Suppress("DSL_SCOPE_VIOLATION") // IntelliJ incorrectly marks libs as not callable
plugins {
`maven-publish`
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.dockerCompose)
alias(libs.plugins.gradlePluginPublish)
alias(libs.plugins.versioning)
}
group = "com.liftric"
version = with(versioning.info) {
if (branch == "HEAD" && dirty.not()) tag else full
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dockerCompose {
// Docker Compose v1 is needed for this Plugin to work
useComposeFiles.set(listOf("docker-compose.yml"))
waitForTcpPorts.set(true)
captureContainersOutput.set(true)
stopContainers.set(true)
removeContainers.set(true)
buildBeforeUp.set(true)
}
val integrationTest = sourceSets.create("integrationTest")
tasks {
val test by existing
withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
systemProperty("org.gradle.testkit.dir", gradle.gradleUserHomeDir)
}
val integrationTestTask = register<Test>("integrationTest") {
description = "Runs the integration tests"
group = "verification"
testClassesDirs = integrationTest.output.classesDirs
classpath = integrationTest.runtimeClasspath
mustRunAfter(test)
useJUnitPlatform()
}
dockerCompose.isRequiredBy(integrationTestTask)
val pluginPropertiesBuildFolder = file("$buildDir/compileProperties/")
val propertiesTask = register<WriteProperties>("writePluginProperties") {
outputFile = pluginPropertiesBuildFolder.resolve("plugin.properties")
property("vendor", "Liftric")
property("name", rootProject.name)
property("version", rootProject.version)
}
sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).resources.srcDir(pluginPropertiesBuildFolder)
withType(ProcessResources::class.java) {
dependsOn(propertiesTask)
}
withType(Jar::class.java) {
dependsOn(propertiesTask)
}
}
tasks.named("publishPlugins") {
dependsOn("writePluginProperties")
}
gradlePlugin {
website.set("https://github.com/Liftric/dependency-track-companion-plugin")
vcsUrl.set("https://github.com/Liftric/dependency-track-companion-plugin")
testSourceSets(integrationTest)
plugins {
create("dependency-track-companion-plugin") {
id = "$group.$name"
implementationClass = "$group.dtcp.DepTrackCompanionPlugin"
displayName = name
description = "Common tasks for Dependency Track interaction, like SBOM upload or VEX Generation"
tags.set(listOf("dependency", "track", "sbom", "vex", "upload", "generate"))
}
}
}
dependencies {
implementation(platform(libs.kotlinBom))
implementation(libs.kotlinStdlibJdk8)
implementation(libs.cyclonedxCoreJava)
implementation(libs.ktorClientCio)
implementation(libs.ktorClientCore)
implementation(libs.ktorClientJson)
implementation(libs.ktorClientSerialization)
implementation(libs.ktorClientContentNegotiation)
implementation(libs.ktorSerializationKotlinxJson)
implementation(libs.kotlinReflect)
implementation(libs.cyclonedxGradlePlugin)
testImplementation(libs.junitJupiter)
"integrationTestImplementation"(gradleTestKit())
"integrationTestImplementation"(libs.cyclonedxCoreJava)
"integrationTestImplementation"(libs.junitJupiter)
"integrationTestImplementation"(libs.ktorClientCio)
"integrationTestImplementation"(libs.ktorClientContentNegotiation)
"integrationTestImplementation"(libs.ktorSerializationKotlinxJson)
}