Only include relevant platform files from modules (#41089)

This commit adds a filter to the files include from modules to only
include platform specific files relevant to the distribution being
built. For example, the deb files on linux would now only include linux
ML binaries, and not windows or macos files.
This commit is contained in:
Ryan Ernst 2019-04-19 11:34:16 -07:00
parent 154d40494f
commit c0164cbb63
3 changed files with 28 additions and 16 deletions

View File

@ -113,25 +113,25 @@ task buildIntegTestZip(type: Zip) {
task buildWindowsZip(type: Zip) {
configure(commonZipConfig)
archiveClassifier = 'windows-x86_64'
with archiveFiles(modulesFiles(false), 'zip', 'windows', false, true)
with archiveFiles(modulesFiles(false, 'windows'), 'zip', 'windows', false, true)
}
task buildOssWindowsZip(type: Zip) {
configure(commonZipConfig)
archiveClassifier = 'windows-x86_64'
with archiveFiles(modulesFiles(true), 'zip', 'windows', true, true)
with archiveFiles(modulesFiles(true, 'windows'), 'zip', 'windows', true, true)
}
task buildNoJdkWindowsZip(type: Zip) {
configure(commonZipConfig)
archiveClassifier = 'no-jdk-windows-x86_64'
with archiveFiles(modulesFiles(false), 'zip', 'windows', false, false)
with archiveFiles(modulesFiles(false, 'windows'), 'zip', 'windows', false, false)
}
task buildOssNoJdkWindowsZip(type: Zip) {
configure(commonZipConfig)
archiveClassifier = 'no-jdk-windows-x86_64'
with archiveFiles(modulesFiles(true), 'zip', 'windows', true, false)
with archiveFiles(modulesFiles(true, 'windows'), 'zip', 'windows', true, false)
}
Closure commonTarConfig = {
@ -144,49 +144,49 @@ Closure commonTarConfig = {
task buildDarwinTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'darwin-x86_64'
with archiveFiles(modulesFiles(false), 'tar', 'darwin', false, true)
with archiveFiles(modulesFiles(false, 'darwin'), 'tar', 'darwin', false, true)
}
task buildOssDarwinTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'darwin-x86_64'
with archiveFiles(modulesFiles(true), 'tar', 'darwin', true, true)
with archiveFiles(modulesFiles(true, 'darwin'), 'tar', 'darwin', true, true)
}
task buildNoJdkDarwinTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'no-jdk-darwin-x86_64'
with archiveFiles(modulesFiles(false), 'tar', 'darwin', false, false)
with archiveFiles(modulesFiles(false, 'darwin'), 'tar', 'darwin', false, false)
}
task buildOssNoJdkDarwinTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'no-jdk-darwin-x86_64'
with archiveFiles(modulesFiles(true), 'tar', 'darwin', true, false)
with archiveFiles(modulesFiles(true, 'darwin'), 'tar', 'darwin', true, false)
}
task buildLinuxTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'linux-x86_64'
with archiveFiles(modulesFiles(false), 'tar', 'linux', false, true)
with archiveFiles(modulesFiles(false, 'linux'), 'tar', 'linux', false, true)
}
task buildOssLinuxTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'linux-x86_64'
with archiveFiles(modulesFiles(true), 'tar', 'linux', true, true)
with archiveFiles(modulesFiles(true, 'linux'), 'tar', 'linux', true, true)
}
task buildNoJdkLinuxTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'no-jdk-linux-x86_64'
with archiveFiles(modulesFiles(false), 'tar', 'linux', false, false)
with archiveFiles(modulesFiles(false, 'linux'), 'tar', 'linux', false, false)
}
task buildOssNoJdkLinuxTar(type: Tar) {
configure(commonTarConfig)
archiveClassifier = 'no-jdk-linux-x86_64'
with archiveFiles(modulesFiles(true), 'tar', 'linux', true, false)
with archiveFiles(modulesFiles(true, 'linux'), 'tar', 'linux', true, false)
}
Closure tarExists = { it -> new File('/bin/tar').exists() || new File('/usr/bin/tar').exists() || new File('/usr/local/bin/tar').exists() }

View File

@ -305,7 +305,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
}
}
modulesFiles = { oss ->
modulesFiles = { oss, platform ->
copySpec {
eachFile {
if (it.relativePath.segments[-2] == 'bin') {
@ -315,10 +315,22 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
it.mode = 0644
}
}
Task buildModules
if (oss) {
from project(':distribution').buildOssModules
buildModules = project(':distribution').buildOssModules
} else {
from project(':distribution').buildDefaultModules
buildModules = project(':distribution').buildDefaultModules
}
List excludePlatforms = ['linux', 'windows', 'darwin']
if (platform != null) {
excludePlatforms.remove(excludePlatforms.indexOf(platform))
} else {
excludePlatforms = []
}
from(buildModules) {
for (String excludePlatform : excludePlatforms) {
exclude "**/platform/${excludePlatform}-x86_64/**"
}
}
}
}

View File

@ -139,7 +139,7 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk) {
with libFiles(oss)
}
into('modules') {
with modulesFiles(oss)
with modulesFiles(oss, 'linux')
}
if (jdk) {
into('jdk') {