private List<File> getClasspathEntries(File entry) { Version version = ControlPanelPortletUtil.getPortalVaadinVersion(); List<File> classpathEntries = new ArrayList<File>(); classpathEntries.add(entry); // The vaadin-client-compiler JAR is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getVaadinClientCompilerJarLocation()); if (version.compareTo(ControlPanelPortletUtil.VAADIN_CLIENT_COMPILER_DEPS_LOW_VERSION) >= 0) { // The vaadin-client-compiler-deps JAR is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getVaadinClientCompilerDepsJarLocation()); } // The vaadin-client JAR is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getVaadinClientJarLocation()); // The vaadin-server JAR is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getVaadinServerJarLocation()); // The vaadin-shared.jar is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getVaadinSharedJarLocation()); // The vaadin-shared-deps.jar is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getVaadinSharedDepsJarLocation()); // The ant.jar is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getAntJarLocation()); // The validation-api.GA.jar is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getValidationApi()); // The validation-api.GA-sources.jar is located in the portal lib dir classpathEntries.add(ControlPanelPortletUtil.getValidationApiSources()); for (VaadinAddonInfo addon : includeAddons) { classpathEntries.add(addon.getJarFile()); } classpathEntries.addAll(additionalDependencies); return classpathEntries; }
public void run() { File tmpDir = null; try { tmpDir = WidgetsetUtil.createTempDir(); WidgetsetUtil.createWidgetset(tmpDir, widgetset, getIncludeWidgetsets()); compiler = new WidgetsetCompiler( outputLog, widgetset, tmpDir.getAbsolutePath(), getClasspathEntries(tmpDir)); try { compiler.compileWidgetset(); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } File compiledWidgetset = new File(tmpDir, widgetset); if (compiledWidgetset.exists() && compiledWidgetset.isDirectory()) { String ws = ControlPanelPortletUtil.getWidgetsetDir() + widgetset; WidgetsetUtil.rotateWidgetsetBackups(ws); WidgetsetUtil.backupOldWidgetset(ws); File destDir = new File(ws); outputLog.log("Copying widgetset from " + compiledWidgetset + " to " + destDir); System.out.println("Copying widgetset from " + compiledWidgetset + " to " + destDir); FileUtils.copyDirectory(compiledWidgetset, destDir); outputLog.log("Copying done"); System.out.println("Copying done"); } } catch (IOException e) { log.warn("Could not compile widgetsets.", e); System.out.println("Could not compile widgetsets. " + e.getMessage()); } finally { try { System.out.println("Remove temp directory"); FileUtils.deleteDirectory(tmpDir); System.out.println("Removing done..."); } catch (IOException e) { log.warn("Could not delete temporary directory: " + tmpDir, e); System.out.println("Could not delete temporary directory: " + tmpDir + " " + e); } compilationFinished(); } }