| 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 |
maven { |
| 38 |
url "file:///usr/share/mave-repo" |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
sourceSets { |
| 43 |
main { |
| 44 |
java { |
| 45 |
srcDir 'java' |
| 46 |
exclude 'com/google/re2j/super/**' |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
gwt { |
| 51 |
java { |
| 52 |
srcDir 'java' |
| 53 |
include 'com/google/re2j/super/**' |
| 54 |
} |
| 55 |
resources { |
| 56 |
srcDir 'java' |
| 57 |
include 'com/google/re2j/RE2J.gwt.xml' |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
test { |
| 62 |
java { |
| 63 |
srcDir 'javatests' |
| 64 |
} |
| 65 |
resources { |
| 66 |
srcDir 'testdata' |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
idea { |
| 72 |
module { |
| 73 |
// Unfortunately, IntelliJ ignores the `exclude` directive in the sourceSet declaration |
| 74 |
// above. Without this, it complains about duplicated classes that exist both in GWT and non- |
| 75 |
// GWT sources. |
| 76 |
excludeDirs += file('java/com/google/re2j/super') |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
test { |
| 81 |
// Allow parallel test execution. |
| 82 |
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 |
| 83 |
} |
| 84 |
|
| 85 |
dependencies { |
| •86 |
//errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1' |
| 87 |
//errorprone 'com.google.errorprone:error_prone_core:2.10.0' |
| 88 |
|
| 89 |
testCompile 'junit:junit:4.12' |
| 90 |
testCompile 'com.google.gwt:gwt-dev:2.9.0' |
| 91 |
testCompile 'com.google.gwt:gwt-user:2.9.0' |
| 92 |
testCompile 'com.google.truth:truth:0.36' |
| 93 |
|
| 94 |
// Cobertura requires slf4j at runtime |
| 95 |
testRuntime "org.slf4j:slf4j-api:1.7.10" |
| 96 |
} |
| 97 |
|
| 98 |
task sourceJar(type: Jar) { |
| 99 |
baseName 'sources' |
| 100 |
|
| 101 |
from sourceSets.main.allJava |
| 102 |
from sourceSets.gwt.allSource |
| 103 |
} |
| 104 |
|
| 105 |
task javadocJar(type: Jar, dependsOn: javadoc) { |
| 106 |
baseName 'javadoc' |
| 107 |
|
| 108 |
from javadoc.destinationDir |
| 109 |
} |
| 110 |
|
| 111 |
def appendMavenCentralMetadata(Node node) { |
| 112 |
node.appendNode('name', 'RE2/J') |
| 113 |
node.appendNode('description', 'Linear time regular expressions for Java') |
| 114 |
node.appendNode('url', 'http://github.com/google/re2j') |
| 115 |
|
| 116 |
def license = node.appendNode('licenses').appendNode('license') |
| 117 |
license.appendNode('name', 'Go License') |
| 118 |
license.appendNode('url', 'https://golang.org/LICENSE') |
| 119 |
license.appendNode('distribution', 'repo') |
| 120 |
|
| 121 |
node.appendNode('scm').appendNode('url', 'https://github.com/google/re2j.git') |
| 122 |
|
| 123 |
def developerInfo = node.appendNode('developers').appendNode('developer') |
| 124 |
developerInfo.appendNode('id', 'dev') |
| 125 |
developerInfo.appendNode('name', 'The RE2/J Contributors') |
| 126 |
developerInfo.appendNode('email', '[email protected]') |
| 127 |
} |
| 128 |
|
| 129 |
publishing { |
| 130 |
publications { |
| 131 |
mavenJava(MavenPublication) { |
| 132 |
from components.java |
| 133 |
|
| 134 |
artifact sourceJar { |
| 135 |
classifier 'sources' |
| 136 |
} |
| 137 |
|
| 138 |
artifact javadocJar { |
| 139 |
classifier 'javadoc' |
| 140 |
} |
| 141 |
|
| 142 |
groupId 'com.google.re2j' |
| 143 |
artifactId 're2j' |
| 144 |
version project.version |
| 145 |
|
| 146 |
pom.withXml { |
| 147 |
appendMavenCentralMetadata(asNode()) |
| 148 |
} |
| 149 |
} |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
signing { |
| •154 |
//useGpgCmd() |
| 155 |
|
| •156 |
//sign publishing.publications.mavenJava |
| 157 |
} |
| 158 |
|
| •159 |
//nexusPublishing { |
| 160 |
// repositories { |
| 161 |
// sonatype { |
| 162 |
// username = findProperty('sonatype.username') |
| 163 |
// password = findProperty('sonatype.password') |
| 164 |
// } |
| 165 |
// } |
| 166 |
//} |
| 167 |
|
| 168 |
// If Java formatter checks fail, tell the user how to fix them. |
| 169 |
task printFormatHelperMessage { |
| 170 |
doLast { |
| 171 |
throw new GradleException('google-java-format is required.\n' + |
| 172 |
'Use ./gradlew googleJavaFormat to reformat the broken files') |
| 173 |
} |
| 174 |
} |
| •175 |
//verifyGoogleJavaFormat.finalizedBy printFormatHelperMessage |
| 176 |
//printFormatHelperMessage.onlyIf { verifyGoogleJavaFormat.state.failure != null } |
| 177 |
|
| •178 |
//import com.hierynomus.gradle.license.tasks.LicenseCheck |
| 179 |
|
| 180 |
// By default, this plugin only applies to the root project. We apply it here |
| 181 |
// manually to all projects so that even the subprojects receive license |
| 182 |
// enforcement. |
| •183 |
//allprojects { |
| 184 |
// apply plugin: "license" |
| 185 |
// |
| 186 |
// license { |
| 187 |
// header rootProject.file('LICENSE.header') |
| 188 |
// ext.year = Calendar.getInstance().get(Calendar.YEAR) |
| 189 |
// strictCheck true |
| 190 |
// skipExistingHeaders true |
| 191 |
// |
| 192 |
// mapping { |
| 193 |
// // Without this, the plugin adds javadoc-style comments to the top |
| 194 |
// // of each Java source file. |
| 195 |
// java = 'SLASHSTAR_STYLE' |
| 196 |
// } |
| 197 |
// |
| 198 |
// include '**/*.gradle' |
| 199 |
// include '**/*.java' |
| 200 |
// include '**/*.xml' |
| 201 |
// include '**/*.pl' |
| 202 |
// } |
| 203 |
// |
| 204 |
// // Each license check task gets a new "help message" task to tell the |
| 205 |
// // user how to fix license violations. |
| 206 |
// tasks.withType(LicenseCheck) { checkTask -> |
| 207 |
// def helpMessageTask = task "${checkTask.name}HelpMessage" { |
| 208 |
// doLast { |
| 209 |
// throw new GradleException( |
| 210 |
// 'Some files lack an appropriate license header.\n' + |
| 211 |
// 'Run ./gradlew licenseFormat to add one.') |
| 212 |
// } |
| 213 |
// } |
| 214 |
// |
| 215 |
// checkTask.finalizedBy helpMessageTask |
| 216 |
// helpMessageTask.onlyIf { checkTask.state.failure != null } |
| 217 |
// } |
| 218 |
allprojects { |
| •219 |
group = 'com.google.re2j' |
| 220 |
version = "1.7" |
| 221 |
} |