Skip to content

Commit 8222643

Browse files
committed
Build: Group archive and package distribution projects
This commit adds intermediate gradle projects for archive based distributions (zip, tar) and package based distributions (rpm, deb). The grouping allows the common distribution build file to be considerably shorter and clearly separated from the common zip/tar and rpm/deb configuration.
1 parent 34e95e5 commit 8222643

File tree

26 files changed

+357
-287
lines changed

26 files changed

+357
-287
lines changed

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ task verifyVersions {
144144
* the enabled state of every bwc task. It should be set back to true
145145
* after the backport of the backcompat code is complete.
146146
*/
147-
final boolean bwc_tests_enabled = true
148-
final String bwc_tests_disabled_issue = "" /* place a PR link here when commiting bwc changes */
147+
final boolean bwc_tests_enabled = false
148+
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/28673" /* place a PR link here when commiting bwc changes */
149149
if (bwc_tests_enabled == false) {
150150
if (bwc_tests_disabled_issue.isEmpty()) {
151151
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
@@ -204,10 +204,10 @@ subprojects {
204204
"org.elasticsearch.client:transport:${version}": ':client:transport',
205205
"org.elasticsearch.test:framework:${version}": ':test:framework',
206206
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:integ-test-zip',
207-
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:zip',
208-
"org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:tar',
209-
"org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:rpm',
210-
"org.elasticsearch.distribution.deb:elasticsearch:${version}": ':distribution:deb',
207+
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:archives:zip',
208+
"org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:archives:tar',
209+
"org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:packages:rpm',
210+
"org.elasticsearch.distribution.deb:elasticsearch:${version}": ':distribution:packages:deb',
211211
"org.elasticsearch.test:logger-usage:${version}": ':test:logger-usage',
212212
// for transport client
213213
"org.elasticsearch.plugin:transport-netty4-client:${version}": ':modules:transport-netty4',

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ class VagrantTestPlugin implements Plugin<Project> {
114114

115115
DISTRIBUTION_ARCHIVES.each {
116116
// Adds a dependency for the current version
117+
if (it == 'tar') {
118+
it = 'archives:tar'
119+
} else {
120+
it = "packages:${it}"
121+
}
117122
project.dependencies.add(BATS, project.dependencies.project(path: ":distribution:${it}", configuration: 'archives'))
118123
}
119124

distribution/archives/build.gradle

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import org.apache.tools.ant.filters.FixCrLfFilter
21+
import org.apache.tools.ant.taskdefs.condition.Os
22+
import org.elasticsearch.gradle.BuildPlugin
23+
import org.elasticsearch.gradle.EmptyDirTask
24+
import org.elasticsearch.gradle.ConcatFilesTask
25+
import org.elasticsearch.gradle.MavenFilteringHack
26+
import org.elasticsearch.gradle.NoticeTask
27+
import org.elasticsearch.gradle.precommit.DependencyLicensesTask
28+
import org.elasticsearch.gradle.precommit.UpdateShasTask
29+
import org.elasticsearch.gradle.test.RunTask
30+
31+
subprojects {
32+
// CopySpec does not make it easy to create an empty director so we create the directory that we want, and then point CopySpec to its
33+
// parent to copy to the root of the distribution
34+
File logs = new File(buildDir, 'logs-hack/logs')
35+
task createLogDir(type: EmptyDirTask) {
36+
dir "${logs}"
37+
dirMode 0755
38+
}
39+
File plugins = new File(buildDir, 'plugins-hack/plugins')
40+
task createPluginsDir(type: EmptyDirTask) {
41+
dir "${plugins}"
42+
dirMode 0755
43+
}
44+
project.ext.archivesFiles = copySpec {
45+
into("elasticsearch-${version}") {
46+
with libFiles
47+
into('config') {
48+
dirMode 0750
49+
fileMode 0660
50+
with configFiles
51+
}
52+
into('bin') {
53+
with copySpec {
54+
with binFiles
55+
from('../../src/main/resources/bin') {
56+
include '*.bat'
57+
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
58+
}
59+
MavenFilteringHack.filter(it, expansions)
60+
}
61+
}
62+
into('') {
63+
from {
64+
dirMode 0755
65+
logs.getParent()
66+
}
67+
}
68+
into('') {
69+
from {
70+
dirMode 0755
71+
plugins.getParent()
72+
}
73+
}
74+
with commonFiles
75+
with noticeFile
76+
from('../../src/main/resources') {
77+
include 'bin/*.exe'
78+
}
79+
if (project.name != 'integ-test-zip') {
80+
with modulesFiles
81+
} else {
82+
with transportModulesFiles
83+
}
84+
}
85+
}
86+
}
File renamed without changes.

0 commit comments

Comments
 (0)