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

trailing arguments doesn't work for sbt projects #650

Closed
ghostbuster91 opened this issue Sep 24, 2023 · 1 comment · Fixed by #651
Closed

trailing arguments doesn't work for sbt projects #650

ghostbuster91 opened this issue Sep 24, 2023 · 1 comment · Fixed by #651

Comments

@ghostbuster91
Copy link
Contributor

Hi,

Actual behavior

I discovered that no matter what I put into trailing arguments it will be ignored when running against sbt project and instead a generic task sourcegraphScip will be called that will eventually invoke compilation of the whole project.

Why this is an issue

This is particularly bad for project that cross-compile against multiple scala versions and/or platforms (most of the modern scala libraries) as such compilation can exceed available resources on the CI runner. In order to deal with limited resources scala projects often partition CI pipelines based on the scala version and target platform. Then, commands are invoked only against given pairs of (scalaVersion, targetPlatfor).

Besides that, it is also wasteful, as there is no need to compute that kind of information for every (scalaVersion, targetPlatfor). While there could be some specific sources for some of such pairs, afaik sourcegraph platform doesn't allow for submitting semantic data for different targets.

Expected behavior

I would expect scip-java to respect my trailing arguments and forward them to sbt. This would allow me to call scip-java as follows:

$ cs launch com.sourcegraph:scip-java_2.13:0.9.6 -- index -- compileScoped 2.13 JVM 

where compileScoped is a custom task that will compile only 2.13 sources for JVM platform.

This would be also inline with the documentation that states:

TRAILING ARGUMENTS
Optional. The build command to use to compile all sources. Defaults to a
build-specific command. For example, the default command for Maven command is
'clean verify -DskipTests'.To override the default, pass in the build command
after a double dash: 'scip-java index -- compile test:compile'

Alternatives you have considered

The only alternative I can think of would be to use the manual configuration but using scip-java is more convenient as I don't want to deal with enabling semanticDB plugin at runtime. I also don't want to have the semanticDB plugin enabled by default as it slows down the compilation as stated in https://sourcegraph.github.io/scip-java/docs/benchmarks.html

How to reproduce

  1. clone https://github.com/softwaremill/diffx
  2. call cs launch com.sourcegraph:scip-java_2.13:0.9.6 -- index -- compileScoped 2.13 JVM
  3. observe that it will compile against all targets:
[info] compiling 39 Scala sources to /home/kghost/workspace/diffx/core/target/js-2.13/classes ...
[info] compiling 39 Scala sources to /home/kghost/workspace/diffx/core/target/jvm-2.12/classes ...
[info] compiling 39 Scala sources to /home/kghost/workspace/diffx/core/target/js-2.12/classes ...
[info] compiling 39 Scala sources to /home/kghost/workspace/diffx/core/target/jvm-2.13/classes ...
[info] compiling 39 Scala sources to /home/kghost/workspace/diffx/core/target/jvm-3/classes ...
[info] compiling 39 Scala sources to /home/kghost/workspace/diffx/core/target/js-3/classes ...
@keynmol
Copy link
Contributor

keynmol commented Sep 25, 2023

Heyo @ghostbuster91

Thanks for the report, this is a bug indeed.

I'm fixing it in #651

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 a pull request may close this issue.

2 participants