diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-03-22 16:36:14 +0200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-03-22 16:36:14 +0200 |
commit | c78069eb3ece1b450c8fe911bf3c3a4dafef02c3 (patch) | |
tree | 17db6ae8f64200dd07d12167199c570006806610 | |
parent | 6fb2d1a98076c6fbb9ba014fab37d7bf7a6e6a62 (diff) | |
download | vaadin-framework-c78069eb3ece1b450c8fe911bf3c3a4dafef02c3.tar.gz vaadin-framework-c78069eb3ece1b450c8fe911bf3c3a4dafef02c3.zip |
Remove unnecessary buildhelpers module (#10742)
-rw-r--r-- | all/pom.xml | 1 | ||||
-rw-r--r-- | buildhelpers/pom.xml | 100 | ||||
-rw-r--r-- | buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java | 159 | ||||
-rw-r--r-- | buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java | 159 | ||||
-rw-r--r-- | client-compiled/pom.xml | 7 | ||||
-rw-r--r-- | compatibility-client-compiled/pom.xml | 7 | ||||
-rw-r--r-- | compatibility-themes/pom.xml | 6 | ||||
-rw-r--r-- | pom.xml | 11 | ||||
-rw-r--r-- | themes/pom.xml | 6 |
9 files changed, 0 insertions, 456 deletions
diff --git a/all/pom.xml b/all/pom.xml index c3297d3c90..f84b9aa4ca 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -345,7 +345,6 @@ </goals> <configuration> <failOnError>false</failOnError> - <excludePackageNames>com.vaadin.buildhelpers</excludePackageNames> <skip>false</skip> <links> <link>https://docs.oracle.com/javase/8/docs/api/</link> diff --git a/buildhelpers/pom.xml b/buildhelpers/pom.xml deleted file mode 100644 index c28dd68097..0000000000 --- a/buildhelpers/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>com.vaadin</groupId> - <artifactId>vaadin-root</artifactId> - <version>8.4-SNAPSHOT</version> - </parent> - <!-- Needed by a plugin in release build --> - <groupId>com.vaadin</groupId> - <artifactId>vaadin-buildhelpers</artifactId> - <name>vaadin-buildhelpers</name> - <packaging>jar</packaging> - - <url>https://vaadin.com/</url> - <description>Vaadin build helpers</description> - - <dependencies> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - </dependency> - <dependency> - <groupId>com.vaadin</groupId> - <artifactId>vaadin-sass-compiler</artifactId> - </dependency> - - <dependency> - <groupId>com.carrotsearch</groupId> - <artifactId>smartsprites</artifactId> - </dependency> - </dependencies> - - <build> - <resources> - <!-- Include eclipse formatting settings in the jar to make them available - as a dependency for all submodules --> - <resource> - <directory>${project.basedir}/../eclipse</directory> - <targetPath>eclipse</targetPath> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>checkstyle</goal> - </goals> - <phase>process-sources</phase> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <index>false</index> - <manifest> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - </manifest> - </archive> - </configuration> - </plugin> - <plugin> - <artifactId>maven-deploy-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - - <!-- Skip sources jar --> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-source-plugin</artifactId> - <configuration> - <skipSource>true</skipSource> - </configuration> - </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - <configuration> - <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> -</project> diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java deleted file mode 100644 index 4cb5d70019..0000000000 --- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2000-2016 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.buildhelpers; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; -import org.apache.commons.cli.PosixParser; - -import com.vaadin.sass.internal.ScssStylesheet; - -/** - * Helper to combine css divided into separate per component dirs into one to - * optimize http requests. - */ -public class CompileTheme { - - /** - * @param args - * @throws IOException - * @throws ParseException - */ - public static void main(String[] args) throws IOException, ParseException { - Options options = new Options(); - options.addOption("t", "theme", true, "the theme to compile"); - options.addOption("f", "theme-folder", true, - "the folder containing the theme"); - options.addOption("v", "version", true, - "the Vaadin version to compile for"); - CommandLineParser parser = new PosixParser(); - CommandLine params = parser.parse(options, args); - if (!params.hasOption("theme") || !params.hasOption("theme-folder") - || !params.hasOption("version")) { - // automatically generate the help statement - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp(CompileTheme.class.getName(), options); - return; - } - String themeName = params.getOptionValue("theme"); - String themeFolder = params.getOptionValue("theme-folder"); - String version = params.getOptionValue("version"); - - // Regular theme - try { - processSassTheme(themeFolder, themeName, "styles", version); - System.out.println( - "Compiling theme " + themeName + " styles successful"); - } catch (Exception e) { - System.err - .println("Compiling theme " + themeName + " styles failed"); - e.printStackTrace(); - } - // Legacy theme w/o .themename{} wrapping - try { - String legacyFile = themeFolder + File.separator + themeName - + File.separator + "legacy-styles.scss"; - if (new File(legacyFile).exists()) { - processSassTheme(themeFolder, themeName, "legacy-styles", - version); - System.out.println("Compiling theme " + themeName - + " legacy-styles successful"); - } - } catch (Exception e) { - System.err.println( - "Compiling theme " + themeName + " legacy-styles failed"); - e.printStackTrace(); - } - } - - private static void processSassTheme(String themeFolder, String themeName, - String variant, String version) throws Exception { - - StringBuilder cssHeader = new StringBuilder(); - - String stylesCssDir = themeFolder + File.separator + themeName - + File.separator; - - String stylesCssName = stylesCssDir + variant + ".css"; - - // Process as SASS file - String sassFile = stylesCssDir + variant + ".scss"; - - ScssStylesheet scss = ScssStylesheet.get(sassFile); - if (scss == null) { - throw new IllegalArgumentException( - "SASS file: " + sassFile + " not found"); - } - scss.compile(); - String filteredScss = scss.printState().replace("@version@", version); - - BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName)); - out.write(cssHeader.toString()); - out.write(filteredScss); - out.close(); - - System.out.println("Compiled CSS to " + stylesCssName + " (" - + filteredScss.length() + " bytes)"); - - createSprites(themeFolder, themeName); - File oldCss = new File(stylesCssName); - File newCss = new File(stylesCssDir + variant + "-sprite.css"); - - if (newCss.exists()) { - // Theme contained sprites. Renamed "styles-sprite.css" -> - // "styles.css" - oldCss.delete(); - - boolean ok = newCss.renameTo(oldCss); - if (!ok) { - throw new RuntimeException( - "Rename " + newCss + " -> " + oldCss + " failed"); - } - } - - } - - private static void createSprites(String themeFolder, String themeName) - throws FileNotFoundException, IOException { - try { - // Try loading the class separately from using it to avoid - // hiding other classpath issues - Class<?> smartSpritesClass = org.carrot2.labs.smartsprites.SmartSprites.class; - } catch (NoClassDefFoundError e) { - System.err.println( - "Could not find smartsprites. No sprites were generated. The theme should still work."); - return; - } - - String[] parameters = { "--sprite-png-depth", "AUTO", - "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8", - "--root-dir-path", themeFolder + File.separator + themeName, - "--log-level", "WARN" }; - - org.carrot2.labs.smartsprites.SmartSprites.main(parameters); - System.out.println("Generated sprites"); - - } -} diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java deleted file mode 100644 index c82303e3e1..0000000000 --- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2000-2016 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.buildhelpers; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Date; -import java.util.jar.Manifest; - -public class ManifestWriter { - StringBuilder buffer = new StringBuilder(); - - public ManifestWriter() { - } - - /** - * Writes a manifest attribute to a temporary buffer. - * - * @param name - * Attribute name - * @param value - * Attribute value - */ - public void writeAttribute(String name, String value) { - int linelen = name.length() + 2; - buffer.append(name); - buffer.append(": "); - - String remainingValue = value; - while (linelen + remainingValue.length() > 72) { - int fitsLine = 72 - linelen; - buffer.append(remainingValue.substring(0, fitsLine) + "\n "); - remainingValue = remainingValue.substring(fitsLine); - linelen = 1; - } - buffer.append(remainingValue + "\n"); - } - - /** - * Writes the manifest to given JAR file. - * - * The manifest must be created with {@code #writeAttribute(String, String)} - * before calling this write. - * - * @param jarFilename - * File name of the JAR in which the manifest is written - * @return 0 on success, nonzero value on error - */ - int updateJar(String jarFilename) { - int status = 0; - - // Determine a temporary file name - String newMfPrefix = "vaadin-manifest-" + (new Date()).getTime(); - File newMfFile = null; - try { - newMfFile = File.createTempFile(newMfPrefix, ".mf"); - } catch (IOException e) { - System.err.println("Creating temp file failed"); - status = 1; - } - - // Write the manifest to the temporary file - if (status == 0) { - FileOutputStream fos = null; - try { - fos = new FileOutputStream(newMfFile); - fos.write(getBytes()); - fos.close(); - } catch (IOException e) { - System.err.println( - "Writing to file '" + newMfFile.getAbsolutePath() - + "' failed because: " + e.getMessage()); - status = 1; - } - } - - // Check that the manifest is OK - if (status == 0) { - Manifest checkMf = new Manifest(); - FileInputStream is; - try { - is = new FileInputStream(newMfFile); - checkMf.read(is); - } catch (IOException e) { - System.err.println( - "Reading from file '" + newMfFile.getAbsolutePath() - + "' failed because: " + e.getMessage()); - status = 1; - } - } - - // Update the manifest in the Jar - if (status == 0) { - System.out.println("Updating manifest in JAR " + jarFilename); - try { - // The "mf" order must correspond with manifest-jarfile order - Process process = Runtime.getRuntime() - .exec(new String[] { "jar", "umf", - newMfFile.getAbsolutePath(), jarFilename }); - int exitValue = process.waitFor(); - if (exitValue != 0) { - InputStream jarErr = process.getErrorStream(); - BufferedReader reader = new BufferedReader( - new InputStreamReader(jarErr)); - while (reader.ready()) { - System.err.println("jar: " + reader.readLine()); - } - System.err.println( - "The 'jar' command returned with exit value " - + exitValue); - status = 1; - } - } catch (IOException e) { - System.err.println( - "Failed to execute 'jar' command. " + e.getMessage()); - status = 1; - } catch (InterruptedException e) { - System.err - .println("Execution of 'jar' command was interrupted. " - + e.getMessage()); - status = 1; - } - } - - // Remove the temporary file - if (newMfFile != null) { - newMfFile.delete(); - } - - return status; - } - - @Override - public String toString() { - return buffer.toString(); - } - - public byte[] getBytes() { - return buffer.toString().getBytes(); - } -} diff --git a/client-compiled/pom.xml b/client-compiled/pom.xml index 8c089c8c26..96c8d56f05 100644 --- a/client-compiled/pom.xml +++ b/client-compiled/pom.xml @@ -52,13 +52,6 @@ </dependency> <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>vaadin-buildhelpers</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> - - <dependency> <groupId>org.osgi</groupId> <artifactId>osgi.core</artifactId> </dependency> diff --git a/compatibility-client-compiled/pom.xml b/compatibility-client-compiled/pom.xml index 48dc8823f5..4651acabdc 100644 --- a/compatibility-client-compiled/pom.xml +++ b/compatibility-client-compiled/pom.xml @@ -45,13 +45,6 @@ </dependency> <dependency> - <groupId>com.vaadin</groupId> - <artifactId>vaadin-buildhelpers</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> - - <dependency> <groupId>org.osgi</groupId> <artifactId>osgi.core</artifactId> </dependency> diff --git a/compatibility-themes/pom.xml b/compatibility-themes/pom.xml index 27e1480bcf..13386000a6 100644 --- a/compatibility-themes/pom.xml +++ b/compatibility-themes/pom.xml @@ -27,12 +27,6 @@ <version>${project.version}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>vaadin-buildhelpers</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>com.vaadin</groupId> @@ -541,13 +541,6 @@ <!-- Provide a dummy JS config file to avoid errors --> <configJsFile>classpath:/eclipse/VaadinJavaConventions.xml</configJsFile> </configuration> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>vaadin-buildhelpers</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -614,7 +607,6 @@ <activeByDefault>true</activeByDefault> </activation> <modules> - <module>buildhelpers</module> <module>shared</module> <module>push</module> <module>server</module> @@ -662,7 +654,6 @@ <vaadin.plugin.version>${project.version}</vaadin.plugin.version> </properties> <modules> - <module>buildhelpers</module> <module>shared</module> <module>push</module> <module>server</module> @@ -729,7 +720,6 @@ <vaadin.plugin.version>${project.version}</vaadin.plugin.version> </properties> <modules> - <module>buildhelpers</module> <module>shared</module> <module>push</module> <module>server</module> @@ -796,7 +786,6 @@ <vaadin.plugin.version>${project.version}</vaadin.plugin.version> </properties> <modules> - <module>buildhelpers</module> <module>shared</module> <module>push</module> <module>server</module> diff --git a/themes/pom.xml b/themes/pom.xml index 9ba2e9910c..1b6d4ea79f 100644 --- a/themes/pom.xml +++ b/themes/pom.xml @@ -22,12 +22,6 @@ <version>${project.version}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>vaadin-buildhelpers</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>com.vaadin</groupId> |