-
Notifications
You must be signed in to change notification settings - Fork 931
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
Deprecate Analysis.apis #1268
Comments
So, do you have a way to still support the I think Related to tests, there's been a long-standing issue of "testOnly" selecting a specific test rather than a test class. related, we'd like to do the same with testQuick. The write-up is great and compelling, but I think we need to talk about the testing case, as well as other "like-minded" tasks which I think we'll be trying to leverage more of in things like Activator... |
When it comes to
Specifically, for I don't follow this remark:
Could you elaborate or give me some pointers? Is this related to incremental compilation? When it comes to test discovery (and generally, semantic analysis of compiled program) then I think the best bet is either Java reflection or Scala reflection (if full Scala semantics are needed). There will be some performance penalty of using reflection but I expect it to be lower than the 20% performance overhead described in #1078. |
It's sort of related. SO:
Maybe easier to do a G+ chat about it so we make sure we're in synch (not N'SYNC) |
Ok, I understand that now. I think you're talking about new functionality/improvements to testing infrastructure in sbt. I agree it's the best to have a chat on G+ on this and summarize our discussion here. |
I just checked activator's source code for uses of
The first use is for discovering main methods that we'll have to find some alternative way of providing. The other one is determining last compilation time. It'll be easy to migrate to |
This is a proposal.
Analysis.apis
The
Analysis.apis
returns an instance ofAPIs
. Methods inAPIs
allow one to inspect the public API of the compiled program. By the API we mean information like declared classes (and their method) in given source file.One can think of
APIs
as a very basic reflection-like API.The role of
Analysis.apis
The main client of
APIs
is the incremental compiler itself. It uses information stored inAPIs
to find out what semantic changes were applied to Scala sources. Based on that knowledge, the incremental compiler algorithm determines which files should be recompiled. That's was the original use case for introduction ofAnalysis.apis
.Over time, some other use cases arose. In sbt 0.13.2
Analysis.apis
is used for the following tasks performed outside of the incremental compiler:testQuick
task uses information about compilation start time of each of source files to determine which tests got recompiled and should be rerun (seetestQuickFilter
in Defaults.scala)xsbt.version.properties
file should be regenerated (seegenerateVersionFile
andlastCompilationTime
methods in project/Util.scala)APIs
in reflection-like manner (see thediscover
method in Tests.scala)Given that
Analysis.apis
is public, andAnalysis
object is returned by thecompile
task then one can imagine other projects depending onAnalysis.apis
.Why to touch
Analysis.apis
The main motivation is anticipated work for #1078. In order to address performance problems of incremental compiler it's very likely we'll have to be more aggressive about it's internal data structures. The
Analysis.apis
is one of such data structures that is most likely to be redesigned as part of fixing #1078.We should warn sbt users this API is going away. For details why we'll remove this API (or limit it to sbt-internal consumption) see the section on Pitfalls.
Migrating uses of
Analysis.apis
The last bullet is the most advanced use of of information available through
APIs
API. The other two bullets are trivial to replace by dedicated APIs that Analysis should introduce.Pitfalls with
APIs
Originally, the
APIs
stored an index of entire Scala program sbt was compiling. It included information about public member in a source files including nested members. However, this turned to be very expensive both memory-wise and CPU-wise. In sbt 0.12.x hashing of extracted API has been introduced. As a result, almost all information about members in given source files is wiped out and replaced by hash sum of removed members.In other words, for performance reasons
APIs
won't ever become a minimal reflection-like API.Tasks related to deprecation
To make the proposal more specific, here's the list of tasks related to deprecation of
Analysis.apis
:Analysis.apis
val, deprecate the entireAPIs
trait and provide documentation on how to migrate the most common use cases to other methods provided by sbtAnalysis.apis
toAnalysis.compilations
for determininglastCompilationTime
(UseAnalysis.compilation
for lastCompilationTime #1272)The text was updated successfully, but these errors were encountered: