Add a script to repackage windows zip as self-extracting jars
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<ul>
|
||||
|
||||
<li><a href="https://download.springsource.com/snapshot/STS4/nightly/dist/@MAJOR-TARGET@/spring-tool-suite-4-@QUALIFIER@-@TARGET@-win32.win32.x86_64.7z.exe">spring-tool-suite-4-@QUALIFIER@-@TARGET@-win32.win32.x86_64.7z.exe</li>
|
||||
<li><a href="https://download.springsource.com/snapshot/STS4/nightly/dist/@MAJOR-TARGET@/spring-tool-suite-4-@QUALIFIER@-@TARGET@-win32.win32.x86_64.self-extracting.jar">spring-tool-suite-4-@QUALIFIER@-@TARGET@-win32.win32.x86_64.self-extracting.jar</li>
|
||||
<li><a href="https://download.springsource.com/snapshot/STS4/nightly/dist/@MAJOR-TARGET@/spring-tool-suite-4-@QUALIFIER@-@TARGET@-win32.win32.x86_64.zip">spring-tool-suite-4-@QUALIFIER@-@TARGET@-win32.win32.x86_64.zip</li>
|
||||
<li><a href="https://download.springsource.com/snapshot/STS4/nightly/dist/@MAJOR-TARGET@/spring-tool-suite-4-@QUALIFIER@-@TARGET@-macosx.cocoa.x86_64.dmg">spring-tool-suite-4-@QUALIFIER@-@TARGET@-macosx.cocoa.x86_64.dmg</li>
|
||||
<li><a href="https://download.springsource.com/snapshot/STS4/nightly/dist/@MAJOR-TARGET@/spring-tool-suite-4-@QUALIFIER@-@TARGET@-linux.gtk.x86_64.tar.gz">spring-tool-suite-4-@QUALIFIER@-@TARGET@-linux.gtk.x86_64.tar.gz</li>
|
||||
|
||||
11
eclipse-distribution/common/repackage-windows-zips.sh
Executable file
11
eclipse-distribution/common/repackage-windows-zips.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
#We are assuming this script will be called by bamboo from the root of the git repo
|
||||
set -ev
|
||||
echo "Repackaging Windows Distribution Zip files as self extracting jars..."
|
||||
cd eclipse-distribution
|
||||
echo pwd = $(pwd)
|
||||
find . -name "*.zip"
|
||||
for zipfile in $(find $(pwd) -name "*.win32.x86_64.zip"); do
|
||||
java -jar commons/self-extracting-jar-creator.jar "$zipfile"
|
||||
done
|
||||
echo "Repackaging Windows Distribution Zip files DONE"
|
||||
BIN
eclipse-distribution/common/self-extracting-jar-creator.jar
Normal file
BIN
eclipse-distribution/common/self-extracting-jar-creator.jar
Normal file
Binary file not shown.
25
self-extracting-jar-creator/README.md
Normal file
25
self-extracting-jar-creator/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
Self-extracting Jar Creator
|
||||
===========================
|
||||
|
||||
Simple utility that creates self-extracting jars.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
Run `./build.sh` from the directory containing this readme.
|
||||
The creator utility is produced as `target/self-extracting-jar-creator-*.jar`.
|
||||
A copy of this file is also installed into eclipse-distributions/commons for
|
||||
use by the STS build.
|
||||
|
||||
Creating a Self Extracting Jar
|
||||
------------------------------
|
||||
|
||||
Run command `java -jar self-extracing-jar-creator/target/self-extracing-jar-creator-0.0.1-SNAPSHOT.jar <path-to-zip-you-want-to-repackage>`.
|
||||
The repackaged zip is created in the same directory as the original zip.
|
||||
|
||||
Unpacking a Self Extracting Jar
|
||||
------------------------------
|
||||
|
||||
Double-click the self extracting jar (this works only if your OS environment is setup to recognize executable jars and run them
|
||||
through a JVM, this seems to be the case in Windows if a JVM is installed). Alternatively, you can also unpack STS
|
||||
from the commandline via `java -jar <path-to-self-extracting-jar>`.
|
||||
3
self-extracting-jar-creator/build.sh
Executable file
3
self-extracting-jar-creator/build.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
mvn clean package
|
||||
cp target/*.jar ../eclipse-distribution/common/self-extracting-jar-creator.jar
|
||||
@@ -2,8 +2,8 @@
|
||||
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>
|
||||
<groupId>com.github.kdvolder</groupId>
|
||||
<artifactId>self-extracing-jar-creator</artifactId>
|
||||
<groupId>org.springframework.ide</groupId>
|
||||
<artifactId>self-extracting-jar-creator</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SelfExtractor {
|
||||
try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(new File(repackagedPath)))) {
|
||||
ZipEntry entry;
|
||||
while ((entry = zipIn.getNextEntry())!=null) {
|
||||
System.out.println("Adding: "+entry.getName());
|
||||
//System.out.println("Adding: "+entry.getName());
|
||||
if (entry.getName().equals("contents.zip")) {
|
||||
//skip. We need to write the wrapped zip contents here.
|
||||
} else {
|
||||
@@ -67,7 +67,7 @@ public class SelfExtractor {
|
||||
} //end while
|
||||
entry = new ZipEntry("contents.zip");
|
||||
zipOut.putNextEntry(entry);
|
||||
System.out.println("Adding: "+entry.getName());
|
||||
//System.out.println("Adding: "+entry.getName());
|
||||
try (FileInputStream contentsZipIn = new FileInputStream(contentsZip)) {
|
||||
copy(contentsZipIn, zipOut);
|
||||
}
|
||||
@@ -89,7 +89,8 @@ public class SelfExtractor {
|
||||
String myResourceUrl = resource.toString();
|
||||
//Example: jar:file:/home/.../self-extracing-jar-creator-0.0.1-SNAPSHOT.jar!/SelfExtractor.class
|
||||
if (!myResourceUrl.startsWith("jar:file:")) {
|
||||
File devJar = new File("target/self-extracing-jar-creator-0.0.1-SNAPSHOT.jar");
|
||||
//For convenience in 'development mode' look for a local jar built by maven.
|
||||
File devJar = new File("target/self-extracting-jar-creator-0.0.1-SNAPSHOT.jar");
|
||||
if (devJar.isFile()) {
|
||||
return devJar;
|
||||
}
|
||||
@@ -101,7 +102,7 @@ public class SelfExtractor {
|
||||
private ZipInputStream openContentsZip() {
|
||||
InputStream zip = this.getClass().getResourceAsStream(CONTENTS_ZIP_RSRC);
|
||||
if (zip==null) {
|
||||
throw new IllegalArgumentException("Couldn't find embedded '"+CONTENTS_ZIP_RSRC+"");
|
||||
throw new IllegalArgumentException("Malformed archive: Couldn't find embedded '"+CONTENTS_ZIP_RSRC+"");
|
||||
}
|
||||
return new ZipInputStream(zip);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user