mirror of https://github.com/sbt/sbt.git
This commit finally fixes #241 by adding support for sbt to either print a warning or automatically reload the project if the metabuild sources have changed. To facilitate this, I introduce a new key, metaBuildSourceOption which has three options: 1) IgnoreSourceChanges 2) WarnOnSourceChanges 3) ReloadOnSourceChanges When the former is set, sbt will not check if the meta build sources have changed. Otherwise, sbt will use the buildStructure / fileInputs to get the ChangedFiles for the metabuild. If there are any changes, it will either warn or reload the build depending on the value of metaBuildSourceOption. The mechanism for diffing the files is that I add a step to EvaluateTask where, if the project has been loaded and metaBuildSourceOption != IgnoreSourceChanges, we evaluate the needReload task. If we need a reload, we return an error that indicates that a Reload is necessary. When that error is detected, the MainLoop will prepend "reload" to the pending commands for the state. Otherwise we just print a warning and continue. I benchmarked the overhead of this and it wasn't too bad. I generally saw it taking 5-20ms to perform the check. Since this is only done once per task evaluation run, I don't think it's a big deal. When IgnoreSourceChanges is set, there is O(10us) overhead. If performance does become a problem, we could add a global watch service and skip the needReload evaluation if no files have been modified. I removed the watchTrackMetaBuild key and made it so that the continuous builds only track the meta build when metaBuildSourceOption == ReloadOnSourceChanges |
||
|---|---|---|
| .. | ||
| src | ||
| NOTICE | ||