This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
/
build.gradle
183 lines (145 loc) · 5.5 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
179
180
181
182
183
apply plugin: 'java'
apply plugin: 'eclipse'
import java.io.File;
dependencies {
compile project(":syncany-lib")
compile project(":syncany-util")
compile project(":syncany-plugins:syncany-plugin-ftp")
compile project(":syncany-plugins:syncany-plugin-webdav")
compile "net.sf.jopt-simple:jopt-simple:4.5"
testCompile "com.github.stefanbirkner:system-rules:1.5.0"
testCompile project(path: ":syncany-lib", configuration: "tests")
testCompile project(path: ":syncany-util", configuration: "tests")
testCompile project(path: ":syncany-plugins:syncany-plugin-ftp", configuration: "tests")
testCompile "org.apache.ftpserver:ftpserver-core:1.0.6"
testCompile "junit:junit:4.9"
}
// Application Plugin Settings and Hooks ///////////////////////////////////////
apply plugin: "application"
applicationName = "syncany"
mainClassName = "org.syncany.Syncany"
startScripts {
defaultJvmOpts = [ "-Xmx1024m", "-Dfile.encoding=utf-8" ]
classpath = files('$APP_HOME/lib/*')
doLast {
def winFile = file getWindowsScript()
def unixFile = file getUnixScript()
winFile.text = winFile.text.replaceAll("(set CLASSPATH=.+)", '$1;%AppData%\\\\syncany\\\\plugins\\\\*')
unixFile.text = unixFile.text.replaceAll("(CLASSPATH=\\\$APP_HOME.+)", '$1:~/.config/syncany/plugins/*')
}
}
applicationDistribution.from("${rootProject.projectDir}/") {
include "AUTHORS.md", "CHANGELOG.md", "LICENSE.md", "README.md"
}
distTar {
baseName = "syncany"
version = "$applicationVersionFull"
compression = Compression.GZIP
extension = "tar.gz"
}
distZip {
baseName = "syncany"
version = "$applicationVersionFull"
}
// Packaging ///////////////////////////////////////////////////////////////////
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.kenshoo:gradle-fpm:0.4"
}
}
apply plugin: "fpm-packaging"
packaging {
dependencies = ["openjdk-7-jre"]
baseDir = "${buildDir}/install/${applicationName}"
prefix = "/usr/lib/syncany"
extraOptions = [
"--name": "syncany",
"--architecture": "all",
"--license": "GPLv2",
"--version": "${applicationVersionFull}",
"--maintainer": "Philipp Heckel <philipp.heckel@gmail.com>",
"--vendor": "Philipp Heckel <philipp.heckel@gmail.com>",
"--url": "http://www.syncany.org/",
"--description":
"""
Syncany is an open-source cloud storage and filesharing application.
It allows users to backup and share certain folders of their workstations
using any kind of storage. Syncany is open-source and provides data encryption
and incredible flexibility in terms of storage type and provider:
- Data encryption: Syncany encrypts the files locally, so that any online
storage can be used even for sensitive data.
- Arbitrary storage: Syncany uses a plug-in based storage system. It can be
used with any type of remote storage.
""",
"--after-install": "${rootProject.projectDir}/gradle/fpm/postinst",
"--before-remove": "${rootProject.projectDir}/gradle/fpm/prerm",
"--exclude": "*.bat"
]
filesArgs = ["."]
force = true
}
debian.dependsOn installApp
rpm.dependsOn installApp
// Windows Installer ///////////////////////////////////////////////////////////
task exe(dependsOn: ["installApp"]) << {
def innoSetupDir = new File("${buildDir}/innosetup")
delete innoSetupDir
innoSetupDir.mkdir();
copy {
from("${rootProject.projectDir}/gradle/innosetup/setup-left.bmp")
from("${rootProject.projectDir}/gradle/innosetup/setup-top.bmp")
from("${rootProject.projectDir}/gradle/innosetup/setup-info-before.rtf")
from("${rootProject.projectDir}/gradle/innosetup/setup-info-after.rtf")
from("${rootProject.projectDir}/gradle/innosetup/setup-icon.ico")
from("${rootProject.projectDir}/gradle/innosetup/modpath.iss")
into(innoSetupDir)
}
copy {
from("${rootProject.projectDir}/gradle/innosetup/setup.iss.skel")
rename("setup.iss.skel", "setup.iss")
expand([
applicationVersion: "${applicationVersion}",
applicationVersionFull: "${applicationVersionFull}",
])
into(innoSetupDir)
}
exec {
workingDir rootProject.projectDir
commandLine "iscc ${innoSetupDir}/setup.iss".split()
}
}
// CLI-specific Tasks //////////////////////////////////////////////////////////
String osName = System.getProperty("os.name").toLowerCase();
task fakeinstall(dependsOn: ["fakeuninstall"]) << {
description = "Must be run as root: Makes syncany/sy command available everywhere (symlink to syncany-cli/build/..)"
// Do not depend on :syncany-cli:installApp to avoid permission issues when
// running fakeinstall as "root"; manually calling installApp required
if (osName.startsWith("windows")) {
copy {
from "../gradle/windows/syncany.bat"
into System.getenv()["windir"]
expand(appBinary: "${buildDir}/install/${applicationName}/bin/${applicationName}.bat")
}
}
else{
ant.symlink(resource: "${buildDir}/install/${applicationName}/bin/${applicationName}", link: "/usr/local/bin/syncany")
ant.symlink(resource: "${buildDir}/install/${applicationName}/bin/${applicationName}", link: "/usr/local/bin/sy")
}
}
task fakeuninstall << {
description = "Must be run as root: Removes symlink for syncany/sy command (complement to fakeinstall)"
if (osName.startsWith("windows")) {
new File(System.getenv()["windir"] + "/syncany.bat").delete()
}
else {
new File("/usr/local/bin/syncany").delete()
new File("/usr/local/bin/sy").delete()
}
}
task(runCli, dependsOn: "classes", type: JavaExec) {
main = "org.syncany.Syncany"
classpath = sourceSets.main.runtimeClasspath
}