Skip to content

WamBamBoozle/sbt-source-align

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-source-align

simple plugin for simple-build-tool, compose code and source jars, align sources inside for your favorite IDE

  • allow fetch all dependency jars with code (include simple-build-tool itself) to target folder
  • allow fetch all dependency jars with code and sources (include simple-build-tool itself) to target folder
  • allow fetch all dependency jars with code and sources, merge them (include simple-build-tool itself) and save to target folder

If you want to improve it, please send mail to sbt-android-mill at digimead.org. You will be added to the group. Please, feel free to add yourself to authors.

It is less than 300 lines. SBT source code is really simple to read and simple to extend :-)

This readme cover all plugin functionality, even if it is written in broken english (would you have preferred well written russian :-) Please, correct it, if you find something inappropriate.

Adding to your project

Create a

  • project/plugins/project/Build.scala - for older simple-build-tool
  • project/project/Build.scala - for newer simple-build-tool

file that looks like the following:

    import sbt._
    object PluginDef extends Build {
      override def projects = Seq(root)
      lazy val root = Project("plugins", file(".")) dependsOn(ssa)
      lazy val ssa = uri("git://github.com/sbt-android-mill/sbt-source-align.git#0.2")
    }

You may find more information about Build.scala at https://github.com/harrah/xsbt/wiki/Plugins

Then in your build.sbt file, simply add:

    sbt.source.align.SSA.ssaSettings

You may find sample project at src/sbt-test/source-align/simple

Usage

By default aligned jars saved to target/align Change update-align-path or add to your project something like

    ssaPath <<= (target in LocalRootProject) map { _ / "my-align-dir" }

or

    ssaPath <<= (baseDirectory) (_ / "my-aling-dir")

You may skip dependencies with ssa-skip-organization. If you got something like this

[trace] Stack trace suppressed: run last *:update-align for the full output.
[error] (*:update-align) java.lang.IllegalArgumentException: Cannot add dependency 'org.scala-lang#scala-library;2.9.2' to configuration 'provided' of module sbt.android.mill#sbt-android-mill$sbt;0.1-SNAPSHOT because this configuration doesn't exist!

add an exception to alignSkipOrganizationin your build.sbt

    ssaSkipOrganization += "org.scala-lang"

By default ssaSkipOrganization contains "org.scala-lang" and "org.scala-sbt". This setting affects library-dependencies only.

Align project dependencies

  1. Download all project and SBT dependencies, sources, javadocs

  2. Merge code jars with sources

  3. Align sources inside jars

SBT task name

> dependency-fetch-align

It is very useful to develop simple-build-tool plugins. Most SBT source code are unaligned. Original sources saved in root directory of jar, but it binded to different packages. This situation prevent source code lookup in most common situations. This is very annoying. SBT *-sources.jar was mostly useless in development before sbt-source-align ;-)

Fetch project dependencies with sources to '123' directory

> set ssaPath <<= baseDirectory map {(f) => f / "123" }
> dependency-fetch-with-sources

Internals

Options

  • ssa-fetch-path (ssaPath) - Target directory for dependency jars
  • ssa-skip-organization (ssaSkipOrganization) - Ignore dependency jars with paticular sbt.ModuleID
  • ssa-ignore-configurations (ssaIgnoreConfigurations) - Ignore configurations while lookup, 'test' for example

Tasks

  • dependency-fetch - Fetch dependency code jars. Save result to target directory
  • dependency-fetch-with-sources - Fetch dependency code and source jars. Save result to target directory
  • dependency-fetch-align - Fetch dependency code and source jars, merge them. Save result to target directory

Demonstration

Simple-build-tool plugin with Eclipse in 5 Minutes on Youtube

HD quality Simple-build-tool plugin with Eclipse in 5 Minutes - 60,5Mb

Developing simple SBT plugin in Eclipse IDE with

  • autocomplete
  • sources lookup
  • debug SBT tasks in Eclipse debugger (I asked about debugging in SBT mailing list, but no one can answer. I suspect that others people for debug sbt plugins used print or s.log.debug. lol ;-) )
  • implicit lookup
  • types lookup
  • refactoring support

... and bunch of other standard features

PS sbt-source-align obsoletes capabilities provided by sbt deliver-local + IvyDE or sbteclipse plugin

Authors

  • Alexey Aksenov

License

The sbt-source-align is licensed to you under the terms of the Apache License, version 2.0, a copy of which has been included in the LICENSE file.

Copyright

Copyright © 2012 Alexey B. Aksenov/Ezh. All rights reserved.

About

simple plugin for simple-build-tool, compose code and source jars, align sources inside for IDE

Resources

License

Stars

Watchers

Forks

Packages

No packages published