forked from syncany/syncany
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
180 lines (146 loc) · 6.86 KB
/
build.xml
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
<?xml version="1.0" ?>
<project name="SyncanyCore" default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- /// Global variables and required conditions ////////////////////////////////////////// -->
<path id="test.classpath">
<pathelement location="./build" />
<fileset dir="./lib">
<include name="**/*.jar" />
</fileset>
</path>
<condition property="online">
<or>
<http url="http://www.google.com/" />
<http url="http://www.amazon.com/" />
</or>
</condition>
<condition property="isWindows" value="true">
<os family="windows"/>
</condition>
<condition property="isLinux" value="true">
<os family="unix" />
</condition>
<property environment="env"/>
<!-- /// Targets //////////////////////////////////////////////////////////////////////////// -->
<target name="init" depends="init-ivy">
<tstamp />
<mkdir dir="build" />
<ivy:settings file="ivysettings.xml" />
<ivy:retrieve conf="cc-impl" />
</target>
<target name="compile" depends="init" description="compile the source ">
<echo>Compiling SyncanyCore</echo>
<path id="project.class.path">
<fileset dir="lib" includes="*.jar" />
</path>
<javac srcdir="src" destdir="build" classpathref="project.class.path" includeantruntime="true" />
<javac srcdir="tests" destdir="build" classpathref="project.class.path" />
<copy file="logging.properties" todir="build" />
</target>
<target name="dist" depends="compile" description="generate the distribution">
<echo>Creating Distribution</echo>
<manifestclasspath property="lib.list" jarfile="SyncanyCore.jar">
<classpath refid="project.class.path" />
</manifestclasspath>
<jar jarfile="SyncanyCore.jar" basedir="build">
<manifest>
<attribute name="Main-Class" value="org.syncany.Syncany" />
<attribute name="Class-Path" value="${lib.list}" />
</manifest>
</jar>
</target>
<target name="fakeinstall" depends="fakeinstall-linux,fakeinstall-windows" description="install 'sy' and 'syncany' commands on command line">
<!-- Platform-dependent target is run -->
</target>
<target name="fakeuninstall" depends="fakeuninstall-linux,fakeuninstall-windows" description="uninstall 'sy' and 'syncany' commands">
<!-- Platform-dependent target is run -->
</target>
<target name="fakeinstall-linux" depends="fakeuninstall-linux" if="isLinux" description="install symbolic links 'sy' and 'syncany' to /usr/local/bin.">
<echo>Installing symlinks in /usr/local/bin ...</echo>
<symlink resource="${user.dir}/syncany" link="/usr/local/bin/syncany" />
<symlink resource="${user.dir}/syncany" link="/usr/local/bin/sy" />
</target>
<target name="fakeuninstall-linux" if="isLinux" description="remove symbolic links 'sy' and 'syncany' from /usr/local/bin.">
<delete file="/usr/local/bin/syncany" />
<delete file="/usr/local/bin/sy" />
</target>
<target name="fakeinstall-windows" depends="fakeuninstall-windows" if="isWindows" description="add syncany path to environment variable Path for futures shells.">
<exec executable="setx">
<arg value="Path"/>
<arg value="%Path%;${user.dir}"/>
</exec>
<echo>Please close current cmd and open new one.</echo>
</target>
<target name="fakeuninstall-windows" if="isWindows" description="remove syncany path from environment variable Path for futures shells.">
<property name="fullenvpath" value="${env.Path}" />
<property name="envpathminussyncany" value="" />
<script language="javascript">
var before = project.getProperty("fullenvpath");
var match = project.getProperty("user.dir");
project.setProperty("envpathminussyncany", before.replace(match, ""));
</script>
<exec executable="setx">
<arg value="Path"/>
<arg value="${envpathminussyncany}"/>
</exec>
</target>
<target name="install" depends="install-linux,install-windows" description="install 'sy' and 'syncany' commands on command line">
<!-- Platform-dependent target is run -->
</target>
<target name="uninstall" depends="uninstall-linux,uninstall-windows" description="uninstall 'sy' and 'syncany' commands">
<!-- Platform-dependent target is run -->
</target>
<target name="install-windows" depends="uninstall-windows" if="isWindows" description="install 'sy' and 'syncany' commands on command line">
<echo>NO WINDOWS INSTALL/UNINSTALL TARGET</echo>
</target>
<target name="uninstall-windows" if="isWindows" description="uninstall 'sy' and 'syncany' commands">
<echo>NO WINDOWS INSTALL/UNINSTALL TARGET</echo>
</target>
<target name="install-linux" depends="uninstall-linux" if="isLinux" description="install to /usr/local">
<mkdir dir="/usr/local/lib/syncany" />
<mkdir dir="/usr/local/lib/syncany/lib" />
<copy file="syncany" tofile="/usr/local/lib/syncany/syncany" />
<chmod file="/usr/local/lib/syncany/syncany" perm="+x" />
<copy file="SyncanyCore.jar" todir="/usr/local/lib/syncany" />
<copy todir="/usr/local/lib/syncany/lib">
<fileset dir="./lib">
<include name="**/*.jar" />
</fileset>
</copy>
<symlink resource="/usr/local/lib/syncany/syncany" link="/usr/local/bin/syncany" />
<symlink resource="/usr/local/lib/syncany/syncany" link="/usr/local/bin/sy" />
</target>
<target name="uninstall-linux" if="isLinux" description="remove all resources from /usr/local">
<delete file="/usr/local/bin/syncany" />
<delete file="/usr/local/bin/sy" />
<delete dir="/usr/local/lib/syncany" />
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="build" />
<delete dir="dist" />
<delete file="SyncanyCore.jar" />
</target>
<!-- ##### IVY START ##### -->
<property name="ivy.install.version" value="2.3.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" if="online">
<mkdir dir="${ivy.jar.dir}" />
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
</target>
<!-- ##### IVY END ##### -->
</project>