This SBuild plugin provides a Plugin to build SBuild Plugins.
The SBuild Plugin Plugin is available from Maven Central.
To use it in SBuild 0.7.1 or newer, simply add it to the project classpath.
@classpath("mvn:org.sbuild:org.sbuild.plugin.sbuildplugin:0.3.0")
All configurable properties are documented via ScalaDoc in the configuration class SBuildPlugin
.
To build an imaginary ExamplePlugin
in package org.sbuild.plugins.example
in version 0.1.0
you can use the following SBuild buildfile. Scala source files are assumed to be in src/main/scala
directory.
import de.tototec.sbuild._
@version("0.7.1")
@classpath("mvn:org.sbuild:org.sbuild.plugins.sbuildplugin:0.3.0")
class SBuild(implicit _project: Project) {
import org.sbuild.plugins.sbuildplugin._
Plugin[SBuildPlugin] configure (_.copy(
// the version of SBuild this plugin is compatible to
sbuildVersion = SBuildVersion.v0_7_1,
// the plugin API
pluginClass = "org.sbuild.plugins.example.Example",
// the version of this plugin
pluginVersion = "0.1.0"
))
}
That’s all to compile and package a plugin which has no additional dependencies.
bash$ sbuild -l /tmp/exampleproject/target/org.sbuild.plugins.example-0.1.0.jar clean compile jar
To build the plugin use the jar
target, which is an alias to the output jar (target/org.sbuild.plugins.example-0.1.0.jar
).
You need a recent version of SBuild.
git clone https://github.com/SBuild-org/sbuild-sbuild-plugin.git cd sbuild-sbuild-plugin/org.sbuild.plugins.sbuildplugin sbuild all
You will find the built jar in the directory org.sbuild.plugins.sbuildplugin/target
.
The SBuild plugin ecosystem just was born. If there are in the near future stable plugin for tasks like compiling, packaging, testing, etc, this plugin will start to use these instead of defining all these task on its own.
-
API Change: Rework configuration of SBuild version used for the plugin build (and as lowest compatibility margin). By this change, it is also possible to build a plugin against an unreleased SBuild version.
-
Compile and run tests with ScalaTest.
-
New
manifest
parameter to allow additional entries in the final plugin JAR manifest.
-
Fixed a bug resulting in an invalid
SBuild-Plugin
entry in the manifest.
-
This version requires at least SBuild 0.7.1!
-
Changed to immutable config class
SBuildPlugin