Why packageSrc is not depend on managedSources ?

129 views
Skip to first unread message

Kenji Yoshida

unread,
Nov 29, 2012, 7:35:05 AM11/29/12
to simple-b...@googlegroups.com
Why packageSrc Task is not depend on managedSources Task?
Is there any reason not depend ?

eugene yokota

unread,
Nov 29, 2012, 7:19:03 PM11/29/12
to simple-b...@googlegroups.com
Here are inspect tree outputs for package-src and sources used by compile:

helloworld> inspect tree package-src
[info] compile:package-src = Task[java.io.File]
[info]   +-compile:package-src::package-configuration = Task[sbt.Package$Configuration]
[info]   | +-compile:package-src::mappings = Task[scala.collection.Seq[scala.Tuple2[java.io.File, java.lang.String]]]
[info]   | | +-compile:unmanaged-sources = Task[scala.collection.Seq[java.io.File]]
[info]   | | +-compile:unmanaged-source-directories = List(/Users/eed3si9n/work/helloworld/src/main/scala, /Users/eed3si9n/work/helloworld/src/main/java)
[info]   | | +-*:base-directory = /Users/eed3si9n/work/helloworld
[info]   | | +-compile:unmanaged-resource-directories = List(/Users/eed3si9n/work/helloworld/src/main/resources, /Users/eed3si9n/work/helloworld/foo)
[info]   | | +-compile:unmanaged-resources = Task[scala.collection.Seq[java.io.File]]
[info]   | | 
[info]   | +-compile:package-src::artifact-path = target/scala-2.9.1/helloworld_2.9.1-0.1-SNAPSHOT-sources.jar
[info]   | | +-*:cross-target = target/scala-2.9.1
[info]   | | +-*:scala-version = 2.9.1
[info]   | | +-*/*:artifact-name = <function3>
[info]   | | +-compile:package-src::artifact = Artifact(helloworld,src,jar,Some(sources),List(sources),None,Map())
[info]   | | | +-*/*:package-src::artifact-classifier = Some(sources)
[info]   | | | +-compile:configuration = compile
[info]   | | | 
[info]   | | +-*:project-id = production:helloworld:0.1-SNAPSHOT
[info]   | | +-*/*:scala-binary-version = 2.9.1
[info]   | | 
[info]   | +-compile:package-src::package-options = Task[scala.collection.Seq[sbt.PackageOption]]
[info]   |   +-*:name = helloworld
[info]   |   +-*/*:version = 0.1-SNAPSHOT
[info]   |   +-*:organization-name = production
[info]   |   
[info]   +-compile:package-src::cache-directory = target/scala-2.9.1/cache/default-b65acd/compile/for_package-src
[info]   +-compile:package-src::streams = Task[sbt.std.TaskStreams[sbt.Init$ScopedKey[_ <: Any]]]
[info]     +-*/*:streams-manager = Task[sbt.std.Streams[sbt.Init$ScopedKey[_ <: Any]]]
[info] 

helloworld> inspect tree sources
[info] compile:sources = Task[scala.collection.Seq[java.io.File]]
[info]   +-compile:unmanaged-sources = Task[scala.collection.Seq[java.io.File]]
[info]   | +-compile:unmanaged-source-directories = List(/Users/eed3si9n/work/helloworld/src/main/scala, /Users/eed3si9n/work/helloworld/src/main/java)
[info]   | | +-compile:scala-source = src/main/scala
[info]   | | | +-compile:source-directory = src/main
[info]   | | |   +-*:source-directory = src
[info]   | | |   | +-*:base-directory = /Users/eed3si9n/work/helloworld
[info]   | | |   |   +-*:this-project = Project(id: default-b65acd, base: /Users/eed3si9n/work/helloworld, aggregate: List(), dependencies: List(), delegates: List(), configurations: List(compile, runtime, test, provided, optional))
[info]   | | |   |   
[info]   | | |   +-compile:configuration = compile
[info]   | | |   
[info]   | | +-compile:java-source = src/main/java
[info]   | |   +-compile:source-directory = src/main
[info]   | |     +-*:source-directory = src
[info]   | |     | +-*:base-directory = /Users/eed3si9n/work/helloworld
[info]   | |     |   +-*:this-project = Project(id: default-b65acd, base: /Users/eed3si9n/work/helloworld, aggregate: List(), dependencies: List(), delegates: List(), configurations: List(compile, runtime, test, provided, optional))
[info]   | |     |   
[info]   | |     +-compile:configuration = compile
[info]   | |     
[info]   | +-compile:unmanaged-sources::include-filter = sbt.SimpleFilter@23020bf9
[info]   | | +- = 
[info]   | | 
[info]   | +-*:base-directory = /Users/eed3si9n/work/helloworld
[info]   | +-compile:unmanaged-sources::exclude-filter = sbt.SimpleFileFilter@5b601a63
[info]   | | +- = 
[info]   | | 
[info]   | +-*/*:sources-in-base = true
[info]   | 
[info]   +-compile:managed-sources = Task[scala.collection.Seq[java.io.File]]
[info]     +-compile:source-generators = List(Task((task-definition-key: ScopedKey(Scope(Select(ProjectRef(file:/Users/eed3si9n/work/helloworld/,default-b65acd)),Global,Global,Global),buildinfo))), Task((task-definition-key: ScopedKe..
[info]       +-*:buildinfo = Task[scala.collection.Seq[java.io.File]]
[info]       | +-*:this-project-ref = ProjectRef(file:/Users/eed3si9n/work/helloworld/,default-b65acd)
[info]       | +-*:buildinfo-keys = List(Setting(sbt.SettingKey$$anon$4@7dd26a3e), Setting(sbt.SettingKey$$anon$4@13d4cfb), Setting(sbt.SettingKey$$anon$4@5f88f35f), Setting(sbt.SettingKey$$anon$4@182212f9), Setting(sbt.SettingKey$$a..
[info]       | +-*:buildinfo-object = BuildInfo
[info]       | +-compile:source-managed = target/scala-2.9.1/src_managed/main
[info]       | | +-*:source-managed = target/scala-2.9.1/src_managed
[info]       | | | +-*:cross-target = target/scala-2.9.1
[info]       | | |   +-*:target = target
[info]       | | |   | +-*:base-directory = /Users/eed3si9n/work/helloworld
[info]       | | |   |   +-*:this-project = Project(id: default-b65acd, base: /Users/eed3si9n/work/helloworld, aggregate: List(), dependencies: List(), delegates: List(), configurations: List(compile, runtime, test, provided, optiona..
[info]       | | |   |   
[info]       | | |   +-*/*:scala-binary-version = 2.9.1
[info]       | | |   +-*/*:sbt-plugin = false
[info]       | | |   +-*/*:cross-paths = true
[info]       | | |   +-*/*:sbt-binary-version = 0.12
[info]       | | |   
[info]       | | +-compile:configuration = compile
[info]       | | 
[info]       | +-*/*:state = Task[sbt.State]
[info]       | +-*:buildinfo-package = buildinfo
[info]       | 
[info]       +-*:scalashim = Task[scala.collection.Seq[java.io.File]]
[info]         +-compile:source-managed = target/scala-2.9.1/src_managed/main
[info]         | +-*:source-managed = target/scala-2.9.1/src_managed
[info]         | | +-*:cross-target = target/scala-2.9.1
[info]         | |   +-*:target = target
[info]         | |   | +-*:base-directory = /Users/eed3si9n/work/helloworld
[info]         | |   |   +-*:this-project = Project(id: default-b65acd, base: /Users/eed3si9n/work/helloworld, aggregate: List(), dependencies: List(), delegates: List(), configurations: List(compile, runtime, test, provided, optiona..
[info]         | |   |   
[info]         | |   +-*/*:scala-binary-version = 2.9.1
[info]         | |   +-*/*:sbt-plugin = false
[info]         | |   +-*/*:cross-paths = true
[info]         | |   +-*/*:sbt-binary-version = 0.12
[info]         | |   
[info]         | +-compile:configuration = compile
[info]         | 
[info]         +-*:scala-version = 2.9.1
[info]         +-*:scalashim-package = scalashim
[info]         

package-src is missing the generated code by plugins like sbt-buildinfo, but also code from java-source.

-eugene

eugene yokota

unread,
Nov 29, 2012, 8:04:10 PM11/29/12
to simple-b...@googlegroups.com
In the spirit of archival purpose for long after people have forgotten which version control/branch/tool the build has come from,
 could we include both compile:sources (scala, java, and generated code) and all build resources (*.sbt, project/**)?

With maven, pom.xml is the build file, so all it's missing is sources. With sbt, we don't typically upload our build script to repos, but we could.

-eugene

Mark Harrah

unread,
Dec 3, 2012, 8:37:37 AM12/3/12
to simple-b...@googlegroups.com
Hey Eugene,

On Thu, 29 Nov 2012 17:04:10 -0800 (PST)
eugene yokota <eed3...@gmail.com> wrote:

> In the spirit of archival purpose for long after people have forgotten
> which version control/branch/tool the build has come from,
> could we include both compile:sources (scala, java, and generated code)
> and all build resources (*.sbt, project/**)?
>
> With maven, pom.xml is the build file, so all it's missing is sources. With
> sbt, we don't typically upload our build script to repos, but we could.

Java code should be included via unmanaged-source-dirctories, which includes both Java and Scala directories. Whether to include build files or managed sources would depend on what the original purpose of the source jar is. If it is mainly for attaching sources in an IDE, we should include managed sources, but not the build file. If it is supposed to be to archive a project, I don't think it makes sense to include both the build file and the managed sources, since the build file would generate the managed sources. I'm not sure the project archive mode makes sense as the default, since a multi-project build would need to be packaged into a single jar to work.

-Mark
> >> Why packageSrc<https://github.com/harrah/xsbt/blob/v0.12.1/main/Keys.scala#L168>Task is not depend on
> >> managedSources<https://github.com/harrah/xsbt/blob/v0.12.1/main/Keys.scala#L89>Task?
> >> Is there any reason not depend ?
> >>
> >>
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/jcbhpJFSMqAJ.
> 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.
>

eugene yokota

unread,
Dec 3, 2012, 9:21:55 AM12/3/12
to simple-b...@googlegroups.com

"Build a JAR of sources for use in IDEs and distribution to the repository."

The fact that it explicitly mentions both IDE *and* distribution to the repository can be interpreted as follows:
1. Primarily it's for locally generating source jar for IDE/debugging by the authors and end users.
2. The project authors could also use source jar as the means of source distribution (I suppose for IDE, GPL compliance, source deps, etc).

But that's just what they do. sbt 0.13 can do whatever.
 
-eugene

Mark Harrah

unread,
Dec 3, 2012, 9:51:16 AM12/3/12
to simple-b...@googlegroups.com
On Mon, 3 Dec 2012 09:21:55 -0500
eugene yokota <eed3...@gmail.com> wrote:

> http://maven.apache.org/plugins/index.html says:
>
> "Build a JAR of sources for use in IDEs and distribution to the repository."
>
> The fact that it explicitly mentions both IDE *and* distribution to the
> repository can be interpreted as follows:
> 1. Primarily it's for locally generating source jar for IDE/debugging by
> the authors and end users.
> 2. The project authors could also use source jar as the means of source
> distribution (I suppose for IDE, GPL compliance, source deps, etc).
>
> But that's just what they do. sbt 0.13 can do whatever.

If it is going to have a different purpose than it does in Maven, it should be a different artifact/classifier and a different task. GPL compliance has different requirements than sources for an IDE. Say there is a preprocessor on Scala sources. You'd want the processed Scala sources for an IDE but you'd probably need the originals for GPL compliance. Also, there is still the problem with multiple projects and you'd only want a single jar published for the whole build.

-Mark

> -eugene
>
> On Mon, Dec 3, 2012 at 8:37 AM, Mark Harrah <dmha...@gmail.com> wrote:
>
> > Hey Eugene,
> >
> > On Thu, 29 Nov 2012 17:04:10 -0800 (PST)
> > eugene yokota <eed3...@gmail.com> wrote:
> >
> > > In the spirit of archival purpose for long after people have forgotten
> > > which version control/branch/tool the build has come from,
> > > could we include both compile:sources (scala, java, and generated code)
> > > and all build resources (*.sbt, project/**)?
> > >
> > > With maven, pom.xml is the build file, so all it's missing is sources.
> > With
> > > sbt, we don't typically upload our build script to repos, but we could.
> >
> > Java code should be included via unmanaged-source-dirctories, which
> > includes both Java and Scala directories. Whether to include build files
> > or managed sources would depend on what the original purpose of the source
> > jar is. If it is mainly for attaching sources in an IDE, we should include
> > managed sources, but not the build file. If it is supposed to be to
> > archive a project, I don't think it makes sense to include both the build
> > file and the managed sources, since the build file would generate the
> > managed sources. I'm not sure the project archive mode makes sense as the
> > default, since a multi-project build would need to be packaged into a
> > single jar to work.
> >
> > -Mark
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
Reply all
Reply to author
Forward
0 new messages