Created
August 11, 2018 19:11
-
-
Save mizanRahman/9c381a3a1c9866ebe6e4c03be3709d92 to your computer and use it in GitHub Desktop.
finds new properties added in source.properties from dest.properties file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sourceProps = new Properties() | |
def destProps = new Properties() | |
def diffProps = new Properties() | |
file("source.properties").withInputStream { sourceProps.load(it) } | |
file("dest.properties").withInputStream { destProps.load(it) } | |
task diff { | |
doFirst { | |
def sourceKeys = sourceProps.stringPropertyNames(); | |
def destKeys = destProps.stringPropertyNames(); | |
sourceKeys.removeAll(destKeys) | |
sourceKeys.each({ diffProps.put(it, sourceProps.getProperty(it)) }) | |
file("diff.properties").withWriter { diffProps.store(it, null) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment