diff options
author | Andreas Abraham <aabraham@iaik.tugraz.at> | 2018-03-21 14:57:50 +0100 |
---|---|---|
committer | Andreas Abraham <aabraham@iaik.tugraz.at> | 2018-03-21 14:57:50 +0100 |
commit | 6c0b2c9ed89f39f2d0606c113173645476de69b6 (patch) | |
tree | 63ab747796cc2c46dbdc630851b40bf7edc4e33a /pdf-over-install-helper | |
parent | 13c593b5ec413b94d6a990a41938a2e071501270 (diff) | |
download | pdf-over-6c0b2c9ed89f39f2d0606c113173645476de69b6.tar.gz pdf-over-6c0b2c9ed89f39f2d0606c113173645476de69b6.tar.bz2 pdf-over-6c0b2c9ed89f39f2d0606c113173645476de69b6.zip |
new helper files added, pom has changed,
Diffstat (limited to 'pdf-over-install-helper')
-rw-r--r-- | pdf-over-install-helper/pom.xml | 126 | ||||
-rw-r--r-- | pdf-over-install-helper/src/main/java/at/asit/helper/Main.java | 266 |
2 files changed, 196 insertions, 196 deletions
diff --git a/pdf-over-install-helper/pom.xml b/pdf-over-install-helper/pom.xml index 17314706..9ca9eedb 100644 --- a/pdf-over-install-helper/pom.xml +++ b/pdf-over-install-helper/pom.xml @@ -1,64 +1,64 @@ -<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>at.a-sit</groupId> - <artifactId>pdf-over</artifactId> - <version>4.1.17-SNAPSHOT</version> - </parent> - - <artifactId>pdf-over-install-helper</artifactId> - <version>1.0.0</version> - - <dependencies> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - </dependencies> - - <build> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>3.7.0</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - <verbose>true</verbose> - <showWarnings>true</showWarnings> - <showDeprecation>true</showDeprecation> - <encoding>UTF-8</encoding> - <debug>true</debug> - <debuglevel>lines,vars,source</debuglevel> - </configuration> - </plugin> -<!-- <plugin> --> -<!-- <artifactId>maven-release-plugin</artifactId> --> -<!-- <version>2.4.2</version> --> -<!-- <dependencies> --> -<!-- <dependency> --> -<!-- <groupId>org.apache.maven.scm</groupId> --> -<!-- <artifactId>maven-scm-provider-gitexe</artifactId> --> -<!-- <version>1.8.1</version> --> -<!-- </dependency> --> -<!-- </dependencies> --> -<!-- </plugin> --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <mainClass>at.asit.helper.Main</mainClass> - </manifest> - <addMavenDescriptor>false</addMavenDescriptor> - </archive> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> +<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>at.a-sit</groupId>
+ <artifactId>pdf-over</artifactId>
+ <version>4.1.17-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>pdf-over-install-helper</artifactId>
+ <version>1.0.0</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>3.7.0</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <verbose>true</verbose>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <encoding>UTF-8</encoding>
+ <debug>true</debug>
+ <debuglevel>lines,vars,source</debuglevel>
+ </configuration>
+ </plugin>
+<!-- <plugin> -->
+<!-- <artifactId>maven-release-plugin</artifactId> -->
+<!-- <version>2.4.2</version> -->
+<!-- <dependencies> -->
+<!-- <dependency> -->
+<!-- <groupId>org.apache.maven.scm</groupId> -->
+<!-- <artifactId>maven-scm-provider-gitexe</artifactId> -->
+<!-- <version>1.8.1</version> -->
+<!-- </dependency> -->
+<!-- </dependencies> -->
+<!-- </plugin> -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>at.asit.helper.Main</mainClass>
+ </manifest>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
\ No newline at end of file diff --git a/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java b/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java index 6fd5bdbb..9f39db2c 100644 --- a/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java +++ b/pdf-over-install-helper/src/main/java/at/asit/helper/Main.java @@ -1,133 +1,133 @@ -package at.asit.helper; - -import java.io.File; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; - -import org.apache.commons.io.FileUtils; - - - - -/*** - * - * @author aabraham - * - * @version 1.0.0 - * - * The created jar is used as helper library when installing pdf-over. - * Basically, the helper determines the java version used including architecture and - * appends afterwards the right swt library since this swt is platform dependend. - * - */ -public class Main { - - public static void main(String[] args) { - - System.out.println("start post install task"); - - copyLib(); - - } - - - public static int getArchBits() { - String arch = System.getProperty("os.arch"); - return arch.contains("64") ? 64 : 32; - } - - public static String getSwtJarName() throws SWTLoadFailedException { - String os = System.getProperty("os.name").toLowerCase(); - if (os.contains("win")) - os = "windows"; - else if (os.contains("mac")) - os = "mac"; - else if (os.contains("linux") || os.contains("nix")) - os = "linux"; - else { - throw new SWTLoadFailedException("Unknown OS: " + os); - } - return "swt-" + os + "-" + getArchBits() + ".jar"; - } - - public static String getSwtJarPath() { - String path = ""; - try { - path = URLDecoder.decode(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8"); - int idx = path.lastIndexOf('/'); - idx = path.lastIndexOf('/', idx - 1); - path = path.substring(0, idx + 1); - } catch (UnsupportedEncodingException e) { - // Ignore - System.err.println("Unsuported Encoding Exception " + e.getMessage()); - } - return path + "lib-swt/"; - } - - private static class SWTLoadFailedException extends Exception { - private static final long serialVersionUID = 1L; - - SWTLoadFailedException(String msg) { - super(msg); - } - } - - - private static String getSwtTargetLibName() throws SWTLoadFailedException { - - String os = System.getProperty("os.name").toLowerCase(); - System.out.println("OS " + os + " detected!"); - String swtTargetLibName; - - if (os.contains("win")) { - swtTargetLibName = "org.eclipse.swt.win32.win32.x86-4.3.2.jar"; - } - else if (os.contains("mac")) { - swtTargetLibName = "org.eclipse.swt.cocoa.macosx-4.3.2.jar"; - } - else if (os.contains("linux") || os.contains("nix")) { - swtTargetLibName = "org.eclipse.swt.gtk.linux.x86-4.3.2.jar"; - } - else { - throw new SWTLoadFailedException("Unknown OS: " + os); - } - return swtTargetLibName; - - - } - - - private static void copyLib() { - try { - String swtLibPath = Main.getSwtJarPath() + Main.getSwtJarName(); - File swtLib = new File(swtLibPath); - if (!swtLib.isFile()) { - - System.err.println("not found "); - throw new SWTLoadFailedException("Library " + swtLibPath + " not found"); - } - - String newPath = swtLibPath.replace("lib-swt", "lib"); - newPath = newPath.replace(Main.getSwtJarName(), getSwtTargetLibName()); - File newFile = new File(newPath); - System.out.println("Source Lib " + swtLibPath.toString()); - System.out.println("Target Lib " + newFile.toString()); - FileUtils.copyFile(swtLib, newFile); - - if (!newFile.isFile()) { - System.err.println("not found "); - throw new SWTLoadFailedException("Library " + swtLibPath + " not found"); - } - - System.out.println("success "); - return; - - - } catch(Exception e){ - e.printStackTrace(); - } - - } - - -} +package at.asit.helper;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import org.apache.commons.io.FileUtils;
+
+
+
+
+/***
+ *
+ * @author aabraham
+ *
+ * @version 1.0.0
+ *
+ * The created jar is used as helper library when installing pdf-over.
+ * Basically, the helper determines the java version used including architecture and
+ * appends afterwards the right swt library since this swt is platform dependend.
+ *
+ */
+public class Main {
+
+ public static void main(String[] args) {
+
+ System.out.println("start post install task");
+
+ copyLib();
+
+ }
+
+
+ public static int getArchBits() {
+ String arch = System.getProperty("os.arch");
+ return arch.contains("64") ? 64 : 32;
+ }
+
+ public static String getSwtJarName() throws SWTLoadFailedException {
+ String os = System.getProperty("os.name").toLowerCase();
+ if (os.contains("win"))
+ os = "windows";
+ else if (os.contains("mac"))
+ os = "mac";
+ else if (os.contains("linux") || os.contains("nix"))
+ os = "linux";
+ else {
+ throw new SWTLoadFailedException("Unknown OS: " + os);
+ }
+ return "swt-" + os + "-" + getArchBits() + ".jar";
+ }
+
+ public static String getSwtJarPath() {
+ String path = "";
+ try {
+ path = URLDecoder.decode(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8");
+ int idx = path.lastIndexOf('/');
+ idx = path.lastIndexOf('/', idx - 1);
+ path = path.substring(0, idx + 1);
+ } catch (UnsupportedEncodingException e) {
+ // Ignore
+ System.err.println("Unsuported Encoding Exception " + e.getMessage());
+ }
+ return path + "lib-swt/";
+ }
+
+ private static class SWTLoadFailedException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ SWTLoadFailedException(String msg) {
+ super(msg);
+ }
+ }
+
+
+ private static String getSwtTargetLibName() throws SWTLoadFailedException {
+
+ String os = System.getProperty("os.name").toLowerCase();
+ System.out.println("OS " + os + " detected!");
+ String swtTargetLibName;
+
+ if (os.contains("win")) {
+ swtTargetLibName = "org.eclipse.swt.win32.win32.x86-4.3.2.jar";
+ }
+ else if (os.contains("mac")) {
+ swtTargetLibName = "org.eclipse.swt.cocoa.macosx-4.3.2.jar";
+ }
+ else if (os.contains("linux") || os.contains("nix")) {
+ swtTargetLibName = "org.eclipse.swt.gtk.linux.x86-4.3.2.jar";
+ }
+ else {
+ throw new SWTLoadFailedException("Unknown OS: " + os);
+ }
+ return swtTargetLibName;
+
+
+ }
+
+
+ private static void copyLib() {
+ try {
+ String swtLibPath = Main.getSwtJarPath() + Main.getSwtJarName();
+ File swtLib = new File(swtLibPath);
+ if (!swtLib.isFile()) {
+
+ System.err.println("not found ");
+ throw new SWTLoadFailedException("Library " + swtLibPath + " not found");
+ }
+
+ String newPath = swtLibPath.replace("lib-swt", "lib");
+ newPath = newPath.replace(Main.getSwtJarName(), getSwtTargetLibName());
+ File newFile = new File(newPath);
+ System.out.println("Source Lib " + swtLibPath.toString());
+ System.out.println("Target Lib " + newFile.toString());
+ FileUtils.copyFile(swtLib, newFile);
+
+ if (!newFile.isFile()) {
+ System.err.println("not found ");
+ throw new SWTLoadFailedException("Library " + swtLibPath + " not found");
+ }
+
+ System.out.println("success ");
+ return;
+
+
+ } catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+
+}
|