| /* |
| * 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. |
| */ |
| import io.franzbecker.gradle.lombok.task.DelombokTask |
| |
| buildscript { |
| repositories { |
| mavenCentral() |
| } |
| } |
| |
| plugins { |
| id "org.jetbrains.gradle.plugin.idea-ext" |
| id 'java' |
| id "com.github.vlsi.stage-vote-release" version "1.77" |
| id 'checkstyle' |
| id 'org.nosphere.apache.rat' |
| id 'com.github.spotbugs' |
| id 'org.owasp.dependencycheck' |
| id 'io.franzbecker.gradle-lombok' version "5.0.0" |
| } |
| |
| subprojects { |
| task allDeps(type: DependencyReportTask) {} |
| } |
| |
| apply from: "$rootDir/version.gradle" |
| version = buildVersion |
| |
| releaseArtifacts { |
| fromProject("bookkeeper-dist") |
| fromProject("bookkeeper-dist-all") |
| fromProject("bookkeeper-dist-bkctl") |
| fromProject("bookkeeper-dist-server") |
| |
| tasks.withType(Jar) { |
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| } |
| |
| tasks.withType(Tar) { |
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| } |
| |
| tasks.withType(Zip) { |
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| } |
| } |
| |
| releaseParams { // ReleaseExtension |
| tlp.set("Bookkeeper") |
| componentName.set("Apache Bookkeeper") |
| releaseTag.set("release-$buildVersion") |
| rcTag.set(rc.map { "release-$buildVersion-rc$it" }) |
| |
| sitePreviewEnabled.set(false) |
| |
| nexus { |
| packageGroup.set("org.apache.bookkeeper") |
| } |
| } |
| |
| def skipDepCheck = [] |
| allprojects { |
| if (it.path.startsWith(':tests')) { |
| skipDepCheck << it.path |
| } |
| } |
| |
| allprojects { |
| apply from: "$rootDir/dependencies.gradle" |
| if (it.path != ':circe-checksum:src:main:circe' |
| && it.path != ':cpu-affinity:src:main:affinity' |
| && it.name != 'src' |
| && it.name != 'main') { |
| apply plugin: 'java' |
| apply plugin: 'maven-publish' |
| apply plugin: 'signing' |
| apply plugin: 'org.nosphere.apache.rat' |
| apply plugin: "checkstyle" |
| apply plugin: 'com.github.spotbugs' |
| |
| if (!it.path.startsWith(':tests')) { |
| apply plugin: 'org.owasp.dependencycheck' |
| |
| dependencyCheck { |
| // see https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html |
| // for configuration properties |
| suppressionFile = "$rootDir/src/owasp-dependency-check-suppressions.xml" |
| skipProjects = skipDepCheck |
| skipConfigurations = ["checkstyle", "spotbugs"] |
| failBuildOnCVSS = 7 |
| analyzers { |
| msbuildEnabled = false |
| rubygemsEnabled = false |
| pyDistributionEnabled = false |
| pyPackageEnabled = false |
| nuspecEnabled = false |
| nugetconfEnabled = false |
| assemblyEnabled = false |
| cmakeEnabled = false |
| composerEnabled = false |
| cpanEnabled = false |
| nodeEnabled = false |
| cocoapodsEnabled = false |
| swiftEnabled = false |
| swiftPackageResolvedEnabled = false |
| bundleAuditEnabled = false |
| golangDepEnabled = false |
| golangModEnabled = false |
| |
| nodeAudit.enabled = false |
| retirejs.enabled = false |
| } |
| } |
| } |
| |
| checkstyle { |
| toolVersion "${checkStyleVersion}" |
| configFile file("$rootDir/buildtools/src/main/resources/bookkeeper/checkstyle.xml") |
| configDirectory = file("$rootDir/buildtools/src/main/resources/bookkeeper") |
| checkstyleMain { |
| source ='src/main/java' |
| } |
| |
| checkstyleTest { |
| source ='src/test/java' |
| } |
| } |
| |
| spotbugs { |
| excludeFilter = file("$rootDir/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml") |
| reportLevel = 'high' |
| spotbugsTest.enabled = false |
| } |
| |
| |
| |
| tasks.withType(Jar) { |
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| } |
| |
| tasks.withType(Tar) { |
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| } |
| tasks.withType(Zip) { |
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| } |
| task testJar(type: Jar, dependsOn: testClasses) { |
| archiveClassifier = 'tests' |
| from sourceSets.test.output |
| } |
| |
| // TODO- Separate rat plugins and other plugins configuration in separate files |
| rat { |
| excludes = [ |
| '**/.*/**', |
| '**/*.ipr', |
| '**/out/**', |
| '**/generated/**', |
| '**/build/**', |
| '**/target/**', |
| '**/.idea/**', |
| '.git/**/*', |
| '.github/**/*', |
| '**/.gitignore', |
| '**/.svn/**/*', |
| '**/target/**/*', |
| '**/README.md', |
| '**/README.rst', |
| '**/apidocs/*', |
| '**/src/main/resources/deps/**', |
| '**/META-INF/**', |
| '**/.classpath', |
| '**/.project', |
| '**/.checkstyle', |
| '**/.settings/*', |
| '**/*.iml', |
| '**/*.iws', |
| '**/*.ipr', |
| 'site/**', |
| 'site3/**', |
| '**/*.log', |
| 'data/**', |
| 'dev/.vagrant/**', |
| '**/proto/**.py', |
| '**/keyStoreClientPassword.txt', |
| '**/keyStoreServerPassword.txt', |
| '**/proc_cpuinfo.txt', |
| '**/__pycache__/**', |
| '**/bookkeeper.egg-info/**', |
| '**/apache_bookkeeper_client.egg-info/**', |
| '**/pip-selfcheck.json', |
| '**/test_conf_2.conf' |
| ] |
| } |
| |
| configurations { |
| testArtifacts { |
| extendsFrom testRuntimeOnly |
| } |
| } |
| |
| artifacts { |
| testArtifacts testJar |
| } |
| |
| plugins.withType(DistributionPlugin) { |
| distTar { |
| dependsOn(jar) |
| if (it.path.contains('bookkeeper-dist-all')) { |
| dependsOn(':bookkeeper-benchmark:jar') |
| dependsOn(':bookkeeper-common:jar') |
| dependsOn(':bookkeeper-common-allocator:jar') |
| } |
| archiveClassifier = "bin" |
| compression = Compression.GZIP |
| archiveExtension = 'tar.gz' |
| } |
| } |
| compileJava { |
| sourceCompatibility = 1.8 |
| targetCompatibility = 1.8 |
| options.compilerArgs = ["-Xlint:unchecked", "-Xlint:deprecation", "-Werror"] |
| } |
| |
| |
| |
| def componentName = it.name |
| publishing { |
| publications { |
| maven(MavenPublication) { |
| groupId = 'org.apache.bookkeeper' |
| artifactId = componentName |
| version = buildVersion |
| |
| from components.java |
| artifact testJar |
| } |
| } |
| } |
| signing { |
| def skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean() |
| def shouldSign = !skipSigning |
| if (shouldSign) { |
| if (project.hasProperty("singingKey")) { |
| // The following allow the secretKey and password to be specified using env var |
| // This is mainly for the CI system. |
| // * ORG_GRADLE_PROJECT_signingKey |
| // * ORG_GRADLE_PROJECT_signingPassword |
| // * ORG_GRADLE_PROJECT_signingKeyId |
| // See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys |
| // for details |
| def signingKey = findProperty("signingKey") |
| def signingKeyId = findProperty("signingKeyId") |
| def signingPassword = findProperty("signingPassword") |
| if (signingKeyId && signingKey && signingPassword) { |
| useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) |
| } else if (signingKey && signingPassword) { |
| useInMemoryPgpKeys(signingKey, signingPassword) |
| } |
| } |
| // Signing task is added by the release plugin |
| } |
| } |
| test { |
| filter { |
| String testGroup = System.properties['testGroup'] |
| if (testGroup == 'client') { |
| include '**/client/*' |
| } else if (testGroup == 'bookie') { |
| include '**/bookie/*' |
| } else if (testGroup == 'other') { |
| exclude '**/client/*' |
| exclude '**/bookie/*' |
| } |
| |
| if (project.hasProperty('excludeTests')) { |
| String excludeTests = project.property('excludeTests'); |
| ArrayList<String> tests = excludeTests.split(','); |
| tests.forEach({it |
| String excludeStr = it.trim(); |
| exclude excludeStr |
| }); |
| } |
| } |
| systemProperty "gradle.buildDirectory", project.buildDir |
| systemProperty "currentVersion", project.rootProject.version |
| testLogging { |
| outputs.upToDateWhen {false} |
| showStandardStreams = !Boolean.getBoolean("testHideStandardOut") |
| } |
| } |
| dependencies { |
| implementation(enforcedPlatform(depLibs.nettyBom)) |
| testImplementation depLibs.log4jSlf4jImpl |
| implementation(enforcedPlatform(depLibs.jacksonBom)) |
| } |
| |
| dependencies { |
| implementation(enforcedPlatform(depLibs.guavaBom)) |
| } |
| |
| tasks.withType(GenerateModuleMetadata).configureEach { |
| // The value 'enforced-platform' is provided in the validation |
| // error message you got |
| suppressedValidationErrors.add('enforced-platform') |
| } |
| |
| apply plugin: 'io.franzbecker.gradle-lombok' |
| |
| task delombok(type: DelombokTask, dependsOn: compileJava) { |
| ext.outputDir = file("$buildDir/delombok") |
| outputs.dir(outputDir) |
| sourceSets.main.java.srcDirs.each { |
| inputs.dir(it) |
| args(it, "-d", outputDir) |
| } |
| } |
| |
| task generateJavadoc(type: Javadoc, dependsOn: delombok) { |
| options.addBooleanOption('Xdoclint:none', true) |
| source = delombok.outputDir |
| classpath = sourceSets.main.compileClasspath |
| } |
| |
| } |
| |
| repositories { |
| mavenCentral() |
| mavenLocal() |
| } |
| } |
| |
| |
| def javadocProjects = [ |
| ":bookkeeper-common", |
| ":bookkeeper-server", |
| ":bookkeeper-stats", |
| ":bookkeeper-stats-providers:prometheus-metrics-provider", |
| ":bookkeeper-stats-providers:codahale-metrics-provider", |
| ] |
| |
| task generateApiJavadoc(type: Javadoc) { |
| javadocProjects.each { dependsOn("${it}:delombok"); } |
| options.addBooleanOption("package", true) |
| options.addBooleanOption('Xdoclint:none', true) |
| options.addBooleanOption('-no-module-directories', true) |
| |
| options.addMultilineMultiValueOption("group").setValue([ |
| ["Bookkeeper Client", "org.apache.bookkeeper.client*:org.apache.bookkeeper.common.annotation*:org.apache.bookkeeper.conf*:org.apache.bookkeeper.feature*"], |
| ["Bookkeeper Stats API", "org.apache.bookkeeper.stats*"], |
| ["Bookkeeper Stats Providers", "org.apache.bookkeeper.stats.codahale*:org.apache.bookkeeper.stats.prometheus*"] |
| ]) |
| source = javadocProjects.collect { project(it).buildDir.getAbsolutePath() + "/delombok" } |
| classpath = files(javadocProjects.collect { project(it).sourceSets.main.compileClasspath }) |
| |
| title = "BookKeeper Java API (version ${project.version})" |
| destinationDir = file("${buildDir}/docs/javadoc") |
| } |
| |
| idea.project.settings { |
| subprojects { subproject -> |
| subproject.plugins.withId('com.google.protobuf') { |
| it.project.afterEvaluate { |
| taskTriggers { |
| // run all generateProto tasks after project import or refresh |
| afterSync subproject.protobuf.generateProtoTasks.all() |
| } |
| } |
| } |
| } |
| } |