Created
October 28, 2014 17:34
-
-
Save JohnMurray/b3e89764a48fef96a356 to your computer and use it in GitHub Desktop.
Extract from BuiltinCommands object in SBT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set = Command(SetCommand, setBrief, setDetailed)(setParser) { | |
case (s, (all, arg)) => | |
val extracted = Project extract s | |
import extracted._ | |
val dslVals = extracted.currentUnit.unit.definitions.dslDefinitions | |
// TODO - This is possibly inefficient (or stupid). We should try to only attach the | |
// classloader + imports NEEDED to compile the set command, rather than | |
// just ALL of them. | |
val ims = (imports(extracted) ++ dslVals.imports.map(i => (i, -1))) | |
val cl = dslVals.classloader(currentLoader) | |
val settings = EvaluateConfigurations.evaluateSetting( | |
session.currentEval(), | |
"<set>", | |
ims, | |
arg, | |
LineRange(0, 0) | |
)(cl) | |
val setResult = if (all) SettingCompletions.setAll(extracted, settings) else SettingCompletions.setThis(s, extracted, settings, arg) | |
s.log.info(setResult.quietSummary) | |
s.log.debug(setResult.verboseSummary) | |
reapply(setResult.session, structure, s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment