Now using reader and writer to access the properties file.
This commit is contained in:
parent
5b8a298a2b
commit
e378d47946
1 changed files with 5 additions and 5 deletions
|
@ -59,8 +59,8 @@ class SemverPlugin : Plugin<Project> {
|
||||||
put(config.preReleasePrefixKey, version.preReleasePrefix)
|
put(config.preReleasePrefixKey, version.preReleasePrefix)
|
||||||
if (version.separator != Version.DEFAULT_SEPARATOR)
|
if (version.separator != Version.DEFAULT_SEPARATOR)
|
||||||
put(config.separatorKey, version.separator)
|
put(config.separatorKey, version.separator)
|
||||||
FileOutputStream(config.properties).use { output ->
|
FileOutputStream(config.properties).writer().use { writer ->
|
||||||
store(output, "Generated by the Semver Plugin for Gradle")
|
store(writer, "Generated by the Semver Plugin for Gradle")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,11 +88,11 @@ class SemverPlugin : Plugin<Project> {
|
||||||
}
|
}
|
||||||
propsFile.apply {
|
propsFile.apply {
|
||||||
project.logger.info(
|
project.logger.info(
|
||||||
if (canRead()) {
|
|
||||||
FileInputStream(this).use { fis ->
|
|
||||||
"[$simpleName] Attempting to read properties from: `$absoluteFile`. [exists: ${exists()}, isFile: $isFile, canRead: ${canRead()}]")
|
"[$simpleName] Attempting to read properties from: `$absoluteFile`. [exists: ${exists()}, isFile: $isFile, canRead: ${canRead()}]")
|
||||||
|
if (canRead() && isFile) {
|
||||||
|
FileInputStream(this).reader().use { reader ->
|
||||||
Properties().apply {
|
Properties().apply {
|
||||||
load(fis)
|
load(reader)
|
||||||
version.major = getProperty(config.majorKey, Version.DEFAULT_MAJOR)
|
version.major = getProperty(config.majorKey, Version.DEFAULT_MAJOR)
|
||||||
version.minor = getProperty(config.minorKey, Version.DEFAULT_MINOR)
|
version.minor = getProperty(config.minorKey, Version.DEFAULT_MINOR)
|
||||||
version.patch = getProperty(config.patchKey, Version.DEFAULT_PATCH)
|
version.patch = getProperty(config.patchKey, Version.DEFAULT_PATCH)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue