forked from frostwire/frostwire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
175 lines (140 loc) · 5.78 KB
/
build.gradle
File metadata and controls
175 lines (140 loc) · 5.78 KB
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
/*
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.
*/
group 'com.frostwire'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply from: "$rootDir/common/dependencies.gradle"
sourceCompatibility = 1.7
// if false, you will need to have a symlink to frostwire-jlibtorrent at the root of the project.
// this won't work for windows users, who will either have to have this in true, or just
// copy frostwire-jlibtorrent if they need to hack frostwire-jlibtorrent while coding.
def useJlibtorrentFromMaven = true
if (!useJlibtorrentFromMaven && !new File("frostwire-jlibtorrent").exists()) {
def path = new File("frostwire-jlibtorrent").getAbsolutePath()
throw new Exception("You want to use jlibtorrent from source but you don't have a symlink at '" + path + "' with the sources.");
}
compileJava {
options.encoding = '8859_1'
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/ijabz/maven"
}
}
dependencies {
compile 'com.googlecode.gettext-commons:gettext-commons:0.9.8'
compile 'com.h2database:h2:1.4.190'
compile 'org.apache.lucene:lucene-core:3.5.0'
compile 'net.jthink:jaudiotagger:2.2.5'
if (useJlibtorrentFromMaven) {
compile 'com.frostwire:jlibtorrent:1.1.0.16'
}
compile fileTree(dir: 'desktop/lib/jars', include: ['*.jar'])
}
sourceSets {
main {
java {
// frostwire-common
srcDir 'common/src/main/java'
srcDir 'desktop/src'
if (!useJlibtorrentFromMaven) {
//To avoid 'Can't register given path of type 'SOURCE' ... error in intelliJ
//make a symlink to frostwire-jlibtorrent inside our content root folder,
//at the same level where desktop,common and android are.
srcDir 'frostwire-jlibtorrent/src/main/java'
}
}
resources {
srcDir 'common/src/main/resources'
srcDir 'desktop/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: 'desktop/lib/jars/gettext-ant-tasks-0.9.7.jar')
ant.taskdef(name: 'gettextMerge', classname: 'org.xnap.commons.ant.gettext.GettextMergeKeysTask', classpath: 'desktop/lib/jars/gettext-ant-tasks-0.9.7.jar')
ant.taskdef(name: 'gettextGenerateDefault', classname: 'org.xnap.commons.ant.gettext.GenerateDefaultBundleTask', classpath: 'desktop/lib/jars/gettext-ant-tasks-0.9.7.jar')
ant.taskdef(name: 'gettextDist', classname: 'org.xnap.commons.ant.gettext.GettextDistTask', classpath: 'desktop/lib/jars/gettext-ant-tasks-0.9.7.jar')
}
}
task gettextExtract {
description 'Extracts message keys from the source code'
doLast {
println 'gettext extract...'
ant.gettextExtract(keysFile: 'frostwire.pot',
poDirectory: 'desktop/lib/messagebundles',
keywords: '-kgetStringResource -kgetFormattedStringResource -ktrc -ktr -ktrn:1,2 -ktrl') {
fileset(dir: "desktop/src") {
include(name: '**/*.java')
}
}
println 'gettext merge...'
ant.gettextMerge(keysFile: "frostwire.pot", poDirectory: "desktop/lib/messagebundles")
}
}
task gettextBundle {
description 'Rebuilds messages and bundles them into messages.jar'
doLast {
// clean up
println 'gettext bundle...'
println 'cleaning up...'
delete 'desktop/lib/messagebundles/org'
// generate default bundle for complete messages
println 'gettext generate default'
ant.gettextGenerateDefault(targetBundle: 'org.limewire.i18n.Messages',
outputDirectory: 'desktop/lib/messagebundles',
potfile: 'desktop/lib/messagebundles/frostwire.pot')
// generate complete bundles
println 'gettext dist (complete bundles)'
ant.gettextDist(targetBundle: 'org.limewire.i18n.Messages',
poDirectory: 'desktop/lib/messagebundles',
outputDirectory: 'desktop/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: 'desktop/lib/messagebundles') {
fileset(dir: 'desktop/lib/messagebundles') {
include(name: 'en.po')
}
}
// jar them
println 'jar it...'
ant.jar(destfile: 'desktop/lib/jars/messages.jar',
basedir: 'desktop/lib/messagebundles',
includes: "org/**")
// clean up
println 'cleaning up...'
delete 'desktop/lib/messagebundles/org'
}
}
gettextExtract.dependsOn gettextInit
gettextBundle.dependsOn gettextInit