forked from davidfauth/FEC_GRAPH
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.xml
More file actions
163 lines (133 loc) · 6.08 KB
/
Copy pathbuild.xml
File metadata and controls
163 lines (133 loc) · 6.08 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
<project name="fec-graph" default="tool" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="project.version" value="1.0"/>
<property name="project.main.class" value="org.followthedata.importer.Tool"/>
<property name="project.jar" value="${ant.project.name}-${project.version}.jar"/>
<property name="lib.dir" value="CODE/fecGraph/lib" />
<property name="build.dir" value="CODE/fecGraph/bin" />
<property name="src.dir" value="CODE/fecGraph/src" />
<property name="bin.dir" value="bin" />
<property name="fec.data.dir" location="FEC-DATA" />
<property name="neo4j.home.dir" location="neo4j-home" />
<property name="neo4j.data.dir" location="fec.graphdb" />
<property name="neo4j.version" value="1.8.RC1" />
<property name="neo4j.server" value="neo4j-community-${neo4j.version}" />
<!-- paths used for compilation and run -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<path id="run.path.id">
<path refid="lib.path.id" />
<path location="${build.dir}" />
</path>
<!-- here is the version of ivy we will use. change this property to try a newer
version if you want -->
<property name="ivy.install.version" value="2.0.0-beta1" />
<property name="ivy.jar.dir" value="${basedir}/ivy" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<path id="ivy.lib.path">
<pathelement location="${ivy.jar.file}"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="initialize" depends="install-ivy, prep-data">
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" sync="true"/>
</target>
<target name="build" description="compile project">
<echo message="compiling..."/>
<mkdir dir="${build.dir}" />
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" includeAntRuntime="false"/>
</target>
<target name="jar" depends="build">
<jar destfile="${lib.dir}/${project.jar}" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${project.main.class}"/>
</manifest>
</jar>
</target>
<target name="tool" depends="jar">
<mkdir dir="${bin.dir}" />
<echo file="${bin.dir}/fec2graph">#!/usr/bin/env bash
exec java -Xmx1G -cp "${lib.dir}/*" ${project.main.class} "$@"
</echo>
<echo file="${bin.dir}/advancedImporter">#!/usr/bin/env bash
exec java -Xmx1G -cp "${lib.dir}/*" org.followthedata.importer.Importer "$@"
</echo>
<chmod file="${bin.dir}/fec2graph" perm="+x"/>
<chmod file="${bin.dir}/advancedImporter" perm="+x"/>
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" description="--> clean the project">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${build.dir}" />
<fileset dir="${bin.dir}" />
</delete>
</target>
<!-- =================================
target: clean-ivy
================================= -->
<target name="clean-ivy" description="--> clean the ivy installation">
<delete dir="${ivy.jar.dir}"/>
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache" depends="install-ivy"
description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<!-- =================================
target: prep-data
================================= -->
<target name="prep-data">
<unzip dest="${fec.data.dir}">
<fileset dir="${fec.data.dir}">
<include name="**/*.zip" />
</fileset>
</unzip>
</target>
<!-- =================================
target: neo4j-install
================================= -->
<target name="-check-neo4j-install">
<available file="${neo4j.server}/bin/neo4j" property="neo4j.installed"/>
</target>
<target name="neo4j-install" depends="-check-neo4j-install" description="downloads Neo4j server" unless="${neo4j.installed}">
<get src="http://dist.neo4j.org/${neo4j.server}-unix.tar.gz" skipexisting="true" dest="."/>
<gunzip src="${neo4j.server}-unix.tar.gz"/>
<untar src="${neo4j.server}-unix.tar" dest="." />
<delete file="${neo4j.server}-unix.tar" />
<chmod file="${neo4j.server}/bin/neo4j" perm="+x"/>
</target>
<target name="neo4j-config" depends="neo4j-install" description="updates Neo4j configuration to use imported FEC graph database">
<exec executable="sed">
<arg value="-e"/>
<arg value="/org\.neo4j\.server\.database\.location/d"/>
<arg value="-i"/>
<arg value=""/>
<arg value="${neo4j.server}/conf/neo4j-server.properties"/>
</exec>
<echo file="${neo4j.server}/conf/neo4j-server.properties" append="true">org.neo4j.server.database.location=${neo4j.data.dir}
</echo>
</target>
<target name="neo4j-start" depends="neo4j-config">
<exec executable="${neo4j.server}/bin/neo4j">
<arg value="start" />
</exec>
</target>
<target name="neo4j-stop" depends="neo4j-config">
<exec executable="${neo4j.server}/bin/neo4j">
<arg value="stop" />
</exec>
</target>
</project>