| /* |
| * 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 java.util.concurrent.TimeUnit |
| |
| buildscript { |
| repositories { |
| maven { |
| url "https://maven.aliyun.com/repository/public" |
| } |
| |
| maven { |
| url "https://plugins.gradle.org/m2/" |
| } |
| } |
| |
| dependencies { |
| classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.3" |
| classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE" |
| classpath "com.github.jk1:gradle-license-report:1.17" |
| } |
| } |
| |
| //Remove doclint warnings that pollute javadoc logs when building with java8 |
| if(JavaVersion.current().isJava8()){ |
| allprojects { |
| tasks.withType(Javadoc){ |
| options.addStringOption('xdoclint:none','-quiet') |
| } |
| } |
| } |
| |
| allprojects { |
| apply plugin: 'java' |
| apply plugin: "eclipse" |
| apply plugin: "idea" |
| apply plugin: "project-reports" |
| apply plugin: "maven-publish" |
| apply plugin: "com.github.spotbugs" |
| apply plugin: "project-reports" |
| apply plugin: "jacoco" |
| apply plugin: "pmd" |
| apply plugin: "java-library" |
| apply plugin: 'signing' |
| apply plugin: 'checkstyle' |
| |
| [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8' |
| |
| compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" |
| |
| clean.doFirst { |
| delete 'build' |
| delete 'dist' |
| delete 'out' |
| } |
| |
| checkstyle { |
| toolVersion = '9.0' |
| ignoreFailures = false |
| showViolations = true |
| maxWarnings = 0 |
| configFile = new File("${rootDir}/style/checkStyle.xml") |
| } |
| |
| checkstyleMain.exclude '**/org/apache/eventmesh/client/grpc/protos**' |
| |
| dependencies { |
| repositories { |
| maven { |
| url "https://maven.aliyun.com/repository/public" |
| } |
| } |
| testImplementation "junit:junit:4.13.2" |
| } |
| } |
| |
| task tar(type: Tar) { |
| archiveBaseName.set(project.name) |
| archiveVersion.set(project.version.toString()) |
| archiveExtension.set('tar.gz') |
| compression = Compression.GZIP |
| destinationDirectory = new File(projectDir, 'build') |
| into('/') { |
| from 'dist' |
| } |
| } |
| |
| task zip(type: Zip) { |
| archiveBaseName.set(project.name) |
| archiveVersion.set(project.version.toString()) |
| archiveExtension.set('zip') |
| destinationDirectory = new File(projectDir, 'build') |
| into('/') { |
| from 'dist' |
| } |
| } |
| |
| task installPlugin() { |
| if (!new File("${rootDir}/dist").exists()) { |
| return |
| } |
| String[] libJars = java.util.Optional.ofNullable(new File("${rootDir}/dist/lib").list()).orElseGet(() -> new String[0]) |
| getAllprojects().forEach(subProject -> { |
| var file = new File("${subProject.projectDir}/gradle.properties") |
| if (!file.exists()) { |
| return |
| } |
| var properties = new Properties() |
| properties.load(new FileInputStream(file)) |
| var pluginType = properties.getProperty("pluginType") |
| var pluginName = properties.getProperty("pluginName") |
| if (pluginType == null || pluginName == null) { |
| return |
| } |
| var pluginFile = new File("${rootDir}/dist/plugin/${pluginType}/${pluginName}") |
| if (pluginFile.exists()) { |
| return |
| } |
| pluginFile.mkdirs() |
| println String.format( |
| "install plugin, pluginType: %s, pluginInstanceName: %s, module: %s", pluginType, pluginName, subProject.getName() |
| ) |
| |
| copy { |
| into "${rootDir}/dist/plugin/${pluginType}/${pluginName}" |
| from "${subProject.getProjectDir()}/dist/apps" |
| } |
| copy { |
| into "${rootDir}/dist/plugin/${pluginType}/${pluginName}" |
| from "${subProject.getProjectDir()}/dist/lib/" |
| exclude(libJars) |
| } |
| copy { |
| into "${rootDir}/dist/conf" |
| from "${subProject.getProjectDir()}/dist/conf" |
| exclude 'META-INF' |
| } |
| }) |
| } |
| |
| task printProjects() { |
| getAllprojects().forEach(subProject -> { |
| if ("EventMesh".equals(subProject.getName())) { |
| return |
| } |
| println String.format("%s-%s.jar", subProject.getName(), subProject.getVersion()) |
| }) |
| } |
| |
| subprojects { |
| |
| apply plugin: "io.spring.dependency-management" |
| |
| sourceSets { |
| main { |
| java.srcDirs = ['src/main/java'] |
| } |
| |
| test { |
| java.srcDirs = ['src/test/java'] |
| } |
| } |
| |
| clean.doFirst { |
| delete 'build' |
| delete 'dist' |
| } |
| |
| jacoco { |
| toolVersion = "0.8.6" |
| } |
| |
| jacocoTestReport { |
| reports { |
| xml.enabled true |
| csv.enabled false |
| html.enabled false |
| } |
| } |
| |
| spotbugs { |
| ignoreFailures = true |
| showProgress = true |
| showStackTraces = true |
| effort = 'default' |
| reportsDir = file("$buildDir/reports/spotbugs") |
| projectName = rootProject.name |
| release = version |
| extraArgs = ['-nested:false'] |
| maxHeapSize = '256m' |
| |
| } |
| |
| spotbugsMain { |
| |
| reports { |
| xml.enabled = false |
| html { |
| enabled = true |
| destination = file("$buildDir/reports/spotbugs/main/spotbugs.html") |
| stylesheet = 'fancy-hist.xsl' |
| } |
| } |
| } |
| |
| spotbugsTest { |
| reports { |
| xml.enabled = false |
| html { |
| enabled = true |
| destination = file("$buildDir/reports/spotbugs/test/spotbugs.html") |
| stylesheet = 'fancy-hist.xsl' |
| } |
| } |
| } |
| |
| pmd { |
| consoleOutput = true |
| toolVersion = "6.23.0" |
| rulesMinimumPriority = 5 |
| ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"] |
| ignoreFailures = true |
| } |
| |
| jar { |
| manifest { |
| attributes("Specification-Version": project.version, |
| "Specification-Vendor": "Apache", |
| "Specification-Title": project.name, |
| "Implementation-Version": project.version, |
| "Implementation-Vendor": "Apache", |
| "Implementation-Title": project.name, |
| "Build-Jdk": project.findProperty("jdk") |
| ) |
| } |
| } |
| |
| task dist(dependsOn: ['jar']) { |
| doFirst { |
| new File("${projectDir}/dist/bin").mkdirs() |
| new File("${projectDir}/dist/apps").mkdirs() |
| new File("${projectDir}/dist/conf").mkdirs() |
| new File("${projectDir}/dist/lib").mkdirs() |
| new File("${projectDir}/dist/licenses").mkdirs() |
| } |
| Set<String> rootProject = ["eventmesh-admin", |
| "eventmesh-admin-rocketmq", |
| "eventmesh-common", |
| "eventmesh-connector-api", |
| "eventmesh-metrics-api", |
| "eventmesh-registry-api", |
| "eventmesh-trace-api", |
| "eventmesh-runtime", |
| "eventmesh-security-api", |
| "eventmesh-protocol-api", |
| "eventmesh-starter", |
| "eventmesh-spi"] |
| doLast { |
| copy { |
| into("${projectDir}/dist/apps") |
| from project.jar.getArchivePath() |
| } |
| copy { |
| into("${projectDir}/dist/lib") |
| from project.configurations.runtimeClasspath |
| } |
| copy { |
| into("${projectDir}/dist/bin") |
| from 'bin' |
| } |
| copy { |
| into("${projectDir}/dist/conf") |
| from 'conf', sourceSets.main.resources.srcDirs |
| setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) |
| exclude 'META-INF' |
| } |
| if (rootProject.contains(project.name)) { |
| new File("${rootDir}/dist/apps").mkdirs() |
| new File("${rootDir}/dist/lib").mkdirs() |
| new File("${rootDir}/dist/bin").mkdirs() |
| new File("${rootDir}/dist/conf").mkdirs() |
| copy { |
| into("${rootDir}/dist/apps") |
| from "${projectDir}/dist/apps" |
| } |
| copy { |
| into "${rootDir}/dist/lib" |
| from "${projectDir}/dist/lib" |
| exclude "eventmesh-*" |
| } |
| copy { |
| into "${rootDir}/dist/bin" |
| from "${projectDir}/dist/bin" |
| } |
| copy { |
| into "${rootDir}/dist/conf" |
| from "${projectDir}/dist/conf" |
| } |
| } |
| copy { |
| into "${rootDir}/dist/licenses" |
| from "${rootDir}/tools/third-party-licenses/licenses" |
| } |
| } |
| } |
| |
| javadoc { |
| source = sourceSets.main.java |
| destinationDir = reporting.file("javadoc") |
| } |
| |
| task packageJavadoc(type: Jar, dependsOn: ['javadoc']) { |
| from project.javadoc.destinationDir |
| classifier = 'javadoc' |
| } |
| |
| task packageSources(type: Jar) { |
| from project.sourceSets.main.allSource |
| classifier = 'sources' // either here or in artifacts block |
| } |
| |
| artifacts { |
| archives jar |
| archives packageJavadoc |
| archives packageSources |
| } |
| |
| if (!Boolean.valueOf(signEnabled)) { |
| tasks.whenTaskAdded { task -> |
| if (task.name.contains("sign")) { |
| task.enabled = false |
| } |
| } |
| } |
| |
| repositories { |
| maven { url "https://maven.aliyun.com/repository/public" } |
| mavenCentral() |
| mavenLocal() |
| } |
| |
| configurations.all { |
| resolutionStrategy.cacheChangingModulesFor 0, TimeUnit.SECONDS |
| resolutionStrategy.cacheDynamicVersionsFor 0, TimeUnit.SECONDS |
| } |
| |
| publishing { |
| publications { |
| mavenJava(MavenPublication) { |
| from components.java |
| artifact packageSources |
| artifact packageJavadoc |
| versionMapping { |
| usage('java-api') { |
| fromResolutionOf('runtimeClasspath') |
| } |
| usage('java-runtime') { |
| fromResolutionResult() |
| } |
| } |
| pom { |
| name = 'EventMesh' |
| description = 'Apache EventMesh' |
| url = 'https://github.com/apache/incubator-eventmesh' |
| licenses { |
| license { |
| name = 'The Apache License, Version 2.0' |
| url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| } |
| } |
| developers { |
| developer { |
| id = 'Apache EventMesh(incubating)' |
| name = 'Apache EventMesh(incubating) of ASF' |
| url = 'https://eventmesh.apache.org/' |
| } |
| } |
| scm { |
| connection = 'scm:git:git@github.com:apache/incubator-eventmesh.git' |
| developerConnection = 'scm:git:git@github.com:apache/incubator-eventmesh.git' |
| url = 'https://github.com/apache/incubator-eventmesh' |
| } |
| } |
| } |
| } |
| repositories { |
| maven { |
| def releasesRepoUrl = 'https://repository.apache.org/service/local/staging/deploy/maven2' |
| def snapshotsRepoUrl = 'https://repository.apache.org/content/repositories/snapshots/' |
| url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
| credentials { |
| username apacheUserName |
| password apachePassWord |
| } |
| |
| } |
| } |
| } |
| |
| signing { |
| sign publishing.publications.mavenJava |
| } |
| |
| dependencyManagement { |
| dependencies { |
| dependency "org.apache.commons:commons-lang3:3.6" |
| dependency "org.apache.commons:commons-collections4:4.1" |
| dependency "org.apache.commons:commons-text:1.9" |
| |
| |
| dependency "com.google.guava:guava:31.0.1-jre" |
| |
| dependency "org.slf4j:slf4j-api:1.7.30" |
| dependency "org.apache.logging.log4j:log4j-api:2.17.1" |
| dependency "org.apache.logging.log4j:log4j-core:2.17.1" |
| dependency "org.apache.logging.log4j:log4j-slf4j-impl:2.17.1" |
| |
| dependency "com.lmax:disruptor:3.4.2" |
| |
| dependency "com.fasterxml.jackson.core:jackson-databind:2.11.0" |
| dependency "com.fasterxml.jackson.core:jackson-core:2.11.0" |
| dependency "com.fasterxml.jackson.core:jackson-annotations:2.11.0" |
| |
| dependency "org.apache.httpcomponents:httpclient:4.5.13" |
| |
| dependency "io.netty:netty-all:4.1.73.Final" |
| |
| dependency 'io.dropwizard.metrics:metrics-core:4.1.0' |
| dependency "io.dropwizard.metrics:metrics-healthchecks:4.1.0" |
| dependency "io.dropwizard.metrics:metrics-annotation:4.1.0" |
| dependency "io.dropwizard.metrics:metrics-json:4.1.0" |
| |
| dependency 'io.opentelemetry:opentelemetry-api:1.3.0' |
| dependency 'io.opentelemetry:opentelemetry-sdk:1.3.0' |
| dependency 'io.opentelemetry:opentelemetry-sdk-metrics:1.3.0-alpha' |
| dependency 'io.opentelemetry:opentelemetry-exporter-prometheus:1.3.0-alpha' |
| dependency 'io.prometheus:simpleclient:0.8.1' |
| dependency 'io.prometheus:simpleclient_httpserver:0.8.1' |
| dependency 'io.opentelemetry:opentelemetry-exporter-zipkin:1.3.0' |
| dependency 'io.opentelemetry:opentelemetry-semconv:1.3.0-alpha' |
| |
| dependency "io.openmessaging:openmessaging-api:2.2.1-pubsub" |
| |
| dependency "com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0" |
| dependency "com.mebigfatguy.fb-contrib:fb-contrib:7.4.7" |
| |
| dependency "org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE" |
| dependency "io.openmessaging:registry-server:0.0.1" |
| |
| dependency "junit:junit:4.13.2" |
| dependency "com.github.stefanbirkner:system-rules:1.16.1" |
| dependency "org.assertj:assertj-core:2.6.0" |
| |
| dependency "org.mockito:mockito-core:2.23.0" |
| dependency "org.powermock:powermock-module-junit4:2.0.2" |
| dependency "org.powermock:powermock-api-mockito2:2.0.2" |
| |
| dependency "io.cloudevents:cloudevents-core:2.2.0" |
| dependency "io.cloudevents:cloudevents-json-jackson:2.2.0" |
| |
| dependency "io.grpc:grpc-protobuf:1.15.0" |
| dependency "io.grpc:grpc-stub:1.15.0" |
| dependency "io.grpc:grpc-netty:1.15.0" |
| dependency "io.grpc:grpc-netty-shaded:1.15.0" |
| |
| dependency "javax.annotation:javax.annotation-api:1.3.2" |
| |
| dependency "com.github.seancfoley:ipaddress:5.3.3" |
| } |
| } |
| } |