xref: /aosp_15_r20/external/perfmark/build.gradle (revision 27e8546d0ef5f99cf83d5252272c7dd38d18d29a)
1plugins {
2    id "net.ltgt.errorprone" version "3.0.1" apply false
3    id "me.champeau.jmh" version "0.6.8" apply false
4    id "io.github.reyerizo.gradle.jcstress" version "0.8.14" apply false
5}
6
7subprojects {
8    apply plugin: "checkstyle"
9    apply plugin: "java-library"
10    apply plugin: 'maven-publish'
11    apply plugin: "idea"
12    apply plugin: "signing"
13    apply plugin: "net.ltgt.errorprone"
14
15    repositories {
16        maven {
17            url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
18        mavenCentral()
19    }
20
21    java {
22        toolchain {
23            languageVersion = JavaLanguageVersion.of(17)
24        }
25    }
26
27    task javadocJar(type: Jar) {
28        classifier = 'javadoc'
29        from javadoc
30    }
31
32    task sourcesJar(type: Jar) {
33        classifier = 'sources'
34        from sourceSets.main.allSource
35    }
36
37    checkstyle {
38        configDirectory = file("$rootDir/buildscripts")
39        toolVersion = "6.17"
40        ignoreFailures = false
41        if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
42            ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
43        }
44    }
45
46    afterEvaluate {
47        jar {
48            manifest {
49                attributes  ('Automatic-Module-Name': moduleName,
50                    "Implementation-Version": archiveVersion.get(),
51                    "Implementation-Title": "PerfMark",
52                    "Implementation-Vendor": "Carl Mastrangelo",
53                    "Implementation-URL": "https://www.perfmark.io/",
54                    "Carl-Is-Awesome": "true")
55            }
56
57        }
58    }
59
60
61    publishing {
62        publications {
63            maven(MavenPublication) {
64                from components.java
65
66                artifact javadocJar
67                artifact sourcesJar
68
69                pom {
70                    name = project.group + ":" + project.name
71                    url = 'https://github.com/perfmark/perfmark'
72                    afterEvaluate {
73                        // description is not available until evaluated.
74                        description = project.description
75                    }
76
77                    scm {
78                        connection = 'scm:git:https://github.com/perfmark/perfmark.git'
79                        developerConnection = 'scm:[email protected]:perfmark/perfmark.git'
80                        url = 'https://github.com/perfmark/perfmark'
81                    }
82
83                    licenses {
84                        license {
85                            name = 'Apache 2.0'
86                            url = 'https://opensource.org/licenses/Apache-2.0'
87                        }
88                    }
89
90                    developers {
91                        developer {
92                            id = "carl-mastrangelo"
93                            name = "Carl Mastrangelo"
94                            email = "[email protected]"
95                            url = "https://www.perfmark.io/"
96                        }
97                    }
98                }
99            }
100        }
101
102        repositories {
103             maven {
104                 def stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
105                 def releaseUrl = stagingUrl
106                 def snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
107                 url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl
108                 credentials {
109                     if (rootProject.hasProperty('ossrhUsername')
110                             && rootProject.hasProperty('ossrhPassword')) {
111                         username = rootProject.ossrhUsername
112                         password = rootProject.ossrhPassword
113                     }
114                 }
115            }
116        }
117    }
118
119    signing {
120        required false
121        sign publishing.publications.maven
122    }
123
124    [publishMavenPublicationToMavenRepository, publishMavenPublicationToMavenLocal]*.onlyIf {
125        !name.contains("perfmark-examples") && !name.contains("perfmark-api-testing")
126                && !name.contains("perfmark-testing") && !name.contains("perfmark-agent")
127    }
128
129    [javadoc]*.onlyIf {
130        !name.contains("perfmark-java9") && !name.contains("perfmark-examples")
131                && !name.contains("perfmark-api-testing") && !name.contains("perfmark-testing")
132    }
133
134    if (rootProject.properties.get('errorProne', true)) {
135        dependencies {
136            errorprone 'com.google.errorprone:error_prone_core:2.16'
137            errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
138        }
139    } else {
140        // Disable Error Prone
141        allprojects {
142            afterEvaluate { project ->
143                project.tasks.withType(JavaCompile) {
144                    options.errorprone.enabled = false
145                }
146            }
147        }
148    }
149
150    group = "io.perfmark"
151    version = "0.26.0"
152
153    dependencies {
154        testImplementation libs.junit
155    }
156}
157