Skip to content

Use standard sbt#875

Merged
jorgeazevedo merged 3 commits intomainfrom
ja-use-standard-sbt
Mar 20, 2026
Merged

Use standard sbt#875
jorgeazevedo merged 3 commits intomainfrom
ja-use-standard-sbt

Conversation

@jorgeazevedo
Copy link
Copy Markdown
Contributor

@jorgeazevedo jorgeazevedo commented Feb 24, 2026

What does this change?

This retires the old sbt wrapper script and switch to using standard sbt.

This required finding a way to apply the same JVM options (which I'm not really sure are necessary tbh but I found it easier to just maintain it as is) and specifying the local config file in a different way.

There a few different ways to specify this config file, but I ended up opting for an identical implementation to frontend https://github.com/guardian/frontend/blob/436fee5dd6787fcdff9f68bb2699d85d7c89d049/build.sbt#L167

Note: the original debug call specified -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1056", which is no longer necessary with modern sbt as the -jvm-debug flag already sets these exact properties.

How has this change been tested?

The application boots properly when running locally

@jorgeazevedo jorgeazevedo added the maintenance Departmental tracking: maintenance work, not a fix or a feature label Feb 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

@jorgeazevedo jorgeazevedo force-pushed the ja-use-standard-sbt branch 4 times, most recently from 6328e32 to 00de658 Compare February 24, 2026 12:00
@jorgeazevedo jorgeazevedo changed the title chore: Use standard sbt Use standard sbt Feb 25, 2026
@jorgeazevedo jorgeazevedo marked this pull request as ready for review February 25, 2026 16:51
@jorgeazevedo jorgeazevedo requested review from a team as code owners February 25, 2026 16:51
@jorgeazevedo jorgeazevedo marked this pull request as draft February 25, 2026 17:19
@jorgeazevedo jorgeazevedo marked this pull request as ready for review February 25, 2026 17:27
Copy link
Copy Markdown
Contributor

@adamnfish-gu adamnfish-gu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor questions, but great to tidy this up.

@@ -0,0 +1,3 @@
-Xms1024M
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test it without these, I doubt they're required! Might be simpler to omit them if they aren't essential, but no harm.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think these are actually needed, but I thought it'd be simpler to just leave them in rather than to understand why they were put there in the first place and test if the application works as expected etc

build.sbt Outdated

Test / javaOptions += "-Dconfig.file=conf/application.test.conf"

Runtime / javaOptions += s"-Dconfig.file=${System.getProperty("user.home")}/.gu/amiable.local.conf"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Runtime affects Test as well so I'm not 100% sure how these two settings interact? That said, the config isn't currently loaded in the tests so this isn't a huge deal either way as far as I can tell.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great catch! I didn't realise these interact with each other. Test ends up getting a duplicate config.file option

$ sbt 'show Runtime / javaOptions'
[...]
[info] * -Dconfig.file=~/.gu/amiable.local.conf
$ sbt 'show Test / javaOptions'
[...]
[info] * -Dconfig.file=~/.gu/amiable.local.conf
[info] * -Dconfig.file=conf/application.test.conf

What do you think of using PlayKeys.devSettings instead?

So something like

PlayKeys.devSettings += "config.file" -> s"${System.getProperty("user.home")}/.gu/amiable.local.conf"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamnfish-gu any word on this?

Remove the custom ./sbt script that bundled sbt-launch.jar and replace
it with the standard sbt command. JVM memory options are now configured
in .jvmopts, and the local dev config file is set via build.sbt
(run / javaOptions).

This aligns with modern sbt best practices where sbt is installed on the
machine and fetches the right version from project/build.properties.
@jorgeazevedo jorgeazevedo enabled auto-merge March 20, 2026 10:15
@jorgeazevedo jorgeazevedo merged commit c4c2dd1 into main Mar 20, 2026
6 checks passed
@jorgeazevedo jorgeazevedo deleted the ja-use-standard-sbt branch March 20, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants