Skip to content

Commit

Permalink
Ensure only platform-specific dependencies are included in distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Jan 31, 2024
1 parent 0416efa commit 92a8f7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 1 addition & 5 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import java.nio.file.Files
import java.nio.file.Path

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

CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean isTestDistro) {
return copySpec {
into("elasticsearch-${version}") {
into('lib') {
with libFiles("$platform-" + ((architecture == 'x64') ? 'x86_64' : architecture))
with libFiles("$platform-" + ((architecture == 'x64') ? 'x86-64' : architecture), isTestDistro)
}
into('config') {
dirMode 0750
Expand Down
12 changes: 10 additions & 2 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,18 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
/*****************************************************************************
* Common files in all distributions *
*****************************************************************************/
libFiles = { platform ->
libFiles = { platform, isTestDistro ->
copySpec {
// Delay by using closures, since they have not yet been configured, so no jar task exists yet.
from(configurations.libs)
from(configurations.libs) {
if (isTestDistro == false) {
// Remove native binary jars not-applicable to this distribution
def excludePlatforms = ['linux-x86-64', 'linux-aarch64', 'windows-x86-64', 'darwin-x86-64', 'darwin-aarch64'] - platform
excludePlatforms.each {
exclude "**/*-${it}.jar"
}
}
}
into('java-version-checker') {
from(configurations.libsVersionChecker)
}
Expand Down
2 changes: 1 addition & 1 deletion distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def commonPackageConfig(String type, String architecture) {
fileMode 0644
}
into('lib') {
with libFiles('linux-' + ((architecture == 'x64') ? 'x86_64' : architecture))
with libFiles('linux-' + ((architecture == 'x64') ? 'x86-64' : architecture), false)
}
into('modules') {
with modulesFiles('linux-' + ((architecture == 'x64') ? 'x86_64' : architecture))
Expand Down

0 comments on commit 92a8f7d

Please sign in to comment.