LUCENE-3892: configure fallbacks so that ivy downloads work from china

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1331019 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-04-26 18:33:46 +00:00
parent 325c83e650
commit f8577e6cb4
5 changed files with 88 additions and 30 deletions

View File

@ -267,12 +267,22 @@
<!-- currently empty --> <!-- currently empty -->
</target> </target>
<target name="resolve" depends="ivy-availability-check,ivy-fail"> <target name="ivy-configure">
<ivy:configure file="${common.dir}/ivy-settings.xml"/>
</target>
<target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
<!-- todo, make this a property or something. <!-- todo, make this a property or something.
only special cases need bundles --> only special cases need bundles -->
<ivy:retrieve type="jar,bundle" log="download-only"/> <ivy:retrieve type="jar,bundle" log="download-only"/>
</target> </target>
<property name="ivy_install_path" location="${user.home}/.ant/lib" />
<property name="ivy_bootstrap_url1" value="http://repo1.maven.org/maven2"/>
<!-- you might need to tweak this from china so it works -->
<property name="ivy_bootstrap_url2" value="http://mirror.netcologne.de/maven2"/>
<property name="ivy_checksum_sha1" value="f9d1e83e82fc085093510f7d2e77d81d52bc2081"/>
<target name="ivy-availability-check" unless="ivy.available"> <target name="ivy-availability-check" unless="ivy.available">
<echo> <echo>
This build requires Ivy and Ivy could not be found in your ant classpath. This build requires Ivy and Ivy could not be found in your ant classpath.
@ -311,14 +321,41 @@
<target name="ivy-fail" unless="ivy.available"> <target name="ivy-fail" unless="ivy.available">
<fail>Ivy is not available</fail> <fail>Ivy is not available</fail>
</target> </target>
<target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir"> <target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir" depends="ivy-bootstrap1,ivy-bootstrap2,ivy-checksum"/>
<property name="ivy_install_path" location="${user.home}/.ant/lib" />
<mkdir dir="${ivy_install_path}"/> <!-- try to download from repo1.maven.org -->
<echo message="installing ivy ${ivy.bootstrap.version} to ${ivy_install_path}"/> <target name="ivy-bootstrap1">
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.bootstrap.version}/ivy-${ivy.bootstrap.version}.jar" <ivy-download src="${ivy_bootstrap_url1}" dest="${ivy_install_path}"/>
dest="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar" usetimestamp="true"/> <available file="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar" property="ivy.bootstrap1.success" />
</target>
<target name="ivy-bootstrap2" unless="ivy.bootstrap1.success">
<ivy-download src="${ivy_bootstrap_url2}" dest="${ivy_install_path}"/>
</target> </target>
<target name="ivy-checksum">
<checksum file="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar"
property="${ivy_checksum_sha1}"
algorithm="SHA"
verifyproperty="ivy.checksum.success"/>
<fail message="Checksum mismatch for ivy-${ivy.bootstrap.version}.jar. Please download this file manually">
<condition>
<isfalse value="${ivy.checksum.success}"/>
</condition>
</fail>
</target>
<macrodef name="ivy-download">
<attribute name="src"/>
<attribute name="dest"/>
<sequential>
<mkdir dir="@{dest}"/>
<echo message="installing ivy ${ivy.bootstrap.version} to ${ivy_install_path}"/>
<get src="@{src}/org/apache/ivy/ivy/${ivy.bootstrap.version}/ivy-${ivy.bootstrap.version}.jar"
dest="@{dest}/ivy-${ivy.bootstrap.version}.jar" usetimestamp="true" ignoreerrors="true"/>
</sequential>
</macrodef>
<target name="jflex-uptodate-check"> <target name="jflex-uptodate-check">
<uptodate property="jflex.files.uptodate"> <uptodate property="jflex.files.uptodate">
<srcfiles dir="${src.dir}" includes="**/*.jflex" /> <srcfiles dir="${src.dir}" includes="**/*.jflex" />
@ -1057,7 +1094,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<fail message="You must redefine the javadocs task to do something!!!!!"/> <fail message="You must redefine the javadocs task to do something!!!!!"/>
</target> </target>
<target name="install-maven-tasks" unless="maven-tasks.uptodate" depends="ivy-availability-check,ivy-fail"> <target name="install-maven-tasks" unless="maven-tasks.uptodate" depends="ivy-availability-check,ivy-fail,ivy-configure">
<property name="maven-tasks.uptodate" value="true"/> <property name="maven-tasks.uptodate" value="true"/>
<ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3" <ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3"
inline="true" conf="master" type="jar" pathid="maven-ant-tasks.classpath"/> inline="true" conf="master" type="jar" pathid="maven-ant-tasks.classpath"/>
@ -1509,7 +1546,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<!-- PEGDOWN macro: Before using depend on the target "resolve-pegdown" --> <!-- PEGDOWN macro: Before using depend on the target "resolve-pegdown" -->
<target name="resolve-pegdown" unless="pegdown.loaded"> <target name="resolve-pegdown" unless="pegdown.loaded" depends="ivy-availability-check,ivy-fail,ivy-configure">
<ivy:cachepath organisation="org.pegdown" module="pegdown" revision="1.1.0" <ivy:cachepath organisation="org.pegdown" module="pegdown" revision="1.1.0"
inline="true" conf="default" type="jar" transitive="true" pathid="pegdown.classpath"/> inline="true" conf="default" type="jar" transitive="true" pathid="pegdown.classpath"/>
<property name="pegdown.loaded" value="true"/> <property name="pegdown.loaded" value="true"/>

40
lucene/ivy-settings.xml Normal file
View File

@ -0,0 +1,40 @@
<!--
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.
-->
<ivysettings>
<settings defaultResolver="default"/>
<include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
<resolvers>
<ibiblio name="sonatype-releases" root="http://oss.sonatype.org/content/repositories/releases" m2compatible="true" />
<!-- you might need to tweak this from china so it works -->
<ibiblio name="working-chinese-mirror" root="http://mirror.netcologne.de/maven2" m2compatible="true" />
<chain name="default" returnFirst="true" checkmodified="true">
<resolver ref="local"/>
<resolver ref="main"/>
<resolver ref="sonatype-releases" />
<resolver ref="working-chinese-mirror" />
</chain>
</resolvers>
</ivysettings>

View File

@ -27,7 +27,7 @@
<import file="../module-build.xml"/> <import file="../module-build.xml"/>
<target name="install-cpptasks" unless="cpptasks.uptodate" depends="ivy-availability-check,ivy-fail"> <target name="install-cpptasks" unless="cpptasks.uptodate" depends="ivy-availability-check,ivy-fail,ivy-configure">
<property name="cpptasks.uptodate" value="true"/> <property name="cpptasks.uptodate" value="true"/>
<ivy:cachepath organisation="ant-contrib" module="cpptasks" revision="1.0b5" <ivy:cachepath organisation="ant-contrib" module="cpptasks" revision="1.0b5"
inline="true" conf="master" type="jar" pathid="cpptasks.classpath"/> inline="true" conf="master" type="jar" pathid="cpptasks.classpath"/>

View File

@ -1,19 +0,0 @@
<ivysettings>
<!-- Default Ivy settings. -->
<settings defaultResolver="default"/>
<include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
<resolvers>
<ibiblio name="sonatype-releases" root="http://oss.sonatype.org/content/repositories/releases" m2compatible="true" />
<chain name="default" returnFirst="true" checkmodified="true">
<resolver ref="local"/>
<resolver ref="main"/>
<resolver ref="sonatype-releases" />
</chain>
</resolvers>
</ivysettings>

View File

@ -33,7 +33,7 @@
<target name="compile-core"/> <target name="compile-core"/>
<target name="compile-test"/> <target name="compile-test"/>
<target name="resolve" depends="ivy-availability-check"> <target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
<sequential> <sequential>
<!-- jetty libs in lib/ --> <!-- jetty libs in lib/ -->
<ivy:retrieve conf="default" type="jar" log="download-only"/> <ivy:retrieve conf="default" type="jar" log="download-only"/>