Name: sbt-structure
Owner: sbt
Description: SBT plugin to collect information about project structure
Forked from: JetBrains/sbt-structure
Created: 2016-05-18 19:33:56.0
Updated: 2016-05-18 19:33:57.0
Pushed: 2016-05-18 19:34:34.0
Homepage: null
Size: 27030
Language: Scala
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This plugin is designed to allow one extract complete structure of SBT build in XML format. It is used in Intellij Scala plugin in order to support importing arbitrary SBT projects into IDEA.
It consists of two parts:
sbt-structure-core
is a set of datatypes and functions for their (de)serialization used as internal representation
of SBT build in sbt-structuresbt-structure-extractor
is SBT plugin that actually extracts information from SBT buildAdd to your build.sbt
lvers += Resolver.url("jb-bintray", url("http://dl.bintray.com/jetbrains/sbt-plugins"))(Resolver.ivyStylePatterns)
aryDependencies += "org.jetbrains" %% "sbt-structure-core" % "4.1.0" // or later version
Then run extractor or get XML of the structure any other way and deserialize it:
rt org.jetbrains.sbt._
rt org.jetbrains.sbt.XmlSerializer._
structureXml: Elem = XML.load(...)
structure: Either[Throwable, StructureData] = structureXml.deserialize[StructureData]
Extractor is run in several steps:
sbt-structure-output-file
and
sbt-structure-options
settings in Global
scope.dump-structure
task in Global
scopeHere is an example of how to run extractor from SBT REPL:
t SettingKey[Option[File]]("sbt-structure-output-file") := Some(file("structure.xml"))
t SettingKey[String]("sbt-structure-options") := "prettyPrint download"
ply -cp <path-to-extractor-jar> org.jetbrains.sbt.CreateTasks
*:dump-structure
sbt-structure-options
contains space-separated list of options.
sbt-structure-output-file
points to a file where structure will be written; if
it is set to None
then structure will be dump into stdout.
Available options to set in sbt-structure-options
:
download
When this option is set extractor will run update
command for each project in build and build complete
repository of all transitive library dependencies
resolveClassifiers
(requires download
option to be set as well)
Same as download
+ downloading sources and javadocs for each transitive library dependency
resolveSbtClassifiers
This option tells extractor to download sources and javadocs for SBT itself and plugins.
prettyPrint
This option will force extractor to prettify XML output. Useful for debug purposes.
Testing against all supported SBT versions can be done with ^ test
command
Testing against specific version of SBT, for example, 0.13.7: ^^ 0.13.7 test
Selected tests can be run with testOnly
command, e.g. ^ testOnly -- -ex "project name"
To publish artifacts bump version in build.sbt
and run in SBT REPL:
ect core
publish project extractor ^^ 0.12 publish ^^ 0.13 publish