From 75f0438946f802b915f95c20dbe3040d6ef617e6 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Wed, 16 Apr 2014 17:56:49 +0200 Subject: [PATCH] Use the correct state in buildPluginDefinition() Within buildPluginDefinition(), the call to setProject() can (and usually will) return a modified structure together with the new state. The subsequent call to evalPluginDef() should use the updated structure, rather the old stucture that was present before the setProject() ("pluginDef"); if that is not the case, the code called by evalPluginDef() will find an inconsistent structure/state combination, and behave in bizarre ways as a result. More in general, it is a bit dangerous to pass to routines in parallel the two separate state and structure, as the two may easily inadvertently fall out of alignment, as in this case. This patch should be applied to both the 0.13 branch as well as to a future 0.12.5 release (the corresponding file there is ./main/Load.scala). --- main/src/main/scala/sbt/Load.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/Load.scala b/main/src/main/scala/sbt/Load.scala index 672266c94..36d39232a 100755 --- a/main/src/main/scala/sbt/Load.scala +++ b/main/src/main/scala/sbt/Load.scala @@ -612,7 +612,7 @@ object Load { val (eval,pluginDef) = apply(dir, s, config) val pluginState = Project.setProject(Load.initialSession(pluginDef, eval), pluginDef, s) - config.evalPluginDef(pluginDef, pluginState) + config.evalPluginDef(Project.structure(pluginState), pluginState) } @deprecated("Use ModuleUtilities.getCheckedObjects[Build].", "0.13.2")