class MultiPlatformGenerator extends Object
Creates a multi-platform generator similar to a LifecycleGenerator but multi-plaform and multi-os capable when building matrix combinations.
To run this example, clone Jervis and execute ./gradlew console to bring up a Groovy Console with the classpath set up.
import net.gleske.jervis.lang.MultiPlatformGenerator
import net.gleske.jervis.lang.MultiPlatformValidator
MultiPlatformValidator platforms = new MultiPlatformValidator()
platforms.loadPlatformsString(new File('resources/platforms.yaml').text)
platforms.getToolchainFiles().each { String fileName ->
if(!new File("resources/${fileName}.yaml").exists()) { return }
platforms.loadToolchainsString(fileName, new File("resources/${fileName}.yaml").text)
}
platforms.getLifecycleFiles().each { String fileName ->
if(!new File("resources/${fileName}.yaml").exists()) { return }
platforms.loadLifecyclesString(fileName, new File("resources/${fileName}.yaml").text)
}
platforms.getGeneratorFromJervis(yaml: 'language: shell')
MultiPlatformGenerator platformGenerator = new MultiPlatformGenerator(platforms)
platformGenerator.loadMultiPlatformYaml(yaml: '''
language: shell
jenkins:
platform:
- amd64
- arm64
os:
- alpine3
- ubuntu2204
''')
platformGenerator.generateToolchainSection()
| Type | Name and description |
|---|---|
String |
defaultOSIf matrix building of operating systems is requested, the first in the List provided by the user will be known as the default operating system. |
String |
defaultPlatformIf matrix building of platforms is requested, the first in the List provided by the user will be known as the default platform. |
List |
operating_systemsA list of operating systems requested by user .jervis.yml. |
Map<String, Map<String, LifecycleGenerator>> |
platform_generatorsWhen user-provided .jervis.yml is split up into platforms and operating systems, the result will be a series of LifecycleGenerator objects; one for each platform/OS combination. |
Map<String, Map<String, Map>> |
platform_jervis_yamlWhen user-provided .jervis.yml is split up into platforms and operating systems, the result will a new .jervis.yml file unique to each platform/OS combination. |
List |
platformsA list of platforms requested by user .jervis.yml. |
MultiPlatformValidator |
platforms_objPlatforms, operating systems, lifecycles, and toolchains for all suported languages. |
Map |
rawJervisYamlA POJO parsed from the original user provided .jervis.yml. |
| Constructor and description |
|---|
MultiPlatformGenerator
(MultiPlatformValidator platforms) |
MultiPlatformGenerator
(LifecycleGenerator lifecycleGenerator) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
String |
generateToolchainSection() |
|
List |
getBuildableMatrixAxes() |
|
Map |
getDefaultToolchainsEnvironment() |
|
LifecycleGenerator |
getGenerator()Get the LifecycleGenerator for a given default platform and OS. |
|
Map |
getJervisYaml()Get the Jervis YAML for a given default platform and OS. |
|
String |
getJervisYamlString() |
|
List |
getStashes() |
|
Boolean |
isMatrixBuild() |
|
void |
loadMultiPlatformYaml(Map options) |
|
List |
validate(Map options)Reviews the loaded Jervis YAML and detects invalid toolchains or languages. |
If matrix building of operating systems is requested, the first in the List provided by the user will be known as the default operating system.
If matrix building of platforms is requested, the first in the List provided by the user will be known as the default platform.
A list of operating systems requested by user .jervis.yml.
When user-provided .jervis.yml is split up into platforms and operating systems, the result will be a series of LifecycleGenerator objects; one for each platform/OS combination. The object is organized by platforms as a top-level key, with operating system as the child key; where the operating system contains the LifecycleGenerator object for that platform/OS combination.
When user-provided .jervis.yml is split up into platforms and operating systems, the result will a new .jervis.yml file unique to each platform/OS combination. This object contains the generated .jervis.yml objects associated with the LifecycleGenerator created for the platofmr/OS combination. The object is organized by platforms as a top-level key, with operating system as the child key; where the operating system contains the .jervis.yml object for that platform/OS combination.
A list of platforms requested by user .jervis.yml.
Platforms, operating systems, lifecycles, and toolchains for all suported languages. This includes all known support even if a .jervis.ymlM doesn't request it.
A POJO parsed from the original user provided .jervis.yml.
Get the LifecycleGenerator for a given default platform and OS.
Get the Jervis YAML for a given default platform and OS. If you're looking for the original multi-platform Jervis YAML, then refer to rawJervisYaml.
Reviews the loaded Jervis YAML and detects invalid toolchains or languages. This assumes a flattened YAML no matrix support. This would typically be used for validating default YAML loaded from elsewhere or multi-platform YAML which has been flattened by platform and OS.
options - A map of options requiring: platform, os, and yaml.Jervis API documentation.