-
Notifications
You must be signed in to change notification settings - Fork 11
Description
This is not an issue, but I wanted to open a discussion and did not find a better place.
I like the simplicity of the model ply uses: the concept of scopes, scripts, etc.
however, property files are not that nice to read and work with.
Hashicop invented HCL (inspired by ucl) in order to provide a language that was good for both humans and machines.
Typesafe Config is an implementation for Java for a similar idea. Keeping the underlaying model the same, the build configuration could look, in a single file like:
project {
version=1.0
name=ply-compiler
namespace=ply-compiler
}
compiler {
java.source=1.6
java.target=1.6
}
dependencies {
"ply-util:ply-util" = 1.0.5
}
dependencies.test {
// #Fri Oct 21 17:20:55 EDT 2011
"junit:junit" = 4.10
}
manifest {
mainClass=net.ocheyedan.ply.script.CompilerScript
}Also provides some flexibility (which makes it very human friendly), like:
manifest.mainClass=net.ocheyedan.ply.script.CompilerScript
project.version=1.0
project.name=ply-compiler
project.namespace=ply-compilerin this language can be writen with dot notation or:
manifest {
mainClass=net.ocheyedan.ply.script.CompilerScript
}
project {
version=1.0
name=ply-compiler
namespace=ply-compiler
}But you get all the features and testability of a single library that has no dependencies, which at the same time it is also a super-set of properties.
Features of this HOCON language:
- Comments, with
#or// - Allow omitting the
{}around a root object - Allow
=as a synonym for: - Allow omitting the
=or:before a{so
foo { a : 42 } - Allow omitting commas as long as there's a newline
- Allow trailing commas after last element in objects and arrays
- Allow unquoted strings for keys and values
- Unquoted keys can use dot-notation for nested objects,
foo.bar=42meansfoo { bar : 42 } - Duplicate keys are allowed; later values override earlier,
except for object-valued keys where the two objects are merged
recursively includefeature merges root object in another file into
current object, sofoo { include "bar.json" }merges keys in
bar.jsoninto the objectfoo- include with no file extension includes any of
.conf,
.json,.properties - you can include files, URLs, or classpath resources; use
include url("http://example.com")orfile()or
classpath()syntax to force the type, or use justinclude "whatever"to have the library do what you probably mean
(Note:url()/file()/classpath()syntax is not supported
in Play/Akka 2.0, only in later releases.) - substitutions
foo : ${a.b}sets keyfooto the same value
as thebfield in theaobject - substitutions concatenate into unquoted strings,
foo : the quick ${colors.fox} jumped - substitutions fall back to environment variables if they don't
resolve in the config itself, so${HOME}would work as you
expect. Also, most configs have system properties merged in so
you could use${user.home}. - substitutions normally cause an error if unresolved, but
there is a syntax${?a.b}to permit them to be missing. +=syntax to append elements to arrays,path += "/bin"- multi-line strings with triple quotes as in Python or Scala
I am very interested in trying this. I am not sure if you would think about accepting it upstream giving that the property files are kind of "core" to the current design, but I also understand the important part is keeping the simplicity, so I would like to have a discussion before I start to try to implement it.
I believe that:
- A nicer build description
- The ability to bootstrap on Linux without bringing maven in any dependency
- Some extra sugar on Linux like good offline support and building against system jars
- Some extra maven compatibility (eg, a script to build simple maven projects)
Could make it a serious player, especially in Linux distributions where maven is pure pain.