diff options
author | Artur Signell <artur@vaadin.com> | 2013-01-04 11:08:56 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-01-04 12:26:29 +0200 |
commit | fb68bd53035fdd9cf0448623d5f6867fe17bab64 (patch) | |
tree | b42aadb2d95ec0b6e945d80ba97ed3fb26eeac33 /buildhelpers/src | |
parent | bcc7fda715e689f6611f904d52e3fa41a331e63d (diff) | |
download | vaadin-framework-fb68bd53035fdd9cf0448623d5f6867fe17bab64.tar.gz vaadin-framework-fb68bd53035fdd9cf0448623d5f6867fe17bab64.zip |
Updated copyright notices and added missing license headers
Change-Id: I419ce4581d1a8b84d4236a85a1333d23f3423b2e
Diffstat (limited to 'buildhelpers/src')
-rw-r--r-- | buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java | 15 | ||||
-rw-r--r-- | buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java | 75 |
2 files changed, 67 insertions, 23 deletions
diff --git a/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java b/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java index e2786dd4d8..78ab0748ed 100644 --- a/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java +++ b/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2013 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.IOException; diff --git a/buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java b/buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java index a6130e2a46..688af4b591 100644 --- a/buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java +++ b/buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java @@ -1,5 +1,17 @@ -/** +/* + * Copyright 2000-2013 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; @@ -15,21 +27,23 @@ import java.util.jar.Manifest; public class ManifestWriter { StringBuffer buffer = new StringBuffer(); - + public ManifestWriter() { } /** * Writes a manifest attribute to a temporary buffer. * - * @param name Attribute name - * @param value Attribute value + * @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; @@ -39,19 +53,20 @@ public class ManifestWriter { } 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. + * before calling this write. * - * @param jarFilename File name of the JAR in which the manifest is written + * @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; @@ -61,7 +76,7 @@ public class ManifestWriter { System.err.println("Creating temp file failed"); status = 1; } - + // Write the manifest to the temporary file if (status == 0) { FileOutputStream fos = null; @@ -70,11 +85,13 @@ public class ManifestWriter { fos.write(getBytes()); fos.close(); } catch (IOException e) { - System.err.println("Writing to file '"+newMfFile.getAbsolutePath() +"' failed because: " + e.getMessage()); + 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(); @@ -83,47 +100,59 @@ public class ManifestWriter { is = new FileInputStream(newMfFile); checkMf.read(is); } catch (IOException e) { - System.err.println("Reading from file '"+newMfFile.getAbsolutePath() +"' failed because: " + e.getMessage()); + 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}); + 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)); + 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); + 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()); + 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()); + System.err + .println("Execution of 'jar' command was interrupted. " + + e.getMessage()); status = 1; } } - + // Remove the temporary file - if (newMfFile != null) + if (newMfFile != null) { newMfFile.delete(); - + } + return status; } + @Override public String toString() { return buffer.toString(); } - + public byte[] getBytes() { return buffer.toString().getBytes(); } |