forked from lawrancej/logisim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
133 lines (112 loc) · 4.31 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: 'launch4j'
apply plugin: 'sonar-runner'
if (System.properties['os.name'].toLowerCase().contains('mac')) {
apply plugin: 'macAppBundle'
macAppBundle {
mainClassName = "com.cburch.logisim.Main"
icon = "LogisimApp.icns"
}
}
mainClassName = "com.cburch.logisim.Main"
version = '2.7.2'
applicationName = 'Logisim'
description = 'Logisim: Logic Simulator'
task wrapper(type: Wrapper) {
gradleVersion = '2.2'
}
jar {
manifest {
attributes 'Implementation-Title': applicationName,
'Implementation-Version': version,
'Main-Class': mainClassName
}
// create a fat jar
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
launch4j {
// launch4j should know this from the application plugin, right?
mainClassName = project.mainClassName
jar = "lib/"+project.name+"-"+project.version+".jar"
icon = '../resources/main/logisim/logisim icon.ico'
}
buildscript {
repositories {
ivy {
artifactPattern 'http://gradle-launch4j.googlecode.com/files/[module]-[revision].[ext]'
}
mavenCentral()
}
dependencies {
classpath \
'edu.sc.seis.gradle:launch4j:1.0.6',
'net.sourceforge.nekohtml:nekohtml:1.9.18',
'javax.help:javahelp:2.0.05',
'edu.sc.seis.gradle:macappbundle:2.0.0',
'net.sf.proguard:proguard-gradle:5.2'
}
}
repositories {
mavenCentral()
}
dependencies {
compile \
'javax.help:javahelp:2.0.05',
'net.sourceforge.collections:collections-generic:4.01',
'org.apache.xmlgraphics:batik-svggen:1.7',
'org.apache.xmlgraphics:batik-swing:1.7',
// Native JDK logger (java.util.logging)
//'org.slf4j:slf4j-jdk14:1.7.5',
// Simplified logger (less lines)
'org.slf4j:slf4j-simple:1.6.1',
// Logging does nothing (use for release builds)
//'org.slf4j:slf4j-nop:1.7.5',
'com.itextpdf:itextpdf:5.5.0',
// Local dependencies convention: ./libs/*.jar
fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.11'
}
processResources << {
println "Processing Java Help..."
def parser = new org.cyberneko.html.parsers.SAXParser()
def doc_src = 'src/main/resources/doc'
def doc_target = 'build/resources/main/doc'
file(doc_src).listFiles().each { locale ->
if (locale.name.length() == 2) { // Locale names are two characters long
// Build contents.xml with the id=>text mapping from locale/html/contents.html
def dict = [:]
def doc = new XmlParser(parser).parse("${doc_src}/${locale.name}/html/contents.html")
doc.'**'.A.each { dict[it.@id] = it.text() }
// Rewrite support/base-contents.xml as locale/contents.xml.
def contents = new XmlParser().parse("${doc_src}/support/base-contents.xml")
contents.'**'.'tocitem'.each {
it.@text = (dict.containsKey(it.@target)) ? dict[it.@target] : it.@target
}
new XmlNodePrinter(new File("${doc_target}/${locale.name}/contents.xml").newPrintWriter("UTF-8")).print(contents)
// Build JavaHelp map
def map = new XmlParser().parse("${doc_src}/support/base-map.jhm")
map.'**'.'mapID'.each { it.@url = "${locale.name}/${it.@url}" }
new XmlNodePrinter(new PrintWriter(new FileWriter("${doc_target}/map_${locale.name}.jhm"))).print(map)
// Build HelpSet
def hs = new File("${doc_src}/support/base-doc.hs")
def out = new PrintWriter(new FileWriter("${doc_target}/doc_${locale.name}.hs"))
hs.eachLine { out.println(it.replace("{lang}", locale.name)) }
out.close()
// JavaHelp index
javaexec {
main = 'com.sun.java.help.search.Indexer'
classpath = sourceSets.main.compileClasspath
args '-c', 'jhindexer.cfg', '-db', "${doc_target}/search_lookup_${locale.name}", '-locale', locale.name, "${doc_target}/${locale.name}/html/guide", "${doc_target}/${locale.name}/html/libs"
}
}
}
}