IBM / dbb-zappbuild

zAppBuild is a generic build solution for building z/OS applications using Apache Groovy build scripts and IBM Dependency Based Build (DBB) APIs.
Apache License 2.0
41 stars 140 forks source link

files with $ in name will not build #276

Open rsjrny opened 1 year ago

rsjrny commented 1 year ago

files with a $ in the file name cause a failure. I experienced this in my non-dbb build process and also using OCOPY to transfer files between Z/OS and USS. I resolved it by wrapping the file name in quotes.

I believe build.groovy needs to be updated to do the same wrapping.

The file I am processing is /repos/asm/$test.asm01 but as you can see below the $test has been removed from the buildlist file name

For reference the asm01.groovy you see referenced is a copy of assembler.groovy. I am experiencing the same issue with cobol.groovy

*** Building ASM01 file asm/.asm01
Caught: com.ibm.dbb.build.BuildException: java.io.FileNotFoundException: BGZTK0127E Unable to access file, /repos/asm/.asm01
com.ibm.dbb.build.BuildException: java.io.FileNotFoundException: BGZTK0127E Unable to access file, /repos/asm/.asm01
at com.ibm.dbb.dependency.DependencyResolver.getLogicalFile(DependencyResolver.java:311)
at com.ibm.dbb.dependency.DependencyResolver.getLogicalFile(DependencyResolver.java:245)
at asm01$_run_closure1.doCall(asm01.groovy:52)
at asm01.run(asm01.groovy:39)
at asm01$run.callCurrent(Unknown Source)
at com.ibm.dbb.groovy.ScriptLoader._run(ScriptLoader.groovy:124)
at com.ibm.dbb.groovy.ScriptLoader$_run$0.call(Unknown Source)
at com.ibm.dbb.groovy.ScriptLoader.runScript(ScriptLoader.groovy:81)
at build$_run_closure1.doCall(build.groovy:64)
at build.run(build.groovy:56)
Caused by: java.io.FileNotFoundException: BGZTK0127E Unable to access file, /repos/asm/.asm01
at com.ibm.dbb.dependency.AbstractDependencyScanner.scan(AbstractDependencyScanner.java:52)
at com.ibm.dbb.dependency.DependencyResolver.getLogicalFile(DependencyResolver.java:300)
friedhelmmuench commented 1 year ago

Hi,

maybe this is related to IBM/zopeneditor-about/issues/288.
If so, it isn't a problem of the build script but of the command created by IDz oder Z Open Editor to start the userbuild.

rsjrny commented 1 year ago

@friedhelmmuench ,

based on your comment I thought I would try the userbuild from USS and bypass vscode. I had the same results. The dir/$fileName.ext was malformed into dir/.ext

Good thought though.

dennis-behm commented 1 year ago

@rsjrny, when invoking it from the USS, you need to make sure your are escaping the $. So, it has to be \$test.asm01 . Otherwise your shell is trying to resolve it.

So, in my case with $SAM1.cbl , it is \$SAM1.cbl on the CLI.

It builds successfully ...

/usr/lpp/dbb/v2r0/bin/groovyz /var/dbb/dbb-zappbuild_300/build.groovy --userBuild --workspace /u/dbehm/userBuild --application SAM --hlq DBEHM.DBB.UB --outDir /u/dbehm/userBuild/work_zoe --verbose /u/dbehm/userBuild/SAM/COBOL/\$SAM1.cbl

SAM/COBOL/$SAM1.cbl
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
** Building files mapped to Cobol.groovy script
required props = cobol_srcPDS,cobol_cpyPDS,cobol_objPDS,cobol_loadPDS,cobol_compiler,cobol_linkEditor,cobol_tempOptions,applicationOutputsCollectionName,  SDFHCOB,SDFHLOAD,SDSNLOAD,SCEELKED
** Creating / verifying build dataset DBEHM.DBB.UB.COBOL
** Creating / verifying build dataset DBEHM.DBB.UB.COPY
** Creating / verifying build dataset DBEHM.DBB.UB.OBJ
** Creating / verifying build dataset DBEHM.DBB.UB.DBRM
** Creating / verifying build dataset DBEHM.DBB.UB.LOAD
*** Building file SAM/COBOL/$SAM1.cbl
*** Resolution rules for SAM/COBOL/$SAM1.cbl:
search:/u/dbehm/userBuild/?path=SAM/COPYBOOK/*.cpy;SAM/COPYLIB/*.cpy;SAM/COPYLIB-MVS/*.cpy
*** Physical dependencies for SAM/COBOL/$SAM1.cbl:
{"excluded":false,"sourceDir":"\/u\/dbehm\/userBuild\/","lname":"CUSTCOPY","library":"SYSLIB","file":"SAM\/COPYBOOK\/CUSTCOPY.cpy","category":"COPY","resolved":true}
{"excluded":false,"sourceDir":"\/u\/dbehm\/userBuild\/","lname":"TRANREC","library":"SYSLIB","file":"SAM\/COPYBOOK\/TRANREC.cpy","category":"COPY","resolved":true}
Cobol compiler parms for SAM/COBOL/$SAM1.cbl = LIB
** Writing build report data to /u/dbehm/userBuild/work_zoe/BuildReport.json
** Writing build report to /u/dbehm/userBuild/work_zoe/BuildReport.html
** Build ended at Thu Nov 10 16:36:16 GMT+01:00 2022
** Build State : CLEAN
** Total files processed : 1
** Total build time  : 6.277 seconds

Also with a full build it is finding all my test pgms:

** Writing build list file to /u/dbehm/userBuild/work_zoe/build.20221110.044055.040/buildList.txt
SAM/COPYBOOK/CUSTCOPY.cpy
SAM/zapp-example.json
SAM/COBOL/SAM$1.cbl
SAM/COBOL/epscmort.cbl
SAM/COPYBOOK/TRANREC.cpy
SAM/COBOL/$SAM1.cbl
SAM/zapp.yaml
SAM/COBOL/SAM1.cbl
** Scanning source code.
** Updating collections SAM and SAM-outputs
rsjrny commented 1 year ago

Thanks @dennis-behm ,

That resolved the issue when running from USS. what about when I invoke from vscode when I select Run IBM User Build? I will still have the issue.

kristinochka commented 1 year ago

Could dbb-zappbuild interpolate parameters passed in single quotes literally? The user build command is ran from the command line, so as a user I expect it to follow bash rules.