-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
57 lines (47 loc) · 1.33 KB
/
build.gradle
File metadata and controls
57 lines (47 loc) · 1.33 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
plugins {
id 'java-library'
id 'com.github.sherter.google-java-format' version '0.9'
id 'com.diffplug.spotless' version '7.0.2'
id 'idea'
}
group = 'ovh.defrancesco'
version = '1.0-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
spotless {
java {
importOrder()
removeUnusedImports()
googleJavaFormat('1.25.2')
formatAnnotations()
}
}
repositories {
mavenCentral()
}
// Task to build the agent JAR
tasks.register('agentJar', Jar) {
archiveClassifier = 'agent'
from sourceSets.main.output
include 'ovh/defrancesco/example/MemorySamplerAgent.class'
manifest {
from('src/main/resources/META-INF/MANIFEST.MF')
}
}
// Task to run the application with the agent
tasks.register('runWithAgent', JavaExec) {
dependsOn agentJar
classpath = sourceSets.main.runtimeClasspath
mainClass = 'ovh.defrancesco.example.StartStopExample'
jvmArgs = ["-javaagent:${agentJar.archiveFile.get()}"]
}
tasks.register('runExample', JavaExec) {
dependsOn agentJar
classpath = sourceSets.main.runtimeClasspath
mainClass = 'ovh.defrancesco.example.ExampleApp'
jvmArgs = ["-javaagent:${agentJar.archiveFile.get()}"]
}
// Make the runWithAgent task the default run task
defaultTasks 'runWithAgent'