forked from Devsh-Graphics-Programming/Nabla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.groovy
83 lines (67 loc) · 1.59 KB
/
pipeline.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import org.DevshGraphicsProgramming.Agent
import org.DevshGraphicsProgramming.BuilderInfo
import org.DevshGraphicsProgramming.IBuilder
class CNablaBuilder extends IBuilder
{
public static enum PRESET_TYPE
{
CONFIGURE, BUILD
}
public CNablaBuilder(Agent _agent, BuilderInfo _info)
{
super(_agent, _info)
}
@Override
public boolean prepare(Map axisMapping)
{
final def preset = getPreset(PRESET_TYPE.CONFIGURE, axisMapping)
agent.execute("cmake . --preset ${preset}")
return true
}
@Override
public boolean build(Map axisMapping)
{
final def preset = getPreset(PRESET_TYPE.BUILD, axisMapping)
final def nameOfConfig = getNameOfConfig(axisMapping.get("CONFIGURATION"))
agent.execute("cmake --build --preset ${preset} --config ${nameOfConfig} -j12 -v")
return true
}
@Override
public boolean test(Map axisMapping)
{
return true
}
@Override
public boolean install(Map axisMapping)
{
return true
}
private def getPreset(final PRESET_TYPE presetType, final Map _axisMapping) // currently we only maintain Windows as host with MSVC target
{
def mode, preset
switch (presetType)
{
case PRESET_TYPE.CONFIGURE:
mode = "configure"
break
case PRESET_TYPE.BUILD:
mode = "build"
break
}
switch (_axisMapping.get("BUILD_TYPE"))
{
case IBuilder.BUILD_TYPE.STATIC:
preset = "ci-${mode}-static-msvc"
break
case IBuilder.BUILD_TYPE.DYNAMIC:
preset = "ci-${mode}-dynamic-msvc"
break
}
return preset
}
}
def create(Agent _agent, BuilderInfo _info)
{
return new CNablaBuilder(_agent, _info)
}
return this