pttrt alternatives and similar packages
Based on the "Sbt plugins" category.
Alternatively, view pttrt alternatives based on common mentions on social networks and blogs.
-
sbt-ensime
DISCONTINUED. Generates .ensime config files for SBT projects http://ensime.org/build_tools/sbt -
sbt-dependency-check
DISCONTINUED. SBT Plugin for OWASP DependencyCheck. Monitor your dependencies and report if there are any publicly known vulnerabilities (e.g. CVEs). :rainbow: -
sbt-unidoc
sbt plugin to create a unified Scaladoc or Javadoc API document across multiple subprojects. -
sbt-classfinder
SBT plugin for retrieving runtime information about the classes and traits in a project
SaaSHub - Software Alternatives and Reviews
Do you think we are missing an alternative of pttrt or a related project?
README
Pttrt
Pttrt (/ˈpɪtrɪt/, or Pass Them To Run-time) is a sbt plugin, designed to pass data from compile-time to run-time.
Motive
Many times, my programs need some information, which is generated at compile-time and used at run-time. For example, Subversion's revision, JARs's dependencies, configuration files, and poor man's macro ;-), etc.
It is really heavyweight to deal with these situation in sbt.
You need to create a plugin for each type of files you generated,
to define many SettingKeys in each plugin's .scala files,
and to set values for each of these SettingKeys in your .sbt files.
There are some plugins, like xsbt-reflect,
also able to generate some infomation for run-time. But they cannot fit every variant cases I met.
Another plugin, sbt-buildinfo has similar feature as Pttrt,
but sbt-buildinfo cannot generate multiply files, preventing itself to be used for code generation from multiply
separate plugins.
I just want a lightweight and general-purpose way like Makefile:
generated.properties:
echo my.base.dir=$(PWD) > $@
That's why I created Pttrt.
Usage
Step 1: Install Pttrt into your project
Add the following line to your project/plugins.sbt:
addSbtPlugin("com.dongxiguo" % "pttrt" % "0.1.2")
And add pttrtSettings to your build.sbt:
pttrtSettings
Step 2: Export the data that will be passed to run-time
For example, if you want to know the building version on run-time,
you need to add following lines at build.sbt:
pttrtSettings
version := "1.2.3-SNAPSHOT"
PttrtKeys.pttrtData <+= version map { v =>
"org.yourHost.yourProject.YourSingleton" -> Map("Version" -> TypedExpression(v))
}
Step 3: Access the data on run-time
Create PttrtExample.scala:
object PttrtExample {
def main(args: Array[String]) {
println("Building version is " + org.yourHost.yourProject.YourSingleton.Version)
}
}
Step 4: Run it!
$ sbt
> run-main PttrtExample
You will see:
Building version is 1.2.3-SNAPSHOT
See https://github.com/Atry/pttrt/tree/master/pttrt-test for more example.
Addition requirement
Pttrtis for sbt 0.12- Any value being passed to run-time must be a primary type (
Int,Double,Boolean, etc) orjava.io.Serializable - The value's type must be found in the classpath for both compile-time and run-time.