This repository has been archived by the owner on Mar 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
/
build.gradle
178 lines (144 loc) · 5.71 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
/*
Usage:
gradle build - builds code and creates a single jar in build/libs/frostwire.jar
gradle clean - cleans the build.
gradle tasks - shows available tasks.
gradle gettextExtract - extract all the strings from the sourcecode into frostwire.pot
gradle gettextBundle - create messages.jar with the extracted strings.
*/
apply plugin: 'java'
if (!System.getenv('ANT_HOME')?.trim()) {
//throw new GradleException("ERROR: ANT_HOME environment variable not set.\n\n(e.g. on MacOSX: /usr/local/Cellar/ant/1.9.3/libexec\n on Linux: /usr/share/ant)")
}
if (!new File("../frostwire-common").exists()) {
//throw new GradleException("ERROR: You need to checkout the dependency frostwire-common")
}
if (!new File("../frostwire-jlibtorrent").exists()) {
//throw new GradleException("ERROR: You need to checkout the dependency frostwire-jlibtorrent")
}
sourceCompatibility = 1.7
compileJava {
options.encoding = '8859_1'
}
repositories {
mavenCentral()
}
// add third party jars to classpath.
dependencies {
compile fileTree(dir: 'lib/jars', include: ['*.jar'])
def ant_jar_path = System.getenv('ANT_HOME') + '/lib/ant.jar'
compile files(new File(ant_jar_path).toURI())
}
sourceSets {
main {
java {
// frostwire-common
srcDir '../frostwire-common/src/main/java'
// jars-src (other third parties dependencies, we keep their sources
// so that we can properly create the .deb sources for debian based mantainers
// to corroborate we build entirely from source.)
srcDir 'lib/jars-src/gettext-commons-0_9_5/src/java'
exclude "**/ant/gettext/*.java"
srcDir 'lib/jars-src/lucene-3.5.0'
srcDir 'lib/jars-src/h2-1.4.186/src/main'
srcDir 'lib/jars-src/jaudiotagger/src'
srcDir 'lib/jars-src/metadata-extractor-2.6.2-src/Source'
srcDir 'src'
}
resources {
srcDir 'src'
include '**/*.properties'
include '**/*.png'
include '**/*.gif'
include '**/*.jpg'
include '**/*.html'
include '**/*.js'
include '**/*.sh'
include '**/*.dat'
include '**/*.icc'
exclude '**/*.DS_Store'
srcDir 'resources'
include '**/*.properties'
include '**/*.png'
include '**/*.gif'
include '**/*.jpg'
include '**/*.html'
include '**/*.js'
include '**/*.sh'
include '**/*.dat'
include '**/*.icc'
exclude '**/*.DS_Store'
}
}
}
jar {
archiveName = 'frostwire.jar'
exclude('META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF')
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes 'Main-Class': 'com.limegroup.gnutella.gui.Main'
}
}
// gettext tasks
task gettextInit {
description 'Loads and define the ant gettext related tasks'
doLast {
ant.taskdef(name: 'gettextExtract', classname: 'org.xnap.commons.ant.gettext.GettextExtractKeysTask', classpath: 'lib/jars/gettext-commons.jar')
ant.taskdef(name: 'gettextMerge', classname: 'org.xnap.commons.ant.gettext.GettextMergeKeysTask', classpath: 'lib/jars/gettext-commons.jar')
ant.taskdef(name: 'gettextGenerateDefault', classname: 'org.xnap.commons.ant.gettext.GenerateDefaultBundleTask', classpath: 'lib/jars/gettext-commons.jar')
ant.taskdef(name: 'gettextDist', classname: 'org.xnap.commons.ant.gettext.GettextDistTask', classpath: 'lib/jars/gettext-commons.jar')
}
}
task gettextExtract {
description 'Extracts message keys from the source code'
doLast {
println 'gettext extract...'
ant.gettextExtract(keysFile: 'frostwire.pot',
poDirectory: 'lib/messagebundles',
keywords: '-kgetStringResource -kgetFormattedStringResource -ktrc -ktr -ktrn:1,2 -ktrl') {
fileset(dir: "src") {
include(name: '**/*.java')
}
}
println 'gettext merge...'
ant.gettextMerge(keysFile: "frostwire.pot", poDirectory: "lib/messagebundles")
}
}
task gettextBundle {
description 'Rebuilds messages and bundles them into messages.jar'
doLast {
// clean up
println 'gettext bundle...'
println 'cleaning up...'
delete 'lib/messagebundles/org'
// generate default bundle for complete messages
println 'gettext generate default'
ant.gettextGenerateDefault(targetBundle: 'org.limewire.i18n.Messages',
outputDirectory: 'lib/messagebundles',
potfile: 'lib/messagebundles/frostwire.pot')
// generate complete bundles
println 'gettext dist (complete bundles)'
ant.gettextDist(targetBundle: 'org.limewire.i18n.Messages',
poDirectory: 'lib/messagebundles',
outputDirectory: 'lib/messagebundles',
percentage: '35')
// generate the empty en.po file without percentage
println 'gettext dist (empty en.po file without percentage)'
ant.gettextDist(targetBundle: 'org.limewire.i18n.Messages',
outputDirectory: 'lib/messagebundles') {
fileset(dir: 'lib/messagebundles') {
include(name: 'en.po')
}
}
// jar them
println 'jar it...'
ant.jar(destfile: 'lib/jars/messages.jar',
basedir: 'lib/messagebundles',
includes: "org/**")
// clean up
println 'cleaning up...'
delete 'lib/messagebundles/org'
}
}
gettextExtract.dependsOn gettextInit
gettextBundle.dependsOn gettextInit