Language task: CPP.yaml
Description
This sample provides the language task configuration to compile C and C++ programs for a simple "Hello World" sample. It is imported via Languages.yaml.
Actions
- Define sources.
- Define variables.
- Create datasets.
- Loop through steps for each build file.
- Copy build file and dependencies to datasets.
- Compile build file.
- Link-edit build file.
Define sources
Define sources
as a list of file patterns to locate C/C++ programs within the build list. By default, C files have the .c
extension and C++ files have the .C
extention.
sources:
- "**.c"
- "**.C"
Task Variables
Required variables
compileParms
Type: String
Default: "/CXX XPLINK"
Variable used to define the compile parameters of the CCNDRVR
C/CPP Compiler.
doLinkEdit
Type: Boolean
Default: true
Flag to control if link-edit is to be performed.
linkEditParms
Type: String
Default: AMODE=31,MAP,RENT,DYNAM=DLL,CASE=MIXED
Link-edit parameters.
dependencySearchPath
Type: String
Default: search:${WORKSPACE}/?path=${APP_DIR_NAME}/**.h
Default dependency search path for a single repository build.
Create datasets
Create datasets that must exist and be evaluated before the compilation.
datasets:
- name: ${HLQ}.CPP
options: cyl space(1,5) lrecl(80) dsorg(PO) recfm(F,B) dsntype(library)
- name: ${HLQ}.HEADER
options: cyl space(1,5) lrecl(80) dsorg(PO) recfm(F,B) dsntype(library)
- name: ${HLQ}.OBJ
options: cyl space(1,5) lrecl(80) dsorg(PO) recfm(F,B) dsntype(library)
- name: ${HLQ}.LOAD
options: cyl space(1,5) dsorg(PO) recfm(U) blksize(32760) dsntype(library)
Task steps
For each build file, the following steps will be executed.
Copy step
The copySrc
copy step copies the current build file from its HFS source to the //'${HLQ}.CPP(${MEMBER})'
dataset along with any dependencies (header files) that are copied to ${HLQ}.HEADER
.
- step: copySrc
type: copy
source: ${FILE_PATH}
target: //'${HLQ}.CPP(${MEMBER})'
dependencyCopy:
- search: ${dependencySearchPath}
mappings:
- source: "**/*"
dataset: ${HLQ}.HEADER
Compile step
The compile
mvs step executes the CCNDRVR
compiler with the previously determined compileParms
and defines necessary DD statements.
- step: compile
type: mvs
pgm: CCNDRVR
parm: ${compileParms}
maxRC: 4
dds:
- { name: "TASKLIB", dsn: "${SCEERUN2}", options: "shr" }
- { dsn: "${SCCNCMP}", options: "shr" }
- { dsn: "${SCEERUN}", options: "shr" }
- { name: "SYSIN", dsn: "${HLQ}.CPP(${MEMBER})", options: "shr" }
- { name: "SYSLIN", dsn: "${HLQ}.OBJ(${MEMBER})", options: "shr", output: true }
- { name: "SYSLIB", dsn: "${HLQ}.HEADER", options: "shr" }
- { dsn: "${SCEEH}", options: "shr", condition: {exists: "${SCEEH}"} }
- { dsn: "${SCEEHH}", options: "shr", condition: {exists: "${SCEEHH}"} }
- { dsn: "${SCEEHSH}", options: "shr", condition: {exists: "${SCEEHSH}"} }
- { dsn: "${SCEEHAH}", options: "shr", condition: {exists: "${SCEEHAH}"} }
- { dsn: "${SCEEHNH}", options: "shr", condition: {exists: "${SCEEHNH}"} }
- { dsn: "${SCEEHNIH}", options: "shr", condition: {exists: "${SCEEHNIH}"} }
- { dsn: "${SCEEHT}", options: "shr", condition: {exists: "${SCEEHT}"} }
- { dsn: "${SCLBHH}", options: "shr", condition: {exists: "${SCLBHH}"} }
- { name: "SYSUT1", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT5", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT6", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT7", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT8", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT9", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT10", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT14", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT16", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSUT17", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSMSGS", dsn: "${SCEEMSGP}", options: "shr" }
- { name: "SYSXMSGS", dsn: "${SCEEMSGP}", options: "shr" }
- { name: "SYSOUT", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new", log: "${LOGS}/${STEP}-${FILE_NAME}.log", logAppend: true }
- { name: "SYSCPRT", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new", log: "${LOGS}/${STEP}-${FILE_NAME}.log", logAppend: true }
- { name: "SYSPRINT", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new", log: "${LOGS}/${STEP}-${FILE_NAME}.log", logAppend: true }
Link-edit
The linkEdit
mvs step optionally runs when the doLinkEdit
variable is true
.
- step: linkEdit
type: mvs
pgm: IEWL
parm: ${linkEditParms}
condition: ${doLinkEdit}
maxRC: 0
dds:
- { name: "SYSLMOD", dsn: "${HLQ}.LOAD(${MEMBER})", options: "shr", output: true, deployType: "LOAD" }
- { name: "SYSPRINT", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new", log: "${LOGS}/${STEP}-${FILE_NAME}.log", logAppend: true }
- { name: "SYSUT1", options: "cyl space(5,5) unit(vio) blksize(80) lrecl(80) recfm(f,b) new" }
- { name: "SYSLIN", dsn: "${HLQ}.OBJ(${MEMBER})", options: "shr" }
- { dsn: "CEE.SCEELIB(CELHSCPP)", options: "shr" }
- { dsn: "CEE.SCEELIB(CELHS003)", options: "shr" }
- { dsn: "CEE.SCEELIB(CELHS001)", options: "shr" }
- { dsn: "CEE.SCEELIB(C128)", options: "shr" }
- { dsn: "CBC.SCLBSID(IOSTREAM)", options: "shr" }
- { dsn: "CBC.SCLBSID(COMPLEX)", options: "shr" }
- { name: "SYSLIB", dsn: "${HLQ}.OBJ", options: "shr" }
- { dsn: "CEE.SCEEBND2", options: "shr" }