Skip to content

Instantly share code, notes, and snippets.

@mizanRahman
Created August 11, 2018 19:11
Show Gist options
  • Save mizanRahman/9c381a3a1c9866ebe6e4c03be3709d92 to your computer and use it in GitHub Desktop.
Save mizanRahman/9c381a3a1c9866ebe6e4c03be3709d92 to your computer and use it in GitHub Desktop.
finds new properties added in source.properties from dest.properties file
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