This PR adds a description property to each build properties set. Such information is then printed below the message of an evaluation failure to give the user more context about the properties set involved in the evaluation (as Additional info:). Example:
...
Build file '/Users/toto/novoda/gradle-build-properties-plugin/sample/app/build.gradle' line: 53
> Build properties evaluation failed:
- Unable to find value for key 'googleMapsKey2' in properties set 'buildProperties.secrets'.
- Unable to create properties set 'buildProperties.notThere': file:///Users/toto/novoda/gradle-build-properties-plugin/sample/whatever does not exist.
Additional info:
* buildProperties.notThere: This file actually doesn't exists. This properties set is used to show how
properties files are lazy-loaded.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
The new description property makes incidentally obsolete the old API to create a build properties set from a properties file:
Before
After
file (File file, String errorMessage)
from (File file) setDescription(String description)
buildProperties { foo { from project.file('foo.properties') description='This properties set ...' }}
Considerations/Implementation Details
Each properties set (instance of BuildProperties) now holds an ExceptionFactory that can be used to create exceptions thrown as part of the evaluation of their entries.
The BuildPropertiesException instances assembled via the factory are then including also the additional info of the properties sets involved in the evaluation.
Scope of the PR
This PR adds a
description
property to each build properties set. Such information is then printed below the message of an evaluation failure to give the user more context about the properties set involved in the evaluation (asAdditional info:
). Example:The new
description
property makes incidentally obsolete the old API to create a build properties set from a properties file:Considerations/Implementation Details
Each properties set (instance of
BuildProperties
) now holds anExceptionFactory
that can be used to create exceptions thrown as part of the evaluation of their entries. TheBuildPropertiesException
instances assembled via the factory are then including also the additional info of the properties sets involved in the evaluation.