sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.59k stars 437 forks source link

fix: JavaAppPackaging dependencies on Bash and Bat script plugins #1559

Closed jakubjanecek closed 7 months ago

jakubjanecek commented 9 months ago

Use of bashScriptExtraDefines stopped working since sbt 1.9.7 which brought different order of auto plugins application (https://github.com/sbt/sbt/commit/7beb23e818a181e2980da7261e6300d1d50e91da). The reason seems to be that JavaAppPackaing plugin does not depend on BashStartScriptPlugin directly. Similar issue as encountered here: https://github.com/sbt/sbt-javaagent/issues/28#issuecomment-1778234652

lightbend-cla-validator commented 9 months ago

Hi @jakubjanecek,

Thank you for your contribution! We really value the time you've taken to put this together.

We see that you have signed the Lightbend Contributors License Agreement before, however, the CLA has changed since you last signed it. Please review the new CLA and sign it before we proceed with reviewing this pull request:

http://www.lightbend.com/contribute/cla

jakubjanecek commented 9 months ago

I just signed the CLA.

jakubjanecek commented 7 months ago

@muuki88 Can you please have a look at this PR so that we can merge it? Thanks.

muuki88 commented 7 months ago

Thanks for the ping. Seems I have missed it.

jakubjanecek commented 7 months ago

@muuki88 Thanks. The build does not pass and I think it's because the tests run on older versions of sbt (there is a cross compilation to sbt 1.1.6) and which is not compatible with my change. Is it OK to remove the cross-compilation and update the tests to the latest version?

muuki88 commented 7 months ago

@jakubjanecek the new dependencies seem to cause an error

[info] [error] sbt.AutoPluginException: Error determining plugins for project 'absolute-path' in /private/var/folders/qv/pdh5wsgn0lq3dp77zj602b5c0000gn/T/sbt_32fa5988/absolute-path: [info] [error] Failed to sort List(sbt.plugins.CorePlugin, com.typesafe.sbt.packager.archetypes.JavaAppPackaging, com.typesafe.sbt.packager.rpm.RpmPlugin, com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptPlugin, com.typesafe.sbt.packager.windows.WindowsPlugin, com.typesafe.sbt.packager.archetypes.scripts.BatStartScriptPlugin, com.typesafe.sbt.packager.docker.DockerPlugin, sbt.plugins.IvyPlugin, sbt.plugins.Giter8TemplatePlugin, com.typesafe.sbt.packager.debian.DebianPlugin, sbt.plugins.JvmPlugin, com.typesafe.sbt.packager.universal.UniversalPlugin, com.typesafe.sbt.packager.linux.LinuxPlugin, sbt.plugins.JUnitXmlReportPlugin, com.typesafe.sbt.SbtNativePackager) topologically

https://github.com/sbt/sbt-native-packager/actions/runs/7260349331/job/19779388174?pr=1559#step:5:938

Maybe you also need to update the sbt version that is running the tests?

ghost commented 7 months ago

So after all this won't work. I haven't noticed that BashStartScriptPlugin and its Bat counterpart both depend on JavaAppPackaging so there is a cycle and that's why the tests fail. This can be fixed in some external plugin that can force the initialization order (which is what we are doing in our internal plugins) but it can't be done here directly.

@muuki88 I think we can close this PR (I don't have permission to do so) unless you have an idea how to resolve this.

muuki88 commented 7 months ago

Oh no 😬 that's very unfortunate.

I have no other idea on how to fix this, unfortunately 🥲