Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to programmatically define projects: Seq[Project] #2532

Closed
fommil opened this issue Apr 1, 2016 · 11 comments
Closed

Ability to programmatically define projects: Seq[Project] #2532

fommil opened this issue Apr 1, 2016 · 11 comments
Assignees
Projects
Milestone

Comments

@fommil
Copy link
Contributor

fommil commented Apr 1, 2016

With the new move to .sbt files, we will lack a key feature which is the ability to transform Seq[Project].

A typical usecase for this is when the build structure is generated (perhaps translated from another tool) and the owner of the sbt build scripts can only apply transformations to the Project object rather than edit the build.sbt directly.

I feel this is a blocker for 1.0.

@dwijnand
Copy link
Member

dwijnand commented Apr 1, 2016

@Duhemm has explored trying to port this in #2183.

I've needed access to .projects to solve the use case details in http://stackoverflow.com/a/31061013/463761.

Also I think this might be a blocker for https://github.com/sbt/sbt-pom-reader.

@fommil
Copy link
Contributor Author

fommil commented Apr 1, 2016

That's interesting. It is explicitly read-only, but this ticket is to allow the "mutation" of Seq[Project].

Somewhat related is the ability to specify / select the rootProject from the transformed Seq[Project].

@dwijnand
Copy link
Member

dwijnand commented Apr 1, 2016

Yes, that pull requested morphed into read-only.

But I'm agreeing with you, there are use-cases that require programmatically defining projects, for which, to my knowledge, there's no facility currently in 1.0.

@fommil
Copy link
Contributor Author

fommil commented May 13, 2016

@eed3si9n can this please be considered for 1.0? This one really is a blocker for me at work in moving to 1.0.

@dwijnand dwijnand changed the title Transform Project Ability to programmatically define projects: Seq[Project] Jul 8, 2016
@dwijnand dwijnand added this to the 1.0.0 milestone Jul 8, 2016
@dwijnand dwijnand self-assigned this Jul 12, 2016
@SethTisue
Copy link
Member

for MiMa to convert to build.sbt style is blocked by this; the MiMa build generates test projects on the fly (one per subdirectory of reporter/functional-tests/src/test) and then adds them to the build via override lazy val projects = ...

@eed3si9n eed3si9n assigned eed3si9n and unassigned dwijnand Aug 27, 2016
eed3si9n added a commit to eed3si9n/sbt that referenced this issue Aug 27, 2016
This adds support to generate synthetic subprojects from an auto plugin.

In addition, a method called `projectOrigin` is added to distinguish
Organic, BuildExtra, ProjectExtra, and GenericRoot.
eed3si9n added a commit to eed3si9n/sbt that referenced this issue Aug 27, 2016
This adds support to generate synthetic subprojects from an auto plugin.

In addition, a method called `projectOrigin` is added to distinguish
Organic, BuildExtra, ProjectExtra, and GenericRoot.
dwijnand pushed a commit to dwijnand/sbt that referenced this issue Sep 28, 2016
This adds support to generate synthetic subprojects from an auto plugin.

In addition, a method called `projectOrigin` is added to distinguish
Organic, BuildExtra, ProjectExtra, and GenericRoot.

Forward-port of sbt#2717 and sbt#2738
eed3si9n added a commit that referenced this issue Sep 29, 2016
FPORT: Add extraProjects adn derivedProjects. Fixes #2532
@fommil
Copy link
Contributor Author

fommil commented Sep 29, 2016

Nice! I'll try this out sometime

@dwijnand
Copy link
Member

@fommil It'll be part of 0.13.13 (and available in the 0.13.13-RC2 pre-release)

@SethTisue
Copy link
Member

SethTisue commented Oct 17, 2016

@dwijnand to help you test the fix, could I interest you in submitting a PR upgrading MiMa to use 0.13.13-RCx and addressing https://github.com/typesafehub/migration-manager/blob/7c956c57ae137dbfc729db54f5d35d33b9436347/project/Build.scala#L85-L87?

“to help you”, my god, how transparent. see, it's all about you

@dwijnand
Copy link
Member

Sure.

@Atry
Copy link
Contributor

Atry commented Mar 24, 2017

Is there a corresponding DslEntry for extraProjects method?

@Atry
Copy link
Contributor

Atry commented Mar 24, 2017

aggregate and dependsOn is similar, however they always error for inline projects:

dependsOn(Project("aaa", file("yyy")), Project("xxx2", file("yyy2")))
java.lang.RuntimeException: No project 'aaa' in 'file:/private/tmp/xxx/'.
Valid project IDs: xxx
	at scala.sys.package$.error(package.scala:27)
	at sbt.Load$$anonfun$checkAll$2$$anonfun$apply$16.apply(Load.scala:401)
	at sbt.Load$$anonfun$checkAll$2$$anonfun$apply$16.apply(Load.scala:396)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at sbt.Load$$anonfun$checkAll$2.apply(Load.scala:396)
	at sbt.Load$$anonfun$checkAll$2.apply(Load.scala:396)
	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
	at scala.collection.immutable.Map$Map1.foreach(Map.scala:109)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
	at sbt.Load$.checkAll(Load.scala:396)
	at sbt.Load$.loadURI(Load.scala:321)
	at sbt.Load$.load(Load.scala:316)
	at sbt.Load$.load(Load.scala:305)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.apply(Load.scala:146)
	at sbt.Load$.defaultLoad(Load.scala:39)
	at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:496)
	at sbt.BuiltinCommands$.doLoadProject(Main.scala:496)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:488)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:488)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$.process(Command.scala:93)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.State$$anon$1.process(State.scala:184)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.MainLoop$.next(MainLoop.scala:96)
	at sbt.MainLoop$.run(MainLoop.scala:89)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
	at sbt.Using.apply(Using.scala:24)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
	at sbt.MainLoop$.runLogged(MainLoop.scala:22)
	at sbt.StandardMain$.runManaged(Main.scala:57)
	at sbt.xMain.run(Main.scala:29)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
	at xsbt.boot.Launch$.run(Launch.scala:109)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
	at xsbt.boot.Launch$.launch(Launch.scala:117)
	at xsbt.boot.Launch$.apply(Launch.scala:18)
	at xsbt.boot.Boot$.runImpl(Boot.scala:41)
	at xsbt.boot.Boot$.main(Boot.scala:17)
	at xsbt.boot.Boot.main(Boot.scala)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

5 participants