mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 21:18:31 +00:00
* Build: Remove old maven deploy support This change removes the old maven deploy that we have in parallel to maven-publish, and makes maven-publish fully work with publishing to maven local. Using `gradle publishToMavenLocal` should be used to publish to .m2. Note that there is an unfortunate hack that means for zip artifacts we must first create/publish a dummy pom file, and then follow that with the real pom file. It would be nice to have the pom file contains packaging=zip, but maven central then requires sources and javadocs. But our zips are really just attached artifacts, so we already set the packaging type to pom for our zip files. This change just works around a limitation of the underlying maven publishing library which silently skips attached artifacts when the packaging type is set to pom. relates #20164 closes #20375 * Remove unnecessary extra spacing
153 lines
5.7 KiB
Groovy
153 lines
5.7 KiB
Groovy
/*
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch 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.nio.file.Files
|
|
|
|
apply plugin: 'groovy'
|
|
|
|
group = 'org.elasticsearch.gradle'
|
|
|
|
// TODO: remove this when upgrading to a version that supports ProgressLogger
|
|
// gradle 2.14 made internal apis unavailable to plugins, and gradle considered
|
|
// ProgressLogger to be an internal api. Until this is made available again,
|
|
// we can't upgrade without losing our nice progress logging
|
|
// NOTE that this check duplicates that in BuildPlugin, but we need to check
|
|
// early here before trying to compile the broken classes in buildSrc
|
|
if (GradleVersion.current() != GradleVersion.version('2.13')) {
|
|
throw new GradleException('Gradle 2.13 is required to build elasticsearch')
|
|
}
|
|
|
|
if (project == rootProject) {
|
|
// change the build dir used during build init, so that doing a clean
|
|
// won't wipe out the buildscript jar
|
|
buildDir = 'build-bootstrap'
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* Propagating version.properties to the rest of the build *
|
|
*****************************************************************************/
|
|
|
|
Properties props = new Properties()
|
|
props.load(project.file('version.properties').newDataInputStream())
|
|
version = props.getProperty('elasticsearch')
|
|
boolean snapshot = "true".equals(System.getProperty("build.snapshot", "true"));
|
|
if (snapshot) {
|
|
// we update the version property to reflect if we are building a snapshot or a release build
|
|
// we write this back out below to load it in the Build.java which will be shown in rest main action
|
|
// to indicate this being a snapshot build or a release build.
|
|
version += "-SNAPSHOT"
|
|
props.put("elasticsearch", version);
|
|
}
|
|
|
|
File tempPropertiesFile = new File(project.buildDir, "version.properties")
|
|
task writeVersionProperties {
|
|
inputs.properties(props)
|
|
outputs.file(tempPropertiesFile)
|
|
doLast {
|
|
OutputStream stream = Files.newOutputStream(tempPropertiesFile.toPath());
|
|
try {
|
|
props.store(stream, "UTF-8");
|
|
} finally {
|
|
stream.close();
|
|
}
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
dependsOn writeVersionProperties
|
|
from tempPropertiesFile
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* Dependencies used by the entire build *
|
|
*****************************************************************************/
|
|
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
compile gradleApi()
|
|
compile localGroovy()
|
|
compile "com.carrotsearch.randomizedtesting:junit4-ant:${props.getProperty('randomizedrunner')}"
|
|
compile("junit:junit:${props.getProperty('junit')}") {
|
|
transitive = false
|
|
}
|
|
compile 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3'
|
|
compile 'com.netflix.nebula:nebula-publishing-plugin:4.4.4'
|
|
compile 'com.netflix.nebula:gradle-info-plugin:3.0.3'
|
|
compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r'
|
|
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
|
|
compile 'de.thetaphi:forbiddenapis:2.2'
|
|
compile 'org.apache.rat:apache-rat:0.11'
|
|
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.0.1'
|
|
}
|
|
|
|
|
|
/*****************************************************************************
|
|
* Bootstrap repositories *
|
|
*****************************************************************************/
|
|
// this will only happen when buildSrc is built on its own during build init
|
|
if (project == rootProject) {
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
test.exclude 'org/elasticsearch/test/NamingConventionsCheckBadClasses*'
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* Normal project checks *
|
|
*****************************************************************************/
|
|
|
|
// this happens when included as a normal project in the build, which we do
|
|
// to enforce precommit checks like forbidden apis, as well as setup publishing
|
|
if (project != rootProject) {
|
|
apply plugin: 'elasticsearch.build'
|
|
apply plugin: 'nebula.maven-base-publish'
|
|
apply plugin: 'nebula.maven-scm'
|
|
|
|
// groovydoc succeeds, but has some weird internal exception...
|
|
groovydoc.enabled = false
|
|
|
|
// build-tools is not ready for primetime with these...
|
|
dependencyLicenses.enabled = false
|
|
forbiddenApisMain.enabled = false
|
|
forbiddenApisTest.enabled = false
|
|
jarHell.enabled = false
|
|
thirdPartyAudit.enabled = false
|
|
|
|
// test for elasticsearch.build tries to run with ES...
|
|
test.enabled = false
|
|
|
|
// TODO: re-enable once randomizedtesting gradle code is published and removed from here
|
|
licenseHeaders.enabled = false
|
|
|
|
forbiddenPatterns {
|
|
exclude '**/*.wav'
|
|
// the file that actually defines nocommit
|
|
exclude '**/ForbiddenPatternsTask.groovy'
|
|
}
|
|
|
|
namingConventions {
|
|
testClass = 'org.elasticsearch.test.NamingConventionsCheckBadClasses$UnitTestCase'
|
|
integTestClass = 'org.elasticsearch.test.NamingConventionsCheckBadClasses$IntegTestCase'
|
|
}
|
|
}
|