-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
122 lines (112 loc) · 3.98 KB
/
Copy pathbuild.gradle
File metadata and controls
122 lines (112 loc) · 3.98 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
buildscript {
repositories {
maven {
url = "https://plugins.gradle.org/" // fix missing jcenter dependencies for e.g. cyclonedx plugin
}
}
}
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.adarshr.test-logger' version "4.0.0"
id 'com.github.ben-manes.versions' version "0.61.0"
id "io.freefair.lombok" version "9.5.0"
id "com.gradleup.shadow" version "9.6.1"
id 'com.github.jk1.dependency-license-report' version "3.1.4"
id 'org.cyclonedx.bom' version "3.4.1"
id "org.jreleaser" version '1.25.0'
}
group = 'io.github.msg-systems'
version = rootProject.file('version.txt').text.trim()
description = 'JUnit Extension and Java Agent for energy consumption measurement. See also https://github.com/msg-systems/jpowermonitor'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
// options.compilerArgs << '-Xlint:deprecation'
options.compilerArgs << '-parameters'
}
repositories {
mavenCentral()
}
configurations {
demo
}
dependencies {
implementation(
'org.apache.httpcomponents.client5:httpclient5:5.6.4',
'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.22.2',
'org.yaml:snakeyaml:2.6',
'io.prometheus:simpleclient:0.16.0',
'io.prometheus:simpleclient_common:0.16.0',
'io.prometheus:simpleclient_hotspot:0.16.0',
'io.prometheus:simpleclient_httpserver:0.16.0',
'org.slf4j:slf4j-api:2.0.18'
)
demo(
'org.slf4j:slf4j-api:2.0.18',
'org.slf4j:slf4j-simple:2.0.18'
)
compileOnly(
'org.jetbrains:annotations:26.1.0',
'org.junit.jupiter:junit-jupiter:6.1.3'
)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation(
// use logger only in test implementation in order to have a minimal set of dependencies in main source
'org.slf4j:slf4j-simple:2.0.18',
'org.junit.jupiter:junit-jupiter:6.1.3',
'org.assertj:assertj-core:3.27.7'
)
}
apply from: "gradle/test-config.gradle"
apply from: "gradle/jar.gradle"
apply from: "gradle/dependencyUpdates.gradle"
apply from: "gradle/publish.gradle"
apply from: "gradle/signing.gradle"
apply from: "gradle/dist.gradle"
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.InventoryHtmlReportRenderer
// --------------------- shadowJar
shadowJar {
exclude("*.yaml") // exclude template.yaml
exclude("*.json") // exclude grafana dashboards
exclude("simplelogger.properties")
exclude("group/msg/jpowermonitor/demo")
exclude("group/msg/jpowermonitor/demo/*")
dependencies {
exclude(dependency('org.slf4j:slf4j-simple'))
}
}
tasks.register('shadowJarDemo', ShadowJar) {
mergeServiceFiles()
group = "shadow"
archiveBaseName = 'jpowermonitor-demo'
configurations = [project.configurations.demo]
manifest {
attributes('Main-Class': 'group.msg.jpowermonitor.demo.StressCpuExample')
}
from(sourceSets.main.output) {
include 'group/msg/jpowermonitor/demo/StressCpuExample.class' // Pfad zur gewünschten Klasse
include 'simplelogger.properties'
}
}
shadowJar.dependsOn(shadowJarDemo)
// --------------------- license-report:
licenseReport {
renderers = [new InventoryHtmlReportRenderer()]
filters = [new LicenseBundleNormalizer(bundlePath: "$projectDir/gradle/license-normalizer-bundle.json")]
}
// --------------------- SBOM:
tasks.cyclonedxDirectBom {
// includeConfigs is the list of configuration names to include when generating the BOM
// (leave empty to include every configuration)
includeConfigs = []
// skipConfigs is a list of configuration names to exclude when generating the BOM
skipConfigs = ["testCompileClasspath", "testRuntimeClasspath"]
}