Skip to content

Commit

Permalink
Build-Skript um signieren und pack200 erweitert, Speichern des "geles…
Browse files Browse the repository at this point in the history
…en"-Status gefixt
  • Loading branch information
tobiasbaum committed Jan 25, 2014
1 parent 2eeab20 commit 683cebf
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 28 deletions.
65 changes: 40 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tasks.withType(Compile) {
}

mainClassName = 'de.tntinteractive.portalsammler.Portalsammler'
sourceCompatibility = '1.7'

repositories {
mavenCentral()
Expand All @@ -40,7 +41,11 @@ dependencies {

jar {
manifest {
attributes 'Implementation-Title': 'Portalsammler', 'Implementation-Version': version, 'Main-Class': project.mainClassName
attributes 'Implementation-Title': 'Portalsammler',
'Implementation-Version': version,
'Main-Class': project.mainClassName,
'Application-Name': 'Portalsammler',
'Permissions': 'all-permissions'
}
}

Expand Down Expand Up @@ -85,38 +90,48 @@ task mergeJarsIntoOne(dependsOn: installApp) {
}


task pack200(dependsOn: mergeJarsIntoOne, type: Exec) {
String jar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.tmp.jar";
String packgz = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.pack.gz";
task repack200(dependsOn: mergeJarsIntoOne, type: Exec) {
String injar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.tmp.jar";
String outjar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.repacked.jar";

inputs.file jar
outputs.file packgz
inputs.file injar
outputs.file outjar

commandLine Jvm.current().getJavaHome().toString() + '/bin/pack200', packgz, jar
commandLine System.getenv('JAVA_HOME') + '/bin/pack200', '--repack', outjar, injar
}

task unpack200(dependsOn: pack200, type: Exec) {
String jar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.jar";
String packgz = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.pack.gz";
task signJar(dependsOn: repack200, type: Exec) {
String injar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.repacked.jar";
String outjar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.jar";

inputs.file packgz
outputs.file jar
inputs.file injar
outputs.file outjar

commandLine Jvm.current().getJavaHome().toString() + '/bin/unpack200', packgz, jar
commandLine System.getenv('JAVA_HOME') + '/bin/jarsigner',
'-storetype', 'pkcs12',
'-keystore', "${project.buildDir}/../../codesigning.p12",
'-tsa', 'http://time.certum.pl',
'-signedjar', outjar,
injar,
'root ca id von tobias baum'

doFirst {
String password = javax.swing.JOptionPane.showInputDialog('Enter keystore password');
args '-storepass', password
}
}

task oneSignedJar(dependsOn: unpack200) {
// ant.signjar(
// destDir: webstartSignedLibPath,
// alias: project.getProperty('jarsign.keystore.alias'),
// jar: it,
// keystore: project.getProperty('jarsign.keystore.path'),
// storepass: project.getProperty('jarsign.keystore.password'),
// preservelastmodified: 'true'
// )
task pack200(dependsOn: signJar, type: Exec) {
String jar = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.jar";
String packgz = "${project.buildDir}/oneSignedJar/${project.name}-${project.version}.jar.pack.gz";

inputs.file jar
outputs.file packgz

commandLine System.getenv('JAVA_HOME') + '/bin/pack200', packgz, jar
}

build.dependsOn oneSignedJar
build.dependsOn pack200

task createJnlp {
File output = file("${project.buildDir}/oneSignedJar/${project.name}-${project.version}.jnlp")
Expand All @@ -126,7 +141,7 @@ task createJnlp {
doLast {
def out = new FileWriter(output)
def b = new MarkupBuilder(out)
b.jnlp(id: 'test', border: 0) {
b.jnlp(id: 'portalsammler', border: 0) {
information {
title('Portalsammler')
vendor('Tobias Baum / TNT Interactive')
Expand All @@ -137,7 +152,7 @@ task createJnlp {
'all-permissions'()
}
resources {
j2se(version: '7.0')
j2se(version: '7.0+')
jar(href: "${project.name}-${project.version}.jar")
}
'application-desc'()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -223,8 +224,11 @@ private void openDocument(final int row) {
final byte[] content = this.store.getDocument(di);
this.store.markAsRead(di);
this.gui.showDocument(di, content);
this.store.writeMetadata();
} catch (final IOException e) {
this.gui.showError(e);
} catch (final GeneralSecurityException e) {
this.gui.showError(e);
}
}

Expand All @@ -241,11 +245,13 @@ private boolean exportDocument(final JFileChooser chooser, final int row) {

FileUtils.writeByteArrayToFile(chooser.getSelectedFile(), content);
this.store.markAsRead(di);
return false;
this.store.writeMetadata();
} catch (final GeneralSecurityException e) {
this.gui.showError(e);
} catch (final IOException e) {
this.gui.showError(e);
return false;
}
return false;
}

private String makeFilenameFor(final DocumentInfo di) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public HanVBSourceV1(final String id) {
@Override
public Pair<Integer, Integer> poll(final SourceSettings settings, final UserInteraction gui,
final SecureStore store) throws Exception {
final WebDriver driver = this.createDriver("https://www.hanvb.de/ptlweb/WebPortal?bankid=0744");
final WebDriver driver =
this.createDriver("https://www.hannoversche-volksbank.de/ptlweb/WebPortal?bankid=0744");

final WebElement userField = driver.findElement(By.id("vrkennungalias"));
userField.sendKeys(settings.get(USER, gui));
Expand Down

0 comments on commit 683cebf

Please sign in to comment.