toolchain support
This commit is contained in:
14
README.md
14
README.md
@@ -18,7 +18,7 @@ Next you should register this library in Jenkins -> System settings -> Global Pi
|
||||
* `get()` - download and parse `platforms.json` file from `PLATFORMS_GIT`
|
||||
* `root()` - returns root JSON object of `platforms.json`
|
||||
* `forEach(func, ...)` - iterate over platforms, `func` is only mandatory parameter:
|
||||
* `func` - method to execute for each enabled platform, pass JSON element of current platform
|
||||
* `func` - method to execute for each enabled platform, pass JSON element of current platform and optional CMake toolchain argument
|
||||
* `stagePrefix` - prefix string for `stage`
|
||||
* `stageSuffix` - suffix string for `stage`
|
||||
* `whiteList` - array of permitted names, ignored if empty
|
||||
@@ -40,6 +40,18 @@ node {
|
||||
}
|
||||
```
|
||||
|
||||
With toolchain:
|
||||
```
|
||||
@Library('SHS.Platforms') _
|
||||
node {
|
||||
def pl = new org.SHS.Platforms(this)
|
||||
pl.get()
|
||||
pl.forEach ({ dist, cmake_toolchain ->
|
||||
print("compile in ${dist.docker_image} with arg ${cmake_toolchain}")
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
With filter:
|
||||
```
|
||||
@Library('SHS.Platforms') _
|
||||
|
||||
@@ -22,9 +22,10 @@ class Platforms {
|
||||
def prefix = args.stagePrefix ?: ""
|
||||
def suffix = args.stageSuffix ?: ""
|
||||
filterJSON(args.whiteList ?: [], args.blackList ?: []).each { key, dist ->
|
||||
//steps.print("final ${key}${suffix}")
|
||||
def toolchain = dist.cmake_toolchain ?: ""
|
||||
if (toolchain != "") toolchain = "-DCMAKE_TOOLCHAIN_FILE=${toolchain}"
|
||||
steps.stage ("${prefix}${key}${suffix}") {
|
||||
functor(dist)
|
||||
functor(dist, toolchain)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,12 +34,12 @@ class Platforms {
|
||||
//@NonCPS
|
||||
private Boolean filterDist(name, dist, whiteList, blackList) {
|
||||
if (!dist.enabled) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
def in_white = true, in_black = false
|
||||
def dn = name.toLowerCase()
|
||||
if (whiteList.size() > 0) {
|
||||
in_white = false
|
||||
in_white = false
|
||||
whiteList.each { l -> if (dn.indexOf(l.toLowerCase()) >= 0) { in_white = true } }
|
||||
}
|
||||
blackList.each { l -> if (dn.indexOf(l.toLowerCase()) >= 0) { in_black = true } }
|
||||
@@ -46,12 +47,12 @@ class Platforms {
|
||||
}
|
||||
|
||||
private def filterJSON(whiteList, blackList) {
|
||||
def ret = [:]
|
||||
_root.Platforms.each({name, dist ->
|
||||
if (filterDist(name, dist, whiteList, blackList))
|
||||
ret[name] = dist
|
||||
})
|
||||
return ret
|
||||
def ret = [:]
|
||||
_root.Platforms.each({name, dist ->
|
||||
if (filterDist(name, dist, whiteList, blackList))
|
||||
ret[name] = dist
|
||||
})
|
||||
return ret
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user