On 2012-01-22 03:23, GerdP wrote:
Hi Richard,

I have problems to apply the patch on r2179 using tortoiseSVN on windows.
What tool do you suggest to do that?

Apologies -- I prefer Git for development so that's what I used to generate the patch. Subversion must not have liked the osmpbf.jar (binary file) section. Attached is the same patch but generated by svn, so tortoiseSVN should be able to apply it.

Because svn doesn't support binary diffs, you'll have to manually download osmpbf.jar from <https://github.com/openstreetmap/osmosis/raw/master/build-support/repo/crosby/osmpbf/1.1.1-754a33af/jars/osmpbf.jar> and put it in build-support/repo/crosby/osmpbf/1.1.1-754a33af/jars. Subversion also doesn't support embedding the commit message in patches, so here's the commit message I used in case someone want to reuse some of it:

-------------------------------------------------------------------
Use Apache Ivy to fetch dependencies, put them in dist

Much of the code was borrowed from osmosis.

Notes:
 * pbf support is no longer conditionally compiled -- it is always
   enabled
 * osmpbf has not yet been published to the public Maven Central
   Repository, so a copy of it is included locally
 * junit is only fetched if the 'test' target is run
 * macker and its dependencies are only fetched if the 'macker' target
   is run
 * The Ivy publish task needs the project version, so build.xml now
   sets a property called 'project.version'.  The value is currently
   hard-coded to "svn"; this should probably be replaced with a
   programmatic method for determining the current svn version.
 * build.xml now creates the version.properties file with svn.version
   set to the value of the project.version property.  This ensures
   that the version used by the Ivy publish task matches the version
   reported by the '--version' argument.
 * build.xml now sets the Implementation-Version property in the
   manifest file to the value of the project.version property
 * the organization setting in the ivy.xml file is set to
   "uk.me.parabola"; maybe this should be "uk.org.mkgmap"
Index: build.xml
===================================================================
--- build.xml	(revision 2179)
+++ build.xml	(working copy)
@@ -17,7 +17,8 @@
 		Author: Steve Ratcliffe
 		Create date: 26 Nov 2006
 -->
-<project name="mkgmap" default="dist" basedir=".">
+<project name="mkgmap" default="dist" basedir="."
+	 xmlns:ivy="antlib:org.apache.ivy.ant">
 
 	<!-- Init -->
 	<property name="top" value="."/>
@@ -44,14 +45,6 @@
 	<property name="javadoc" value="${doc}/api"/>
 	<property name="resources" value="resources"/>
 
-	<property name="jars" value="/opt/jars"/>
-
-	<!-- the locations of these external jars are set in external.properties
-	and can be overridden in a local.properties file. -->
-	<property name="junit.jar" value="junit-4.5.jar"/>
-	<property name="osmprotobuf.jar" value="osmprotobuf.jar"/>
-	<property name="protobuf.jar" value="protobuf.jar"/>
-
 	<!-- A place to keep a local copy of the test input data.  The test files
 	 are large and so are not kept in svn.	If you don't set this then they
 	 will be downloaded.
@@ -60,31 +53,48 @@
 	 -->
 	<property name="test.input.cache" value="/opt/data/testinput"/>
 
+	<!-- mkgmap's version number -->
+	<!-- todo: programmatically get the svn revision and put it in
+	     project.version -->
+	<property name="project.version" value="svn" />
+
+	<!-- ivy dependency support -->
+	<property name="build-support.dir" location="build-support"/>
+	<property name="dependency.version.ivy" value="2.2.0"/>
+	<property name="ivy.lib.dir" value="${basedir}/lib" />
+	<import file="${build-support.dir}/script/build-ivy-base.xml"/>
+	<import file="${build-support.dir}/script/build-ivy.xml"/>
+
 	<!-- For class paths -->
+	<path id="compile.classpath">
+		<fileset dir="${ivy.lib.dir}/compile" />
+	</path>
+	<path id="test.classpath">
+		<fileset dir="${ivy.lib.dir}/test" />
+	</path>
+	<path id="macker.classpath">
+		<fileset dir="${ivy.lib.dir}/macker" />
+	</path>
+
 	<path id="main">
 		<pathelement location="${build.classes}" />
-		<pathelement location="${osmprotobuf.jar}"/>
-		<pathelement location="${protobuf.jar}"/>
+		<path refid="compile.classpath" />
 	</path>
 
 	<path id="test">
 		<pathelement location="test/resources"/>
 		<pathelement location="build/test"/>
-		<pathelement location="${junit.jar}"/>
-		<path refid="main"/>
+		<path refid="test.classpath" />
+		<pathelement location="${build.classes}" />
 		<pathelement location="test"/>
 	</path>
 
-	<condition property="protobuf-available">
-		<and>
-			<available file="${osmprotobuf.jar}"/>
-			<available file="${protobuf.jar}"/>
-		</and>
-	</condition>
-
 	<!-- Prepare - make all the directories -->
-	<target name="prepare">
+	<target name="prepare" depends="resolve-compile">
 		<mkdir dir="${build.classes}" />
+		<propertyfile file="${build.classes}/version.properties">
+			<entry key="svn.version" value="${project.version}" />
+		</propertyfile>
 	</target>
 
 	<!-- Compile the product itself (no tests). -->
@@ -94,22 +104,11 @@
 			<include name="**/*.java" />
 			<classpath refid="main"/>
 			<exclude name="**/reader/dem/optional/*.java"/>
-			<exclude name="**/reader/osm/bin/*.java"/>
-			<exclude name="**/OsmBinBoundaryDataSource.java"/>
 		</javac>
 	</target>
 
-	<target name="compile-pbf" if="protobuf-available">
-		<echo>Protobuf binary format support</echo>
-		<javac srcdir="${src}" destdir="${build.classes}" debug="true">
-			<classpath refid="main"/>
-			<include name="**/reader/osm/bin/*.java"/>
-			<include name="**/OsmBinBoundaryDataSource.java"/>
-		</javac>
-	</target>
-
 	<!-- Build into the build direcotory.  All resource files are copied in. -->
-	<target name="build" depends="compile, compile-pbf" description="Build everything into the build direcotory">
+	<target name="build" depends="compile" description="Build everything into the build direcotory">
 		<copy todir="${build.classes}">
 			<fileset dir="${resources}">
 				<include name="*.csv"/>
@@ -129,7 +128,7 @@
 	</target>
 
 	<!-- Compile the test classes -->
-	<target name="build-test" depends="build">
+	<target name="build-test" depends="build, resolve-test">
 		<mkdir dir="${build.test}" />
 		<javac srcdir="${test}" destdir="${build.test}" debug="true">
 			<include name="**/*.java" />
@@ -192,11 +191,28 @@
 					description="Make the distribution area">
 
 		<mkdir dir="${dist}"/>
+		<mkdir dir="${dist}/lib"/>
 		<mkdir dir="${dist}/doc/api"/>
 
+		<copy todir="${dist}/lib" >
+			<path refid="compile.classpath" />
+		</copy>
+
+		<manifestclasspath property="manifest_cp" jarfile="${dist}/mkgmap.jar">
+			<classpath>
+				<fileset dir="${dist}/lib">
+					<include name="**/*.jar" />
+				</fileset>
+			</classpath>
+		</manifestclasspath>
+
 		<!-- Make the jar -->
-		<jar basedir="${build.classes}" jarfile="${dist}/mkgmap.jar"
-				manifest="${resources}/MANIFEST.MF">
+		<jar basedir="${build.classes}" jarfile="${dist}/mkgmap.jar">
+			<manifest>
+				<attribute name="Main-Class" value="uk.me.parabola.mkgmap.main.Main" />
+				<attribute name="Class-Path" value="${manifest_cp}" />
+				<attribute name="Implementation-Version" value="${project.version}" />
+			</manifest>
 			<include name="**/*.class"/>
 			<include name="*.csv"/>
 			<include name="*.xml"/>
@@ -246,11 +262,7 @@
 		</javadoc>
 	</target>
 
-	<target name="macker">
-		<path id="macker.classpath">
-			<fileset dir="${macker.root}/lib"/>
-			<pathelement location="${macker.root}/build/macker.jar"/>
-		</path>
+	<target name="macker" depends="build, resolve-macker">
 		<taskdef name="macker"
 						 classname="net.innig.macker.ant.MackerAntTask"
 						 classpathref="macker.classpath"/>
Index: .classpath
===================================================================
--- .classpath	(revision 2179)
+++ .classpath	(working copy)
@@ -7,5 +7,7 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/junit"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/resource"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="lib" path="lib/compile/protobuf-java-2.4.1.jar"/>
+	<classpathentry kind="lib" path="lib/compile/osmpbf-1.1.1-754a33af.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: ivy.xml
===================================================================
--- ivy.xml	(revision 0)
+++ ivy.xml	(revision 0)
@@ -0,0 +1,51 @@
+<ivy-module version="2.0">
+	<info organisation="uk.me.parabola" module="mkgmap"/>
+	<configurations>
+		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
+		<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
+		<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
+		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
+		<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
+		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
+		<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
+		<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
+		<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
+		<conf name="optional" visibility="public" description="contains all optional dependencies"/>
+		<conf name="distribution" visibility="public" description="contains distribution packages"/>
+
+		<conf name="macker" />
+	</configurations>
+	<publications>
+		<artifact name="mkgmap" conf="master" />
+	</publications>
+	<dependencies>
+		<dependency org="com.google.protobuf" name="protobuf-java"
+			    rev="2.4.1"
+			    conf="compile->compile(*),master(*);runtime->runtime(*)" />
+		<dependency org="crosby" name="osmpbf"
+			    rev="1.1.1-754a33af"
+			    changing="true"
+			    conf="compile->compile(*),master(*);runtime->runtime(*)" />
+		<dependency org="junit" name="junit"
+			    rev="4.5"
+			    conf="test->runtime(*),master(*)" />
+		<dependency org="innig" name="macker"
+			    rev="0.4.2"
+			    conf="macker->compile(*),master(*)" />
+		<!-- the following are dependencies of macker, but
+		     macker's POM file doesn't list them so they're
+		     listed manually here -->
+		<dependency org="commons-lang" name="commons-lang"
+			    rev="1.0.1"
+			    conf="macker->compile(*),master(*)" />
+		<dependency org="innig" name="innig-util"
+			    rev="0.4.2"
+			    conf="macker->compile(*),master(*)" />
+		<dependency org="bcel" name="bcel"
+			    rev="5.1"
+			    conf="macker->compile(*),master(*)" />
+		<dependency org="jdom" name="jdom"
+			    rev="b9"
+			    conf="macker->compile(*),master(*)" />
+	</dependencies>
+</ivy-module>
Index: build-support/script/build-ivy.xml
===================================================================
--- build-support/script/build-ivy.xml	(revision 0)
+++ build-support/script/build-ivy.xml	(revision 0)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="mkgmap.Build.Ivy" default="init-ivy" basedir="."
+	xmlns:ivy="antlib:org.apache.ivy.ant">
+
+	<description>Ivy-specific tasks</description>
+
+	<!-- Include common build components. -->
+	<property name="build-support.dir" location="../"/>
+	<import file="${build-support.dir}/script/build-ivy-base.xml"/>
+	<property name="ivy.retrieve.pattern" value="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" />
+
+	<target name="resolve-compile" depends="init-ivy" description="Downloads compile dependencies using ivy.">
+		<ivy:retrieve conf="compile" />
+	</target>
+	<target name="resolve-test" depends="init-ivy" description="Downloads test program dependencies using ivy.">
+		<ivy:retrieve conf="test" />
+	</target>
+	<target name="resolve-macker" depends="init-ivy" description="Downloads macker program dependencies using ivy.">
+		<ivy:retrieve conf="macker" />
+	</target>
+	<target name="resolve" depends="resolve-compile, resolve-test, resolve-macker" description="Downloads all program dependencies using ivy." />
+
+	<property name="ivy.distrib.dir" value="${ivy.project.dir}/dist" />
+	<property name="ivy.publish.src.artifacts.pattern" value="${ivy.distrib.dir}/[artifact].[ext]" />
+	<target name="publish" depends="dist">
+		<ivy:deliver pubrevision="${project.version}"/>
+		<ivy:publish resolver="local" pubrevision="${project.version}" overwrite="true"/>
+	</target>
+</project>
Index: build-support/script/build-ivy-base.xml
===================================================================
--- build-support/script/build-ivy-base.xml	(revision 0)
+++ build-support/script/build-ivy-base.xml	(revision 0)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="mkgmap.Build.Ivy.Base" default="init-ivy" basedir="."
+	xmlns:ivy="antlib:org.apache.ivy.ant">
+
+	<description>
+		Installs and configures the ivy build dependencies system.
+	</description>
+
+	<!-- Include common build components. -->
+	<property name="build-support.dir" location="../"/>
+
+	<target name="ivy-availability" description="Checks if the ivy library is available">
+		<property name="ivy.version" value="${dependency.version.ivy}" />
+		<property name="ivy.jar.dir" value="${build-support.dir}/ivy" />
+		<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.version}.jar" />
+
+		<!-- Determine if the ivy jar is already available. -->
+		<available property="ivy.available" file="${ivy.jar.file}" />
+	</target>
+
+	<target name="download-ivy" unless="ivy.available" description="Downloads the ivy library from public repositories.">
+		<!-- Delete any existing ivy files -->
+		<delete dir="${ivy.jar.dir}"/>
+
+		<mkdir dir="${ivy.jar.dir}" />
+
+		<!--
+			Download Ivy from web site so that it can be used even without any
+			special installation
+		-->
+		<get
+			src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar";
+			dest="${ivy.jar.file}" usetimestamp="true"/>
+	</target>
+
+	<target name="init-ivy" depends="ivy-availability, download-ivy" description="Registers ivy with ant and initializes it." unless="ivy.initialized">
+		<!--
+			Try to load ivy 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" />
+
+		<!-- Override the shared repo location to point at the svn-based ivy repo. -->
+		<property name="ivy.shared.default.root" location="${build-support.dir}/repo"/>
+		<ivy:configure />
+
+		<!-- Retrieve ivy details from the config file. -->
+		<ivy:info />
+
+		<property name="ivy.initialized" value="true"/>
+	</target>
+
+	<target name="clean-cache" depends="init-ivy" description="Clean the ivy cache.">
+		<ivy:cleancache />
+	</target>
+
+	<target name="clean-ivy" description="Clean the ivy installation.">
+		<delete dir="${ivy.jar.dir}"/>
+	</target>
+</project>
Index: build-support/repo/crosby/osmpbf/1.1.1-754a33af/ivys/ivy.xml
===================================================================
--- build-support/repo/crosby/osmpbf/1.1.1-754a33af/ivys/ivy.xml	(revision 0)
+++ build-support/repo/crosby/osmpbf/1.1.1-754a33af/ivys/ivy.xml	(revision 0)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="1.0" xmlns:m="http://ant.apache.org/ivy/maven";>
+	<info organisation="crosby" module="osmpbf" revision="1.1.1-754a33af"/>
+	<configurations>
+		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
+		<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
+		<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
+		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
+		<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
+		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
+		<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
+		<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
+		<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
+		<conf name="optional" visibility="public" description="contains all optional dependencies"/>
+	</configurations>
+	<publications>
+		<artifact name="osmpbf" type="jar" ext="jar" conf="master"/>
+	</publications>
+</ivy-module>
Index: build-support/repo/README
===================================================================
--- build-support/repo/README	(revision 0)
+++ build-support/repo/README	(revision 0)
@@ -0,0 +1,2 @@
+This directory is a repository for dependencies that aren't
+available in the public Maven repository.
Index: resources/MANIFEST.MF
===================================================================
--- resources/MANIFEST.MF	(revision 2179)
+++ resources/MANIFEST.MF	(working copy)
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-class: uk.me.parabola.mkgmap.main.Main
-Class-Path: osmprotobuf.jar protobuf.jar
Index: external.properties
===================================================================
--- external.properties	(revision 2179)
+++ external.properties	(working copy)
@@ -1,11 +0,0 @@
-
-jars=/opt/jars
-
-# To include the protobuf binary format.
-protobuf.jar=${jars}/protobuf-2.3.0/protobuf.jar
-osmprotobuf.jar=${jars}/osmprotobuf/osmprotobuf.jar
-
-# For the test tasks
-junit.jar=${jars}/junit-4.5/junit-4.5.jar
-
-macker.root=${jars}/macker-0.4.2
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to