Skip to main content
summaryrefslogtreecommitdiffstats
blob: 76b9bb1d5c8d95929e419a98c2c5180a78b1f179 (plain) (blame)
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?xml version="1.0"?>
<!-- ====================================================================== 
     ANT script to build org.eclispe.ohf.stem.geography project 
     and the initial set of STEM scenarios.  
     This must be run after installing the STEM workspace and after changes
     to code generated by EMF models.
                                                                    
     ====================================================================== -->
<project name="STEM Internal Geographic Data" default="update_all">
	<description>
     Use the properties files to populate the org.eclipse.stem.data.geography plugin
    </description>

	<!-- P r o j e c t  S p e c i f i c a t i o n s -->

	<!-- The name of the project -->
	<property name="project.name" value="stem" />


	<!-- Are we running headless? -->
	<condition property="runningHeadless" >
		<isset property="buildDirectory" />
	</condition>

	<!-- The buildDirectory property is set in a headless build -->
	<condition property="pluginRootDirectory" value="${buildDirectory}/plugins" else="..">
		<isset property="runningHeadless" />
	</condition>

	<!-- The baseLocation property is the location of the eclipse home installation -->
	<!-- It is used to find eclipse plugins                                         -->
	<!-- It is set in a headless build, but not one started manually from Eclipse   -->
	<condition property="baseLocation" value="${eclipse.pdebuild.home}../..">
		<not>
			<isset property="runningHeadless" />
		</not>
	</condition>

	<!-- This is the location of the class files of the built plug-ins     -->
	<!-- If this is a manual build started from Eclipse then the directory -->
	<!-- is "bin", if its a headless build then the directory is "@dot"    -->
	<!-- The property baseLocation is set in a headless build              -->
	<condition property="targetBin" value="@dot" else="bin">
		<isset property="runningHeadless" />
	</condition>


	<!-- The prefix for fully qualified names -->
	<property name="ID_ROOT" value="org.eclipse.stem" />

	<!-- The name of the source plugin (i.e., the one that contains this file -->
	<property name="source.plugin" value="${ID_ROOT}.internal.data.geography" />

	<!-- The name of the target plugin -->
	<property name="target.plugin" value="${ID_ROOT}.data.geography" />

	<!-- The path to the root directory of the source plugin -->
	<property name="path.sourceplugin" location="${pluginRootDirectory}/${source.plugin}" />

	<!-- The path to the root directory of the plugin that will be augmented with generated content -->
	<property name="path.targetplugin" location="${pluginRootDirectory}/${target.plugin}" />

	<!-- The path to the root directory of the resource files -->
	<property name="path.resource.files" value="${path.sourceplugin}/resources/data/country" />

	<!-- The path to the root directory of the lat/long files -->
	<property name="path.latlong.files" value="${path.sourceplugin}/resources/data/geo" />

	<!-- The path to the root directory of the static statistics files -->
	<property name="path.statistics.files" value="${path.sourceplugin}/resources/data/statistics" />
	
	<!-- The path to the root directory of the plugin that will be augmented with generated content-->
	<property name="path.generated.files" value="${path.sourceplugin}/temp/data" />

	<!-- The path to the root directory of geography source code -->
	<property name="path.geography.src" value="${path.targetplugin}/src/org/eclipse/stem/data/geography" />

	<!-- The path to the root directory of geography source code for centers -->
	<property name="path.geography.src.centers" value="${path.geography.src}/centers" />

	<!-- The name of the plugin.xml file that will be augmented with generated content-->
	<property name="file.target.pluginxml" value="${path.targetplugin}/plugin.xml" />

	<!-- The name of the plugin.properties file that will be augmented with generated content-->
	<property name="file.target.pluginproperties" value="${path.targetplugin}/plugin.properties" />

	<!-- The name of the plugin.xml file that that is the aggregation of the generated content-->
	<property name="file.util.pluginxml" value="${path.sourceplugin}/temp/data/plugin.xml" />

	<!-- The name of the plugin.properties file that is the aggregation of the generated content-->
	<property name="file.util.pluginproperties" value="${path.sourceplugin}/temp/data/plugin.properties" />

	<!-- The class path to use -->
	<path id="classpath.runtime">
		<pathelement location="${path.sourceplugin}/${targetBin}" />
		<pathelement location="${pluginRootDirectory}/${ID_ROOT}.core/${targetBin}" />
		<pathelement location="${pluginRootDirectory}/${ID_ROOT}.definitions/${targetBin}" />
		<pathelement location="${pluginRootDirectory}/${ID_ROOT}.geography/${targetBin}" />
		<pathelement location="${pluginRootDirectory}/${ID_ROOT}.internal.data/${targetBin}" />
		<pathelement location="${pluginRootDirectory}/${ID_ROOT}.data.geography/${targetBin}" />
		<fileset dir="${baseLocation}/plugins/">
			<include name="*emf*.jar" />
		</fileset>
		<fileset dir="${pluginRootDirectory}/${ID_ROOT}.internal.data/lib/">
			<include name="*emf*.jar" />
		</fileset>
	</path>

	<target name="update_all" depends=" update_iso_mappings, update_centers, update_geography, update_latlong, update_graph_partition_statistics" />

	<!-- Update the geography plugin with the latest definitions -->
	<target name="update_geography" depends="create_candidates, update_geography_plugin_xml, update_geography_plugin_properties, update_geography_generated_files" />

	<target name="update_geography_generated_files" depends="update_geography_graphs" />

	<target name="update_geography_plugin_xml" depends="create_candidates">
		<copy tofile="${file.target.pluginxml}" file="${file.util.pluginxml}" overwrite="true" />
	</target>

	<target name="update_geography_plugin_properties" depends="create_candidates">
		<copy tofile="${file.target.pluginproperties}" file="${file.util.pluginproperties}" overwrite="true" />
	</target>


	<!-- Update the graph files in the geography plugin -->
	<target name="update_geography_graphs" depends="create_candidates">
		<copy todir="${path.targetplugin}/resources/data/" overwrite="true">
			<fileset dir="${path.generated.files}">
				<include name="**/*.graph" />
			</fileset>
		</copy>
	</target>

	<!-- Copy generated and existing iso key mapping files to the geography plugin -->
	<target name="update_iso_mappings" depends="create_iso_mappings">
		<!-- Copy generated Level 0 ISO key NLS properties file to Geography SRC directory  -->
		<copy todir="${path.geography.src}" overwrite="true" flatten="true">
			<fileset dir="${path.generated.files}">
				<include name="**/level0ISONames.properties" />
			</fileset>
		</copy>
		<!-- Copy existing ISO key NLS properties file to Geography SRC directory  -->
		<copy todir="${path.geography.src}" overwrite="true" flatten="true">
			<fileset dir="${path.resource.files}">
				<include name="**/*_names.properties" />
			</fileset>
		</copy>
		<!-- Copy generated alpha2 to alpha3 ISO key properties file to Geography ZZZ DATA directory  -->
		<copy todir="${path.targetplugin}/resources/data/" overwrite="true">
			<fileset dir="${path.generated.files}">
				<include name="**/level0ISOKeys.properties" />
			</fileset>
		</copy>

	</target>
	
	<target name="update_graph_partition_statistics" depends="create_graph_partition_statistics">
		<copy todir="${path.targetplugin}/resources/data/" overwrite="true">
			<fileset dir="${path.generated.files}">
				<include name="statistics/*" />
			</fileset>
		</copy>
		
		
		<copy todir="${path.targetplugin}/resources/data/statistics" overwrite="true" >
			<fileset dir="${path.statistics.files}">
				<include name="*.csv" />
			</fileset>
		</copy>
	</target>
	
	<target name="update_centers" depends="update_iso_mappings">
		<copy todir="${path.geography.src.centers}" overwrite="true" flatten="true">
			<fileset dir="${path.resource.files}">
				<include name="**/*_centers.properties" />
			</fileset>
		</copy>
	</target>

	<target name="update_latlong">
		<copy todir="${path.targetplugin}/resources/data/geo" overwrite="true" >
			<fileset dir="${path.latlong.files}">
				<include name="**/*_MAP.xml" />
			</fileset>
		</copy>
	</target>

	
	<target name="create_graph_partition_statistics" depends="clean">
		<java classname="${ID_ROOT}.internal.data.geography.graphsynchronizer.WorldPartitioningStats" fork="true" maxmemory="1024m">
			<classpath refid="classpath.runtime" />
			<arg value="${path.sourceplugin}" />
			<jvmarg value="-Xms1024m" />
			<jvmarg value="-Xmx1024m" />
		</java>
	</target>
	
	<!-- Create the graph files for countries and the plugin.xml and plugin.properties fragments -->
	<target name="create_candidates" depends="clean">
		<!-- There is a problem here with specifying fork="true"  maxmemory="768m".  It causes an IOException on some machines -->
		<java classname="${ID_ROOT}.internal.data.geography.GeographyDataGenerator" fork="true" maxmemory="1024m">
			<classpath refid="classpath.runtime" />
			<arg value="${path.sourceplugin}" />
			<jvmarg value="-Xms1024m" />
			<jvmarg value="-Xmx1024m" />
		</java>
	</target>

	<!-- Create the top level (0) files that list the level 0 alpha3 and alpha2 ISO-3166 mappings and the 
		coresponding names for each ISOKEY.  These can be used in things like the GUI where we list
		every country and its name -->
	<target name="create_iso_mappings" depends="clean, create_generated_files_dir">
		<java  classname="${source.plugin}.isokeycollector.ISOKeyCollector">
			<classpath refid="classpath.runtime" />
			<arg value="${path.sourceplugin}" />
		</java>
	</target>

	<!-- clean out the .../temp/data directories -->
	<!-- clean out the target directories -->
	<target name="clean" depends="create_generated_files_dir">
		<delete includeEmptyDirs="true" quiet="true">
			<fileset dir="${path.sourceplugin}/temp/">
				<include name="**/*" />
			</fileset>
			<fileset dir="${path.targetplugin}/resources/data/">
				<include name="country/**/*" />
				<include name="relationship/**/*" />
				<include name="geo/**/*" />
				<include name="statistics/**/*" />
			</fileset>
		</delete>
	</target>

	<target name="create_generated_files_dir">
		<mkdir dir="${path.generated.files}"/>
	</target>
</project>

Back to the top