Now using reader and writer to access the properties file.

This commit is contained in:
Erik C. Thauvin 2018-07-11 03:41:37 -07:00
parent 5b8a298a2b
commit e378d47946

View file

@ -59,8 +59,8 @@ class SemverPlugin : Plugin<Project> {
put(config.preReleasePrefixKey, version.preReleasePrefix)
if (version.separator != Version.DEFAULT_SEPARATOR)
put(config.separatorKey, version.separator)
FileOutputStream(config.properties).use { output ->
store(output, "Generated by the Semver Plugin for Gradle")
FileOutputStream(config.properties).writer().use { writer ->
store(writer, "Generated by the Semver Plugin for Gradle")
}
}
}
@ -88,11 +88,11 @@ class SemverPlugin : Plugin<Project> {
}
propsFile.apply {
project.logger.info(
if (canRead()) {
FileInputStream(this).use { fis ->
"[$simpleName] Attempting to read properties from: `$absoluteFile`. [exists: ${exists()}, isFile: $isFile, canRead: ${canRead()}]")
if (canRead() && isFile) {
FileInputStream(this).reader().use { reader ->
Properties().apply {
load(fis)
load(reader)
version.major = getProperty(config.majorKey, Version.DEFAULT_MAJOR)
version.minor = getProperty(config.minorKey, Version.DEFAULT_MINOR)
version.patch = getProperty(config.patchKey, Version.DEFAULT_PATCH)