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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
plugins {
id 'java-library'
id 'wrapper'
// id 'com.jfrog.bintray' version '1.8.1'
id 'maven-publish'
// id 'com.github.sherter.google-java-format' version '0.3.2'
// id 'net.ltgt.errorprone' version '0.0.11'
id 'idea'
// code coverage support
// id 'net.saliman.cobertura' version '2.5.4'
// id 'com.github.kt3k.coveralls' version '2.8.2'
// Add license plugin. By default, this plugin only applies to the root
// project. Since we need license enforcement for benchmarks and the
// Unicode table generator, "apply false" specifies that the plugin should
// be downloaded and made available to Gradle, but not applied yet. See the
// allprojects section below for where this plugin is actually applied.
// id 'com.github.hierynomus.license' version '0.15.0' apply false
}
//cobertura.coverageFormats = ['html', 'xml']
// The name of the release we're working on. See RELEASING.md for details.
def versionName = '1.5'
wrapper {
gradleVersion '4.9'
}
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
maven {
url "file:///usr/share/mave-repo"
}
}
sourceSets {
main {
java {
srcDir 'java'
exclude 'com/google/re2j/super/**'
}
}
gwt {
java {
srcDir 'java'
include 'com/google/re2j/super/**'
}
resources {
srcDir 'java'
include 'com/google/re2j/RE2J.gwt.xml'
}
}
test {
java {
srcDir 'javatests'
}
resources {
srcDir 'testdata'
}
}
}
idea {
module {
// Unfortunately, IntelliJ ignores the `exclude` directive in the sourceSet declaration
// above. Without this, it complains about duplicated classes that exist both in GWT and non-
// GWT sources.
excludeDirs += file('java/com/google/re2j/super')
}
}
test {
// Allow parallel test execution.
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'com.google.gwt:gwt-dev:2.8.2'
testCompile 'com.google.gwt:gwt-user:2.8.2'
testCompile 'com.google.truth:truth:0.36'
// Cobertura requires slf4j at runtime
testRuntime "org.slf4j:slf4j-api:1.7.10"
}
// Use error_prone_core 2.0.5, later versions require Java 8 to build and we'd
// like to support building on Java 7.
//configurations.errorprone {
// resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.5'
//}
task sourceJar(type: Jar) {
baseName 'sources'
from sourceSets.main.allJava
from sourceSets.gwt.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
baseName 'javadoc'
from javadoc.destinationDir
}
def appendMavenCentralMetadata(Node node) {
node.appendNode('name', 'RE2/J')
node.appendNode('description', 'Linear time regular expressions for Java')
node.appendNode('url', 'http://github.com/google/re2j')
def license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', 'Go License')
license.appendNode('url', 'https://golang.org/LICENSE')
license.appendNode('distribution', 'repo')
node.appendNode('scm').appendNode('url', 'https://github.com/google/re2j.git')
def developerInfo = node.appendNode('developers').appendNode('developer')
developerInfo.appendNode('id', 'dev')
developerInfo.appendNode('name', 'The RE2/J Contributors')
developerInfo.appendNode('email', 're2j-discuss@googlegroups.com')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
artifact javadocJar {
classifier 'javadoc'
}
groupId 'com.google.re2j'
artifactId 're2j'
version versionName
pom.withXml {
appendMavenCentralMetadata(asNode())
}
}
}
}
//bintray {
// user = System.getenv('BINTRAY_USER')
// key = System.getenv('BINTRAY_KEY')
//
// pkg {
// repo = 'maven'
// name = 're2j'
// userOrg = 're2j'
// licenses = ['Go']
// vcsUrl = 'https://github.com/google/re2j.git'
//
// version {
// name = versionName
// desc = "RE2/J ${versionName}"
// released = new Date()
// vcsTag = "re2j-${versionName}"
// }
// }
//
// publications = ['mavenJava']
//}
// If Java formatter checks fail, tell the user how to fix them.
task printFormatHelperMessage {
doLast {
throw new GradleException('google-java-format is required.\n' +
'Use ./gradlew googleJavaFormat to reformat the broken files')
}
}
//verifyGoogleJavaFormat.finalizedBy printFormatHelperMessage
//printFormatHelperMessage.onlyIf { verifyGoogleJavaFormat.state.failure != null }
//import com.hierynomus.gradle.license.tasks.LicenseCheck
// By default, this plugin only applies to the root project. We apply it here
// manually to all projects so that even the subprojects receive license
// enforcement.
//allprojects {
// apply plugin: "license"
//
// license {
// header rootProject.file('LICENSE.header')
// ext.year = Calendar.getInstance().get(Calendar.YEAR)
// strictCheck true
//
// mapping {
// // Without this, the plugin adds javadoc-style comments to the top
// // of each Java source file.
// java = 'SLASHSTAR_STYLE'
// }
//
// include '**/*.gradle'
// include '**/*.java'
// include '**/*.xml'
// include '**/*.pl'
// }
//
// // Each license check task gets a new "help message" task to tell the
// // user how to fix license violations.
// tasks.withType(LicenseCheck) { checkTask ->
// def helpMessageTask = task "${checkTask.name}HelpMessage" {
// doLast {
// throw new GradleException(
// 'Some files lack an appropriate license header.\n' +
// 'Run ./gradlew licenseFormat to add one.')
// }
// }
//
// checkTask.finalizedBy helpMessageTask
// helpMessageTask.onlyIf { checkTask.state.failure != null }
// }
//}
allprojects {
group = 'com.google.re2j'
version = versionName
}
|