Native: extract license packing into a function

This commit is contained in:
Svyatoslav Scherbina
2021-12-01 14:54:17 +03:00
committed by Space
parent 71deeab57c
commit 3898c52454
+9 -8
View File
@@ -536,11 +536,6 @@ task bundleRegular(type: (isWindows()) ? Zip : Tar) {
exclude 'klib/cache/*/org.jetbrains.kotlin.native.platform.*/**' exclude 'klib/cache/*/org.jetbrains.kotlin.native.platform.*/**'
into archiveBaseName into archiveBaseName
} }
from(project.projectDir) {
include 'licenses/**'
exclude '**/xcode_license.pdf'
into archiveBaseName
}
} }
task bundlePrebuilt(type: (isWindows()) ? Zip : Tar) { task bundlePrebuilt(type: (isWindows()) ? Zip : Tar) {
@@ -553,15 +548,21 @@ task bundlePrebuilt(type: (isWindows()) ? Zip : Tar) {
exclude 'klib/testLibrary' exclude 'klib/testLibrary'
into archiveBaseName into archiveBaseName
} }
from(project.projectDir) { }
void configurePackingLicensesToBundle(AbstractArchiveTask task, boolean containsPlatformLibraries) {
task.from(project.projectDir) {
include 'licenses/**' include 'licenses/**'
if (!isMac()) { if (!containsPlatformLibraries || !isMac()) {
exclude '**/xcode_license.pdf' exclude '**/xcode_license.pdf'
} }
into archiveBaseName into task.archiveBaseName
} }
} }
configurePackingLicensesToBundle(bundleRegular, /* containsPlatformLibraries = */ false)
configurePackingLicensesToBundle(bundlePrebuilt, /* containsPlatformLibraries = */ true)
configure([bundleRegular, bundlePrebuilt]) { configure([bundleRegular, bundlePrebuilt]) {
dependsOn("crossDist") dependsOn("crossDist")
dependsOn("crossDistStdlibCache") dependsOn("crossDistStdlibCache")