toolchain support

This commit is contained in:
2023-04-26 14:08:30 +03:00
parent 7978ea6161
commit 820fd44946
2 changed files with 24 additions and 11 deletions

View File

@@ -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` * `get()` - download and parse `platforms.json` file from `PLATFORMS_GIT`
* `root()` - returns root JSON object of `platforms.json` * `root()` - returns root JSON object of `platforms.json`
* `forEach(func, ...)` - iterate over platforms, `func` is only mandatory parameter: * `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` * `stagePrefix` - prefix string for `stage`
* `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
@@ -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: With filter:
``` ```
@Library('SHS.Platforms') _ @Library('SHS.Platforms') _

View File

@@ -22,9 +22,10 @@ class Platforms {
def prefix = args.stagePrefix ?: "" def prefix = args.stagePrefix ?: ""
def suffix = args.stageSuffix ?: "" def suffix = args.stageSuffix ?: ""
filterJSON(args.whiteList ?: [], args.blackList ?: []).each { key, dist -> 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}") { steps.stage ("${prefix}${key}${suffix}") {
functor(dist) functor(dist, toolchain)
} }
} }
} }