Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor zAppBuild reporting capabilities #341

Merged
merged 14 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import groovy.cli.commons.*
@Field def gitUtils= loadScript(new File("utilities/GitUtilities.groovy"))
@Field def buildUtils= loadScript(new File("utilities/BuildUtilities.groovy"))
@Field def impactUtils= loadScript(new File("utilities/ImpactUtilities.groovy"))
@Field def reportingUtils= loadScript(new File("utilities/ReportingUtilities.groovy"))
@Field def filePropUtils= loadScript(new File("utilities/FilePropUtilities.groovy"))
@Field String hashPrefix = ':githash:'
@Field String giturlPrefix = ':giturl:'
Expand Down Expand Up @@ -596,18 +597,18 @@ def createBuildList() {
if (props.reportExternalImpacts && props.reportExternalImpacts.toBoolean()){
if (buildSet && changedFiles) {
println "** Perform analysis and reporting of external impacted files for the build list including changed files."
impactUtils.reportExternalImpacts(buildSet.plus(changedFiles))
reportingUtils.reportExternalImpacts(buildSet.plus(changedFiles))
}
else if(buildSet) {
println "** Perform analysis and reporting of external impacted files for the build list."
impactUtils.reportExternalImpacts(buildSet)
reportingUtils.reportExternalImpacts(buildSet)
}
}

// Document and validate concurrent changes
if (props.reportConcurrentChanges && props.reportConcurrentChanges.toBoolean()){
println "** Calculate and document concurrent changes."
impactUtils.calculateConcurrentChanges(buildSet)
reportingUtils.calculateConcurrentChanges(buildSet)
}

// document deletions in build report
Expand Down
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ This folder contains supplemental documentation to help explain the implementati

|File|Description|
|-|-|
|FilePropertyManagement|Documentation on managing default and overriding build properties for specific application files|
|[FilePropertyManagement](FilePropertyManagement.md)|Documentation on managing default and overriding build properties for specific application files|
|[Reporting Capabilities](REPORTS.md)|Documentation of zAppBuild reporting capabilities like reporting external impacted file and reporting of concurrent changes|
2 changes: 1 addition & 1 deletion REPORT.md → docs/REPORTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ App-EPSM/cobol/epsplist.cbl

### Purpose

Concurrent development activies in separated isolated branches on the same source code, lead to the need to merge the code at some point in time. Git does an excellent job for this task and supports the developer for this task. While pessimistic locking is a common practise on the mainframe, developers will need to keep an eye on what is happening in the git repository, which follows the optimistic locking approach.
Concurrent development activities in separated isolated branches on the same source code, lead to the need to merge the code at some point in time. Git does an excellent job for this task and supports the developer for this task. While pessimistic locking is a common practise on the mainframe, developers will need to keep an eye on what is happening in the git repository, which follows the optimistic locking approach.

The _Report concurrent changes_ feature can be activated to generate a report to document changes in other configurations within the repository. Additionally, it validates if the current build list intersects with those changes.

Expand Down
40 changes: 39 additions & 1 deletion utilities/BuildUtilities.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import groovy.json.JsonSlurper
import com.ibm.dbb.build.DBBConstants.CopyMode
import com.ibm.dbb.build.report.records.*
import com.ibm.jzos.FileAttribute
import java.nio.file.FileSystems
import java.nio.file.Path
import java.nio.file.PathMatcher
import groovy.ant.*

// define script properties
Expand Down Expand Up @@ -791,6 +794,40 @@ def getShortGitHash(String buildFile) {
return null
}

/**
* createPathMatcherPattern
* Generic method to build PathMatcher from a build property
*/

def createPathMatcherPattern(String property) {
List<PathMatcher> pathMatchers = new ArrayList<PathMatcher>()
if (property) {
property.split(',').each{ filePattern ->
if (!filePattern.startsWith('glob:') || !filePattern.startsWith('regex:'))
filePattern = "glob:$filePattern"
PathMatcher matcher = FileSystems.getDefault().getPathMatcher(filePattern)
pathMatchers.add(matcher)
}
}
return pathMatchers
}

/**
* matches
* Generic method to validate if a file is matching any pathmatchers
*
*/
def matches(String file, List<PathMatcher> pathMatchers) {
def result = pathMatchers.any { matcher ->
Path path = FileSystems.getDefault().getPath(file);
if ( matcher.matches(path) )
{
return true
}
}
return result
}

/**
* method to print the logicalFile attributes (CICS, SQL, DLI, MQ) of a scanned file
* and indicating if an attribute is overridden through a property definition.
Expand All @@ -817,4 +854,5 @@ def printLogicalFileAttributes(LogicalFile logicalFile) {
println "Program attributes: CICS=$cicsFlag, SQL=$sqlFlag, DLI=$dliFlag, MQ=$mqFlag"

}



Loading