| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| buildscript { |
| repositories { |
| maven { url "https://plugins.gradle.org/m2/" } |
| maven { url "https://dl.bintray.com/palantir/releases" } |
| jcenter() |
| } |
| |
| dependencies { |
| // Newer versions of the nebula plugins require gradle-info-plugin 4.0.2 or higher, which in |
| // depends on JGit 5.0. Conversely, gradle-git relies of JGit 4.0. |
| // Be mindful of potential classpath issues when updating any of these three dependencies. |
| classpath "com.netflix.nebula:nebula-project-plugin:5.1.0" |
| classpath "com.netflix.nebula:gradle-lint-plugin:10.1.0" |
| classpath "org.ajoberstar:gradle-git:1.7.2" |
| |
| classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.1" |
| classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2' |
| classpath "com.diffplug.spotless:spotless-plugin-gradle:3.10.0" |
| classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8" |
| classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' |
| classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' |
| } |
| } |
| |
| apply plugin: 'wrapper' |
| apply plugin: 'nebula.facet' |
| |
| wrapper { |
| gradleVersion = minimumGradleVersion |
| distributionType = "all" |
| } |
| |
| allprojects { |
| ext.isReleaseVersion = true |
| if(version.contains("SNAPSHOT")) { |
| ext.isReleaseVersion = false |
| version = (version as String).replaceFirst(/SNAPSHOT.*/, 'SNAPSHOT') |
| } |
| |
| repositories { |
| mavenLocal() |
| mavenCentral() |
| maven { url "https://repo.spring.io/release" } |
| } |
| |
| buildRoot = buildRoot.trim() |
| if (!buildRoot.isEmpty()) { |
| buildDir = buildRoot + project.path.replace(":", "/") + "/build" |
| } |
| } |
| |
| apply from: "${scriptDir}/java.gradle" |
| apply from: "${scriptDir}/ide.gradle" |
| apply from: "${scriptDir}/dependency-resolution.gradle" |
| apply from: "${scriptDir}/test.gradle" |
| apply from: "${scriptDir}/code-analysis.gradle" |
| apply from: "${scriptDir}/sonar.gradle" |
| apply from: "${scriptDir}/rat.gradle" |
| apply from: "${scriptDir}/docker.gradle" |
| apply from: "${scriptDir}/spotless.gradle" |
| apply from: "${scriptDir}/lint.gradle" |
| apply from: "${scriptDir}/resolve-dependencies.gradle" |
| |
| subprojects { |
| apply plugin: 'com.github.ben-manes.versions' |
| } |
| |
| task devBuild(dependsOn: [":assemble"]) { |
| description "A convenience target for a typical developer workflow: apply spotless and assemble all classes." |
| // spotless targets are not available until after evaluation. |
| subprojects { |
| afterEvaluate { |
| this.devBuild.dependsOn(project.spotlessApply) |
| } |
| } |
| } |
| |
| |
| |
| ext.readScmInfo = { proj -> |
| // Attempt to read git information, or else return UNKNOWN |
| try { |
| def git = org.ajoberstar.grgit.Grgit.open(currentDir: project(proj).projectDir) |
| try { |
| return [ |
| 'Source-Repository': git.branch.current.name, |
| 'Source-Revision' : git.head().id, |
| 'Source-Date' : git.head().date.format('yyyy-MM-dd HH:mm:ss Z') |
| ] as Properties |
| } finally { |
| git.close() |
| } |
| } catch (org.ajoberstar.grgit.exception.GrgitException ignoredDistributionBuild) { |
| // If we're building from the source distribution, we don't have git. |
| // Instead, we use the .buildinfo copied to the root directory during the distribution build |
| // from the writeBuildInfo task below (from build/.buildinfo) |
| def buildInfo = file "$rootDir/.buildinfo" |
| if (buildInfo.exists()) { |
| def props = new Properties() |
| new FileInputStream(buildInfo).withStream { fis -> |
| props.load(fis) |
| } |
| return props |
| } |
| throw new GradleException("Cannot get SCM information when neither git nor source distribution is available") |
| } |
| } |
| |
| task writeBuildInfo { |
| def buildInfo = file "$buildDir/.buildinfo" |
| def scmInfo = this.readScmInfo("geode-core") |
| |
| inputs.property("Source-Revision", scmInfo.getProperty("Source-Revision")) |
| outputs.file buildInfo |
| doLast { |
| buildInfo.getParentFile().mkdirs() |
| new FileOutputStream(buildInfo).withStream { fos -> |
| scmInfo.store(fos, '') |
| } |
| } |
| } |
| |
| tasks.register('generate') { |
| group = 'Build' |
| description = "Top-level target for all source generation. Helps IDE integration" |
| // This task is a no-op, with other tasks (such as geode-protobuf-messages:generateProto) |
| // injecting themselves as a task dependency into this task. E.g., via |
| // `afterEvaluate.rootProject.generate.dependsOn(generateProto)` |
| } |
| |
| // Prompt the user for a publication passsword to sign archives or upload artifacts, if requested |
| if (project.hasProperty('askpass')) { |
| gradle.taskGraph.whenReady { taskGraph -> |
| if(taskGraph.allTasks.any {it instanceof Sign}) { |
| if(!project.hasProperty('signing.keyId') || !project.hasProperty('signing.secretKeyRingFile')) { |
| println "You must configure your signing.keyId and signing.secretKeyRingFile" |
| println "in ~/.gradle/gradle.properties in order to sign jars\n" |
| println "See https://cwiki.apache.org/confluence/display/GEODE/Release+Steps" |
| throw new GradleException("Signing key/keyring is missing") |
| } |
| |
| if(!project.hasProperty('signing.password')) { |
| def password = PasswordDialog.askPassword("Please enter your password to unlock your gpg keyring for signing artifacts") |
| |
| subprojects { ext."signing.password" = password } |
| } |
| } |
| |
| if(taskGraph.allTasks.any {it instanceof PublishToMavenRepository}) { |
| if(!project.hasProperty('mavenUsername')) { |
| println "You must configure your mavenUsername in ~/.gradle/gradle.properties in order to publish\n" |
| println "See https://cwiki.apache.org/confluence/display/GEODE/Release+Steps" |
| throw new GradleException("mavenUsername is missing") |
| } |
| if(!project.hasProperty('mavenPassword')) { |
| def getPassword = PasswordDialog.askPassword("Please enter your apache password to publish to Apache Maven") |
| |
| taskGraph.allTasks.each { |
| if(it instanceof PublishToMavenRepository) { |
| (it as PublishToMavenRepository).repository.credentials.password = getPassword |
| } |
| } |
| } |
| } |
| } |
| } |