xref: /aosp_15_r20/external/perfmark/agent/build.gradle.kts (revision 27e8546d0ef5f99cf83d5252272c7dd38d18d29a)
1 import groovy.util.Node
2 
<lambda>null3 buildscript {
4     extra.apply {
5         set("moduleName", "io.perfmark.agent")
6     }
7 }
8 
<lambda>null9 plugins {
10     id("com.github.johnrengelman.shadow") version "7.0.0"
11 }
12 
13 val jdkVersion = JavaVersion.VERSION_1_6
14 
<lambda>null15 dependencies {
16     compileOnly(libs.jsr305)
17     compileOnly(libs.errorprone)
18 
19     implementation("org.ow2.asm:asm:9.1")
20     implementation("org.ow2.asm:asm-commons:9.1")
21 
22     testImplementation(project(":perfmark-api"))
23     testImplementation(project(":perfmark-impl"))
24     testImplementation(libs.truth)
25     testRuntimeOnly(project(":perfmark-java6"))
26 }
27 
<lambda>null28 tasks.named<JavaCompile>("compileJava") {
29     sourceCompatibility = jdkVersion.toString()
30     targetCompatibility = jdkVersion.toString()
31 
32     javaCompiler.set(javaToolchains.compilerFor {
33         languageVersion.set(JavaLanguageVersion.of(11))
34     })
35 
36     options.compilerArgs.add("-Xlint:-options")
37 }
38 
<lambda>null39 tasks.named<JavaCompile>("compileTestJava") {
40     sourceCompatibility = JavaVersion.VERSION_17.toString()
41     targetCompatibility = JavaVersion.VERSION_17.toString()
42 }
43 
<lambda>null44 tasks.named<Jar>("jar") {
45     // Make this not the default
46     archiveClassifier.value("original")
47     manifest {
48         attributes(mapOf(
49                 "Premain-Class" to "io.perfmark.agent.PerfMarkAgent",
50         ))
51     }
52 }
53 
<lambda>null54 tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
55     // make sure this is THE jar, which removes the suffix.
56     archiveClassifier.value(null as String?)
57 
58     relocate("org.objectweb.asm", "io.perfmark.agent.shaded.org.objectweb.asm")
59 }
60 
61 publishing {
<lambda>null62     publications {
63         named<MavenPublication>("maven") {
64             pom.withXml {
65                 val root = asNode()
66 
67                 for (child in root.children()) {
68                     val c = child as Node
69                     if (c.name().toString().endsWith("dependencies")) {
70                         root.remove(c)
71                         break
72                     }
73                 }
74             }
75         }
76     }
77 }