Instead it would be good to decouple the upgrade hook from the actual groovy console class but rather rely on Java Scripting API only. That way you could leverage every scripting engine being registered with the Java Scripting API (Groovy supports that OOTB, see http://groovy-lang.org/integrating.html#jsr223)
Basically Sling provides several scripting engines (https://sling.apache.org/documentation/bundles/scripting.html#sling-scripting-engines) which are all exposed through the Java Scripting API (https://docs.oracle.com/javase/7/docs/api/javax/script/package-summary.html). Currently the upgrade hook is very specific to the Groovy Console and uses that class directly.
Instead it would be good to decouple the upgrade hook from the actual groovy console class but rather rely on Java Scripting API only. That way you could leverage every scripting engine being registered with the Java Scripting API (Groovy supports that OOTB, see http://groovy-lang.org/integrating.html#jsr223)