Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
209 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?xml version="1.0"?> | ||
|
||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<project name="avro-rpc-quickstart" default="compile" xmlns:ivy="antlib:org.apache.ivy.ant"> | ||
<property name="name" value="avro-rpc-quickstart" /> | ||
|
||
<property environment="env"/> | ||
|
||
<property name="version" value="1.1.0" /> | ||
<property name="final.name" value="${name}-${version}"/> | ||
|
||
<property name="src.dir" value="${basedir}/src/main/java" /> | ||
<property name="avro.schema.dir" value="${basedir}/src/main/avro" /> | ||
|
||
<property name="lib.dir" value="${basedir}/lib" /> | ||
|
||
<property name="build.dir" value="${basedir}/target" /> | ||
<property name="generated.dir" value="${build.dir}/generated-sources" /> | ||
<property name="avro.generated.dir" value="${build.dir}/generated-sources/avro" /> | ||
<property name="build.classes" value="${build.dir}/classes"/> | ||
|
||
<property name="ivy.version" value="2.1.0-rc2"/> | ||
<property name="ivy.url" | ||
value="http://repo2.maven.org/maven2/org/apache/ivy/ivy" /> | ||
<property name="ivy.home" value="${user.home}/.ant" /> | ||
<property name="ivy.lib" value="${build.dir}/lib"/> | ||
|
||
<!-- the normal classpath --> | ||
<path id="java.classpath"> | ||
<pathelement location="${build.classes}"/> | ||
<fileset dir="${lib.dir}"> | ||
<include name="**/*.jar" /> | ||
</fileset> | ||
<fileset dir="${ant.home}/lib"> | ||
<include name="ant.jar" /> | ||
</fileset> | ||
<fileset dir="${ivy.lib}"> | ||
<include name="**/*.jar" /> | ||
</fileset> | ||
</path> | ||
|
||
<!-- ====================================================== --> | ||
<!-- Generate and compile the Java files --> | ||
<!-- ====================================================== --> | ||
<target name="init"> | ||
<mkdir dir="${lib.dir}" /> | ||
|
||
<mkdir dir="${build.dir}" /> | ||
<mkdir dir="${generated.dir}" /> | ||
<mkdir dir="${avro.generated.dir}" /> | ||
<mkdir dir="${build.classes}" /> | ||
|
||
<mkdir dir="${ivy.lib}"/> | ||
<condition property="ivy.jar.exists"> | ||
<available file="${lib.dir}/ivy-${ivy.version}.jar"/> | ||
</condition> | ||
|
||
<tstamp> | ||
<format property="build.time" pattern="MM/dd/yyyy HH:mm zz" timezone="GMT"/> | ||
<format property="year" pattern="yyyy" timezone="GMT"/> | ||
</tstamp> | ||
</target> | ||
|
||
<target name="ivy-download" unless="ivy.jar.exists" depends="init"> | ||
<delete dir="${lib.dir}" | ||
includes="ivy-*.jar" excludes="ivy-${ivy.version}.jar"/> | ||
<get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar" | ||
dest="${lib.dir}/ivy-${ivy.version}.jar" usetimestamp="true"/> | ||
</target> | ||
|
||
<target name="ivy-init" depends="ivy-download" unless="ivy.initialized"> | ||
<taskdef resource="org/apache/ivy/ant/antlib.xml" | ||
uri="antlib:org.apache.ivy.ant" classpathref="java.classpath"/> | ||
<!-- ensure that ivy taskdef is only run once, otw ant will error --> | ||
<property name="ivy.initialized" value="true"/> | ||
</target> | ||
|
||
<target name="ivy-retrieve" depends="init,ivy-init"> | ||
<ivy:retrieve type="jar" conf="default" | ||
pattern="${ivy.lib}/[artifact]-[revision].[ext]"/> | ||
</target> | ||
|
||
<target name="generate" depends="ivy-retrieve"> | ||
<taskdef name="protocol" | ||
classname="org.apache.avro.specific.ProtocolTask"> | ||
<classpath refid="java.classpath" /> | ||
</taskdef> | ||
<taskdef name="schema" classname="org.apache.avro.specific.SchemaTask"> | ||
<classpath refid="java.classpath" /> | ||
</taskdef> | ||
<taskdef name="paranamer" | ||
classname="com.thoughtworks.paranamer.ant.ParanamerGeneratorTask"> | ||
<classpath refid="java.classpath" /> | ||
</taskdef> | ||
|
||
<protocol destdir="${avro.generated.dir}"> | ||
<fileset dir="${avro.schema.dir}"> | ||
<include name="**/*.avpr" /> | ||
</fileset> | ||
</protocol> | ||
|
||
<schema destdir="${avro.generated.dir}"> | ||
<fileset dir="${avro.schema.dir}"> | ||
<include name="**/*.avsc" /> | ||
</fileset> | ||
</schema> | ||
</target> | ||
|
||
<target name="compile-generated" depends="ivy-retrieve"> | ||
<javac srcdir="${avro.generated.dir}" destdir="${build.classes}"> | ||
<classpath refid="java.classpath"/> | ||
</javac> | ||
|
||
<paranamer sourceDirectory="${avro.generated.dir}" | ||
outputDirectory="${build.classes}"/> | ||
</target> | ||
|
||
<target name="compile-app" depends="ivy-retrieve"> | ||
<javac srcdir="${src.dir}" destdir="${build.classes}"> | ||
<classpath refid="java.classpath"/> | ||
</javac> | ||
</target> | ||
|
||
<target name="exec:java" depends="compile"> | ||
<java classname="example.Main"> | ||
<arg value="avro_users"/> | ||
<arg value="pat"/> | ||
<arg value="Hello_World"/> | ||
<classpath refid="java.classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="compile" depends="generate,compile-generated,compile-app"/> | ||
|
||
<!-- ====================================================== --> | ||
<!-- Clean. Delete the build files, and their directories --> | ||
<!-- ====================================================== --> | ||
<target name="clean"> | ||
<delete dir="${build.dir}"/> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> | ||
|
||
<info organisation="org.apache.avro" | ||
module="${name}" revision="${version}"> | ||
<license name="Apache 2.0"/> | ||
<ivyauthor name="Apache Hadoop" url="http://hadoop.apache.org"/> | ||
<description>Avro RPC Quick Start</description> | ||
</info> | ||
|
||
<configurations defaultconfmapping="default"> | ||
<conf name="default"/> | ||
<conf name="test"/> | ||
</configurations> | ||
|
||
<dependencies> | ||
<dependency org="org.apache.hadoop" name="avro" rev="1.1.0"/> | ||
|
||
<dependency org="junit" name="junit" rev="4.7" conf="test->default"/> | ||
</dependencies> | ||
|
||
</ivy-module> |