Add facility to cross compile for Mac OS X on Linux (elastic/elasticsearch#717)
Adding a build system that makes it possible for an Ubuntu 16.04 build server configured according to the instructions in https://github.com/elastic/prelert-legacy/wiki/Plugin-Development-Setup-for-Mac-OS-X-cross-compiled-on-Linux to build a Mac OS X version of the product. Original commit: elastic/x-pack-elasticsearch@c6f39c0395
This commit is contained in:
parent
c9a8d9d283
commit
bc03dba9a2
15
build.gradle
15
build.gradle
|
@ -20,6 +20,18 @@ if (envMlAwsSecretKey != null) {
|
|||
project.ext.mlAwsSecretKey = PRELERT_AWS_SECRET_ACCESS_KEY
|
||||
}
|
||||
|
||||
String cppCrossCompile = System.env.CPP_CROSS_COMPILE
|
||||
if (cppCrossCompile != null) {
|
||||
project.ext.cppCrossCompile = cppCrossCompile
|
||||
} else if (project.hasProperty("CPP_CROSS_COMPILE")) {
|
||||
project.ext.cppCrossCompile = CPP_CROSS_COMPILE
|
||||
} else {
|
||||
project.ext.cppCrossCompile = ''
|
||||
}
|
||||
if (project.ext.cppCrossCompile != '' && project.ext.cppCrossCompile != 'macosx') {
|
||||
throw new GradleException("CPP_CROSS_COMPILE property must be empty or 'macosx'")
|
||||
}
|
||||
|
||||
project.ext.isWindows = OperatingSystem.current().isWindows()
|
||||
project.ext.isLinux = OperatingSystem.current().isLinux()
|
||||
project.ext.isMacOsX = OperatingSystem.current().isMacOsX()
|
||||
|
@ -41,7 +53,8 @@ if (['true', 'false', 'auto'].contains(cppEnabledStr) == false) {
|
|||
project.ext.cppEnabled = cppEnabledStr == 'true'
|
||||
if (cppEnabledStr == 'auto') {
|
||||
// Disable the C++ build if the 3rd party tools/libraries aren't available
|
||||
String[] cmdArray = [ project.ext.bash, '-c', 'source cpp/set_env.sh && cpp/3rd_party/3rd_party.sh --check' ]
|
||||
String[] cmdArray = [ project.ext.bash, '-c',
|
||||
'export CPP_CROSS_COMPILE=' + project.ext.cppCrossCompile + ' && source cpp/set_env.sh && cpp/3rd_party/3rd_party.sh --check' ]
|
||||
Process checkProcess = Runtime.getRuntime().exec(cmdArray, null, rootDir)
|
||||
StringBuffer checkOutput = new StringBuffer()
|
||||
checkProcess.consumeProcessOutputStream(checkOutput)
|
||||
|
|
|
@ -32,6 +32,8 @@ check.dependsOn noBootstrapTest
|
|||
noBootstrapTest.mustRunAfter test
|
||||
|
||||
integTest {
|
||||
// Cannot run integration tests when cross compiling
|
||||
enabled project.cppCrossCompile == ''
|
||||
cluster {
|
||||
//setting 'useNativeProcess', 'true'
|
||||
distribution = 'zip'
|
||||
|
|
Loading…
Reference in New Issue