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 pack test scoped jars #110 #324

Merged
merged 2 commits into from
Nov 24, 2022

Conversation

Marc-Ducret
Copy link
Contributor

Using Def.derive allows to propagate Compile/Test configurations.

Therefore Compile / pack packs without the tests and Test / pack packs with the tests.

@xerial
Copy link
Owner

xerial commented Nov 21, 2022

Interesting. Just from curiosity, could you tell me how you use the packed test code?

@xerial
Copy link
Owner

xerial commented Nov 21, 2022

It seems this forces the user to always select Compile or Test target for the pack command. Any idea so as not to introduce such a breaking change?

@Marc-Ducret
Copy link
Contributor Author

Interesting. Just from curiosity, could you tell me how you use the packed test code?

We use ZIO-test, therefore each test suite is a runnable main class. Also we have a custom RunAllSpecs main that uses reflection to run all test suites in our package in the classpath.

Then we simply add Test / packMain := Map("app-test" -> "com.ayolab.testing.RunAllSpecs") to build.sbt .

It seems this forces the user to always select Compile or Test target for the pack command. Any idea so as not to introduce such a breaking change?

Running sbt pack does still fallback on Compile / pack as expected. Though I pushed a commit to pass the tests.
The only test I had to change is archive-modules, I had to add > packagedArtifacts, and I don't understand how it was automatically called before.

@xerial xerial merged commit 947dd59 into xerial:master Nov 24, 2022
@xerial
Copy link
Owner

xerial commented Nov 24, 2022

OK. Let me merge. Will release a new version soon

@xerial
Copy link
Owner

xerial commented Nov 24, 2022

@Marc-Ducret Released 0.17, but it seems projects using sbt-pack is broken like this. wvlet/airframe#2584

I guess some tests are missing

@xerial
Copy link
Owner

xerial commented Nov 24, 2022

ok. I've found a fix. If pack task is overwritten, it needs to be properly scoped like Compile / pack := ....

ckipp01 added a commit to ckipp01/dotty that referenced this pull request May 11, 2023
This pr bumps sbt-pack to the latest 0.17 and also accounts for a
breaking change that was introduced in
xerial/sbt-pack#324 meaning that `pack` now must
be scoped.
nicolasstucki added a commit to scala/scala3 that referenced this pull request May 12, 2023
This pr bumps sbt-pack to the latest 0.17 and also accounts for a
breaking change that was introduced in
xerial/sbt-pack#324 meaning that `pack` now must
be scoped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants