[0.9] Source directories

229 views
Skip to first unread message

SorenMat

unread,
Mar 15, 2011, 1:44:03 PM3/15/11
to simple-build-tool
Hi,

How do I override / append to the src directories in 0.9. Both in the
Basic format, and the full format ?

Br, Soren

Mark Harrah

unread,
Mar 15, 2011, 6:24:28 PM3/15/11
to simple-b...@googlegroups.com
Hi Soren,

The full format is the same as the basic format except that you
explicitly construct the Seq of settings. See the Project Settings
section of [1]. If you are asking because that wasn't clear, I can
provide a direct comparison.

What source directories do you want to override?

-Mark

[1] https://github.com/harrah/xsbt/wiki/FullConfiguration

> Br, Soren
>
> --
> You received this message because you are subscribed to the Google Groups
> "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to
> simple-build-t...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/simple-build-tool?hl=en.
>
>

SorenMat

unread,
May 5, 2011, 5:38:01 AM5/5/11
to simple-build-tool
The current config excepts a source layout with /src/main/java as the
java source directory. But what if i have java sources in /src and /
src_test ?

I've tried the following with nu success :(

import sbt._
import Keys._
import java.io.File

object MyBuild extends Build {

lazy val projects = Seq(root)


lazy val root = Project("root", file("."),
settings = Defaults.defaultSettings ++ Seq(name := "Foundation",
version := "1.0",sourceDirectories := Seq(new File("src"), new
File("src_test") )
)
}

On Mar 16, 12:24 am, Mark Harrah <dmhar...@gmail.com> wrote:
> Hi Soren,
>
> On 3/15/11, SorenMat <li...@software.dk> wrote:
>
> > Hi,
>
> > How do I override / append to the srcdirectoriesin 0.9. Both in the
> > Basic format, and the full format ?
>
> The full format is the same as the basic format except that you
> explicitly construct the Seq of settings.  See the Project Settings
> section of [1].  If you are asking because that wasn't clear, I can
> provide a direct comparison.
>
> Whatsourcedirectoriesdo you want to override?

Mark Harrah

unread,
May 8, 2011, 10:26:33 PM5/8/11
to simple-b...@googlegroups.com
On 5/5/11, SorenMat <li...@software.dk> wrote:
> The current config excepts a source layout with /src/main/java as the
> java source directory. But what if i have java sources in /src and /
> src_test ?
>
> I've tried the following with nu success :(
>
> import sbt._
> import Keys._
> import java.io.File
>
> object MyBuild extends Build {
>
> lazy val projects = Seq(root)
>
> lazy val root = Project("root", file("."),
> settings = Defaults.defaultSettings ++ Seq(name := "Foundation",
> version := "1.0",sourceDirectories := Seq(new File("src"), new
> File("src_test") )
> )
> }

scalaSource in Compile <<= baseDirectory(_ / "src")

Substitute Compile with Test to set the test directory. For java
sources, the key is javaSource.

baseDirectory(_ / "src") expands to:

baseDirectory apply { (baseDir: File) =>
baseDir / "src"
}

-Mark

As a side note, I think it will be good style (for clarity) to write:

Project("root", file("."), settings = Defaults.defaultSettings ++ mySettings )

or the equivalent:

Project("root", file(".") ) settings( mySettings : _*)

where
def mySettings = Seq(
name := ...
)

I'll update the documentation on this when I get a chance.

SorenMat

unread,
May 23, 2011, 3:09:02 AM5/23/11
to simple-build-tool
Cool, that works !

But what if i have multiple source directories like src, src_model and
src_view folders. The scalaSource in Compile <<=, doesn't seem to take
a Seq ?


On May 9, 4:26 am, Mark Harrah <dmhar...@gmail.com> wrote:
> On 5/5/11, SorenMat <li...@software.dk> wrote:
>
>
>
>
>
> > The current config excepts asourcelayout with /src/main/java as the
> > javasourcedirectory. But what if i have java sources in /src and /

Mark Harrah

unread,
May 23, 2011, 10:20:50 AM5/23/11
to simple-b...@googlegroups.com
On Mon, 23 May 2011 00:09:02 -0700 (PDT)
SorenMat <li...@software.dk> wrote:

> Cool, that works !
>
> But what if i have multiple source directories like src, src_model and
> src_view folders. The scalaSource in Compile <<=, doesn't seem to take
> a Seq ?

In that case, use unmanagedSourceDirectories directly. Its default definition concatenates scalaSource and javaSource, which are basically convenience settings. unmanagedSourceDirectories is the definitive setting to override.

-Mark

Reply all
Reply to author
Forward
0 new messages