support "ondemand" platforms
This commit is contained in:
@@ -23,6 +23,7 @@ Next you should register this library in Jenkins -> System settings -> Global Pi
|
|||||||
* `stageSuffix` - suffix string for `stage`
|
* `stageSuffix` - suffix string for `stage`
|
||||||
* `whiteList` - array of permitted names, ignored if empty
|
* `whiteList` - array of permitted names, ignored if empty
|
||||||
* `blackList` - array of denied names, ignored if empty
|
* `blackList` - array of denied names, ignored if empty
|
||||||
|
* `ondemand` - if true then process also ondemand platforms
|
||||||
|
|
||||||
`whiteList` and `blackList` are case-insensitive, and can be part of platform name
|
`whiteList` and `blackList` are case-insensitive, and can be part of platform name
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class Platforms {
|
|||||||
public void forEach(Map args, functor) {
|
public void forEach(Map args, functor) {
|
||||||
def prefix = args.stagePrefix ?: ""
|
def prefix = args.stagePrefix ?: ""
|
||||||
def suffix = args.stageSuffix ?: ""
|
def suffix = args.stageSuffix ?: ""
|
||||||
filterJSON(args.whiteList ?: [], args.blackList ?: []).each { key, dist ->
|
def ondemand = args.ondemand ?: false
|
||||||
|
filterJSON(args.whiteList ?: [], args.blackList ?: [], ondemand).each { key, dist ->
|
||||||
def toolchain = dist.cmake_toolchain ?: ""
|
def toolchain = dist.cmake_toolchain ?: ""
|
||||||
if (toolchain != "") toolchain = "-DCMAKE_TOOLCHAIN_FILE=${toolchain}"
|
if (toolchain != "") toolchain = "-DCMAKE_TOOLCHAIN_FILE=${toolchain}"
|
||||||
steps.stage ("${prefix}${key}${suffix}") {
|
steps.stage ("${prefix}${key}${suffix}") {
|
||||||
@@ -32,11 +33,14 @@ class Platforms {
|
|||||||
public void forEach(functor) { forEach(functor, stagePrefix: "") }
|
public void forEach(functor) { forEach(functor, stagePrefix: "") }
|
||||||
|
|
||||||
//@NonCPS
|
//@NonCPS
|
||||||
private Boolean filterDist(name, dist, whiteList, blackList) {
|
private Boolean filterDist(name, dist, whiteList, blackList, ondemand) {
|
||||||
if (!dist.enabled) {
|
if (!dist.enabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
def in_white = true, in_black = false
|
def in_white = true, in_black = false
|
||||||
|
if (dist.containsKey('ondemand'))
|
||||||
|
in_white = !dist.ondemand
|
||||||
|
if (ondemand) in_white = true
|
||||||
def dn = name.toLowerCase()
|
def dn = name.toLowerCase()
|
||||||
if (whiteList.size() > 0) {
|
if (whiteList.size() > 0) {
|
||||||
in_white = false
|
in_white = false
|
||||||
@@ -46,10 +50,10 @@ class Platforms {
|
|||||||
return in_white && !in_black
|
return in_white && !in_black
|
||||||
}
|
}
|
||||||
|
|
||||||
private def filterJSON(whiteList, blackList) {
|
private def filterJSON(whiteList, blackList, ondemand) {
|
||||||
def ret = [:]
|
def ret = [:]
|
||||||
_root.Platforms.each({name, dist ->
|
_root.Platforms.each({name, dist ->
|
||||||
if (filterDist(name, dist, whiteList, blackList))
|
if (filterDist(name, dist, whiteList, blackList, ondemand))
|
||||||
ret[name] = dist
|
ret[name] = dist
|
||||||
})
|
})
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
Reference in New Issue
Block a user