/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ buildscript { ext { opensearch_version = System.getProperty("opensearch.version", "2.3.0") isSnapshot = "true" == System.getProperty("build.snapshot", "true") buildVersionQualifier = System.getProperty("build.version_qualifier", "") version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' if (buildVersionQualifier) { opensearch_build += "-${buildVersionQualifier}" } if (isSnapshot) { // 2.0.0-rc1-SNAPSHOT -> 2.0.0.0-rc1-SNAPSHOT (opensearch_build) opensearch_build += "-SNAPSHOT" } getArchType = { if (System.getProperty("os.arch").startsWith("x") || System.getProperty("os.arch").startsWith("amd")) { return "amd64" } else { return "arm64" } } getOSFamilyType = { def os = org.gradle.internal.os.OperatingSystem.current(); if (os.isMacOsX()) { return "darwin" } else if(os.isLinux()){ return "linux" } else if(os.isWindows()) { return "windows" } else { return os.getFamilyName().toString() } } } repositories { mavenLocal() maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() } dependencies { classpath "org.opensearch.gradle:build-tools:${opensearch_version}" } } plugins { id 'nebula.ospackage' version "8.3.0" id 'java-library' id 'checkstyle' id 'jacoco' } // import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94 // versions https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/version.properties apply plugin: 'opensearch.java' // Repository on root level is for dependencies that project code depends on. And this block must be placed after plugins{} repositories { mavenLocal() maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() // For Elastic Libs that you can use to get started coding until open OpenSearch libs are available } allprojects { version = opensearch_version.tokenize('-')[0] + '.0' if (buildVersionQualifier) { version += "-${buildVersionQualifier}" } if (isSnapshot) { version += "-SNAPSHOT" } } subprojects { repositories { mavenLocal() maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() } } jacoco { toolVersion = "0.8.7" } jacocoTestReport { reports { xml.enabled false csv.enabled false } } test.finalizedBy(project.tasks.jacocoTestReport) jacocoTestCoverageVerification { violationRules { rule { limit { minimum = 0.5 } } } } check.dependsOn jacocoTestCoverageVerification // TODO: fix code style in main and test source code /* allprojects { apply plugin: 'checkstyle' checkstyle { configFile rootProject.file("config/checkstyle/google_checks.xml") toolVersion "10.3.2" configProperties = [ "org.checkstyle.google.suppressionfilter.config": rootProject.file("config/checkstyle/suppressions.xml")] ignoreFailures = true } } checkstyle { configFile file("config/checkstyle/checkstyle.xml") } checkstyleMain.ignoreFailures = true checkstyleTest.ignoreFailures = true */ configurations.all { resolutionStrategy.force 'junit:junit:4.13.2' exclude group: "commons-logging", module: "commons-logging" // enforce 1.1.3, https://www.whitesourcesoftware.com/vulnerability-database/WS-2019-0379 resolutionStrategy.force 'commons-codec:commons-codec:1.13' resolutionStrategy.force 'com.google.guava:guava:32.0.1-jre' }