Skip to content

Commit

Permalink
Merge pull request #3 from peterkir/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
peterkir authored Jul 22, 2019
2 parents 1ac5046 + 7cab9a0 commit 2591a42
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
42 changes: 21 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
sudo: false

language: java

jdk:
- openjdk8

Expand All @@ -14,36 +12,38 @@ cache:
- $HOME/.gradle/wrapper/

script:
# build fat jar
- ./gradlew export.prepareEclipseInstaller

# prepare OomphInstallers (workaround for a non-zero exit code appended)
- java -jar io.klib.prepare.eclipseinstaller/generated/distributions/executable/prepareEclipseInstaller.jar || true
- >
export version=`grep "base.version" cnf/build.bnd |cut -d'=' -f2`;
export currDate=`date +'%Y%m%d-%H%M%S'`;
export gitTag=$(git log --format=%h -1);
export snapshot=".SNAPSHOT";
export prerelease=true;
if [ "${TRAVIS_BRANCH}" == "master" ]; then
export snapshot="";
export prerelease=false;
fi;
export TRAVIS_TAG=${version}.${currDate}_${gitTag}${snapshot};
./gradlew export.prepareEclipseInstaller;
java
-Dtimestamp=${currDate}
-jar io.klib.prepare.eclipseinstaller/generated/distributions/executable/prepareEclipseInstaller.jar
before_deploy:
# Set up git user name and tag this commit
- git config --local user.name "Peter Kirschner"
- git config --local user.email "[email protected]"
- export version=`grep "base.version" cnf/build.bnd |cut -d'=' -f2`
- export prerelease=true
- export snapshot=".SNAPSHOT"
- >
if [ "${TRAVIS_BRANCH}" == "master" ]; then
export prerelease=false;
export snapshot="";
fi
- export TRAVIS_TAG=$version.${TRAVIS_TAG:-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)}$snapshot
- export RELEASE_NAME="IDEfix $TRAVIS_TAG"
- export RELEASE_CONTENT="t.b.d."
- git tag $TRAVIS_TAG
- git tag $TRAVIS_TAG

- export RELEASE="IDEfix"
- export RELEASE_NAME="$RELEASE $TRAVIS_TAG"
- export RELEASE_CONTENT="t.b.d. - $RELEASE"

deploy:
provider: releases
prerelease: $prerelease
api_key:
secure: In29qlp4RJ9P8Lo4dEZQCKWwaLGzVul/ElMf4kLdOg0MJBtVyTstMR+R61AfCM66VMeF2B1M2McadjOd5d2GWx8cWgPs5bR5tJJZuqztEX2aZYVj/OBO51vhHy3xFuS525JouzomVIuVeOXVIcEl0MarVKdU4lCMuAO8umJlprRJRNRo26B5iYQ2O06V11CxrLMWOfJM6eay7NdX2/W9LcchX7+aqvacjsJ7MX5KsA00AQjRZ9Mzv9nH0YJa6wAL+jDud0IIW1BE3+7IGeAovDwTjMXZY587BPQHFZS0+IBg5NR2qCK2uVVRx3L5qVEOUAEjIuU2I0LB8N4qWBcIEk4pfZXear9SfGm7W8b1PviwSdafmz6BdlQqPALlDfs/Pp+Z9bdU6jRR4H5GQg0dDp6KnO6P6ofuvNirb2JmygOGNC+cuTbgb5oIKfjcIgw5D/MCiJOntiPwUV4WyiewpzHY6mc4kUpRIXZe2T+ZK3UQzyf+JGpTmkKLOnNQ9xXXjJvaEgd8qGa0qX5ATWxZV4Y1KRH9pH0I6CZ+WrqjYM4Sj4aexamPp+PQPnHt7o6gnRy2Bnoz80vEVXoYKtMIwft4IJDvwc70UjUO7auPOzwHCLH7dAZ8YGey5D7wwU0tp3xk5NyDCm6NSRFrfN+tukz9RYwqI2skewIpLPIrJlE=
file_glob: true
file: _result/**/*
file: _result/**/IDEfix*
skip_cleanup: true
on:
all_branches: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,32 @@
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.apache.commons.compress.utils.IOUtils;
import org.eclipse.oomph.extractor.lib.BINExtractor;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkUtil;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;

// @formatter:off
@Component
public class EclipseInstallerPatchINI {

private static final String USCORE = "_";

private static final String DL_PROD = "http://www.eclipse.org/downloads/download.php?file=/oomph/products";

// format: archive name, download URL, oomph archive name, IDEfix archive name,
// setup.p2.agent location

String[][] archives = {
{ "prod.macosx.x86-64", DL_PROD, "eclipse-inst-mac64.tar.gz", "IDEfix.inst.macosx.x86-64.tar.gz",
{ "prod.macosx.x86-64", DL_PROD, "eclipse-inst-mac64.tar.gz", "macosx.x86-64.tar.gz",
"@user.home/oomph/.p2" },
{ "prod.linux.x86-64", DL_PROD, "eclipse-inst-linux64.tar.gz", "IDEfix.inst.linux.x86-64.tar.gz",
{ "prod.linux.x86-64", DL_PROD, "eclipse-inst-linux64.tar.gz", "linux.x86-64.tar.gz",
"@user.home/oomph/.p2" },
// { "prod.linux.x86", DL_PROD, "eclipse-inst-linux32.tar.gz",
// "IDEfix.inst.linux.x86.tar.gz", "@user.home/oomph/.p2" },
{ "prod.win32.x86-64", DL_PROD, "eclipse-inst-win64.exe", "IDEfix.inst.win32.x86-64.exe", "C:/IDEfix/.p2" },
// ".linux.x86.tar.gz", "@user.home/oomph/.p2" },
{ "prod.win32.x86-64", DL_PROD, "eclipse-inst-win64.exe", "win32.x86-64.exe", "C:/IDEfix/.p2" },
// { "prod.win32.x86", DL_PROD, "eclipse-inst-win32.exe",
// "IDEfix.inst.win32.x86.exe", "C:/IDEfix/.p2" },
// ".win32.x86.exe", "C:/IDEfix/.p2" },
};

private static final String DL_NIGHTLY = "http://www.eclipse.org/downloads/download.php?file=/oomph/products/latest";
Expand Down Expand Up @@ -96,23 +98,25 @@ public class EclipseInstallerPatchINI {
private static final String wrkDir = DIR + SEP + "_wrk";
private static final String resultRootDir = DIR + SEP + "_result";

private static final String ts = DateTimeFormatter.ofPattern("yyyyMMdd-HHmm").format(LocalDateTime.now());
private static final String ts = System.getProperty("timestamp",
DateTimeFormatter.ofPattern("yyyyMMdd-HHmm").format(LocalDateTime.now()));
private static final String resultVariantDir = resultRootDir + SEP + ts;

private static final int BUFFER_SIZE = 4096;

private static final HashMap<String, String[]> iniSuffix = new LinkedHashMap<String, String[]>();
private static final HashMap<String, String[]> prodVariant = new LinkedHashMap<String, String[]>();

public EclipseInstallerPatchINI() {
iniSuffix.put("peterkir", new String[] { "-Doomph.setup.installer.mode=advanced",

prodVariant.put("peterkir", new String[] { "-Doomph.setup.installer.mode=advanced",
"-Doomph.setup.installer.p2pool=true", "-Doomph.setup.installer.launch=true",
"-Doomph.update.url=http://download.eclipse.org/oomph/updates/release/latest/",
"-Doomph.redirection.idefixProductCatalog=index:/redirectable.products.setup->http://peterkir.github.io/idefix/bootstrap/peterkir/catalogProducts.setup",
"-Doomph.redirection.idefixProjectCatalog=index:/redirectable.projects.setup->http://peterkir.github.io/idefix/bootstrap/peterkir/catalogProjects.setup",
"-Doomph.setup.product.catalog.filter=io\\\\.klib\\\\.products",
"-Doomph.setup.product.filter=(?\\!io\\\\.klib\\\\.products\\\\.idefix\\\\.oxygen).*",
"-Doomph.setup.product.version.filter=.*\\\\.latest\\\\.cloudbees", "-Dsetup.p2.agent=" });
iniSuffix.put("IDEfix.fw.1912", new String[] { "-Doomph.setup.installer.mode=advanced",
prodVariant.put("fw.1912", new String[] { "-Doomph.setup.installer.mode=advanced",
"-Doomph.setup.stats.skip=true", "-Doomph.setup.installer.p2pool=true",
"-Doomph.setup.installer.launch=true",
"-Doomph.update.url=http://download.eclipse.org/oomph/updates/release/latest/",
Expand All @@ -125,7 +129,7 @@ public EclipseInstallerPatchINI() {
};

@Activate
public void activate(BundleContext ctx) {
public void activate() {

createWorkingDirs();

Expand All @@ -134,17 +138,18 @@ public void activate(BundleContext ctx) {
String productVersion = archives[archiveIndex][0];
String sourceUrl = archives[archiveIndex][1];
String archiveName = archives[archiveIndex][2];
String patchedArchiveName = archives[archiveIndex][3];
String p2PoolPath = archives[archiveIndex][4];

String downloadDir = wrkDir + SEP + "1_download" + SEP + productVersion;
String extractDir = wrkDir + SEP + "2_extracted" + SEP + productVersion;
String patchDir = wrkDir + SEP + "3_patched_INI" + SEP + productVersion;

iniSuffix.forEach((variant, iniSuffix) -> {
for (String prod : prodVariant.keySet()) {

String resultDir = resultVariantDir + SEP + variant;
System.out.format("# processing variant <%s> product version <%s>\n", variant, productVersion);
String patchedArchiveName = "IDEfix" + USCORE + prod + USCORE + archives[archiveIndex][3];
String[] iniSuffix = prodVariant.get(prod);
String resultDir = resultVariantDir + SEP + prod;
System.out.format("# processing variant <%s> product version <%s>\n", prod, productVersion);

download(sourceUrl, downloadDir, archiveName, ECL_DL_SUFFIX);

Expand Down Expand Up @@ -184,8 +189,8 @@ public void activate(BundleContext ctx) {
System.out.format("No strategy for archive <%s> with suffix <%s>", archiveName, archiveSuffix);
break;
}

});
}
;
}

updateIndexFile();
Expand All @@ -196,11 +201,7 @@ public void activate(BundleContext ctx) {
}

System.out.println("done");
try {
ctx.getBundle(0).stop();
} catch (BundleException e) {
e.printStackTrace();
}
System.exit(0);
}

private void updateIndexFile() {
Expand Down Expand Up @@ -464,7 +465,7 @@ private void extractExe(String executable, String targetFolder) {
Path source = Paths.get(DIR, "signed_extractor/win64/extractor.exe");
Path destination = Paths.get(wrkDir, "2_extracted/prod.win32.x86-64/extractor.exe");
if (source.toFile().exists()) {
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
Path copy = Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
} else {
System.out.println("no source file exists " + source);
}
Expand Down

0 comments on commit 2591a42

Please sign in to comment.