-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
178 lines (155 loc) · 5.59 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.yuvimasory:orange-extensions:1.3.0' // OSX support
}
}
plugins {
id "nebula.ospackage" version "8.5.6"
id "edu.sc.seis.launch4j" version "2.4.9"
}
apply plugin: 'java'
apply plugin: 'distribution'
// Common Configuration //
project.version = '2.8.0'
project.ext.author = 'Dan Adler'
project.ext.email = '<[email protected]>'
project.ext.copyright = '(C) 2021'
project.ext.description = 'Logisim Circuit Simulator'
project.ext.url = 'https://github.com/dadler64/Logisim'
project.ext.bundleId = 'com.cburch.logisim'
project.ext.mainClass = "${project.ext.bundleId}.Main"
project.ext.resPath = '/src/main/resources'
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
tasks.withType(JavaCompile) {
sourceCompatibility = targetCompatibility = '1.10'
options.compilerArgs << '-Xlint:deprecation'
options.compilerArgs << '-Xlint:unchecked'
options.encoding = 'UTF-8'
}
repositories {
jcenter()
}
configurations {
provided
compile.extendsFrom provided
}
}
// 'cleanIdea' task extension //
cleanIdea.doFirst {
delete project.name + '.iws'
delete 'out'
followSymLinks = true
}
// All in one JAR file //
jar {
manifest {
attributes 'Main-Class': project.ext.mainClass, 'JD-FX-Version': project.version
}
duplicatesStrategy DuplicatesStrategy.EXCLUDE
// This line of code recursively collects and copies all of a project's files
// and adds them to the JAR itself. One can extend this task, to skip certain
// files or particular types at will
from {
configurations.compileClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
// Java executable wrapper for Windows //
launch4j {
createExe.dependsOn 'jar'
version = textVersion = project.version
fileDescription = productName = rootProject.name
errTitle = "${rootProject.name} Wrapper"
copyright = "${project.ext.author} ${project.ext.copyright}"
fileDescription = project.ext.description
icon = "${projectDir.path}/dist/windows/${project.name}.ico"
bundledJrePath = '%JAVA_HOME%'
}
// Distributions for MacOS and Windows //
distributions {
osx.contents {
// info.plist file
into("${rootProject.name}.app/Contents") {
if (file("./dist/macos/Info.plist").exists()) {
from('./dist/macos') {
include 'Info.plist'
expand VERSION: project.version,
JAR: project.name,
COPYRIGHT: project.ext.copyright,
AUTHOR: project.ext.author,
BUNDLE_ID: project.ext.bundleId,
MAIN_CLASS: project.ext.mainClass
}
} else {
println("WARNING: Unable to locate the \'Info.plist\' file!\nMacOS bundled app may not work!")
}
}
// universalJavaApplicationStub.sh
into("${rootProject.name}.app/Contents/MacOS") {
if (file("./dist/macos/universalJavaApplicationStub.sh").exists()) {
from('./dist/macos') {
include 'universalJavaApplicationStub.sh'
fileMode 0755
}
} else {
println("WARNING: Unable to locate the \'universalJavaApplicationStub.sh\' file!\nMacOS bundled app may not work!")
}
}
// App *.icns file
into("${rootProject.name}.app/Contents/Resources") {
String iconFileName = "${rootProject.name}App"
if (file("./dist/macos/${iconFileName}.icns").exists()) {
from('./dist/macos') {
// Make sure this matches the name of the .icns file in the 'dist/macos/resources/' folder
include "${iconFileName}.icns"
}
} else {
println("WARNING: Unable to locate icon for MacOS app at: <./dist/macos/resources/${rootProject.name}.icns>!")
}
}
// Document *.icns file
into("${rootProject.name}.app/Contents/Resources") {
String iconFileName = "${rootProject.name}Doc"
if (file("./dist/macos/${iconFileName}.icns").exists()) {
from('./dist/macos') {
// Make sure this matches the name of the .icns file in the 'dist/macos/resources/' folder
include "${iconFileName}.icns"
}
} else {
println("WARNING: Unable to locate icon for MacOS app at: <./dist/macos/resources/${rootProject.name}.icns>!")
}
}
// project *.jar file
into("${rootProject.name}.app/Contents/Resources/Java") {
from jar
}
from 'LICENSE', 'README.md'
}
windows.contents {
from "build/launch4j/${project.name}.exe"
from 'LICENSE', 'README.md'
}
crossplatform.contents {
from "build/libs/${project.name}-${project.version}.jar"
from 'LICENSE', 'README.md'
}
installWindowsDist.dependsOn createExe
windowsDistTar.dependsOn createExe
windowsDistZip.dependsOn createExe
installOsxDist.dependsOn 'jar'
osxDistTar.dependsOn 'jar'
osxDistZip.dependsOn 'jar'
// Use this cross platform build until linux building resumes
installCrossplatformDist.dependsOn 'jar'
crossplatformDistTar.dependsOn 'jar'
crossplatformDistZip.dependsOn 'jar'
}
dependencies {
implementation fileTree(dir: 'libs', include: ('*.jar'))
}