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

Module-level build settings #18

Closed
4 of 5 tasks
tindzk opened this issue Jul 11, 2019 · 6 comments · Fixed by #45
Closed
4 of 5 tasks

Module-level build settings #18

tindzk opened this issue Jul 11, 2019 · 6 comments · Fixed by #45
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tindzk
Copy link
Owner

tindzk commented Jul 11, 2019

Various build settings such as the resolvers, compiler versions (Scala, Scala.js, Scala Native), compiler flags and test frameworks are defined only on the project level.

  • Define these settings on seed.model.Module too
  • When importing projects, copy over the new settings as done in Transitive project-defined compilerDeps #17
  • parseBuildToml should return Either[Codec.Error, Map[String, Build.Module]]
  • Access build settings from modules instead of seed.model.Build
  • Update README

See also #15 (comment).

@nafg
Copy link
Contributor

nafg commented Jul 12, 2019

I just hit this. I need custom scalaOptions, because scalajs wants me to add the equivalent of (in sbt) scalacOptions += "-P:scalajs:sjsDefinedByDefault".

@tindzk
Copy link
Owner Author

tindzk commented Jul 12, 2019

Thanks. Good to know there is a valid use case for this.

@nafg nafg mentioned this issue Jul 15, 2019
@megri
Copy link
Contributor

megri commented Jul 19, 2019

I feel like having a go at this!

@tindzk
Copy link
Owner Author

tindzk commented Jul 19, 2019

Perfect. It is all yours.

While working on #29, I realised we should copy the project/module settings also to the platform-specific modules. So as part of loading the build file, this module:

[module.macros]
targets = ["jvm", "js"]
compilerDeps = [["org.scalamacros", "paradise", "2.1.1", "full"]]

would get translated to:

[module.macros.jvm]
compilerDeps = [["org.scalamacros", "paradise", "2.1.1", "full"]]

[module.macros.js]
compilerDeps = [["org.scalamacros", "paradise", "2.1.1", "full"]]

The upside is that it would simplify the generation logic because we will only have to check one module (and its dependencies).

@tindzk tindzk added the enhancement New feature or request label Jul 19, 2019
@tindzk tindzk added this to the 0.1.5 milestone Jul 19, 2019
@tindzk
Copy link
Owner Author

tindzk commented Aug 3, 2019

@megri Have you already started working on this issue? If not, I could take it over and implement the changes next week.

@tindzk tindzk self-assigned this Aug 7, 2019
tindzk added a commit that referenced this issue Aug 8, 2019
Centralise the logic for inheriting settings defined on the project
level or on base modules. Inheritance is now performed during
loading of build files. As a consequence, many functions do not need
to be aware of the project or the parent module anymore which
greatly simplifies the code for generating Bloop and IDEA
configurations.

Also, several missing fields which were only available on the
project-level were added to `Module`.

Closes #18.
@megri
Copy link
Contributor

megri commented Aug 8, 2019

@tindzk Oh sorry, I totally missed the notification on this. I started experimenting but didn't get too far, and then day job came between. Great to see progress :)

tindzk added a commit that referenced this issue Aug 14, 2019
Centralise the logic for inheriting settings from the project
section and base modules. The inheritance step is now performed when
build files are loaded. As a consequence, many functions do not need
to take a reference to the project definition or parent modules
anymore. This greatly simplifies the code for generating Bloop/IDEA
configurations, and makes the logic less error-prone.

The build's project section is now entirely optional and its fields
can be set on modules instead. Now, Scala options can be extended in
platform modules, for example to set additional flags required by
the Scala.js compiler such as `-P:scalajs:sjsDefinedByDefault`.

Furthermore, every module is compiled with the Scala version and the
options it was defined with. Therefore, it is not possible to depend
on modules which have an incompatible Scala version. For example,
including a 2.12 module in a 2.13 module will trigger an error.

Closes #18.
tindzk added a commit that referenced this issue Aug 14, 2019
Centralise the logic for inheriting settings from the project
section and base modules. The inheritance step is now performed when
loading the build file. As a consequence, many functions do not need
to take a reference to the project definition or parent modules
anymore. This greatly simplifies the code for generating Bloop/IDEA
configurations, and makes the logic less error-prone.

The build file's project section is now entirely optional and its
values can be set on modules instead. Now, Scala options can be
extended in platform modules, for example to set additional flags
required by the Scala.js compiler such as
`-P:scalajs:sjsDefinedByDefault`.

Furthermore, every module is compiled with the Scala version and the
options it was defined with. Therefore, it is not possible to depend
on modules anymore which have an incompatible Scala version. For
example, including a 2.12 module in a 2.13 module will trigger an
error.

Closes #18.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants