com.github.jengelman.gradle.plugins.shadow.internal.CleanProperties.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shadow-gradle-plugin Show documentation
Show all versions of shadow-gradle-plugin Show documentation
Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
package com.github.jengelman.gradle.plugins.shadow.internal
import java.io.BufferedWriter
import java.io.IOException
import java.io.Writer
import java.util.Date
import java.util.Properties
internal class CleanProperties : Properties() {
@Throws(IOException::class)
override fun store(writer: Writer, comments: String) {
super.store(StripCommentsWithTimestampBufferedWriter(writer), comments)
}
private class StripCommentsWithTimestampBufferedWriter(out: Writer) : BufferedWriter(out) {
private val lengthOfExpectedTimestamp = ("#" + Date().toString()).length
@Throws(IOException::class)
override fun write(str: String) {
if (str.couldBeCommentWithTimestamp) return
super.write(str)
}
private val String?.couldBeCommentWithTimestamp: Boolean get() {
return this != null && startsWith("#") && length == lengthOfExpectedTimestamp
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy