Skip to content

Commit

Permalink
Remove no-jdk distributions (elastic#76896)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira authored Aug 25, 2021
1 parent 5c00587 commit 8a9ea85
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,38 +364,16 @@ private List<ElasticsearchDistribution> configureDistributions(Project project)
List<ElasticsearchDistribution> currentDistros = new ArrayList<>();

for (Architecture architecture : Architecture.values()) {
ALL_INTERNAL.stream().forEach(type -> {
for (boolean bundledJdk : Arrays.asList(true, false)) {
if (bundledJdk == false) {
// We'll never publish an ARM (aarch64) build without a bundled JDK.
if (architecture == Architecture.AARCH64) {
continue;
}
// All our Docker images include a bundled JDK so it doesn't make sense to test without one.
if (type.isDocker()) {
continue;
}
}
currentDistros.add(
createDistro(distributions, architecture, type, null, bundledJdk, VersionProperties.getElasticsearch())
);
}
});
ALL_INTERNAL.stream().forEach(type -> currentDistros.add(
createDistro(distributions, architecture, type, null, true, VersionProperties.getElasticsearch())
));
}

for (Architecture architecture : Architecture.values()) {
for (Platform platform : Arrays.asList(Platform.LINUX, Platform.WINDOWS)) {
for (boolean bundledJdk : Arrays.asList(true, false)) {
if (bundledJdk == false && architecture != Architecture.X64) {
// We will never publish distributions for non-x86 (amd64) platforms
// without a bundled JDK
continue;
}

currentDistros.add(
createDistro(distributions, architecture, ARCHIVE, platform, bundledJdk, VersionProperties.getElasticsearch())
);
}
currentDistros.add(
createDistro(distributions, architecture, ARCHIVE, platform, true, VersionProperties.getElasticsearch())
);
}
}

Expand Down
56 changes: 14 additions & 42 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ import java.nio.file.Path

apply plugin: 'elasticsearch.internal-distribution-archive-setup'

CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean oss, boolean jdk) {
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean isTestDistro) {
return copySpec {
into("elasticsearch-${version}") {
into('lib') {
with libFiles(oss)
with libFiles(isTestDistro)
}
into('config') {
dirMode 0750
fileMode 0660
with configFiles(distributionType, oss, jdk)
with configFiles(distributionType, isTestDistro)
from {
dirMode 0750
jvmOptionsDir.getParent()
}
}
into('bin') {
with binFiles(distributionType, oss, jdk)
with binFiles(distributionType, isTestDistro)
}
if (jdk) {
into("darwin".equals(platform) ? 'jdk.app' : 'jdk') {
into("darwin".equals(platform) ? 'jdk.app' : 'jdk') {
if (isTestDistro == false) {
with jdkFiles(project, platform, architecture)
}
}
Expand All @@ -50,11 +50,11 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla
include 'README.asciidoc'
}
from(rootProject.file('licenses')) {
include oss ? 'SSPL-1.0+ELASTIC-LICENSE-2.0.txt' : 'ELASTIC-LICENSE-2.0.txt'
include isTestDistro ? 'SSPL-1.0+ELASTIC-LICENSE-2.0.txt' : 'ELASTIC-LICENSE-2.0.txt'
rename { 'LICENSE.txt' }
}

with noticeFile(oss, jdk)
with noticeFile(isTestDistro)
into('modules') {
with modulesFiles
}
Expand All @@ -65,70 +65,42 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla
distribution_archives {
integTestZip {
content {
archiveFiles(transportModulesFiles, 'zip', null, 'x64', true, false)
archiveFiles(transportModulesFiles, 'zip', null, 'x64', true)
}
}

windowsZip {
archiveClassifier = 'windows-x86_64'
content {
archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', false, true)
}
}

noJdkWindowsZip {
archiveClassifier = 'no-jdk-windows-x86_64'
content {
archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', false, false)
archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', false)
}
}

darwinTar {
archiveClassifier = 'darwin-x86_64'
content {
archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', false, true)
archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', false)
}
}

darwinAarch64Tar {
archiveClassifier = 'darwin-aarch64'
content {
archiveFiles(modulesFiles('darwin-aarch64'), 'tar', 'darwin', 'aarch64', false, true)
}
}

noJdkDarwinTar {
archiveClassifier = 'no-jdk-darwin-x86_64'
content {
archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', false, false)
}
}

noJdkDarwinAarch64Tar {
archiveClassifier = 'no-jdk-darwin-aarch64'
content {
archiveFiles(modulesFiles('darwin-aarch64'), 'tar', 'darwin', 'aarch64', false, false)
archiveFiles(modulesFiles('darwin-aarch64'), 'tar', 'darwin', 'aarch64', false)
}
}

linuxAarch64Tar {
archiveClassifier = 'linux-aarch64'
content {
archiveFiles(modulesFiles('linux-aarch64'), 'tar', 'linux', 'aarch64', false, true)
archiveFiles(modulesFiles('linux-aarch64'), 'tar', 'linux', 'aarch64', false)
}
}

linuxTar {
archiveClassifier = 'linux-x86_64'
content {
archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', false, true)
}
}

noJdkLinuxTar {
archiveClassifier = 'no-jdk-linux-x86_64'
content {
archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', false, false)
archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', false)
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions distribution/archives/no-jdk-darwin-aarch64-tar/build.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions distribution/archives/no-jdk-darwin-tar/build.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions distribution/archives/no-jdk-linux-tar/build.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions distribution/archives/no-jdk-windows-zip/build.gradle

This file was deleted.

33 changes: 12 additions & 21 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ def buildDefaultNoticeTaskProvider = tasks.register("buildDefaultNotice", Notice
licensesDir new File(project(':distribution').projectDir, 'licenses')
}

def buildDefaultNoJdkNoticeTaskProvider = tasks.register("buildDefaultNoJdkNotice", NoticeTask)

def buildOssNoJdkNoticeTaskProvider = tasks.register("buildOssNoJdkNotice", NoticeTask)

// The :server and :libs projects belong to all distributions
tasks.withType(NoticeTask).configureEach {
licensesDir project(':server').file('licenses')
Expand All @@ -86,7 +82,6 @@ tasks.withType(NoticeTask).configureEach {
/*****************************************************************************
* Modules *
*****************************************************************************/
String ossOutputs = 'build/outputs/oss'
String defaultOutputs = 'build/outputs/default'
String systemdOutputs = 'build/outputs/systemd'
String transportOutputs = 'build/outputs/transport-only'
Expand Down Expand Up @@ -354,36 +349,36 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
from buildTransportModulesTaskProvider
}

configFiles = { distributionType, testDistro, jdk ->
configFiles = { distributionType, isTestDistro ->
copySpec {
with copySpec {
// main config files, processed with distribution specific substitutions
from '../src/config'
exclude 'log4j2.properties' // this is handled separately below
filter("tokens" : expansionsForDistribution(distributionType, testDistro, jdk), ReplaceTokens.class)
filter("tokens" : expansionsForDistribution(distributionType, isTestDistro), ReplaceTokens.class)
}
from buildDefaultLog4jConfigTaskProvider
from defaultConfigFiles
}
}

binFiles = { distributionType, testDistro, jdk ->
binFiles = { distributionType, testDistro ->
copySpec {
// non-windows files, for all distributions
with copySpec {
from '../src/bin'
exclude '*.exe'
exclude '*.bat'
eachFile { it.setMode(0755) }
filter("tokens" : expansionsForDistribution(distributionType, testDistro, jdk), ReplaceTokens.class)
filter("tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens.class)
}
// windows files, only for zip
if (distributionType == 'zip') {
with copySpec {
from '../src/bin'
include '*.bat'
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
filter("tokens" : expansionsForDistribution(distributionType, testDistro, jdk), ReplaceTokens.class)
filter("tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens.class)
}
with copySpec {
from '../src/bin'
Expand All @@ -403,16 +398,12 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
}
}

noticeFile = { testDistro, jdk ->
noticeFile = { testDistro ->
copySpec {
if (testDistro) {
from buildServerNoticeTaskProvider
} else {
if (jdk) {
from buildDefaultNoticeTaskProvider
} else {
from buildDefaultNoJdkNoticeTaskProvider
}
from buildDefaultNoticeTaskProvider
}
}
}
Expand Down Expand Up @@ -466,14 +457,14 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
* </dl>
*/
subprojects {
ext.expansionsForDistribution = { distributionType, testDistro, jdk ->
ext.expansionsForDistribution = { distributionType, isTestDistro ->
final String packagingPathData = "path.data: /var/lib/elasticsearch"
final String pathLogs = "/var/log/elasticsearch"
final String packagingPathLogs = "path.logs: ${pathLogs}"
final String packagingLoggc = "${pathLogs}/gc.log"

String licenseText
if (testDistro) {
if (isTestDistro) {
licenseText = rootProject.file('licenses/SSPL-1.0+ELASTIC-LICENSE-2.0.txt').getText('UTF-8')
} else {
licenseText = rootProject.file('licenses/ELASTIC-LICENSE-2.0.txt').getText('UTF-8')
Expand Down Expand Up @@ -541,7 +532,7 @@ subprojects {
],

'es.distribution.flavor': [
'def': testDistro ? 'oss' : 'default'
'def': 'default'
],

'es.distribution.type': [
Expand All @@ -552,11 +543,11 @@ subprojects {
],

'es.bundled_jdk': [
'def': jdk ? 'true' : 'false'
'def': 'true'
],

'license.name': [
'deb': testDistro ? 'ASL-2.0' : 'Elastic-License'
'deb': 'Elastic-License'
],

'license.text': [
Expand Down
Loading

0 comments on commit 8a9ea85

Please sign in to comment.