Improve current semanticdb processing #6585
lefou
started this conversation in
Development
Replies: 1 comment 1 reply
-
I wonder, when mill-bsp server uses a separate our dir, does the compile result get shared with mill, or does it not |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is related to the state of
JavaModule/ScalaModulein Mill 1.0 / 1.1.I'd like to split the problem and provide clear solutions separated from each other.
Issue 1: Bad compilation performance
semanticDbDatatask duplicates compilation work already done in thecompiletask.Issue 2: Decide when we need semanticDB data
scalacOptions- thecompileresult will contain the semanticDB data files and we should not not apply any extra processingcompiletask should not contain any semanticDB data files, as these are considered unwanted results (e.g. they should not appear downstream on classpaths or in jars)Proposal for Issue 1:
Disclaimer: proposed task names are not final but choosen to make the concept clear
compileWithMaybeSemanticDbtask which does the actual compilation, and include semanticDB data if we, for some reasons, need them.compiletask use the result ofcompileWithMaybeSemanticDbbut filter out semanticDB data, iff it was not explicitly requested by the module configuration, e.g. viascalacOptions.semanticDbDatatask use the result ofcompileWithMaybeSemanticDband filter out any non-semanticDB data.mill-scalafixplugin keep as-is, but better performing.Ideas for Issue 2:
Maybe too simple, but we could always generate semanticDB data in
compileWithMaybeSemanticDband just don't use it downstream if nobody is interested in it. This has an overhead of up to 20 percent in case nobody is going to need it. (It may also conflict with other compiler plugins and fail the compilation that otherwise would succeed, but that's unlikely.)Smart-decision for semanticDB data need. Either project use of the
semanticDbDatatask or any BSP use should permanently enable it. This must be a bullet-proof design, well-documented and users need a way to disable it (opt-out or opt-in).To detect BSP, we should just use the fact that a Mill-generated
.bsp/mill-bsp.jsonfile is present, since this won't require any extra book keeping. Users, who don't want to use BSP can also safely remove that file. We could also write an extra file next to this location, so we can check its age, for example.Once the semanticDbData task is used/planned, we may record that fact under the namespace of a dedicated module-specific persistent task
semanticDbDataGenerationWanted. This has the issue that thesemanticDbDatatask is a downstream dependency ofcompileWithMaybeSemanticDbtask and we currently can't know if the initial value is correct (so factually we always need to guess "enabled"). It would be really cool to have some way to detect early what the user is going to run. E.g. if we could expose the current execution plan via theTaskCtx. That way we could have an early persistent tasksemanticDbDataGenerationWantedthat decides based on it's persistent state and the fact whether thesemanticDbDatatask is requested. Then we could conservatively default to disabled, unless there is more evidence.Originally posted by @lefou in #5841 (comment)
Beta Was this translation helpful? Give feedback.
All reactions