diff --git a/build.groovy b/build.groovy index 597296185..30358bf48 100644 --- a/build.groovy +++ b/build.groovy @@ -251,7 +251,7 @@ If buildFile is a text file (*.txt) then it is assumed to be a build list file. options: ''' - def cli = new CliBuilder(usage:usage,header:header) + def cli = new CliBuilder(usage:usage,header:header,stopAtNonOption: false) // required sandbox options cli.w(longOpt:'workspace', args:1, 'Absolute path to workspace (root) directory containing all required source directories') cli.a(longOpt:'application', args:1, required:true, 'Application directory name (relative to workspace)') @@ -675,8 +675,7 @@ def createBuildList() { || props.filePropertyValueKeySet().getAt("loadLanguageConfigurationProperties") || (props.loadFileLevelProperties && props.loadFileLevelProperties.toBoolean()) || (props.loadLanguageConfigurationProperties && props.loadLanguageConfigurationProperties.toBoolean())) { - println "** Populating file level properties from individual artifact properties files." - filePropUtils.loadFileLevelPropertiesFromFile(buildList) + filePropUtils.loadFileLevelPropertiesFromConfigFiles(buildList) } // Perform analysis and build report of external impacts diff --git a/docs/FilePropertyManagement.md b/docs/FilePropertyManagement.md index 1d7888553..99710480d 100644 --- a/docs/FilePropertyManagement.md +++ b/docs/FilePropertyManagement.md @@ -2,13 +2,15 @@ ## Table of contents -- [Introduction](#introduction) -- [Overriding build properties with DBB and zAppBuild](#overriding-build-properties-with-dbb-and-zappbuild) -- [Default properties](#default-properties) -- [Overriding properties](#overriding-properties) - - [DBB file properties](#dbb-file-properties) - - [Individual artifact properties file](#individual-artifact-properties-file) - - [Language configuration mapping](#language-configuration-mapping) +- [File Property Management](#file-property-management) + - [Table of contents](#table-of-contents) + - [Introduction](#introduction) + - [Overriding build properties with DBB and zAppBuild](#overriding-build-properties-with-dbb-and-zappbuild) + - [Default properties](#default-properties) + - [Overriding properties](#overriding-properties) + - [DBB file properties](#dbb-file-properties) + - [Individual artifact properties file](#individual-artifact-properties-file) + - [Language configuration mapping](#language-configuration-mapping) ## Introduction @@ -27,9 +29,10 @@ zAppBuild supports overriding the majority of build properties defined within it zAppBuild leverages DBB's API and allows you to define build parameters on three different levels for each language script: 1. General defaults in the corresponding language properties files: For example, you can define the compile options for building COBOL programs in [application-conf/Cobol.properties](../samples/application-conf/Cobol.properties). Property keys make use of a language prefix; for instance, COBOL property keys are prefixed with `cobol_`. -2. A group definition that overrides the general default in one of two ways: +2. A group definition that overrides the general default in one of three ways: - By using DBB's file property syntax in [application-conf/file.properties](../samples/application-conf/file.properties), and specifying the application artifact group via a pattern filter on the path name(s) - - By mapping to a language configuration file to override the defaults, such as in [application-conf/languageConfigurationMapping.properties](../samples/MortgageApplication/application-conf/languageConfigurationMapping.properties) + - By mapping to a *language configuration* file to override the defaults, such as in [application-conf/languageConfigurationMapping.properties](../samples/MortgageApplication/application-conf/languageConfigurationMapping.properties) + - By mapping the build file to a *language configuration* file using the DBB file property syntax file to specify the property `languageConfiguration` in [application-conf/file.properties](../samples/MortgageApplication/application-conf/file.properties#L46-L53) 3. An individual file-level definition that overwrites the general default in one of two ways: - By using DBB's file properties syntax in [application-conf/file.properties](../samples/application-conf/file.properties), and specifying the application artifact's path as the file path pattern - By specifying multiple parameters for a specific file using the individual artifact properties file. For example: [epsmlist.cbl.properties](../samples/MortgageApplication/properties/epsmlist.cbl.properties). @@ -132,12 +135,12 @@ You can view a sample individual artifact properties file, [epsmlist.cbl.propert ### Language configuration mapping -An alternative way to define build properties for a **subgroup of files** is by leveraging a mapping approach. Rather than specifying individual parameters or properties for an individual application artifact, the application artifacts are mapped to a language configuration, which can then define multiple build parameters in a central language configuration properties file. All mapped application artifacts will inherit those defined build parameters. +An alternative way to define build properties for a **subgroup of files** is by leveraging a mapping approach. Rather than specifying individual parameters or properties for an individual application artifact, the application artifacts are mapped to a language configuration, which can then define multiple build parameters in a central language configuration properties file for the language script. All mapped application artifacts will inherit those defined build parameters. This approach consists of: -- Language configuration mapping file: A mapping of the application artifact(s) to a language configuration file -- Language configuration properties file(s): For each language configuration, a properties file defining that language's build parameters +- Language configuration mapping: Either via a mapping file of the application artifact(s) to the language configuration file or alternatively by using the DBB file property syntax to map the build file to the language configuration file. +- Language configuration properties file(s): For each language configuration, a properties file defining that language's build parameters. The "language configuration mapping" approach can be enabled by setting the property `loadLanguageConfigurationProperties` in the `application-conf/application.properties` file to `true`. To enable this option for a specific file or a set of files, use the DBB file property syntax and set `loadLanguageConfigurationProperties` to `true` in the `application-conf/file.properties` file. Below is a sample to enable language configuration mapping for all programs starting with `eps` and `lga` via the `application-conf/file.properties` file: @@ -157,7 +160,9 @@ isCICS = true cobol_linkEditStream= INCLUDE OBJECT(@{member})\n INCLUDE SYSLIB(CUSTOBJ) ``` -To map files to a language configuration, create a `languageConfigurationMapping.properties` file in the `application-conf` folder of your application repository. Then, within this new language configuration mapping file, map each artifact to its corresponding language configuration using the syntax `=`. +Two options exist to map build files to the language configuration: + +Either create a `languageConfigurationMapping.properties` file in the `application-conf` folder of your application repository. Then, within this new language configuration mapping file, map each artifact to its corresponding language configuration using the syntax `=`, or leverage the DBB file property syntax with the build property `languageConfiguration`. - For example, the following snippet in [application-conf/languageConfigurationMapping.properties](../samples/MortgageApplication/application-conf/languageConfigurationMapping.properties) maps both source files `epsnbrvl.cbl` and `epsmlist.cbl` to use the properties defined in `build-conf/language-conf/languageConfigProps01.properties`, while the source file `epscmort.cbl` is mapped to use the properties defined in `build-conf/language-conf/languageConfigProps02.properties` for language configuration mapping overrides: @@ -167,7 +172,17 @@ To map files to a language configuration, create a `languageConfigurationMapping epscmort.cbl=languageConfigProps02 ``` -See [languageConfigurationMapping.properties](../samples/MortgageApplication/application-conf/languageConfigurationMapping.properties) for a sample language configuration mapping file. + See [languageConfigurationMapping.properties](../samples/MortgageApplication/application-conf/languageConfigurationMapping.properties) for a sample language configuration mapping file. + +- The alternative mapping approach using the DBB file property syntax allows you to leverage file patterns similarly to other file properties in the zAppBuild framework. The below configuration is providing the same information like the above approach using the `languageConfigurationMapping.properties` file. + + ```properties + languageConfiguration = languageConfigProps01 :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl + languageConfiguration = languageConfigProps02 :: **/cobol/epscmort.cbl + ``` + + See [application-conf/file.properties](../samples/MortgageApplication/application-conf/file.properties#L46-L53) for a sample language configuration mapping via the DBB file property syntax. + [^1]: The term "artifact" and "file" in this document refer to program source code that will built (as opposed to JCL or other non-buildable items), for example by DBB. [^2]: DBB is managing the DBB file properties in its separate internal table compared to the default properties. This table leverages the combination of [property name + file pattern] as the key of the internal table. When the same key is declared a second time, it overrides the first one. diff --git a/samples/MortgageApplication/application-conf/application.properties b/samples/MortgageApplication/application-conf/application.properties index f5f449876..53e39bc14 100644 --- a/samples/MortgageApplication/application-conf/application.properties +++ b/samples/MortgageApplication/application-conf/application.properties @@ -4,8 +4,7 @@ # Comma separated list of additional application property files to load # Supports both relative path (to ${application}/application-conf/) and absolute path applicationPropFiles=file.properties,BMS.properties,Cobol.properties,\ -LinkEdit.properties,languageConfigurationMapping.properties,\ -CRB.properties +LinkEdit.properties,CRB.properties # # Comma separated list all source directories included in application build. Supports both absolute @@ -21,8 +20,13 @@ applicationSrcDirs=${application} buildOrder=BMS.groovy,Cobol.groovy,LinkEdit.groovy # -# The main build branch. Used for cloning collections for topic branch builds instead -# of rescanning the entire application. +# The main build branch. +# Used for cloning collections for first topic branch build instead +# of rescanning the entire application. +# Used to retrieve the last successful build result for the first topic branch build to +# obtain the baseline hash to calculate changed files for impact build scnearios. +# Used for the build type --mergeBuild to perform the git diff to +# identify changed files mainBuildBranch=main # diff --git a/samples/MortgageApplication/application-conf/file.properties b/samples/MortgageApplication/application-conf/file.properties index cd6c93011..7b8822f14 100644 --- a/samples/MortgageApplication/application-conf/file.properties +++ b/samples/MortgageApplication/application-conf/file.properties @@ -41,4 +41,13 @@ loadFileLevelProperties = true :: **/cobol/epsmlist.cbl # Example 1: Enable language configuration mapping for all COBOL files: loadLanguageConfigurationProperties=true :: **/cobol/*.cbl # Example 2: The following file path pattern looks for a language configuration properties file mapping for epsnbrvl.cbl and epsmpmt.cbl # in the application-conf/languageconfigurationMapping.properties file: -loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl \ No newline at end of file +loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl, **/cobol/epscmort.cbl + +# +# Properties mapping for assigning the language configuration to build files to specify the build configuration +# Please see the detailed documentation on file property management at: +# https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md +# This option replaces the mapping of build files to language configuration in languageConfigurationMapping.properties file +# +languageConfiguration = languageConfigProps01 :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl +languageConfiguration = languageConfigProps02 :: **/cobol/epscmort.cbl diff --git a/samples/MortgageApplication/application-conf/languageConfigurationMapping.properties b/samples/MortgageApplication/application-conf/languageConfigurationMapping.properties index 602b348c7..fd96e87e4 100644 --- a/samples/MortgageApplication/application-conf/languageConfigurationMapping.properties +++ b/samples/MortgageApplication/application-conf/languageConfigurationMapping.properties @@ -1,6 +1,12 @@ # This file maps the program file with the corresponding language configuration properties file in the build-conf/language-conf folder. -# For example: As shown below, the programs `epsnbrvl.cbl` and `epsmpmt.cbl` will map to the language configuration file +# The file needs to be added under the property applicationPropFiles in application-conf/application.properties. +# The current implementation of MortgageApplication is using DBB File Properties. + +# Please see the detailed documentation on file property management at: +# https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md + +# In the below samples, the programs `epsnbrvl.cbl` and `epsmpmt.cbl` will map to the language configuration file # build-conf/language-conf/languageConfigProps01.properties. # The program `epscmort.cbl` will map to the language configuration file build-conf/language-conf/languageConfigProps02.properties. @@ -8,4 +14,5 @@ epsnbrvl.cbl=languageConfigProps01 epsmpmt.cbl=languageConfigProps01 epscmort.cbl=languageConfigProps02 -# Insert all the file ==> language configuration properties mapping here! \ No newline at end of file +# Insert all the file ==> language configuration properties mapping here +# and make sure to load this properties file via applicationPropFiles in application-conf/application.properties! \ No newline at end of file diff --git a/samples/application-conf/README.md b/samples/application-conf/README.md index d1c706a49..b86d2b5cc 100644 --- a/samples/application-conf/README.md +++ b/samples/application-conf/README.md @@ -34,7 +34,10 @@ impactResolutionRules | Comma separated list of resolution rule properties used impactSearch | Impact finder resolution search configuration leveraging the SearchPathImpactFinder API. Sample configurations are inlcuded below, next to the previous rule definitions. | true ### file.properties -Location of file properties, script mappings and file-level property overrides. All file properties for the entire application, including source files in distributed repositories of the application need to be contained either in this file or in other property files in the `application-conf` directory. Look for the column 'Overridable' in the tables below for build properties that can have file-level property overrides. Additional file-level properties can be defined through individual artifact properties files in a separate directory of the repository. For more details, see [File Property Management](https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md). + +Location of file properties, script mappings and file-level property overrides. All file properties for the entire application, including source files in distributed repositories of the application need to be contained either in this file or in other property files in the `application-conf` directory. Look for the column 'Overridable' in the tables below for build properties that can have file-level property overrides. Please also read the section [Build properties](https://www.ibm.com/docs/en/dbb/2.0?topic=apis-build-properties) in the official DBB documentation. + +Additional file-level properties can be defined through **individual artifact properties files** in a separate directory of the repository or through **language configuration** files to configure the language scripts. For more details, see [File Property Management](https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md). Property | Description --- | --- @@ -42,6 +45,12 @@ dbb.scriptMapping | DBB configuration file properties association build files to dbb.scannerMapping | zAppBuild configuration override/expansion to map files extensions to DBB dependency scanner configurations cobol_testcase | File property to indicate a generated zUnit cobol test case to use a different set of source and output libraries +Property | Description +--- | --- +loadFileLevelProperties | Flag to enable the zAppBuild capability to load individual artifact properties files for source files. See default configuration in [application.properties](#application.properties) +loadLanguageConfigurationProperties | Flag to enable the zAppBuild capability to load language configuration properties files for source files. See default configuration in [application.properties](#application.properties) +languageConfiguration | Properties mapping for assigning build files to language configuration to define the build configuration + General file level overwrites to control the allocations of system datasets for compile and link steps or activation of preprocessing Property | Description diff --git a/samples/application-conf/application.properties b/samples/application-conf/application.properties index 5abb1c8b1..87e2a66c1 100644 --- a/samples/application-conf/application.properties +++ b/samples/application-conf/application.properties @@ -37,9 +37,14 @@ testOrder=ZunitConfig.groovy # formatConsoleOutput=false # -# The main build branch. Used for cloning collections for topic branch builds instead -# of rescanning the entire application. -mainBuildBranch=master +# The main build branch. +# Used for cloning collections for first topic branch build instead +# of rescanning the entire application. +# Used to retrieve the last successful build result for the first topic branch build to +# obtain the baseline hash to calculate changed files for impact build scnearios. +# Used for the build type --mergeBuild to perform the git diff to +# identify changed files +mainBuildBranch=main # # The git repository URL of the application repository to establish links to the changed files diff --git a/samples/application-conf/file.properties b/samples/application-conf/file.properties index e419a2226..d54978a0d 100644 --- a/samples/application-conf/file.properties +++ b/samples/application-conf/file.properties @@ -83,8 +83,50 @@ isMQ = true :: **/cobol/member.cbl # isIMS = true :: **/cobol/DLIBATCH.cbl -# Please check for available file property overwrites within samples/application-conf/README.md +######### +# Property File Management +# +# > Please check for available file property overwrites within samples/application-conf/README.md < +# The tables indicate which build parameters can be overwritten for each build file to overwrite the default settings. +# +# The subsequent section provides the configuration parameters to outline +# - file level property overwrites by loading individual artifact properties files +# - loading language configurations that define multiple build parameters for the mapped files +# +# Please see the detailed documentation on file property management at: +# https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md +# +######### + +# +# Flag to enable the zAppBuild capability to load individual artifact properties files for source files. +# Example 1: The following file path pattern looks for an individual artifact properties file for epsmlist.cbl: +# loadFileLevelProperties = true :: **/cobol/epsmlist.cbl +# Example 2: Enable individual artifact properties file for all COBOL files: loadFileLevelProperties=true :: **/cobol/*.cbl +# loadFileLevelProperties = true :: **/cobol/*.cbl + +# +# Language Configuration properties management +# +# Flag to enable the zAppBuild capability to load language configuration properties files for source files. +# Example 1: Enable language configuration mapping for all COBOL files: loadLanguageConfigurationProperties=true :: **/cobol/*.cbl +# loadLanguageConfigurationProperties = true :: **/cobol/*.cbl +# Example 2: The following file path pattern looks for a language configuration properties file mapping for epsnbrvl.cbl and epsmpmt.cbl +# in the application-conf/languageconfigurationMapping.properties file: +# loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl + +# +# Properties mapping for assigning the language configuration to build files to specify the build configuration +# This option is an alternative approach for mapping build files to the language configuration file +# +# languageConfiguration = languageConfigProps01 :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl +# languageConfiguration = languageConfigProps02 :: **/cobol/epscmort.cbl + + +######### +# zUnit Integration +######### # # file mapping for generated zUnit Test case programs (Cobol) to use a seperate set of libraries # cobol_testcase = true :: **/testcase/*.cbl diff --git a/samples/application-conf/languageConfigurationMapping.properties b/samples/application-conf/languageConfigurationMapping.properties index 602b348c7..6f3549f76 100644 --- a/samples/application-conf/languageConfigurationMapping.properties +++ b/samples/application-conf/languageConfigurationMapping.properties @@ -1,5 +1,8 @@ # This file maps the program file with the corresponding language configuration properties file in the build-conf/language-conf folder. +# Please see the detailed documentation on file property management at: +# https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md + # For example: As shown below, the programs `epsnbrvl.cbl` and `epsmpmt.cbl` will map to the language configuration file # build-conf/language-conf/languageConfigProps01.properties. # The program `epscmort.cbl` will map to the language configuration file build-conf/language-conf/languageConfigProps02.properties. diff --git a/test/applications/MortgageApplication/application-conf/file_languageConfig_TC1.properties b/test/applications/MortgageApplication/application-conf/file_languageConfig_TC1.properties index a282b3589..2de071595 100644 --- a/test/applications/MortgageApplication/application-conf/file_languageConfig_TC1.properties +++ b/test/applications/MortgageApplication/application-conf/file_languageConfig_TC1.properties @@ -40,4 +40,13 @@ loadFileLevelProperties = true :: **/cobol/epsmlist.cbl # Example 1: Enable language configuration mapping for all COBOL files: loadLanguageConfigurationProperties=true :: **/cobol/*.cbl # Example 2: The following file path pattern looks for a language configuration properties file mapping for epsnbrvl.cbl and epsmpmt.cbl # in the application-conf/languageconfigurationMapping.properties file: -loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl \ No newline at end of file +loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl, **/cobol/epscmort.cbl + +# +# Properties mapping for assigning the language configuration to build files to specify the build configuration +# Please see the detailed documentation on file property management at: +# https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md +# This option replaces the mapping of build files to language configuration in languageConfigurationMapping.properties file +# +languageConfiguration = languageConfigProps01 :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl +languageConfiguration = languageConfigProps02 :: **/cobol/epscmort.cbl \ No newline at end of file diff --git a/test/applications/MortgageApplication/application-conf/file_languageConfig_TC2.properties b/test/applications/MortgageApplication/application-conf/file_languageConfig_TC2.properties index 5d8f834b6..7b2925598 100644 --- a/test/applications/MortgageApplication/application-conf/file_languageConfig_TC2.properties +++ b/test/applications/MortgageApplication/application-conf/file_languageConfig_TC2.properties @@ -40,4 +40,13 @@ loadFileLevelProperties = true :: **/cobol/epsmlist.cbl # Example 1: Enable language configuration mapping for all COBOL files: loadLanguageConfigurationProperties=true :: **/cobol/*.cbl # Example 2: The following file path pattern looks for a language configuration properties file mapping for epsnbrvl.cbl and epsmpmt.cbl # in the application-conf/languageconfigurationMapping.properties file: -loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl \ No newline at end of file +loadLanguageConfigurationProperties = true :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl, **/cobol/epscmort.cbl + +# +# Properties mapping for assigning the language configuration to build files to specify the build configuration +# Please see the detailed documentation on file property management at: +# https://github.com/IBM/dbb-zappbuild/docs/FilePropertyManagement.md +# This option replaces the mapping of build files to language configuration in languageConfigurationMapping.properties file +# +languageConfiguration = languageConfigProps01 :: **/cobol/epsnbrvl.cbl, **/cobol/epsmpmt.cbl +languageConfiguration = languageConfigProps02 :: **/cobol/epscmort.cbl \ No newline at end of file diff --git a/test/applications/MortgageApplication/test.properties b/test/applications/MortgageApplication/test.properties index caafda573..456ae949e 100644 --- a/test/applications/MortgageApplication/test.properties +++ b/test/applications/MortgageApplication/test.properties @@ -151,7 +151,7 @@ fullBuild_languageConfigurations_compileParms_fullBuild = Cobol compiler parms f fullBuild_languageConfigurations_compileParms_fullBuild = Cobol compiler parms for MortgageApplication/cobol/epsmlist.cbl = LIB,SOURCE,CICS :: epsmlist.cbl fullBuild_languageConfigurations_compileParms_fullBuild = Cobol compiler parms for MortgageApplication/cobol/epsmpmt.cbl = LIB,SOURCE,MAP,LIST :: epsmpmt.cbl fullBuild_languageConfigurations_compileParms_fullBuild = Cobol compiler parms for MortgageApplication/cobol/epscsmrd.cbl = LIB,CICS :: epscsmrd.cbl -fullBuild_languageConfigurations_compileParms_fullBuild = Cobol compiler parms for MortgageApplication/cobol/epscmort.cbl = LIB,CICS,SQL :: epscmort.cbl +fullBuild_languageConfigurations_compileParms_fullBuild = Cobol compiler parms for MortgageApplication/cobol/epscmort.cbl = LIB,SOURCE,CICS,SQL :: epscmort.cbl # # User Build sample file diff --git a/utilities/BuildUtilities.groovy b/utilities/BuildUtilities.groovy index 54bb8b39f..f78d3003a 100644 --- a/utilities/BuildUtilities.groovy +++ b/utilities/BuildUtilities.groovy @@ -593,8 +593,8 @@ def retrieveLastBuildResult(){ if (lastBuildResult == null && props.topicBranchBuild){ // if this is the first topic branch build get the main branch build result - if (props.verbose) println "** No previous successful topic branch build result. Retrieving last successful main branch build result." String mainBranchBuildGroup = "${props.application}-${props.mainBuildBranch}" + if (props.verbose) println "** No previous successful topic branch build result. Retrieving last successful build result from the main build branch group (${mainBranchBuildGroup})." lastBuildResult = metadataStore.getLastBuildResult(mainBranchBuildGroup, BuildResult.COMPLETE, BuildResult.CLEAN) } diff --git a/utilities/FilePropUtilities.groovy b/utilities/FilePropUtilities.groovy index 1bfa715e1..ea71b4f0b 100644 --- a/utilities/FilePropUtilities.groovy +++ b/utilities/FilePropUtilities.groovy @@ -10,65 +10,77 @@ import com.ibm.dbb.build.report.* /* * Loading file level properties for all files on the buildList or list which is passed to this method. + * Either from language configuration configs or individual artifact properties file */ -def loadFileLevelPropertiesFromFile(List buildList) { +def loadFileLevelPropertiesFromConfigFiles(List buildList) { - if (props.verbose) println "* Populating file level properties overrides." + println "** Loading file level properties overrides." buildList.each { String buildFile -> - if (props.verbose) println "** Checking file property overrides for $buildFile " - String propertyFilePath = props.getFileProperty('propertyFilePath', buildFile) - String propertyExtention = props.getFileProperty('propertyFileExtension', buildFile) - String member = new File(buildFile).getName() - def filePropMap = [:] + + loadLanguageConfigurationProperties = props.getFileProperty('loadLanguageConfigurationProperties', buildFile) + loadFileLevelProperties = props.getFileProperty('loadFileLevelProperties', buildFile) + + if (props.verbose && (( loadLanguageConfigurationProperties && loadLanguageConfigurationProperties.toBoolean()) || (loadFileLevelProperties && loadFileLevelProperties.toBoolean())) ) { + println "*** Loading build property overrides for $buildFile " + } + String propertyFilePath = props.getFileProperty('propertyFilePath', buildFile) + String propertyExtention = props.getFileProperty('propertyFileExtension', buildFile) + String member = new File(buildFile).getName() + def filePropMap = [:] // temporary map of build properties that is used to validate for existing file property overrides - // check for language configuration group level overwrite - loadLanguageConfigurationProperties = props.getFileProperty('loadLanguageConfigurationProperties', buildFile) - if (loadLanguageConfigurationProperties && loadLanguageConfigurationProperties.toBoolean()) { - String languageConfigurationPropertyFileName = props."$member" - if (languageConfigurationPropertyFileName != null) { - - // String languageConfigurationPropertyFilePath = buildUtils.getAbsolutePath(props.application) + "/${propertyFilePath}/${languageConfigurationPropertyFileName}.${propertyExtention}" - String languageConfigurationPropertyFilePath = "${props.zAppBuildDir}/build-conf/language-conf/${languageConfigurationPropertyFileName}.${propertyExtention}" - - File languageConfigurationPropertyFile = new File(languageConfigurationPropertyFilePath) - - if (languageConfigurationPropertyFile.exists()) { - filePropMap = loadProgramTypeProperties(languageConfigurationPropertyFileName, languageConfigurationPropertyFilePath, buildFile) - } else { - if (props.verbose) println "***! No language configuration properties file found for ${languageConfigurationPropertyFileName}.${propertyExtention}. Defaults or already defined file properties mapped to $buildFile." - } - - } else { - if (props.verbose) println "***! No language configuration properties file defined for $buildFile" - } - - } + // check for language configuration group level overwrite + if (loadLanguageConfigurationProperties && loadLanguageConfigurationProperties.toBoolean()) { + + // obtain the language configuration file name + String languageConfigurationPropertyFileName; + // retrieve language configuration name from file property first + PropertyMappings languageConfigurationPropertyMapping = new PropertyMappings("languageConfiguration") + if (languageConfigurationPropertyMapping != null) languageConfigurationPropertyFileName = languageConfigurationPropertyMapping.getValue(buildFile) + // if not defined check language configuration name from languageConfigurationMapping.properties, which is loaded as build properties + if (languageConfigurationPropertyFileName == null) languageConfigurationPropertyFileName = props."$member" + + // Load properties from language configuration + if (languageConfigurationPropertyFileName != null) { + + String languageConfigurationPropertyFilePath = "${props.zAppBuildDir}/build-conf/language-conf/${languageConfigurationPropertyFileName}.${propertyExtention}" + + File languageConfigurationPropertyFile = new File(languageConfigurationPropertyFilePath) + if (languageConfigurationPropertyFile.exists()) { + filePropMap = loadProgramTypeProperties(languageConfigurationPropertyFileName, languageConfigurationPropertyFilePath, buildFile) + } else { + if (props.verbose) println "***! Language configuration properties file (${languageConfigurationPropertyFilePath}) not found." + } + + } else { + if (props.verbose) println "*** No language configuration properties file defined for $buildFile" + } + + } - // check for file level overwrite - loadFileLevelProperties = props.getFileProperty('loadFileLevelProperties', buildFile) + // load individual artifact properties file if (loadFileLevelProperties && loadFileLevelProperties.toBoolean()) { String propertyFile = buildUtils.getAbsolutePath(props.application) + "/${propertyFilePath}/${member}.${propertyExtention}" File fileLevelPropFile = new File(propertyFile) if (fileLevelPropFile.exists()) { - if (props.verbose) println "*** $buildFile has an individual artifact properties file defined in ${propertyFilePath}/${member}.${propertyExtention}" + if (props.verbose) println "*** Loading build properties from individual artifact properties file ${propertyFilePath}/${member}.${propertyExtention} for ${buildFile}" InputStream propertyFileIS = new FileInputStream(propertyFile) Properties fileLevelProps = new Properties() fileLevelProps.load(propertyFileIS) fileLevelProps.entrySet().each { entry -> - if (props.verbose) println " Found file property ${entry.key} = ${entry.value}" + if (props.verbose) println " ${entry.key} = ${entry.value}" filePropMap[entry.key] = entry.value } } else { - if (props.verbose) println "***! No property file found for $buildFile. Build will take the defaults or already defined file properties." + if (props.verbose) println "***! No individual artifact properties file found for $buildFile." } } // Add the file patterns from file property map after checking the existence of the file patterns - if (props.verbose) println "*** Checking for existing file property overrides" + if (props.verbose && filePropMap.size() > 0) println "*** Validating file property overrides" filePropMap.each { entry -> // Check if the file property definition already exists (filePatternIsMapped, filePatternIsMappedAtFileName, noChangeFilePattern, currValue) = checkExistingFilesPropertyDefinition(buildFile, member, entry.key) @@ -78,7 +90,7 @@ def loadFileLevelPropertiesFromFile(List buildList) { if (filePatternIsMappedAtFileName) { props.removeFileProperty(entry.key) noChangeFilePattern.each { noChangeFile -> - if (props.verbose) println " Retaining file property override ${entry.key} = ${noChangeFile.value} for ${noChangeFile.key}" + if (props.verbose) println " Retaining existing file property override ${entry.key} = ${noChangeFile.value} for ${noChangeFile.key}" props.addFilePattern(entry.key, noChangeFile.value, noChangeFile.key) } // Add the buildFile file pattern with new value @@ -98,7 +110,7 @@ def loadFileLevelPropertiesFromFile(List buildList) { } } else { // Add the buildFile file pattern with new value - if (props.verbose) println " Adding file property override ${entry.key} = ${entry.value} for ${buildFile}" + if (props.verbose) println " Setting file property override ${entry.key} = ${entry.value} for ${buildFile}" props.addFilePattern(entry.key, entry.value, buildFile) } } @@ -113,14 +125,14 @@ def loadProgramTypeProperties(String languageConfigurationPropertyFileName, Stri def filePropMap = [:] String propertyExtention = props.getFileProperty('propertyFileExtension', buildFile) - if (props.verbose) println "*** $buildFile is mapped to ${languageConfigurationPropertyFileName}.${propertyExtention}" + if (props.verbose) println "*** Loading build properties defined in language configuration ${languageConfigurationPropertyFileName}.${propertyExtention} for ${buildFile}" InputStream languageConfigurationPropertyFileIS = new FileInputStream(languageConfigurationPropertyFile) Properties languageConfigProps = new Properties() languageConfigProps.load(languageConfigurationPropertyFileIS) languageConfigProps.entrySet().each { entry -> - if (props.verbose) println " Found language configuration property ${entry.key} = ${entry.value}" + if (props.verbose) println " ${entry.key} = ${entry.value}" filePropMap[entry.key] = entry.value } return filePropMap @@ -132,7 +144,6 @@ def loadProgramTypeProperties(String languageConfigurationPropertyFileName, Stri */ def checkExistingFilesPropertyDefinition(String buildFile, String member, String entryKey){ - if (props.verbose) println " Checking build property ${entryKey}" PropertyMappings propertyMapping = new PropertyMappings(entryKey) def propertyMappingValues = propertyMapping.getValues() String expValue = "" diff --git a/utilities/GitUtilities.groovy b/utilities/GitUtilities.groovy index d5fdb41e9..253c0b57a 100644 --- a/utilities/GitUtilities.groovy +++ b/utilities/GitUtilities.groovy @@ -78,7 +78,7 @@ def getCurrentGitDetachedBranch(String gitDir) { // expecting references with "origin" as segment def origin = "origin/" if (gitBranchesArray.count {it.contains(origin)} > 1 ) { - String warningMsg = "*! (GitUtils.getCurrentGitDetachedBranch) Warning obtaining branch name for ($dir). Multiple references point to the same commit. ($gitBranchArr)" + String warningMsg = "*! (GitUtils.getCurrentGitDetachedBranch) Warning obtaining branch name for ($gitDir). Multiple references point to the same commit. ($gitBranchString)" println(warningMsg) updateBuildResult(warningMsg:warningMsg) } diff --git a/utilities/ImpactUtilities.groovy b/utilities/ImpactUtilities.groovy index 91dae2637..41a5eef00 100644 --- a/utilities/ImpactUtilities.groovy +++ b/utilities/ImpactUtilities.groovy @@ -109,7 +109,7 @@ def createImpactBuildList() { // impactedFile found, but on Exclude List // Possible reasons: Exclude of file was defined after building the collection. // Rescan/Rebuild Collection to synchronize it with defined build scope. - if (props.verbose) println "*! $impactFile is impacted by changed file $changedFile, but is on Exlude List. Not added to build list." + if (props.verbose) println "*! $impactFile is impacted by changed file $changedFile, but it is excluded from the build scope. See excludeFileList configuration. Not added to build list." } } else { String warningMsg = "*! $impactFile is impacted by changed file $changedFile, but is not added to build list, because it is not mapped to a language script." @@ -421,10 +421,13 @@ def calculateChangedFiles(BuildResult lastBuildResult, boolean calculateConcurre changed.each { file -> (file, mode) = fixGitDiffPath(file, dir, true, null) if ( file != null ) { + // filter excluded files if ( !buildUtils.matches(file, excludeMatchers)) { changedFiles << file if (!calculateConcurrentChanges) githashBuildableFilesMap.addFilePattern(abbrevCurrent, file) if (props.verbose) println "**** $file" + } else { + if (props.verbose) println "**** $file is changed, but is excluded from build scope. See excludeFileList configuration." } //retrieving changed build properties if (props.impactBuildOnBuildPropertyChanges && props.impactBuildOnBuildPropertyChanges.toBoolean() && file.endsWith(".properties")){ @@ -442,6 +445,8 @@ def calculateChangedFiles(BuildResult lastBuildResult, boolean calculateConcurre (file, mode) = fixGitDiffPath(file, dir, false, mode) deletedFiles << file if (props.verbose) println "**** $file" + } else { + if (props.verbose) println "**** $file is deleted, but is excluded from build scope. See excludeFileList configuration. No follow-up processing." } } @@ -451,6 +456,8 @@ def calculateChangedFiles(BuildResult lastBuildResult, boolean calculateConcurre (file, mode) = fixGitDiffPath(file, dir, false, mode) renamedFiles << file if (props.verbose) println "**** $file" + } else { + if (props.verbose) println "**** $file is renamed, but is excluded from build scope. See excludeFileList configuration. No follow-up processing." } } diff --git a/version.properties b/version.properties index 711584f92..ed363131b 100644 --- a/version.properties +++ b/version.properties @@ -2,7 +2,7 @@ # delivered via the public github repository # https://github.com/IBM/dbb-zappbuild. # Helps to understand from which version a copy was taken. -zappbuild_baseVersion=3.7.0 +zappbuild_baseVersion=3.8.0 # use this property to add you own version suffix to indicate # contributed enhancements and your own revisions