Skip to content

Commit

Permalink
build exe file
Browse files Browse the repository at this point in the history
  • Loading branch information
nanonull committed Jan 15, 2016
1 parent c55e923 commit 5441c81
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'idea'

setEncoding(this, "UTF-8")

version = '1.0'
version = '1.1'

ext {
groovyVersion = '2.4.3'
Expand Down Expand Up @@ -33,10 +33,8 @@ subprojects {
apply plugin: 'groovy'
apply plugin: 'idea'

// FIXME this is only root
setEncoding(this, "UTF-8")

version = this.version
setEncoding(project, "UTF-8")
project.version = this.version

sourceCompatibility = javaVersion

Expand Down
40 changes: 39 additions & 1 deletion spashole-game/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,55 @@
ext {
mainClass = 'conversion7.spashole.game.ClientApplication'
}

dependencies {
compile 'com.google.code.gson:gson:2.5'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.5.1'
compile 'org.json:json:20151123'
compile 'org.jsoup:jsoup:1.8.3'
}

String fatJarName = null
task fatJar(type: Jar) {
println 'fatJar'
manifest {
attributes 'Implementation-Title': 'Feed the space',
'Implementation-Version': version,
'Main-Class': 'conversion7.spashole.game.ClientApplication'
'Main-Class': "${mainClass}"
}
baseName = project.name
fatJarName = baseName + '-' + version + '.jar'
println 'fatJarName: ' + fatJarName
// from { configurations.compile.first() } // test
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

task copyJarToL4J(type: Copy) {
def root = new File("").getAbsoluteFile()
println root.getAbsolutePath()
from new File(root, "build\\libs\\${fatJarName}")
into new File(root, 'build\\launch4j\\lib')
}

buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'gradle.plugin.edu.sc.seis.gradle:launch4j:1.6.1'
}
}
apply plugin: 'edu.sc.seis.launch4j'

// dont let l4j rewrite fat jar!
jar.enabled = false
launch4j {
outfile = 'Game.exe'
mainClassName = "${mainClass}"
assert fatJarName : 'fatJar must be executed before!'
jar = "lib/${fatJarName}"
}

0 comments on commit 5441c81

Please sign in to comment.