提交 030121c8 编写于 作者: J jurgen

New Windows installer (+pack200 +jre)

Former-commit-id: 5c168fde
上级 ce3d945a
8e1441703a22b4b46bc4e149e8af035e699a205a
\ No newline at end of file
bd013ae71fc772395745a15bc7977a1527b7a886
\ No newline at end of file
......@@ -255,11 +255,38 @@
<!-- ===================================================================== -->
<target name="nsis">
<echo message="Extract archive"/>
<unzip
src="${distDirectory}/${buildId}-win32.win32.${arch}.zip"
dest="${buildDirectory}/installer/raw/win32.${arch}"
overwrite="true"
/>
<echo message="Unsgn jars"/>
<ant dir="../tools/jar-unsigner" antfile="build.xml" target="jar-unsign">
<property name="jarDirectory" value="${buildDirectory}/installer/raw/win32.${arch}/dbeaver/plugins"/>
</ant>
<echo message="Extract JRE"/>
<unzip
src="${buildDirectory}/../../contrib/jre/windows/jre6_u43_${arch}.zip"
dest="${buildDirectory}/installer/raw/win32.${arch}/dbeaver/jre"
overwrite="true"
/>
<echo message="Pack200 all jars"/>
<apply executable="pack200" parallel="false" dest="${buildDirectory}/installer/raw/win32.${arch}/dbeaver/plugins" verbose="true">
<arg value="--modification-time=latest"/>
<arg value="--deflate-hint=true"/>
<arg value="--segment-limit=-1"/>
<arg value="-g"/>
<targetfile/>
<srcfile/>
<fileset dir="${buildDirectory}/installer/raw/win32.${arch}/dbeaver/plugins" includes="*.jar" />
<mapper type="glob" from="*" to="*.pack" />
</apply>
<delete dir="${buildDirectory}/installer/raw/win32.${arch}/dbeaver/plugins" includes="*.jar"/>
<echo message="Filter installer script"/>
<filter filtersfile="build.properties"/>
<filter token="arch" value="${arch}"/>
<filter token="product.dir" value="..\..\.."/>
......
......@@ -30,14 +30,6 @@
VIAddVersionKey "FileVersion" "@productVersion@"
VIProductVersion "@productVersion@.0"
; Definitions for Java 6.0
!define JRE_VERSION "6.0"
!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=74822"
; use javaw.exe to avoid dosbox.
; use java.exe to keep stdout/stderr
!define JAVAEXE "javaw.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\DBeaver"
......@@ -47,6 +39,8 @@
;Request application privileges for Windows Vista
RequestExecutionLevel admin
SetCompressor /FINAL /SOLID lzma
Var JAVA_LOCALE
;--------------------------------
......@@ -110,8 +104,6 @@ FunctionEnd
!include "WordFunc.nsh"
!insertmacro VersionCompare
!include "JRE.nsh"
;--------------------------------
;Languages
......@@ -145,34 +137,37 @@ FunctionEnd
Section "-DBeaver Core" SecCore
; Install JRE on demand
SetShellVarContext all
Call GetJRE
; If there is previous version of DBeaver - remove it's configuration and plugins
RMDir /r $INSTDIR\configuration
RMDir /r $INSTDIR\plugins
RMDir /r $INSTDIR\licenses
RMDir /r $INSTDIR\jre
SetOutPath "$INSTDIR"
; Copy files
; Eclipse files
File "..\raw\win32.@arch@\dbeaver\.eclipseproduct"
File "..\raw\win32.@arch@\dbeaver\readme.txt"
File "..\raw\win32.@arch@\dbeaver\dbeaver.exe"
File /r "..\raw\win32.@arch@\dbeaver\configuration"
File /r /x org.jkiss.*.jar "..\raw\win32.@arch@\dbeaver\plugins"
File /r /x org.jkiss.* "..\raw\win32.@arch@\dbeaver\plugins"
; JRE and unpack script
File /r "..\raw\win32.@arch@\dbeaver\jre"
File "..\..\..\installer\nsis\install.cmd"
; Licenses
CreateDirectory $INSTDIR\licenses
SetOutPath "$INSTDIR\licenses"
File "..\raw\win32.@arch@\dbeaver\licenses\*.*"
; Core plugins
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.core_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.core.application_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.utils_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.core_*"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.core.application_*"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.utils_*"
;Store installation folder
WriteRegStr HKCU "Software\DBeaver" "" $INSTDIR
......@@ -197,7 +192,7 @@ SectionGroup /e "Plugins"
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.generic_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.generic_*"
SectionEnd
......@@ -205,7 +200,7 @@ SectionGroup /e "Plugins"
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.mysql_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.mysql_*"
SectionEnd
......@@ -213,7 +208,7 @@ SectionGroup /e "Plugins"
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.oracle_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.oracle_*"
SectionEnd
......@@ -221,8 +216,8 @@ SectionGroup /e "Plugins"
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.wmi_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.wmi_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.wmi_*"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.wmi_*"
SectionEnd
......@@ -230,7 +225,7 @@ SectionGroup /e "Plugins"
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.nosql*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.nosql*"
SectionEnd
......@@ -238,12 +233,12 @@ SectionGroup /e "Plugins"
SetOutPath "$INSTDIR\plugins"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.erd_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.erd_*"
SectionEnd
Section "-Import 3rd Party Configurations" Sec3RD
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.import_config_*.jar"
File "..\raw\win32.@arch@\dbeaver\plugins\org.jkiss.dbeaver.ext.import_config_*"
SectionEnd
SectionGroupEnd
......@@ -254,6 +249,12 @@ Section "-Drivers" SecDrivers
SectionEnd
Section "-UnpackJars" SecUnpackJars
ExpandEnvStrings $0 %COMSPEC%
ExecWait '"$0" /C "$INSTDIR\install.cmd"'
Delete "$INSTDIR\install.cmd"
SectionEnd
;--------------------------------
;Descriptions
......@@ -295,6 +296,7 @@ Section "Uninstall"
RMDir /r "$INSTDIR\configuration"
RMDir /r "$INSTDIR\plugins"
RMDir /r "$INSTDIR\drivers"
RMDir /r "$INSTDIR\jre"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
......
@echo off
echo Unpack jars
call :unpackJars plugins
call :unpackJars jre\lib .jar
call :unpackJars jre\lib\ext .jar
goto :EOF
:unpackJars
echo Unpack jars in "%~1"
for %%f in (%~1\*.pack) do (
echo Unpack jar "%~1\%%~nf"
jre\bin\unpack200 %~1\%%~nf.pack %~1\%%~nf%~2
del %~1\%%~nf.pack
)
goto :EOF
<?xml version="1.0"?>
<!--
~ Copyright (c) 2011, Serge Rieder and others. All Rights Reserved.
-->
<project name="VersionUpdater" default="build">
<path id="classpath">
<pathelement location="build"/>
</path>
<target name="build">
<mkdir dir="build"/>
<javac srcdir="src" destdir="build" includeantruntime="true">
<classpath refid="classpath"/>
</javac>
</target>
<target name="clean">
<delete dir="build"/>
</target>
<target name="declare" depends="build">
<taskdef name="jar-unsign" classname="org.jkiss.tools.ant.jarunsigner.UnsignJarTask">
<classpath refid="classpath"/>
</taskdef>
</target>
<target name="jar-unsign" depends="declare">
<jar-unsign>
<fileset dir="${jarDirectory}" includes="*.jar" />
</jar-unsign>
</target>
</project>
/*
* UnsignJarImpl.java
*
* Copyright (C) 2006 Dannes Wessels (dizzzz_at_gmail_com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.jkiss.tools.ant.jarunsigner;
import java.io.*;
import java.util.UUID;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
/**
* Implementation class for for unsiging JAR files.
*
* @author Dannes Wessels
*/
public class UnsignJarImpl {
/**
* Unsign the specified jarfile.
*
* @param jarfile File containing signed JAR file.
*/
public void unsign(File jarfile) throws IOException
{
if (!jarfile.canRead()) {
System.err.println("Cannot read file " + jarfile.getAbsolutePath());
return;
}
if (!jarfile.canWrite()) {
System.err.println("Cannot write file " + jarfile.getAbsolutePath());
return;
}
File tmpFile = null;
try {
tmpFile = new File(jarfile.getParent(), "unsigner_" + UUID.randomUUID().toString() + ".tmp");
BufferedOutputStream bos
= new BufferedOutputStream(new FileOutputStream(tmpFile));
BufferedInputStream bis
= new BufferedInputStream(new FileInputStream(jarfile));
unsign(bis, bos);
bos.close();
bis.close();
// Cleanup
jarfile.delete();
tmpFile.renameTo(jarfile);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
/**
* Unsign JAR file supplied as input stream, write results to output stream.
*
* @param is InputStream with signed JAR file.
* @param os OutputStream containing unsigned JAR file.
*/
public void unsign(InputStream is, OutputStream os) throws IOException
{
JarInputStream jis = new JarInputStream(is);
JarOutputStream jos = null;
// Clean manifest, start OutputStream
Manifest manifest = jis.getManifest();
if (manifest == null) {
jos = new JarOutputStream(os);
} else {
manifest.getEntries().clear();
jos = new JarOutputStream(os, manifest);
}
JarEntry src;
while ((src = jis.getNextJarEntry()) != null) {
String name = src.getName();
String lowercaseName = name.toLowerCase();
// Filter files used for jar signing
if (lowercaseName.startsWith("meta-inf") &&
(lowercaseName.endsWith(".rsa") || lowercaseName.endsWith(".dsa") || lowercaseName.endsWith(".sf"))) {
//No op
} else {
//buffer = getNextResource(jis);
JarEntry dest = new JarEntry(name);
jos.putNextEntry(dest);
copyContent(jis, jos);
}
}
jos.close();
jis.close();
}
private static void copyContent(JarInputStream jis, JarOutputStream jos) throws IOException
{
byte[] buffer = new byte[4096];
int len = 0;
while ((len = jis.read(buffer)) != -1) {
jos.write(buffer, 0, len);
}
}
}
/*
* UnsignJarTask.java
*
* Copyright (C) 2006 Dannes Wessels (dizzzz_at_gmail_com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.jkiss.tools.ant.jarunsigner;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Ant task for unsigning JAR files.
*
* @author Dannes Wessels
*/
public class UnsignJarTask extends Task {
private List<FileSet> filesets = new ArrayList<FileSet>();
/**
* Called by the project to let the task do its work.
*
* @throws BuildException if something goes wrong with the build
*/
@Override
public void execute() throws BuildException
{
// Search all file sets
for (FileSet fs : filesets) {
DirectoryScanner scanner = fs.getDirectoryScanner(getProject());
scanner.scan();
String[] files = scanner.getIncludedFiles();
UnsignJarImpl uji = new UnsignJarImpl();
try {
// Perform action per entry.
for (String file : files) {
log("Unsign jar " + file);
uji.unsign(new File(scanner.getBasedir(), file));
}
} catch (IOException ex) {
throw new BuildException(ex.getMessage());
}
}
}
/**
* Create FileSet object that will be filled by ant.
*
* @return Empty FileSet object.
*/
public FileSet createFileSet()
{
FileSet fileSet = new FileSet();
return fileSet;
}
/**
* Add FileSet to Task. FileSet need to be created first, method can
* be called multiple times allowing adding files in steps.
*
* @param set Set of files that need to be executed.
*/
public void addFileset(FileSet set)
{
filesets.add(set);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册