Initial commit.

This commit is contained in:
Erik C. Thauvin 2018-07-10 15:20:17 -07:00
commit ca7b96de65
16 changed files with 511 additions and 0 deletions

46
build.gradle Normal file
View file

@ -0,0 +1,46 @@
class TestPlugin implements Plugin<Project> {
void apply(Project project) {
project.task('runPlugin') {
group = 'application'
def p = new SortedProperties()
p.put("apple", "one")
p.put("beta", "two")
p.put("coffee", "three")
def f = new File("test.properties")
f.withOutputStream { stream -> p.store(stream, "Generated by the plugin.") }
doLast {
println "> cat ${f.name}"
f.eachLine {
println it
}
}
}
}
}
class SortedProperties extends Properties {
@Override
Enumeration<Object> keys() {
def keys = Collections.list(super.keys())
keys.sort { a, b -> (a.toString() <=> b.toString()) }
return Collections.enumeration(keys)
}
}
apply plugin: TestPlugin
apply plugin: 'groovy'
apply plugin: 'application'
mainClassName = 'com.example.App'
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.14'
}
repositories {
jcenter()
}
clean {
delete fileTree(dir: "$projectDir", include: "*.properties")
}