List of usage examples for com.google.gwt.dev About getGwtVersionNum
public static String getGwtVersionNum()
From source file:org.openlayers.linker.OpenLayersScriptInjector.java
License:Apache License
@Override public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean permutation) throws UnableToCompleteException { Float gwtVersion = Float.parseFloat(About.getGwtVersionNum().replaceFirst("([0-9]+\\.[0-9]+).*", "$1")); String moduleName = context.getModuleName(); if (permutation) { return artifacts; }/*from w ww .ja va2s . c o m*/ Artifact scriptLoader = emitString(logger, "", SCRIPT_LOADER); ArtifactSet result = new ArtifactSet(artifacts); result.add(scriptLoader); if (gwtVersion < 2.5f || !forceScriptLoad(logger, moduleName, gwtVersion)) { return result; } Set<ScriptReference> scripts = result.find(ScriptReference.class); if (scripts.size() == 0) { return result; } Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class); for (EmittedArtifact emittedArtifact : emittedArtifacts) { String partialPath = emittedArtifact.getPartialPath(); if (!partialPath.endsWith(moduleName + ".nocache.js")) continue; System.out.println(" Invoking Linker CesiumScriptInjector"); String pageRelativeModulePath = getPageRelativeModulePath(context); System.out.println(" Creating " + SCRIPT_LOADER + " to manually load the following script tags:"); result.remove(emittedArtifact); String nocacheJS = OpenLayersLinkerUtils.getContents(emittedArtifact, logger); nocacheJS += getScriptLoaderJS(pageRelativeModulePath); result.add(emitString(logger, nocacheJS, partialPath, context)); result.remove(scriptLoader); String loadTags = getScriptLoadJS(scripts, pageRelativeModulePath); result.add(emitString(logger, loadTags, SCRIPT_LOADER, context)); break; } return result; }