Fix license header generation on Windows (#31790)
Updates the build.gradle to take into account the OS differences for Windows (in particular line separator and project naming)
This commit is contained in:
parent
6acb591012
commit
f40581caa0
11
build.gradle
11
build.gradle
|
@ -445,12 +445,19 @@ allprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
File licenseHeaderFile;
|
File licenseHeaderFile;
|
||||||
if (eclipse.project.name.startsWith(':x-pack')) {
|
String prefix = ':x-pack';
|
||||||
|
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
prefix = prefix.replace(':', '_')
|
||||||
|
}
|
||||||
|
if (eclipse.project.name.startsWith(prefix)) {
|
||||||
licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/elastic-license-header.txt')
|
licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/elastic-license-header.txt')
|
||||||
} else {
|
} else {
|
||||||
licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/oss-license-header.txt')
|
licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/oss-license-header.txt')
|
||||||
}
|
}
|
||||||
String licenseHeader = licenseHeaderFile.getText('UTF-8').replace('\n', '\\\\n')
|
|
||||||
|
String lineSeparator = Os.isFamily(Os.FAMILY_WINDOWS) ? '\\\\r\\\\n' : '\\\\n'
|
||||||
|
String licenseHeader = licenseHeaderFile.getText('UTF-8').replace(System.lineSeparator(), lineSeparator)
|
||||||
task copyEclipseSettings(type: Copy) {
|
task copyEclipseSettings(type: Copy) {
|
||||||
// TODO: "package this up" for external builds
|
// TODO: "package this up" for external builds
|
||||||
from new File(project.rootDir, 'buildSrc/src/main/resources/eclipse.settings')
|
from new File(project.rootDir, 'buildSrc/src/main/resources/eclipse.settings')
|
||||||
|
|
Loading…
Reference in New Issue