forked from ooici/ion-object-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
142 lines (123 loc) · 5.77 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
<project name="ion-object-definitions" default="dist" xmlns:ivy="antlib:org.apache.ivy.ant" basedir=".">
<!-- import properties -->
<property file="build.properties" />
<!-- ivy properties & settings -->
<property file="${settings.dir}/ivysettings.properties" />
<ivy:settings file="${settings.dir}/ivysettings.xml" />
<!-- ooici properties -->
<property file="${settings.dir}/ooici.properties" />
<!-- import the ooici_build.xml -->
<import file="${settings.dir}/ooici-build.xml" />
<!--
Targets that can be overridden:
- pre-compile: Called before javac compilation - empty by default, override in build.xml to use
- post-compile: Called after javac compilation - empty by default, override in build.xml to use
- pre-dist: Called before all actions in the dist target - empty by default, override in build.xml to use
- post-dist: Called after all actions in the dist target - empty by default, override in build.xml to use
- clean-more: Called at the end of 'clean' - empty by default, override in build.xml to use
-->
<!-- =================================
target: pre-compile
================================= -->
<target name="pre-compile">
<antcall target="protoc-python" />
<antcall target="protoc-java" />
<antcall target="make-init.java" />
</target>
<!-- =================================
target: protoc-java
================================= -->
<target name="protoc-java" description="--> Compiles the .proto files to java source files">
<mkdir dir="${src.dir}" />
<exec executable="${basedir}/mkjava.sh" failonerror="true">
<arg value="${src.dir}" />
</exec>
</target>
<!-- =================================
target: protoc-python
================================= -->
<target name="protoc-python" description="--> Compiles the .proto files to python source files" >
<exec executable="${basedir}/mkpython.sh" failonerror="true"/>
</target>
<!-- =================================
target: make-init.java
================================= -->
<target name="make-init.java">
<property name="classes.dir" value="${src.dir}" />
<property name="net.dir" value="${classes.dir}/net" />
<delete file="${net.dir}/Init.java" />
<path id="classes.contents">
<fileset dir="${classes.dir}">
<include name="**/*.java" />
<exclude name="**/*$*" />
</fileset>
</path>
<pathconvert property="java.class.list" pathsep="${line.separator}">
<path refid="classes.contents" />
<chainedmapper>
<globmapper from="${basedir}/${classes.dir}/*.java" to=""*","/>
</chainedmapper>
</pathconvert>
<echo file="${net.dir}/Init.java" append="true">package net;
public class Init {
public static final String[] protos = {
${java.class.list}
};
}
</echo>
</target>
<!-- =================================
target: post-dist
================================= -->
<target name="post-dist">
<exec executable="python" dir="python">
<arg value="setup.py"/>
<arg value="sdist" />
</exec>
<copy file="python/dist/${project.name}-${version}.tar.gz" todir="${dist.dir}/lib" />
</target>
<!-- =================================
target: clean-more
================================= -->
<target name="clean-more">
<delete dir="${src.dir}" />
<delete includeemptydirs="true">
<fileset dir="python">
<include name="**/*" />
<exclude name="setup.py"/>
</fileset>
</delete>
</target>
<!-- start ivy targets -->
<property name="ivy.jar.version" value="2.2.0"/>
<property name="ivy.jar.name" value="ivy-${ivy.jar.version}.jar"/>
<property name="ivy.home" value="${user.home}/.ivy2"/>
<available property="ivy.installed" file="${ivy.home}/${ivy.jar.name}"/>
<target name="ivy-install" unless="ivy.installed">
<mkdir dir="${ivy.home}"/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest="${ivy.home}/${ivy.jar.name}"/>
</target>
<target name="ivy-init" depends="ivy-install">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.home}/${ivy.jar.name}"/>
<ivy:resolve/>
</target>
<target name="ivy-retrieve" depends="ivy-init" description="downloads jars for the project">
<ivy:retrieve pattern="bin/lib/[conf]/[type]s/[artifact].[ext]" conf="*" type="*"/>
</target>
<target name="gen-pom" depends="ivy-init">
<ivy:makepom ivyfile="ivy.xml" pomfile="bin/poms/${ant.project.name}.pom">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<target name="ivy-publish-local" depends="dist,ivy-init,gen-pom" description="publish jar/source to maven repo mounted at ~/.m2/repository">
<ivy:publish resolver="maven-local-publish" forcedeliver="true" overwrite="true" publishivy="true">
<artifacts pattern="dist/lib/[artifact]-[revision].[ext]" />
</ivy:publish>
</target>
<target name="ivy-publish-share" depends="dist,ivy-init,gen-pom" description="publish jar/source to maven repo mounted at ~/repo">
<ivy:publish resolver="maven-share" forcedeliver="true" overwrite="true" publishivy="true">
<artifacts pattern="dist/lib/[artifact]-[revision].[ext]" />
</ivy:publish>
</target>
<!-- end ivy targets -->
</project>