@@ -31,7 +31,15 @@ props.startTime = startTime.format("yyyyMMdd.HHmmss.SSS")
31
31
println (" \n ** Build start at $props . startTime " )
32
32
33
33
// initialize build
34
- initializeBuildProcess(args)
34
+ try {
35
+ initializeBuildProcess(args)
36
+ } catch ( AssertionError e ) {
37
+ String errorMsg = e. getMessage()
38
+ println (errorMsg)
39
+ props. error = " true"
40
+ buildUtils. updateBuildResult(errorMsg :errorMsg)
41
+ finalizeBuildProcess(start :startTime, 0 )
42
+ }
35
43
36
44
// create build list
37
45
List<String > buildList = new ArrayList ()
@@ -57,13 +65,21 @@ else {
57
65
scriptPath = script
58
66
// Use the ScriptMappings class to get the files mapped to the build script
59
67
def buildFiles = ScriptMappings . getMappedList(script, buildList)
60
- if (buildFiles. size() > 0 ) {
61
- if (scriptPath. startsWith(' /' ))
62
- runScript(new File (" ${ scriptPath} " ), [' buildList' :buildFiles])
63
- else
64
- runScript(new File (" languages/${ scriptPath} " ), [' buildList' :buildFiles])
68
+ try {
69
+ if (buildFiles. size() > 0 ) {
70
+ if (scriptPath. startsWith(' /' ))
71
+ runScript(new File (" ${ scriptPath} " ), [' buildList' :buildFiles])
72
+ else
73
+ runScript(new File (" languages/${ scriptPath} " ), [' buildList' :buildFiles])
74
+ }
75
+ processCounter = processCounter + buildFiles. size()
76
+ } catch (BuildException | AssertionError e ) {
77
+ String errorMsg = e. getMessage()
78
+ println (errorMsg)
79
+ props. error = " true"
80
+ buildUtils. updateBuildResult(errorMsg :errorMsg)
81
+ finalizeBuildProcess(start :startTime, count :processCounter)
65
82
}
66
- processCounter = processCounter + buildFiles. size()
67
83
}
68
84
} else if (props. scanLoadmodules && props. scanLoadmodules. toBoolean()){
69
85
println (" ** Scanning load modules." )
@@ -77,10 +93,6 @@ if (processCounter == 0)
77
93
78
94
finalizeBuildProcess(start :startTime, count :processCounter)
79
95
80
- // if error occurred signal process error
81
- if (props. error)
82
- System . exit(1 )
83
-
84
96
// end script
85
97
86
98
@@ -96,10 +108,17 @@ def initializeBuildProcess(String[] args) {
96
108
97
109
// print and store property dbb toolkit version in use
98
110
def dbbToolkitVersion = VersionInfo . getInstance(). getVersion()
99
- props. dbbToolkitVersion = dbbToolkitVersion
100
111
def dbbToolkitBuildDate = VersionInfo . getInstance(). getDate()
101
- if (props. verbose) println " ** zAppBuild running on DBB Toolkit Version ${ dbbToolkitVersion} ${ dbbToolkitBuildDate} "
112
+ props. dbbToolkitVersion = dbbToolkitVersion
113
+ props. dbbToolkitBuildDate = dbbToolkitBuildDate
102
114
115
+ File versionFile = new File (" ${ props.zAppBuildDir} /version.properties" )
116
+ if (versionFile. exists()) {
117
+ props. load(versionFile)
118
+ if (props. zappbuild_version) println " ** Running zAppBuild Version ${ props.zappbuild_version} "
119
+ }
120
+ if (props. verbose) println " ** Running DBB Toolkit Version ${ dbbToolkitVersion} ${ dbbToolkitBuildDate} "
121
+
103
122
// verify required dbb toolkit
104
123
buildUtils. assertDbbBuildToolkitVersion(props. dbbToolkitVersion, props. requiredDBBToolkitVersion)
105
124
@@ -329,6 +348,8 @@ def populateBuildProperties(def opts) {
329
348
// need to support IDz user build parameters
330
349
if (opts. srcDir) props. workspace = opts. srcDir
331
350
if (opts. wrkDir) props. outDir = opts. wrkDir
351
+
352
+ // assert workspace
332
353
buildUtils. assertBuildProperties(' workspace,outDir' )
333
354
334
355
// load build.properties
@@ -641,7 +662,8 @@ def createBuildList() {
641
662
}
642
663
643
664
// Perform analysis and build report of external impacts
644
- if (props. reportExternalImpacts && props. reportExternalImpacts. toBoolean()){
665
+ // Prereq: Metadatastore Connection
666
+ if (metadataStore && props. reportExternalImpacts && props. reportExternalImpacts. toBoolean()){
645
667
if (buildSet && changedFiles) {
646
668
println " ** Perform analysis and reporting of external impacted files for the build list including changed files."
647
669
reportingUtils. reportExternalImpacts(buildSet. plus(changedFiles))
@@ -653,7 +675,8 @@ def createBuildList() {
653
675
}
654
676
655
677
// Document and validate concurrent changes
656
- if (props. reportConcurrentChanges && props. reportConcurrentChanges. toBoolean()){
678
+ // Prereq: Workspace containing git repos. Skipped for --userBuild build type
679
+ if (! props. userBuild && props. reportConcurrentChanges && props. reportConcurrentChanges. toBoolean()){
657
680
println " ** Calculate and document concurrent changes."
658
681
reportingUtils. calculateConcurrentChanges(buildSet)
659
682
}
@@ -670,7 +693,6 @@ def createBuildList() {
670
693
return buildList
671
694
}
672
695
673
-
674
696
def finalizeBuildProcess (Map args ) {
675
697
println " ***************** Finalization of the build process *****************"
676
698
@@ -722,7 +744,10 @@ def finalizeBuildProcess(Map args) {
722
744
buildResult. setProperty(" filesProcessed" , String . valueOf(args. count))
723
745
buildResult. setState(buildResult. COMPLETE )
724
746
725
-
747
+ // add zAppBuild and DBB toolkit version info
748
+ if (props. zappbuild_version) buildResult. setProperty(" zAppBuildVersion" , props. zappbuild_version)
749
+ buildResult. setProperty(" DBBToolkitVersion" , " ${ props.dbbToolkitVersion} ${ props.dbbToolkitBuildDate} " )
750
+
726
751
// store build result properties in BuildReport.json
727
752
PropertiesRecord buildReportRecord = new PropertiesRecord (" DBB.BuildResultProperties" )
728
753
def buildResultProps = buildResult. getPropertyNames()
@@ -769,6 +794,10 @@ def finalizeBuildProcess(Map args) {
769
794
if (props. preview) println (" ** Build ran in preview mode." )
770
795
println (" ** Total files processed : ${ args.count} " )
771
796
println (" ** Total build time : $duration \n " )
797
+
798
+ // if error occurred signal process error
799
+ if (props. error)
800
+ System . exit(1 )
772
801
}
773
802
774
803
0 commit comments