Debian Codegraph @

build.gradle

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1
2 plugins {
3 id 'java-library'
4 id 'wrapper'
5 id 'maven-publish'
6 id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
7 id 'com.github.sherter.google-java-format' version '0.3.2'
8 id 'net.ltgt.errorprone' version '2.0.2'
9 id 'idea'
10 id 'signing'
11
12 // code coverage support
13 id 'net.saliman.cobertura' version '2.5.4'
14
15 // Add license plugin. By default, this plugin only applies to the root
16 // project. Since we need license enforcement for benchmarks and the
17 // Unicode table generator, "apply false" specifies that the plugin should
18 // be downloaded and made available to Gradle, but not applied yet. See the
19 // allprojects section below for where this plugin is actually applied.
20 id 'com.github.hierynomus.license' version '0.15.0' apply false
21 }
22
23 cobertura.coverageFormats = ['html', 'xml']
24
25 // The name of the release we're working on. See RELEASING.md for details.
26 group = "com.google.re2j"
27 version = "1.7"
28
29 wrapper {
30 gradleVersion '5.2'
31 }
32
33 sourceCompatibility = 1.6
34 targetCompatibility = 1.6
35
36 repositories {
37 mavenCentral()
38 }
39
40 sourceSets {
41 main {
42 java {
43 srcDir 'java'
44 exclude 'com/google/re2j/super/**'
45 }
46 }
47
48 gwt {
49 java {
50 srcDir 'java'
51 include 'com/google/re2j/super/**'
52 }
53 resources {
54 srcDir 'java'
55 include 'com/google/re2j/RE2J.gwt.xml'
56 }
57 }
58
59 test {
60 java {
61 srcDir 'javatests'
62 }
63 resources {
64 srcDir 'testdata'
65 }
66 }
67 }
68
69 idea {
70 module {
71 // Unfortunately, IntelliJ ignores the `exclude` directive in the sourceSet declaration
72 // above. Without this, it complains about duplicated classes that exist both in GWT and non-
73 // GWT sources.
74 excludeDirs += file('java/com/google/re2j/super')
75 }
76 }
77
78 test {
79 // Allow parallel test execution.
80 maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
81 }
82
83 dependencies {
84 errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
85 errorprone 'com.google.errorprone:error_prone_core:2.10.0'
86
87 testCompile 'junit:junit:4.12'
88 testCompile 'com.google.gwt:gwt-dev:2.9.0'
89 testCompile 'com.google.gwt:gwt-user:2.9.0'
90 testCompile 'com.google.truth:truth:0.36'
91
92 // Cobertura requires slf4j at runtime
93 testRuntime "org.slf4j:slf4j-api:1.7.10"
94 }
95
96 task sourceJar(type: Jar) {
97 baseName 'sources'
98
99 from sourceSets.main.allJava
100 from sourceSets.gwt.allSource
101 }
102
103 task javadocJar(type: Jar, dependsOn: javadoc) {
104 baseName 'javadoc'
105
106 from javadoc.destinationDir
107 }
108
109 def appendMavenCentralMetadata(Node node) {
110 node.appendNode('name', 'RE2/J')
111 node.appendNode('description', 'Linear time regular expressions for Java')
112 node.appendNode('url', 'http://github.com/google/re2j')
113
114 def license = node.appendNode('licenses').appendNode('license')
115 license.appendNode('name', 'Go License')
116 license.appendNode('url', 'https://golang.org/LICENSE')
117 license.appendNode('distribution', 'repo')
118
119 node.appendNode('scm').appendNode('url', 'https://github.com/google/re2j.git')
120
121 def developerInfo = node.appendNode('developers').appendNode('developer')
122 developerInfo.appendNode('id', 'dev')
123 developerInfo.appendNode('name', 'The RE2/J Contributors')
124 developerInfo.appendNode('email', '[email protected]')
125 }
126
127 publishing {
128 publications {
129 mavenJava(MavenPublication) {
130 from components.java
131
132 artifact sourceJar {
133 classifier 'sources'
134 }
135
136 artifact javadocJar {
137 classifier 'javadoc'
138 }
139
140 groupId 'com.google.re2j'
141 artifactId 're2j'
142 version project.version
143
144 pom.withXml {
145 appendMavenCentralMetadata(asNode())
146 }
147 }
148 }
149 }
150
151 signing {
152 useGpgCmd()
153
154 sign publishing.publications.mavenJava
155 }
156
157 nexusPublishing {
158 repositories {
159 sonatype {
160 username = findProperty('sonatype.username')
161 password = findProperty('sonatype.password')
162 }
163 }
164 }
165
166 // If Java formatter checks fail, tell the user how to fix them.
167 task printFormatHelperMessage {
168 doLast {
169 throw new GradleException('google-java-format is required.\n' +
170 'Use ./gradlew googleJavaFormat to reformat the broken files')
171 }
172 }
173 verifyGoogleJavaFormat.finalizedBy printFormatHelperMessage
174 printFormatHelperMessage.onlyIf { verifyGoogleJavaFormat.state.failure != null }
175
176 import com.hierynomus.gradle.license.tasks.LicenseCheck
177
178 // By default, this plugin only applies to the root project. We apply it here
179 // manually to all projects so that even the subprojects receive license
180 // enforcement.
181 allprojects {
182 apply plugin: "license"
183
184 license {
185 header rootProject.file('LICENSE.header')
186 ext.year = Calendar.getInstance().get(Calendar.YEAR)
187 strictCheck true
188 skipExistingHeaders true
189
190 mapping {
191 // Without this, the plugin adds javadoc-style comments to the top
192 // of each Java source file.
193 java = 'SLASHSTAR_STYLE'
194 }
195
196 include '**/*.gradle'
197 include '**/*.java'
198 include '**/*.xml'
199 include '**/*.pl'
200 }
201
202 // Each license check task gets a new "help message" task to tell the
203 // user how to fix license violations.
204 tasks.withType(LicenseCheck) { checkTask ->
205 def helpMessageTask = task "${checkTask.name}HelpMessage" {
206 doLast {
207 throw new GradleException(
208 'Some files lack an appropriate license header.\n' +
209 'Run ./gradlew licenseFormat to add one.')
210 }
211 }
212
213 checkTask.finalizedBy helpMessageTask
214 helpMessageTask.onlyIf { checkTask.state.failure != null }
215 }
216 }