mirror of https://github.com/apache/ant-ivy
Merge branch 'master' into xooki2asciidoc
This commit is contained in:
commit
5d6131a301
|
|
@ -1,45 +1,45 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src/java"/>
|
<classpathentry kind="src" path="src/java"/>
|
||||||
<classpathentry kind="src" path="test/java"/>
|
<classpathentry kind="src" path="test/java"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="lib/ant.jar"/>
|
<classpathentry kind="lib" path="lib/ant.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/ant-testutil.jar"/>
|
<classpathentry kind="lib" path="lib/ant-testutil.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-codec.jar"/>
|
<classpathentry kind="lib" path="lib/commons-codec.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-httpclient.jar"/>
|
<classpathentry kind="lib" path="lib/commons-httpclient.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-lang.jar"/>
|
<classpathentry kind="lib" path="lib/commons-lang.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-logging.jar"/>
|
<classpathentry kind="lib" path="lib/commons-logging.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-vfs.jar"/>
|
<classpathentry kind="lib" path="lib/commons-vfs.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/junit.jar"/>
|
<classpathentry kind="lib" path="lib/junit.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/xmlunit.jar"/>
|
<classpathentry kind="lib" path="lib/xmlunit.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/oro.jar"/>
|
<classpathentry kind="lib" path="lib/oro.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bcpg-jdk14.jar"/>
|
<classpathentry kind="lib" path="lib/bcpg-jdk15on.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bcprov-jdk14.jar"/>
|
<classpathentry kind="lib" path="lib/bcprov-jdk15on.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.connector-factory.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.connector-factory.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.core.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.core.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.jsch.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.jsch.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.pageant.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.pageant.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.sshagent.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.sshagent.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.usocket-jna.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.usocket-jna.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch.agentproxy.usocket-nc.jar"/>
|
<classpathentry kind="lib" path="lib/jsch.agentproxy.usocket-nc.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
||||||
2
NOTICE
2
NOTICE
|
|
@ -1,5 +1,5 @@
|
||||||
Apache Ivy (TM)
|
Apache Ivy (TM)
|
||||||
Copyright 2007-2014 The Apache Software Foundation
|
Copyright 2007-2017 The Apache Software Foundation
|
||||||
|
|
||||||
This product includes software developed at
|
This product includes software developed at
|
||||||
The Apache Software Foundation (http://www.apache.org/).
|
The Apache Software Foundation (http://www.apache.org/).
|
||||||
|
|
|
||||||
|
|
@ -17,102 +17,102 @@
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
<project name="IvyRelease" default="snapshot"
|
<project name="IvyRelease" default="snapshot"
|
||||||
xmlns:ivy="antlib:org.apache.ivy.ant"
|
xmlns:ivy="antlib:org.apache.ivy.ant"
|
||||||
xmlns:ivy2="antlib:org.apache.ivy.ant_2"
|
xmlns:ivy2="antlib:org.apache.ivy.ant_2"
|
||||||
xmlns:asciidoctor="antlib:org.asciidoctor.ant"
|
xmlns:asciidoctor="antlib:org.asciidoctor.ant"
|
||||||
xmlns:openpgp="antlib:org.apache.commons.openpgp.ant">
|
xmlns:openpgp="antlib:org.apache.commons.openpgp.ant">
|
||||||
<import file="build.xml"/>
|
<import file="build.xml"/>
|
||||||
|
|
||||||
<macrodef name="run-tutorial">
|
<macrodef name="run-tutorial">
|
||||||
<attribute name="antfile" />
|
<attribute name="antfile" />
|
||||||
<attribute name="output" />
|
<attribute name="output" />
|
||||||
<attribute name="target" default="" />
|
<attribute name="target" default="" />
|
||||||
<attribute name="failonerror" default="true" />
|
<attribute name="failonerror" default="true" />
|
||||||
<sequential>
|
<sequential>
|
||||||
<echo>Running @{antfile} @{target} > @{output}</echo>
|
<echo>Running @{antfile} @{target} > @{output}</echo>
|
||||||
|
|
||||||
<local name="antfile.dir" />
|
<local name="antfile.dir" />
|
||||||
<dirname property="antfile.dir" file="@{antfile}" />
|
<dirname property="antfile.dir" file="@{antfile}" />
|
||||||
|
|
||||||
<local name="antfile.name" />
|
|
||||||
<basename property="antfile.name" file="@{antfile}" />
|
|
||||||
|
|
||||||
<echo file="@{output}">[ivy@apache:${antfile.dir}]$ ant -f ${antfile.name} @{target}${line.separator}</echo>
|
<local name="antfile.name" />
|
||||||
<java classname="org.apache.tools.ant.launch.Launcher"
|
<basename property="antfile.name" file="@{antfile}" />
|
||||||
fork="true"
|
|
||||||
failonerror="@{failonerror}"
|
<echo file="@{output}">[ivy@apache:${antfile.dir}]$ ant -f ${antfile.name} @{target}${line.separator}</echo>
|
||||||
logerror="true"
|
<java classname="org.apache.tools.ant.launch.Launcher"
|
||||||
append="true"
|
fork="true"
|
||||||
output="@{output}">
|
failonerror="@{failonerror}"
|
||||||
<classpath>
|
logerror="true"
|
||||||
<fileset file="${artifacts.build.dir}/jars/${final.name}" />
|
append="true"
|
||||||
|
output="@{output}">
|
||||||
<!--
|
<classpath>
|
||||||
We need to set the classpath like this, otherwise the invoked
|
<fileset file="${artifacts.build.dir}/jars/${final.name}" />
|
||||||
build scripts are not capable of compiling sources ???
|
|
||||||
-->
|
<!--
|
||||||
<path path="${java.class.path}" />
|
We need to set the classpath like this, otherwise the invoked
|
||||||
</classpath>
|
build scripts are not capable of compiling sources ???
|
||||||
<sysproperty key="ivy.cache.dir" value="${tutorial.cache}" />
|
-->
|
||||||
<sysproperty key="ivy.local.default.root" value="${tutorial.local-repo}" />
|
<path path="${java.class.path}" />
|
||||||
|
</classpath>
|
||||||
|
<sysproperty key="ivy.cache.dir" value="${tutorial.cache}" />
|
||||||
|
<sysproperty key="ivy.local.default.root" value="${tutorial.local-repo}" />
|
||||||
<sysproperty key="ivy.cache.ttl.default" value="1s" />
|
<sysproperty key="ivy.cache.ttl.default" value="1s" />
|
||||||
<sysproperty key="skip.download" value="true" />
|
<sysproperty key="skip.download" value="true" />
|
||||||
<arg line="-f @{antfile}" />
|
<arg line="-f @{antfile}" />
|
||||||
<arg line="@{target}" />
|
<arg line="@{target}" />
|
||||||
</java>
|
</java>
|
||||||
</sequential>
|
</sequential>
|
||||||
</macrodef>
|
</macrodef>
|
||||||
|
|
||||||
<target name="generate-tutorial-output" depends="jar" unless="skip.generate-tutorial-output">
|
<target name="generate-tutorial-output" depends="jar" unless="skip.generate-tutorial-output">
|
||||||
<property name="output.dir" value="${basedir}/asciidoc/tutorial/log" />
|
<property name="output.dir" value="${basedir}/asciidoc/tutorial/log" />
|
||||||
<delete dir="${output.dir}" />
|
<delete dir="${output.dir}" />
|
||||||
<mkdir dir="${output.dir}" />
|
<mkdir dir="${output.dir}" />
|
||||||
|
|
||||||
<!-- create a copy of the tutorials so we can easily get rid of the generated files -->
|
<!-- create a copy of the tutorials so we can easily get rid of the generated files -->
|
||||||
<property name="tutorial.src.dir" value="${build.dir}/examples" />
|
<property name="tutorial.src.dir" value="${build.dir}/examples" />
|
||||||
<delete dir="${tutorial.src.dir}" />
|
<delete dir="${tutorial.src.dir}" />
|
||||||
<mkdir dir="${tutorial.src.dir}" />
|
<mkdir dir="${tutorial.src.dir}" />
|
||||||
<copy todir="${tutorial.src.dir}">
|
<copy todir="${tutorial.src.dir}">
|
||||||
<fileset dir="src/example" />
|
<fileset dir="src/example" />
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- create a cache and local-repository for the tutorials -->
|
<!-- create a cache and local-repository for the tutorials -->
|
||||||
<property name="tutorial.build.dir" value="${build.dir}/tutorial" />
|
<property name="tutorial.build.dir" value="${build.dir}/tutorial" />
|
||||||
<property name="tutorial.cache" value="${tutorial.build.dir}/cache" />
|
<property name="tutorial.cache" value="${tutorial.build.dir}/cache" />
|
||||||
<property name="tutorial.local-repo" value="${tutorial.build.dir}/local" />
|
<property name="tutorial.local-repo" value="${tutorial.build.dir}/local" />
|
||||||
|
|
||||||
<!-- go-ivy : not logged, but run in order to check if it still run -->
|
<!-- go-ivy : not logged, but run in order to check if it still run -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/go-ivy/build.xml" output="${output.dir}/dummy.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/go-ivy/build.xml" output="${output.dir}/dummy.txt" />
|
||||||
<delete file="${output.dir}/dummy.txt" />
|
<delete file="${output.dir}/dummy.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- hello-ivy : Quick Start - start.html -->
|
<!-- hello-ivy : Quick Start - start.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/hello-ivy/build.xml" output="${output.dir}/hello-ivy-1.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/hello-ivy/build.xml" output="${output.dir}/hello-ivy-1.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/hello-ivy/build.xml" output="${output.dir}/hello-ivy-2.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/hello-ivy/build.xml" output="${output.dir}/hello-ivy-2.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- multiple resolvers - multiple.html -->
|
<!-- multiple resolvers - multiple.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/chained-resolvers/chainedresolvers-project/build.xml" output="${output.dir}/chained-resolvers.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/chained-resolvers/chainedresolvers-project/build.xml" output="${output.dir}/chained-resolvers.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- dual - dual.html -->
|
<!-- dual - dual.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/dual/project/build.xml" output="${output.dir}/dual.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/dual/project/build.xml" output="${output.dir}/dual.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- Project dependencies - multi-project.html -->
|
<!-- Project dependencies - multi-project.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/dependence/dependee/build.xml" target="publish" output="${output.dir}/dependence-standalone.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/dependence/dependee/build.xml" target="publish" output="${output.dir}/dependence-standalone.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/dependence/depender/build.xml" output="${output.dir}/dependence-depending.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/dependence/depender/build.xml" output="${output.dir}/dependence-depending.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/dependence/dependee/build.xml" target="publish" output="${output.dir}/dependence-standalone-2.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/dependence/dependee/build.xml" target="publish" output="${output.dir}/dependence-standalone-2.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/dependence/depender/build.xml" output="${output.dir}/dependence-depending-2.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/dependence/depender/build.xml" output="${output.dir}/dependence-depending-2.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- configuration - Using Ivy Configuration - conf.html -->
|
<!-- configuration - Using Ivy Configuration - conf.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/filter-framework/build.xml" output="${output.dir}/configurations-lib.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/filter-framework/build.xml" output="${output.dir}/configurations-lib.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/myapp/build.xml" output="${output.dir}/configurations-runcc.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/myapp/build.xml" output="${output.dir}/configurations-runcc.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/myapp/build.xml" target="run-hm" output="${output.dir}/configurations-runhm.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/myapp/build.xml" target="run-hm" output="${output.dir}/configurations-runhm.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!--Building a repository - basic.html -->
|
<!--Building a repository - basic.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2" output="${output.dir}/install.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2" output="${output.dir}/install.txt" />
|
||||||
<pathconvert property="myrepository.content" pathsep="${line.separator}">
|
<pathconvert property="myrepository.content" pathsep="${line.separator}">
|
||||||
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/no-namespace" />
|
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/no-namespace" />
|
||||||
|
|
@ -128,26 +128,26 @@
|
||||||
<echo file="${output.dir}/myrepository-content-deps.txt" append="true">${myrepository.content.deps}</echo>
|
<echo file="${output.dir}/myrepository-content-deps.txt" append="true">${myrepository.content.deps}</echo>
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!--Building a repository - advanced.html -->
|
<!--Building a repository - advanced.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2-namespace" output="${output.dir}/install-namespace.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2-namespace" output="${output.dir}/install-namespace.txt" />
|
||||||
<pathconvert property="myrepository.content.namespace" pathsep="${line.separator}">
|
<pathconvert property="myrepository.content.namespace" pathsep="${line.separator}">
|
||||||
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/advanced" />
|
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/advanced" />
|
||||||
</pathconvert>
|
</pathconvert>
|
||||||
<echo file="${output.dir}/myrepository-content-namespace.txt">$ find ${tutorial.src.dir}/build-a-ivy-repository/myrepository/advanced -type f -print${line.separator}</echo>
|
<echo file="${output.dir}/myrepository-content-namespace.txt">$ find ${tutorial.src.dir}/build-a-ivy-repository/myrepository/advanced -type f -print${line.separator}</echo>
|
||||||
<echo file="${output.dir}/myrepository-content-namespace.txt" append="true">${myrepository.content.namespace}</echo>
|
<echo file="${output.dir}/myrepository-content-namespace.txt" append="true">${myrepository.content.namespace}</echo>
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- multi-project - multiproject.html -->
|
<!-- multi-project - multiproject.html -->
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/multi-project/build.xml" target="-p" output="${output.dir}/multi-project-general-antp.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/multi-project/build.xml" target="-p" output="${output.dir}/multi-project-general-antp.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/multi-project/projects/find/build.xml" target="-p" output="${output.dir}/multi-project-find-antp.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/multi-project/projects/find/build.xml" target="-p" output="${output.dir}/multi-project-find-antp.txt" />
|
||||||
<run-tutorial antfile="${tutorial.src.dir}/multi-project/build.xml" target="publish-all" output="${output.dir}/multi-project-general-publishall.txt" />
|
<run-tutorial antfile="${tutorial.src.dir}/multi-project/build.xml" target="publish-all" output="${output.dir}/multi-project-general-publishall.txt" />
|
||||||
<delete dir="${tutorial.build.dir}" />
|
<delete dir="${tutorial.build.dir}" />
|
||||||
|
|
||||||
<!-- Correct the location of the examples to a dummy '/ivy' location -->
|
<!-- Correct the location of the examples to a dummy '/ivy' location -->
|
||||||
<pathconvert property="tutorial.root" dirsep="/">
|
<pathconvert property="tutorial.root" dirsep="/">
|
||||||
<identitymapper/>
|
<identitymapper/>
|
||||||
<path location="${tutorial.src.dir}"/>
|
<path location="${tutorial.src.dir}"/>
|
||||||
</pathconvert>
|
</pathconvert>
|
||||||
<pathconvert property="tutorial.local" dirsep="/">
|
<pathconvert property="tutorial.local" dirsep="/">
|
||||||
<identitymapper/>
|
<identitymapper/>
|
||||||
<path location="${tutorial.local-repo}"/>
|
<path location="${tutorial.local-repo}"/>
|
||||||
|
|
@ -158,29 +158,22 @@
|
||||||
</pathconvert>
|
</pathconvert>
|
||||||
|
|
||||||
<replace dir="${output.dir}" token="\" value="/" />
|
<replace dir="${output.dir}" token="\" value="/" />
|
||||||
<replace dir="${output.dir}" token="${tutorial.root}" value="/ivy" />
|
<replace dir="${output.dir}" token="${tutorial.root}" value="/ivy" />
|
||||||
<replace dir="${output.dir}" token="${tutorial.local}" value="/home/ivy/.ivy2/local" />
|
<replace dir="${output.dir}" token="${tutorial.local}" value="/home/ivy/.ivy2/local" />
|
||||||
<replace dir="${output.dir}" token="${ivy.jar.location}" value="//home/ivy/ivy.jar" />
|
<replace dir="${output.dir}" token="${ivy.jar.location}" value="//home/ivy/ivy.jar" />
|
||||||
<replace dir="${output.dir}" token="-f build.xml " value="" />
|
<replace dir="${output.dir}" token="-f build.xml " value="" />
|
||||||
<replace dir="${output.dir}" token="${ivy.revision}" value="working@apache" />
|
<replace dir="${output.dir}" token="${ivy.revision}" value="working@apache" />
|
||||||
|
</target>
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="generate-doc" depends="init-ivy">
|
<target name="generate-doc" depends="init-ivy">
|
||||||
<ivy:cachepath pathid="asciidoctor.path">
|
<ivy:cachepath pathid="asciidoctor.path">
|
||||||
<dependency org="org.asciidoctor" name="asciidoctor-ant" rev="1.5.4" />
|
<dependency org="org.asciidoctor" name="asciidoctor-ant" rev="1.5.4" />
|
||||||
</ivy:cachepath>
|
</ivy:cachepath>
|
||||||
<taskdef uri="antlib:org.asciidoctor.ant" resource="org/asciidoctor/ant/antlib.xml" classpathref="asciidoctor.path" />
|
<taskdef uri="antlib:org.asciidoctor.ant" resource="org/asciidoctor/ant/antlib.xml" classpathref="asciidoctor.path" />
|
||||||
<asciidoctor:convert sourceDirectory="${doc.src.dir}" outputDirectory="${doc.build.dir}" backend="xhtml5" templateDir="${doc.src.dir}/templates" preserveDirectories="true">
|
<asciidoctor:convert sourceDirectory="${doc.src.dir}" outputDirectory="${doc.build.dir}" backend="xhtml5" templateDir="${doc.src.dir}/templates" preserveDirectories="true">
|
||||||
<attribute key="basedir" value="${doc.src.dir}" />
|
<attribute key="basedir" value="${doc.src.dir}" />
|
||||||
<attribute key="imagesdir" value="" />
|
<attribute key="imagesdir" value="" />
|
||||||
</asciidoctor:convert>
|
</asciidoctor:convert>
|
||||||
<!-- the basedir seems to fuck up the path to the output directory, let's fix that manually >
|
|
||||||
<delete dir="${doc.build.dir}" />
|
|
||||||
<mkdir dir="${doc.build.dir}" />
|
|
||||||
<copy todir="${doc.build.dir}">
|
|
||||||
<fileset dir="${doc.src.dir}/${doc.build.dir}" />
|
|
||||||
</copy-->
|
|
||||||
<!-- copy static resources -->
|
<!-- copy static resources -->
|
||||||
<copy todir="${doc.build.dir}">
|
<copy todir="${doc.build.dir}">
|
||||||
<fileset dir="${doc.src.dir}" includes="images/**,style/**,samples/**,js/**,ivy.xsd" />
|
<fileset dir="${doc.src.dir}" includes="images/**,style/**,samples/**,js/**,ivy.xsd" />
|
||||||
|
|
@ -188,165 +181,165 @@
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="all-doc" depends="javadoc, generate-doc" />
|
<target name="all-doc" depends="javadoc, generate-doc" />
|
||||||
|
|
||||||
<target name="init-snapshot" depends="default-version">
|
|
||||||
<property name="snapshot.full.name" value="apache-ivy-${build.version}" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="snapshot-metadata" depends="init-snapshot, resolve">
|
<target name="init-snapshot" depends="default-version">
|
||||||
<mkdir dir="${artifacts.build.dir}"/>
|
<property name="snapshot.full.name" value="apache-ivy-${build.version}" />
|
||||||
<ivy:deliver
|
</target>
|
||||||
deliverpattern="${artifacts.build.dir}/ivy.xml"
|
|
||||||
pubrevision="${build.version}"
|
|
||||||
pubdate="${pubdate}"
|
|
||||||
status="${status}"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="snapshot-src" depends="init-snapshot">
|
|
||||||
<delete dir="${build.dir}/snapshot-src" failonerror="false" />
|
|
||||||
<exec executable="git" failonerror="true">
|
|
||||||
<arg line="clone ${basedir} ${build.dir}/snapshot-src" />
|
|
||||||
</exec>
|
|
||||||
<exec dir="${build.dir}/snapshot-src" executable="git" failonerror="true">
|
|
||||||
<arg line="clean -d -x -f" />
|
|
||||||
</exec>
|
|
||||||
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
|
|
||||||
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.zip">
|
|
||||||
<zipfileset dir="${build.dir}/snapshot-src" prefix="${snapshot.full.name}" />
|
|
||||||
</zip>
|
|
||||||
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.tar.gz"
|
|
||||||
compression="gzip" longfile="gnu">
|
|
||||||
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.zip"/>
|
|
||||||
</tar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="snapshot-bin-without-dependencies" depends="snapshot-metadata, jar, all-doc">
|
|
||||||
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
|
|
||||||
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.zip">
|
|
||||||
<zipfileset dir="${doc.build.dir}" prefix="${snapshot.full.name}/doc" excludes="**/reports/coverage/**,**/reports/test/**"/>
|
|
||||||
<zipfileset dir="${basedir}/src/example" prefix="${snapshot.full.name}/src/example"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="NOTICE" fullpath="${snapshot.full.name}/NOTICE"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="README" prefix="${snapshot.full.name}"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE*" prefix="${snapshot.full.name}"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="CHANGES.txt" fullpath="${snapshot.full.name}/CHANGES.txt"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="RELEASE_NOTES" fullpath="${snapshot.full.name}/RELEASE_NOTES"/>
|
|
||||||
<zipfileset dir="${src.dir}/org/apache/ivy/plugins/parser/xml" includes="ivy.xsd" fullpath="${snapshot.full.name}/ivy.xsd"/>
|
|
||||||
<zipfileset dir="${artifacts.build.dir}" includes="ivy.xml" fullpath="${snapshot.full.name}/ivy.xml"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="build-for-bin-distrib.xml" fullpath="${snapshot.full.name}/build.xml"/>
|
|
||||||
|
|
||||||
<zipfileset dir="${artifacts.build.dir}/jars" includes="${final.name}" fullpath="${snapshot.full.name}/ivy-${build.version}.jar"/>
|
<target name="snapshot-metadata" depends="init-snapshot, resolve">
|
||||||
</zip>
|
<mkdir dir="${artifacts.build.dir}"/>
|
||||||
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.tar.gz"
|
<ivy:deliver
|
||||||
compression="gzip" longfile="gnu">
|
deliverpattern="${artifacts.build.dir}/ivy.xml"
|
||||||
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.zip"/>
|
pubrevision="${build.version}"
|
||||||
</tar>
|
pubdate="${pubdate}"
|
||||||
</target>
|
status="${status}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="snapshot-bin-with-dependencies" depends="snapshot-metadata, jar, all-doc">
|
<target name="snapshot-src" depends="init-snapshot">
|
||||||
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
|
<delete dir="${build.dir}/snapshot-src" failonerror="false" />
|
||||||
<delete dir="${build.dir}/lib" />
|
<exec executable="git" failonerror="true">
|
||||||
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]" />
|
<arg line="clone ${basedir} ${build.dir}/snapshot-src" />
|
||||||
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.zip">
|
</exec>
|
||||||
<zipfileset dir="${doc.build.dir}" prefix="${snapshot.full.name}/doc" excludes="**/reports/coverage/**,**/reports/test/**"/>
|
<exec dir="${build.dir}/snapshot-src" executable="git" failonerror="true">
|
||||||
<zipfileset dir="${basedir}/src/example" prefix="${snapshot.full.name}/src/example"/>
|
<arg line="clean -d -x -f" />
|
||||||
<zipfileset dir="${basedir}" includes="NOTICE" fullpath="${snapshot.full.name}/NOTICE"/>
|
</exec>
|
||||||
<zipfileset dir="${basedir}" includes="README" prefix="${snapshot.full.name}"/>
|
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE*" prefix="${snapshot.full.name}"/>
|
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.zip">
|
||||||
<zipfileset dir="${basedir}" includes="CHANGES.txt" fullpath="${snapshot.full.name}/CHANGES.txt"/>
|
<zipfileset dir="${build.dir}/snapshot-src" prefix="${snapshot.full.name}" />
|
||||||
<zipfileset dir="${basedir}" includes="RELEASE_NOTES" fullpath="${snapshot.full.name}/RELEASE_NOTES"/>
|
</zip>
|
||||||
<zipfileset dir="${src.dir}/org/apache/ivy/plugins/parser/xml" includes="ivy.xsd" fullpath="${snapshot.full.name}/ivy.xsd"/>
|
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.tar.gz"
|
||||||
<zipfileset dir="${artifacts.build.dir}" includes="ivy.xml" fullpath="${snapshot.full.name}/ivy.xml"/>
|
compression="gzip" longfile="gnu">
|
||||||
|
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.zip"/>
|
||||||
<zipfileset dir="${artifacts.build.dir}/jars" includes="${final.name}" fullpath="${snapshot.full.name}/ivy-${build.version}.jar"/>
|
</tar>
|
||||||
|
</target>
|
||||||
|
|
||||||
<zipfileset dir="${build.dir}/lib" prefix="${snapshot.full.name}/lib" excludes="ant-*.jar,bcpg-*.jar,bcprov*.jar" />
|
<target name="snapshot-bin-without-dependencies" depends="snapshot-metadata, jar, all-doc">
|
||||||
</zip>
|
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
|
||||||
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.tar.gz"
|
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.zip">
|
||||||
compression="gzip" longfile="gnu">
|
<zipfileset dir="${doc.build.dir}" prefix="${snapshot.full.name}/doc" excludes="**/reports/coverage/**,**/reports/test/**"/>
|
||||||
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.zip"/>
|
<zipfileset dir="${basedir}/src/example" prefix="${snapshot.full.name}/src/example"/>
|
||||||
</tar>
|
<zipfileset dir="${basedir}" includes="NOTICE" fullpath="${snapshot.full.name}/NOTICE"/>
|
||||||
</target>
|
<zipfileset dir="${basedir}" includes="README" prefix="${snapshot.full.name}"/>
|
||||||
|
<zipfileset dir="${basedir}" includes="LICENSE*" prefix="${snapshot.full.name}"/>
|
||||||
|
<zipfileset dir="${basedir}" includes="CHANGES.txt" fullpath="${snapshot.full.name}/CHANGES.txt"/>
|
||||||
|
<zipfileset dir="${basedir}" includes="RELEASE_NOTES" fullpath="${snapshot.full.name}/RELEASE_NOTES"/>
|
||||||
|
<zipfileset dir="${src.dir}/org/apache/ivy/plugins/parser/xml" includes="ivy.xsd" fullpath="${snapshot.full.name}/ivy.xsd"/>
|
||||||
|
<zipfileset dir="${artifacts.build.dir}" includes="ivy.xml" fullpath="${snapshot.full.name}/ivy.xml"/>
|
||||||
|
<zipfileset dir="${basedir}" includes="build-for-bin-distrib.xml" fullpath="${snapshot.full.name}/build.xml"/>
|
||||||
|
|
||||||
<target name="snapshot-bin"
|
<zipfileset dir="${artifacts.build.dir}/jars" includes="${final.name}" fullpath="${snapshot.full.name}/ivy-${build.version}.jar"/>
|
||||||
depends="snapshot-bin-with-dependencies, snapshot-bin-without-dependencies" />
|
</zip>
|
||||||
|
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.tar.gz"
|
||||||
<target name="release-xsd" depends="init-snapshot">
|
compression="gzip" longfile="gnu">
|
||||||
<!-- copies current ivy xml schema to doc source, so that it will be available from web site -->
|
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.zip"/>
|
||||||
<copy file="${src.dir}/org/apache/ivy/plugins/parser/xml/ivy.xsd" todir="${doc.src.dir}" />
|
</tar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<target name="snapshot-maven2" depends="init-snapshot, snapshot-metadata, jar, sources, javadoc">
|
<target name="snapshot-bin-with-dependencies" depends="snapshot-metadata, jar, all-doc">
|
||||||
<property name="m2.distrib.dir" value="${distrib.dir}/maven2/${build.version}" />
|
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
|
||||||
<ivy:makepom ivyfile="${artifacts.build.dir}/ivy.xml"
|
<delete dir="${build.dir}/lib" />
|
||||||
pomfile="${m2.distrib.dir}/ivy-${build.version}.pom"
|
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]" />
|
||||||
templatefile="${basedir}/src/etc/makepom/pom.template">
|
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.zip">
|
||||||
<mapping conf="core" scope="compile"/>
|
<zipfileset dir="${doc.build.dir}" prefix="${snapshot.full.name}/doc" excludes="**/reports/coverage/**,**/reports/test/**"/>
|
||||||
<mapping conf="test" scope="test"/>
|
<zipfileset dir="${basedir}/src/example" prefix="${snapshot.full.name}/src/example"/>
|
||||||
</ivy:makepom>
|
<zipfileset dir="${basedir}" includes="NOTICE" fullpath="${snapshot.full.name}/NOTICE"/>
|
||||||
<copy file="${artifacts.build.dir}/jars/${final.name}"
|
<zipfileset dir="${basedir}" includes="README" prefix="${snapshot.full.name}"/>
|
||||||
tofile="${m2.distrib.dir}/ivy-${build.version}.jar" />
|
<zipfileset dir="${basedir}" includes="LICENSE*" prefix="${snapshot.full.name}"/>
|
||||||
<!-- jar javadocs -->
|
<zipfileset dir="${basedir}" includes="CHANGES.txt" fullpath="${snapshot.full.name}/CHANGES.txt"/>
|
||||||
<jar destfile="${m2.distrib.dir}/ivy-${build.version}-javadoc.jar">
|
<zipfileset dir="${basedir}" includes="RELEASE_NOTES" fullpath="${snapshot.full.name}/RELEASE_NOTES"/>
|
||||||
<fileset dir="${javadoc.build.dir}" />
|
<zipfileset dir="${src.dir}/org/apache/ivy/plugins/parser/xml" includes="ivy.xsd" fullpath="${snapshot.full.name}/ivy.xsd"/>
|
||||||
</jar>
|
<zipfileset dir="${artifacts.build.dir}" includes="ivy.xml" fullpath="${snapshot.full.name}/ivy.xml"/>
|
||||||
<!-- copy sources jar -->
|
|
||||||
<copy file="${artifacts.build.dir}/sources/${final.name}"
|
|
||||||
tofile="${m2.distrib.dir}/ivy-${build.version}-sources.jar" />
|
|
||||||
|
|
||||||
<checksum algorithm="md5">
|
<zipfileset dir="${artifacts.build.dir}/jars" includes="${final.name}" fullpath="${snapshot.full.name}/ivy-${build.version}.jar"/>
|
||||||
<fileset dir="${m2.distrib.dir}">
|
|
||||||
<include name="*.pom"/>
|
|
||||||
<include name="*.jar"/>
|
|
||||||
</fileset>
|
|
||||||
</checksum>
|
|
||||||
<checksum algorithm="sha1">
|
|
||||||
<fileset dir="${m2.distrib.dir}">
|
|
||||||
<include name="*.pom"/>
|
|
||||||
<include name="*.jar"/>
|
|
||||||
</fileset>
|
|
||||||
</checksum>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
|
|
||||||
<target name="snapshot-checksums">
|
<zipfileset dir="${build.dir}/lib" prefix="${snapshot.full.name}/lib" excludes="ant-*.jar,bcpg-*.jar,bcprov*.jar" />
|
||||||
<checksum algorithm="md5">
|
</zip>
|
||||||
<fileset dir="${distrib.dir}/dist/${build.version}">
|
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.tar.gz"
|
||||||
<include name="*.pom"/>
|
compression="gzip" longfile="gnu">
|
||||||
<include name="*.jar"/>
|
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.zip"/>
|
||||||
<include name="*.zip"/>
|
</tar>
|
||||||
<include name="*.gz"/>
|
</target>
|
||||||
</fileset>
|
|
||||||
</checksum>
|
<target name="snapshot-bin"
|
||||||
<checksum algorithm="sha">
|
depends="snapshot-bin-with-dependencies, snapshot-bin-without-dependencies" />
|
||||||
<fileset dir="${distrib.dir}/dist/${build.version}">
|
|
||||||
<include name="*.pom"/>
|
<target name="release-xsd" depends="init-snapshot">
|
||||||
<include name="*.jar"/>
|
<!-- copies current ivy xml schema to doc source, so that it will be available from web site -->
|
||||||
<include name="*.zip"/>
|
<copy file="${src.dir}/org/apache/ivy/plugins/parser/xml/ivy.xsd" todir="${doc.src.dir}" />
|
||||||
<include name="*.gz"/>
|
</target>
|
||||||
</fileset>
|
|
||||||
</checksum>
|
|
||||||
</target>
|
<target name="snapshot-maven2" depends="init-snapshot, snapshot-metadata, jar, sources, javadoc">
|
||||||
|
<property name="m2.distrib.dir" value="${distrib.dir}/maven2/${build.version}" />
|
||||||
<target name="snapshot-version">
|
<ivy:makepom ivyfile="${artifacts.build.dir}/ivy.xml"
|
||||||
<property name="version.prefix" value="${target.ivy.version}-dev-"/>
|
pomfile="${m2.distrib.dir}/ivy-${build.version}.pom"
|
||||||
</target>
|
templatefile="${basedir}/src/etc/makepom/pom.template">
|
||||||
|
<mapping conf="core" scope="compile"/>
|
||||||
<target name="release-version">
|
<mapping conf="test" scope="test"/>
|
||||||
<property name="build.version" value="${target.ivy.version}" />
|
</ivy:makepom>
|
||||||
<echo>Setting version to ${build.version}</echo>
|
<copy file="${artifacts.build.dir}/jars/${final.name}"
|
||||||
<condition property="status" value="release">
|
tofile="${m2.distrib.dir}/ivy-${build.version}.jar" />
|
||||||
<matches pattern="^\d+\.\d+\.\d+$" string="${build.version}"/>
|
<!-- jar javadocs -->
|
||||||
</condition>
|
<jar destfile="${m2.distrib.dir}/ivy-${build.version}-javadoc.jar">
|
||||||
<condition property="status" value="milestone">
|
<fileset dir="${javadoc.build.dir}" />
|
||||||
<matches pattern="^\d+\.\d+\.\d+-(alpha|beta|rc)\d+$" string="${build.version}"/>
|
</jar>
|
||||||
</condition>
|
<!-- copy sources jar -->
|
||||||
<property name="status" value="integration" />
|
<copy file="${artifacts.build.dir}/sources/${final.name}"
|
||||||
<echo>Setting status to ${status}</echo>
|
tofile="${m2.distrib.dir}/ivy-${build.version}-sources.jar" />
|
||||||
</target>
|
|
||||||
|
<checksum algorithm="md5">
|
||||||
<target name="sign" depends="init-ivy">
|
<fileset dir="${m2.distrib.dir}">
|
||||||
|
<include name="*.pom"/>
|
||||||
|
<include name="*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</checksum>
|
||||||
|
<checksum algorithm="sha1">
|
||||||
|
<fileset dir="${m2.distrib.dir}">
|
||||||
|
<include name="*.pom"/>
|
||||||
|
<include name="*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</checksum>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="snapshot-checksums">
|
||||||
|
<checksum algorithm="md5">
|
||||||
|
<fileset dir="${distrib.dir}/dist/${build.version}">
|
||||||
|
<include name="*.pom"/>
|
||||||
|
<include name="*.jar"/>
|
||||||
|
<include name="*.zip"/>
|
||||||
|
<include name="*.gz"/>
|
||||||
|
</fileset>
|
||||||
|
</checksum>
|
||||||
|
<checksum algorithm="sha">
|
||||||
|
<fileset dir="${distrib.dir}/dist/${build.version}">
|
||||||
|
<include name="*.pom"/>
|
||||||
|
<include name="*.jar"/>
|
||||||
|
<include name="*.zip"/>
|
||||||
|
<include name="*.gz"/>
|
||||||
|
</fileset>
|
||||||
|
</checksum>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="snapshot-version">
|
||||||
|
<property name="version.prefix" value="${target.ivy.version}-dev-"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="release-version">
|
||||||
|
<property name="build.version" value="${target.ivy.version}" />
|
||||||
|
<echo>Setting version to ${build.version}</echo>
|
||||||
|
<condition property="status" value="release">
|
||||||
|
<matches pattern="^\d+\.\d+\.\d+$" string="${build.version}"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="status" value="milestone">
|
||||||
|
<matches pattern="^\d+\.\d+\.\d+-(alpha|beta|rc)\d+$" string="${build.version}"/>
|
||||||
|
</condition>
|
||||||
|
<property name="status" value="integration" />
|
||||||
|
<echo>Setting status to ${status}</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="sign" depends="init-ivy">
|
||||||
<property file="${user.home}/ivybuild.properties" />
|
<property file="${user.home}/ivybuild.properties" />
|
||||||
<input message="please enter your PGP password: " addproperty="pgp.password"/>
|
<input message="please enter your PGP password: " addproperty="pgp.password"/>
|
||||||
<input message="please enter your PGP keyId: " addproperty="pgp.keyId"/>
|
<input message="please enter your PGP keyId: " addproperty="pgp.keyId"/>
|
||||||
|
|
@ -368,54 +361,54 @@
|
||||||
module="bcprov-jdk16" revision="1.45" inline="true" pathid="bouncycastle.bcprov.classpath"/>
|
module="bcprov-jdk16" revision="1.45" inline="true" pathid="bouncycastle.bcprov.classpath"/>
|
||||||
<ivy2:cachepath organisation="org.bouncycastle" settingsRef="sign.settingsId" transitive="false" log="download-only"
|
<ivy2:cachepath organisation="org.bouncycastle" settingsRef="sign.settingsId" transitive="false" log="download-only"
|
||||||
module="bcpg-jdk16" revision="1.45" inline="true" pathid="bouncycastle.bcpg.classpath"/>
|
module="bcpg-jdk16" revision="1.45" inline="true" pathid="bouncycastle.bcpg.classpath"/>
|
||||||
|
|
||||||
<!--
|
|
||||||
For some reason, if we use the openpgp:signer task here directly, the bouncycastle security
|
|
||||||
provider cannot be loaded. If we launch it as a forked process everything works fine !?!
|
|
||||||
-->
|
|
||||||
<java classname="org.apache.tools.ant.launch.Launcher"
|
|
||||||
fork="true">
|
|
||||||
<classpath>
|
|
||||||
<fileset dir="${ant.home}" includes="**/*.jar" />
|
|
||||||
<path refid="bouncycastle.bcprov.classpath" />
|
|
||||||
<path refid="bouncycastle.bcpg.classpath" />
|
|
||||||
<path refid="openpgp.classpath" />
|
|
||||||
</classpath>
|
|
||||||
<arg line="-f build-release.xml" />
|
|
||||||
<arg line="sign-internal" />
|
|
||||||
<arg line="-Dpgp.password=${pgp.password}" />
|
|
||||||
<arg line="-Dpgp.keyId=${pgp.keyId}" />
|
|
||||||
</java>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="sign-internal">
|
|
||||||
<property file="build.properties" />
|
|
||||||
<taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant" />
|
|
||||||
<openpgp:signer secring="${user.home}/.gnupg/secring.gpg"
|
|
||||||
pubring="${user.home}/.gnupg/pubring.gpg"
|
|
||||||
password="${pgp.password}"
|
|
||||||
keyid="${pgp.keyId}"
|
|
||||||
asciiarmor="true">
|
|
||||||
<fileset dir="${distrib.dir}">
|
|
||||||
<include name="**/*.pom"/>
|
|
||||||
<include name="**/*.jar"/>
|
|
||||||
<include name="**/*.zip"/>
|
|
||||||
<include name="**/*.gz"/>
|
|
||||||
</fileset>
|
|
||||||
</openpgp:signer>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="rat" depends="init-ivy">
|
|
||||||
<property name="rat.failOnError" value="true"/>
|
|
||||||
<ivy:cachepath organisation="org.apache.rat" module="apache-rat-tasks" revision="0.6"
|
|
||||||
inline="true" conf="default" pathid="rat.classpath"
|
|
||||||
log="download-only"/>
|
|
||||||
|
|
||||||
<typedef resource="org/apache/rat/anttasks/antlib.xml"
|
|
||||||
uri="antlib:org.apache.rat.anttasks"
|
|
||||||
classpathref="rat.classpath" />
|
|
||||||
|
|
||||||
<delete dir="${rat.report.dir}"/>
|
<!--
|
||||||
|
For some reason, if we use the openpgp:signer task here directly, the bouncycastle security
|
||||||
|
provider cannot be loaded. If we launch it as a forked process everything works fine !?!
|
||||||
|
-->
|
||||||
|
<java classname="org.apache.tools.ant.launch.Launcher"
|
||||||
|
fork="true">
|
||||||
|
<classpath>
|
||||||
|
<fileset dir="${ant.home}" includes="**/*.jar" />
|
||||||
|
<path refid="bouncycastle.bcprov.classpath" />
|
||||||
|
<path refid="bouncycastle.bcpg.classpath" />
|
||||||
|
<path refid="openpgp.classpath" />
|
||||||
|
</classpath>
|
||||||
|
<arg line="-f build-release.xml" />
|
||||||
|
<arg line="sign-internal" />
|
||||||
|
<arg line="-Dpgp.password=${pgp.password}" />
|
||||||
|
<arg line="-Dpgp.keyId=${pgp.keyId}" />
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="sign-internal">
|
||||||
|
<property file="build.properties" />
|
||||||
|
<taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant" />
|
||||||
|
<openpgp:signer secring="${user.home}/.gnupg/secring.gpg"
|
||||||
|
pubring="${user.home}/.gnupg/pubring.gpg"
|
||||||
|
password="${pgp.password}"
|
||||||
|
keyid="${pgp.keyId}"
|
||||||
|
asciiarmor="true">
|
||||||
|
<fileset dir="${distrib.dir}">
|
||||||
|
<include name="**/*.pom"/>
|
||||||
|
<include name="**/*.jar"/>
|
||||||
|
<include name="**/*.zip"/>
|
||||||
|
<include name="**/*.gz"/>
|
||||||
|
</fileset>
|
||||||
|
</openpgp:signer>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="rat" depends="init-ivy">
|
||||||
|
<property name="rat.failOnError" value="true"/>
|
||||||
|
<ivy:cachepath organisation="org.apache.rat" module="apache-rat-tasks" revision="0.6"
|
||||||
|
inline="true" conf="default" pathid="rat.classpath"
|
||||||
|
log="download-only"/>
|
||||||
|
|
||||||
|
<typedef resource="org/apache/rat/anttasks/antlib.xml"
|
||||||
|
uri="antlib:org.apache.rat.anttasks"
|
||||||
|
classpathref="rat.classpath" />
|
||||||
|
|
||||||
|
<delete dir="${rat.report.dir}"/>
|
||||||
<mkdir dir="${rat.report.dir}"/>
|
<mkdir dir="${rat.report.dir}"/>
|
||||||
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report.dir}/rat-report.txt">
|
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report.dir}/rat-report.txt">
|
||||||
<fileset dir="${basedir}">
|
<fileset dir="${basedir}">
|
||||||
|
|
@ -443,8 +436,8 @@
|
||||||
</and>
|
</and>
|
||||||
</condition>
|
</condition>
|
||||||
</fail>
|
</fail>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="upload-nexus" depends="release-version, init-ivy, jar">
|
<target name="upload-nexus" depends="release-version, init-ivy, jar">
|
||||||
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]" />
|
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]" />
|
||||||
|
|
||||||
|
|
@ -455,7 +448,7 @@
|
||||||
<fileset dir="${build.dir}/lib" excludes="ant-*.jar" />
|
<fileset dir="${build.dir}/lib" excludes="ant-*.jar" />
|
||||||
</classpath>
|
</classpath>
|
||||||
</taskdef>
|
</taskdef>
|
||||||
|
|
||||||
<property file="${user.home}/ivybuild.properties" />
|
<property file="${user.home}/ivybuild.properties" />
|
||||||
<input message="please enter your PGP password: " addproperty="pgp.password"/>
|
<input message="please enter your PGP password: " addproperty="pgp.password"/>
|
||||||
<input message="please enter your PGP keyId: " addproperty="pgp.keyId"/>
|
<input message="please enter your PGP keyId: " addproperty="pgp.keyId"/>
|
||||||
|
|
@ -481,11 +474,11 @@
|
||||||
</ivy2:publish>
|
</ivy2:publish>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="prepare-snapshot"
|
<target name="prepare-snapshot"
|
||||||
depends="/localivy, clean-ivy-home, clean, clean-lib, snapshot-version, install, clean-examples, coverage-report" />
|
depends="/localivy, clean-ivy-home, clean, clean-lib, snapshot-version, install, clean-examples, coverage-report" />
|
||||||
<target name="snapshot"
|
<target name="snapshot"
|
||||||
depends="prepare-snapshot, snapshot-src, snapshot-bin, snapshot-maven2, snapshot-checksums"
|
depends="prepare-snapshot, snapshot-src, snapshot-bin, snapshot-maven2, snapshot-checksums"
|
||||||
description="used for nightly and integration builds"/>
|
description="used for nightly and integration builds"/>
|
||||||
<target name="release" depends="release-version, /localivy, clean-ivy-home, clean, clean-lib, rat, snapshot" description="make a new release of Ivy"/>
|
<target name="release" depends="release-version, /localivy, clean-ivy-home, clean, clean-lib, rat, snapshot" description="make a new release of Ivy"/>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
287
build.xml
287
build.xml
|
|
@ -14,27 +14,27 @@
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
<project name="ivy" default="coverage-report" xmlns:ivy="antlib:org.apache.ivy.ant">
|
<project name="ivy" default="coverage-report" xmlns:ivy="antlib:org.apache.ivy.ant">
|
||||||
|
|
||||||
<property environment="env" />
|
<property environment="env" />
|
||||||
<property file="version.properties" />
|
<property file="version.properties" />
|
||||||
<property file="build.properties" />
|
<property file="build.properties" />
|
||||||
|
|
||||||
<property name="final.name" value="ivy.jar" />
|
<property name="final.name" value="ivy.jar" />
|
||||||
|
|
||||||
<target name="init-ivy-user-home" unless="ivy.use.local.home">
|
<target name="init-ivy-user-home" unless="ivy.use.local.home">
|
||||||
<condition property="ivy.home" value="${env.IVY_HOME}">
|
<condition property="ivy.home" value="${env.IVY_HOME}">
|
||||||
<isset property="env.IVY_HOME" />
|
<isset property="env.IVY_HOME" />
|
||||||
</condition>
|
</condition>
|
||||||
<property name="ivy.home" value="${user.home}/.ivy2" />
|
<property name="ivy.home" value="${user.home}/.ivy2" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init-ivy-local-home" if="ivy.use.local.home">
|
<target name="init-ivy-local-home" if="ivy.use.local.home">
|
||||||
<property name="ivy.home" value="${basedir}/.ivy2" />
|
<property name="ivy.home" value="${basedir}/.ivy2" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init-ivy-home" depends="init-ivy-user-home, init-ivy-local-home" />
|
<target name="init-ivy-home" depends="init-ivy-user-home, init-ivy-local-home" />
|
||||||
|
|
||||||
<target name="init-ivy" depends="compile-bootstrap, init-ivy-home">
|
<target name="init-ivy" depends="compile-bootstrap, init-ivy-home">
|
||||||
|
|
@ -45,18 +45,18 @@
|
||||||
<pathelement location="${bootstrap.classes.build.dir}" />
|
<pathelement location="${bootstrap.classes.build.dir}" />
|
||||||
</classpath>
|
</classpath>
|
||||||
</taskdef>
|
</taskdef>
|
||||||
|
|
||||||
<ivy:configure override="true" />
|
<ivy:configure override="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="install" depends="init-ivy-home, jar"
|
<target name="install" depends="init-ivy-home, jar"
|
||||||
description="build Ivy and install it in Ivy user home for builds using Ivy user home to load Ivy jar">
|
description="build Ivy and install it in Ivy user home for builds using Ivy user home to load Ivy jar">
|
||||||
<property name="ivy.jar.file" value="${ivy.home}/jars/ivy.jar" />
|
<property name="ivy.jar.file" value="${ivy.home}/jars/ivy.jar" />
|
||||||
<copy file="${artifacts.build.dir}/jars/${final.name}" tofile="${ivy.jar.file}" />
|
<copy file="${artifacts.build.dir}/jars/${final.name}" tofile="${ivy.jar.file}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="install-ant" depends="init-ivy-home, jar"
|
<target name="install-ant" depends="init-ivy-home, jar"
|
||||||
description="build Ivy and install it in Ant home lib">
|
description="build Ivy and install it in Ant home lib">
|
||||||
<condition property="ant.home" value="${env.ANT_HOME}">
|
<condition property="ant.home" value="${env.ANT_HOME}">
|
||||||
<isset property="env.ANT_HOME" />
|
<isset property="env.ANT_HOME" />
|
||||||
</condition>
|
</condition>
|
||||||
|
|
@ -95,8 +95,8 @@
|
||||||
<include name="*.jar" />
|
<include name="*.jar" />
|
||||||
<exclude name="ant.jar" />
|
<exclude name="ant.jar" />
|
||||||
<exclude name="ant-launcher.jar" />
|
<exclude name="ant-launcher.jar" />
|
||||||
<exclude name="ant-nodeps.jar"/>
|
<exclude name="ant-nodeps.jar"/>
|
||||||
<exclude name="ant-trax.jar"/>
|
<exclude name="ant-trax.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<pathelement location="${core.classes.build.dir}" />
|
<pathelement location="${core.classes.build.dir}" />
|
||||||
<pathelement location="${ant.classes.build.dir}" />
|
<pathelement location="${ant.classes.build.dir}" />
|
||||||
|
|
@ -104,20 +104,20 @@
|
||||||
<pathelement path="${test.build.dir}" />
|
<pathelement path="${test.build.dir}" />
|
||||||
</path>
|
</path>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="prepare" depends="init">
|
<target name="prepare" depends="init">
|
||||||
<mkdir dir="${classes.build.dir}" />
|
<mkdir dir="${classes.build.dir}" />
|
||||||
<mkdir dir="${core.classes.build.dir}" />
|
<mkdir dir="${core.classes.build.dir}" />
|
||||||
<mkdir dir="${bootstrap.classes.build.dir}" />
|
<mkdir dir="${bootstrap.classes.build.dir}" />
|
||||||
<mkdir dir="${ant.classes.build.dir}" />
|
<mkdir dir="${ant.classes.build.dir}" />
|
||||||
<mkdir dir="${optional.classes.build.dir}" />
|
<mkdir dir="${optional.classes.build.dir}" />
|
||||||
<mkdir dir="${all.classes.build.dir}" />
|
<mkdir dir="${all.classes.build.dir}" />
|
||||||
<mkdir dir="${test.build.dir}" />
|
<mkdir dir="${test.build.dir}" />
|
||||||
<mkdir dir="${artifacts.build.dir}" />
|
<mkdir dir="${artifacts.build.dir}" />
|
||||||
<mkdir dir="${test.report.dir}" />
|
<mkdir dir="${test.report.dir}" />
|
||||||
<mkdir dir="${ivy.report.dir}" />
|
<mkdir dir="${ivy.report.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean" description="delete all generated files keeping sources only">
|
<target name="clean" description="delete all generated files keeping sources only">
|
||||||
<delete dir="${classes.build.dir}" />
|
<delete dir="${classes.build.dir}" />
|
||||||
<delete dir="${test.build.dir}" />
|
<delete dir="${test.build.dir}" />
|
||||||
|
|
@ -127,49 +127,49 @@
|
||||||
<delete dir="${doc.build.dir}" />
|
<delete dir="${doc.build.dir}" />
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-lib">
|
<target name="clean-lib">
|
||||||
<delete dir="${lib.dir}" />
|
<delete dir="${lib.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-ivy-cache" depends="init-ivy-home">
|
<target name="clean-ivy-cache" depends="init-ivy-home">
|
||||||
<delete dir="${ivy.home}/cache" />
|
<delete dir="${ivy.home}/cache" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-ivy-home" depends="init-ivy-home">
|
<target name="clean-ivy-home" depends="init-ivy-home">
|
||||||
<delete dir="${ivy.home}" />
|
<delete dir="${ivy.home}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-examples" description="clean all examples">
|
<target name="clean-examples" description="clean all examples">
|
||||||
<subant target="clean" failonerror="false">
|
<subant target="clean" failonerror="false">
|
||||||
<fileset dir="${example.dir}" includes="**/build.xml" />
|
<fileset dir="${example.dir}" includes="**/build.xml" />
|
||||||
</subant>
|
</subant>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-all" depends="clean, clean-lib, clean-examples" />
|
<target name="clean-all" depends="clean, clean-lib, clean-examples" />
|
||||||
|
|
||||||
<target name="/noresolve" description="use to skip dependency resolution">
|
<target name="/noresolve" description="use to skip dependency resolution">
|
||||||
<property name="no.resolve" value="true" />
|
<property name="no.resolve" value="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="/notest" description="use to skip tests">
|
<target name="/notest" description="use to skip tests">
|
||||||
<property name="skip.test" value="true" />
|
<property name="skip.test" value="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="/nojavadoc" description="use to skip javadoc">
|
<target name="/nojavadoc" description="use to skip javadoc">
|
||||||
<property name="skip.javadoc" value="true" />
|
<property name="skip.javadoc" value="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="/localivy" description="use a local ivy home">
|
<target name="/localivy" description="use a local ivy home">
|
||||||
<property name="ivy.use.local.home" value="true" />
|
<property name="ivy.use.local.home" value="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="/offline" depends="/noresolve" description="use to indicate no internet connection is available">
|
<target name="/offline" depends="/noresolve" description="use to indicate no internet connection is available">
|
||||||
<property name="offline" value="true" />
|
<property name="offline" value="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="default-version">
|
<target name="default-version">
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="pubdate" pattern="yyyyMMddHHmmss" />
|
<format property="pubdate" pattern="yyyyMMddHHmmss" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
<property name="version.prefix" value="${target.ivy.version}-local-" />
|
<property name="version.prefix" value="${target.ivy.version}-local-" />
|
||||||
|
|
@ -187,7 +187,7 @@
|
||||||
<target name="compile-core" depends="prepare">
|
<target name="compile-core" depends="prepare">
|
||||||
<javac srcdir="${src.dir}"
|
<javac srcdir="${src.dir}"
|
||||||
destdir="${core.classes.build.dir}"
|
destdir="${core.classes.build.dir}"
|
||||||
sourcepath=""
|
sourcepath=""
|
||||||
source="${ivy.minimum.javaversion}"
|
source="${ivy.minimum.javaversion}"
|
||||||
target="${ivy.minimum.javaversion}"
|
target="${ivy.minimum.javaversion}"
|
||||||
debug="${debug.mode}"
|
debug="${debug.mode}"
|
||||||
|
|
@ -202,7 +202,7 @@
|
||||||
<excludesfile name="optional.patterns" />
|
<excludesfile name="optional.patterns" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- copy settings files for backward compatibility with ivyconf naming -->
|
<!-- copy settings files for backward compatibility with ivyconf naming -->
|
||||||
<copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-local.xml"
|
<copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-local.xml"
|
||||||
tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-local.xml" />
|
tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-local.xml" />
|
||||||
|
|
@ -218,11 +218,11 @@
|
||||||
tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf.xml" />
|
tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf.xml" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Build the Ant tasks with the current Ant runtime -->
|
<!-- Build the Ant tasks with the current Ant runtime -->
|
||||||
<target name="compile-bootstrap" depends="compile-core">
|
<target name="compile-bootstrap" depends="compile-core">
|
||||||
<javac srcdir="${src.dir}"
|
<javac srcdir="${src.dir}"
|
||||||
destdir="${bootstrap.classes.build.dir}"
|
destdir="${bootstrap.classes.build.dir}"
|
||||||
sourcepath=""
|
sourcepath=""
|
||||||
classpathref="build.bootstrap.classpath"
|
classpathref="build.bootstrap.classpath"
|
||||||
source="${ivy.minimum.javaversion}"
|
source="${ivy.minimum.javaversion}"
|
||||||
target="${ivy.minimum.javaversion}"
|
target="${ivy.minimum.javaversion}"
|
||||||
|
|
@ -237,12 +237,12 @@
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Build the Ant tasks with the minimal Ant runtime -->
|
<!-- Build the Ant tasks with the minimal Ant runtime -->
|
||||||
<target name="compile-ant" depends="compile-core, resolve">
|
<target name="compile-ant" depends="compile-core, resolve">
|
||||||
<javac srcdir="${src.dir}"
|
<javac srcdir="${src.dir}"
|
||||||
destdir="${ant.classes.build.dir}"
|
destdir="${ant.classes.build.dir}"
|
||||||
sourcepath=""
|
sourcepath=""
|
||||||
classpathref="build.ant.classpath"
|
classpathref="build.ant.classpath"
|
||||||
source="${ivy.minimum.javaversion}"
|
source="${ivy.minimum.javaversion}"
|
||||||
target="${ivy.minimum.javaversion}"
|
target="${ivy.minimum.javaversion}"
|
||||||
|
|
@ -256,16 +256,16 @@
|
||||||
<exclude name="**/*.java" />
|
<exclude name="**/*.java" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- copy antlib for backward compatibility with fr.jayasoft.ivy package -->
|
<!-- copy antlib for backward compatibility with fr.jayasoft.ivy package -->
|
||||||
<copy file="${ant.classes.build.dir}/org/apache/ivy/ant/antlib.xml"
|
<copy file="${ant.classes.build.dir}/org/apache/ivy/ant/antlib.xml"
|
||||||
todir="${ant.classes.build.dir}/fr/jayasoft/ivy/ant" />
|
todir="${ant.classes.build.dir}/fr/jayasoft/ivy/ant" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="compile-optional" depends="compile-ant, resolve">
|
<target name="compile-optional" depends="compile-ant, resolve">
|
||||||
<javac srcdir="${src.dir}"
|
<javac srcdir="${src.dir}"
|
||||||
destdir="${optional.classes.build.dir}"
|
destdir="${optional.classes.build.dir}"
|
||||||
sourcepath=""
|
sourcepath=""
|
||||||
classpathref="build.optional.classpath"
|
classpathref="build.optional.classpath"
|
||||||
source="${ivy.minimum.javaversion}"
|
source="${ivy.minimum.javaversion}"
|
||||||
target="${ivy.minimum.javaversion}"
|
target="${ivy.minimum.javaversion}"
|
||||||
|
|
@ -290,18 +290,18 @@
|
||||||
<echo message="version=${build.version}${line.separator}" file="${core.classes.build.dir}/module.properties" append="true" />
|
<echo message="version=${build.version}${line.separator}" file="${core.classes.build.dir}/module.properties" append="true" />
|
||||||
<echo message="date=${pubdate}${line.separator}" file="${core.classes.build.dir}/module.properties" append="true" />
|
<echo message="date=${pubdate}${line.separator}" file="${core.classes.build.dir}/module.properties" append="true" />
|
||||||
|
|
||||||
<mkdir dir="${artifacts.build.dir}/jars/"/>
|
<mkdir dir="${artifacts.build.dir}/jars/"/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
there is a default Bundle-Version attribute in the source MANIFEST, used to ease
|
there is a default Bundle-Version attribute in the source MANIFEST, used to ease
|
||||||
development in eclipse.
|
development in eclipse.
|
||||||
We remove this line to make sure we get the Bundle-Version as set in the jar task
|
We remove this line to make sure we get the Bundle-Version as set in the jar task
|
||||||
-->
|
-->
|
||||||
<copy file="${basedir}/META-INF/MANIFEST.MF" tofile="${artifacts.build.dir}/MANIFEST.MF">
|
<copy file="${basedir}/META-INF/MANIFEST.MF" tofile="${artifacts.build.dir}/MANIFEST.MF">
|
||||||
<filterchain>
|
<filterchain>
|
||||||
<replaceregex pattern="Bundle-Version:.*" replace="Bundle-Version: ${bundle.version}" byline="true" />
|
<replaceregex pattern="Bundle-Version:.*" replace="Bundle-Version: ${bundle.version}" byline="true" />
|
||||||
</filterchain>
|
</filterchain>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<copy todir="${all.classes.build.dir}">
|
<copy todir="${all.classes.build.dir}">
|
||||||
<fileset dir="${core.classes.build.dir}" />
|
<fileset dir="${core.classes.build.dir}" />
|
||||||
|
|
@ -325,24 +325,24 @@
|
||||||
</manifest>
|
</manifest>
|
||||||
<fileset dir="${all.classes.build.dir}" />
|
<fileset dir="${all.classes.build.dir}" />
|
||||||
</jar>
|
</jar>
|
||||||
<!-- copy main jar to ease its use as an OSGi bundle -->
|
<!-- copy main jar to ease its use as an OSGi bundle -->
|
||||||
<copy file="${artifacts.build.dir}/jars/${final.name}"
|
<copy file="${artifacts.build.dir}/jars/${final.name}"
|
||||||
tofile="${artifacts.build.dir}/org.apache.ivy_${bundle.version}.jar" />
|
tofile="${artifacts.build.dir}/org.apache.ivy_${bundle.version}.jar" />
|
||||||
|
|
||||||
<!-- clean generated module properties file -->
|
<!-- clean generated module properties file -->
|
||||||
<delete file="${core.classes.build.dir}/module.properties" />
|
<delete file="${core.classes.build.dir}/module.properties" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- =================================================================
|
<!-- =================================================================
|
||||||
PUBLISH LOCAL
|
PUBLISH LOCAL
|
||||||
================================================================= -->
|
================================================================= -->
|
||||||
<target name="publish-local" depends="jar,sources" description="publishes Ivy to Ivy local repository">
|
<target name="publish-local" depends="jar,sources" description="publishes Ivy to Ivy local repository">
|
||||||
<ivy:publish resolver="local" pubrevision="${build.version}"
|
<ivy:publish resolver="local" pubrevision="${build.version}"
|
||||||
artifactsPattern="${artifacts.build.dir}/[type]s/[artifact].[ext]"
|
artifactsPattern="${artifacts.build.dir}/[type]s/[artifact].[ext]"
|
||||||
forcedeliver="true" />
|
forcedeliver="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- =================================================================
|
<!-- =================================================================
|
||||||
TESTS
|
TESTS
|
||||||
================================================================= -->
|
================================================================= -->
|
||||||
<target name="build-custom-resolver-jar" depends="jar">
|
<target name="build-custom-resolver-jar" depends="jar">
|
||||||
|
|
@ -365,23 +365,23 @@
|
||||||
<not><contains text="remote.test" /></not>
|
<not><contains text="remote.test" /></not>
|
||||||
</fileset>
|
</fileset>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init-tests-online" unless="offline">
|
<target name="init-tests-online" unless="offline">
|
||||||
<fileset id="test.fileset" dir="${test.dir}">
|
<fileset id="test.fileset" dir="${test.dir}">
|
||||||
<include name="**/${test.class.pattern}.java" />
|
<include name="**/${test.class.pattern}.java" />
|
||||||
<exclude name="**/Abstract*Test.java" />
|
<exclude name="**/Abstract*Test.java" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init-tests" depends="init-tests-offline, init-tests-online" />
|
<target name="init-tests" depends="init-tests-offline, init-tests-online" />
|
||||||
|
|
||||||
<target name="emma" depends="jar" unless="skip.test">
|
<target name="emma" depends="jar" unless="skip.test">
|
||||||
<ivy:cachepath organisation="emma" module="emma" revision="2.0.5312"
|
<ivy:cachepath organisation="emma" module="emma" revision="2.0.5312"
|
||||||
inline="true" conf="default" pathid="emma.classpath"
|
inline="true" conf="default" pathid="emma.classpath"
|
||||||
log="download-only" />
|
log="download-only" />
|
||||||
<ivy:cachepath organisation="emma" module="emma_ant" revision="2.0.5312"
|
<ivy:cachepath organisation="emma" module="emma_ant" revision="2.0.5312"
|
||||||
inline="true" conf="default" pathid="emma.ant.classpath" transitive="false"
|
inline="true" conf="default" pathid="emma.ant.classpath" transitive="false"
|
||||||
log="download-only" />
|
log="download-only" />
|
||||||
<taskdef resource="emma_ant.properties">
|
<taskdef resource="emma_ant.properties">
|
||||||
<classpath refid="emma.classpath" />
|
<classpath refid="emma.classpath" />
|
||||||
<classpath refid="emma.ant.classpath" />
|
<classpath refid="emma.ant.classpath" />
|
||||||
|
|
@ -403,14 +403,14 @@
|
||||||
</instr>
|
</instr>
|
||||||
</emma>
|
</emma>
|
||||||
<delete file="${coverage.dir}/coverage.emma" />
|
<delete file="${coverage.dir}/coverage.emma" />
|
||||||
<!-- add emma path to test path, because emma jars need to be available when running
|
<!-- add emma path to test path, because emma jars need to be available when running
|
||||||
instrumented classes -->
|
instrumented classes -->
|
||||||
<ivy:addpath topath="test.classpath" first="true">
|
<ivy:addpath topath="test.classpath" first="true">
|
||||||
<pathelement location="${coverage.dir}/classes" />
|
<pathelement location="${coverage.dir}/classes" />
|
||||||
<path refid="emma.classpath" />
|
<path refid="emma.classpath" />
|
||||||
</ivy:addpath>
|
</ivy:addpath>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build-test" depends="jar">
|
<target name="build-test" depends="jar">
|
||||||
<javac srcdir="${test.dir}"
|
<javac srcdir="${test.dir}"
|
||||||
destdir="${test.build.dir}"
|
destdir="${test.build.dir}"
|
||||||
|
|
@ -427,12 +427,12 @@
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="prepare-osgi-tests" depends="resolve" unless="skip.test">
|
<target name="prepare-osgi-tests" depends="resolve" unless="skip.test">
|
||||||
<ant dir="${basedir}/test/test-repo" target="generate-bundles" />
|
<ant dir="${basedir}/test/test-repo" target="generate-bundles" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="prepare-test-jar-repositories" unless="skip.test">
|
<target name="prepare-test-jar-repositories" unless="skip.test">
|
||||||
<mkdir dir="${basedir}/test/jar-repos" />
|
<mkdir dir="${basedir}/test/jar-repos" />
|
||||||
<jar destfile="${basedir}/test/jar-repos/jarrepo1.jar" >
|
<jar destfile="${basedir}/test/jar-repos/jarrepo1.jar" >
|
||||||
<fileset dir="${basedir}/test/repositories/1" />
|
<fileset dir="${basedir}/test/repositories/1" />
|
||||||
</jar>
|
</jar>
|
||||||
|
|
@ -441,10 +441,10 @@
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test-internal" depends="build-test, init-tests, prepare-osgi-tests, prepare-test-jar-repositories" unless="skip.test">
|
<target name="test-internal" depends="build-test, init-tests, prepare-osgi-tests, prepare-test-jar-repositories" unless="skip.test">
|
||||||
<mkdir dir="${test.xml.dir}" />
|
<mkdir dir="${test.xml.dir}" />
|
||||||
|
|
||||||
<junit
|
<junit
|
||||||
haltonfailure="off"
|
haltonfailure="off"
|
||||||
haltonerror="off"
|
haltonerror="off"
|
||||||
errorproperty="test.failed"
|
errorproperty="test.failed"
|
||||||
|
|
@ -459,30 +459,40 @@
|
||||||
<pathelement path="${ant.home}/lib/ant-nodeps.jar"/>
|
<pathelement path="${ant.home}/lib/ant-nodeps.jar"/>
|
||||||
<pathelement path="${ant.home}/lib/ant-trax.jar"/>
|
<pathelement path="${ant.home}/lib/ant-trax.jar"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
||||||
<!-- pass the proxy properties to the forked junit process to use correct proxy -->
|
<!-- pass the proxy properties to the forked junit process to use correct proxy -->
|
||||||
<syspropertyset>
|
<syspropertyset>
|
||||||
<propertyref prefix="http" />
|
<propertyref prefix="http" />
|
||||||
</syspropertyset>
|
</syspropertyset>
|
||||||
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" />
|
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" />
|
||||||
<jvmarg value="-Demma.coverage.out.merge=true" />
|
<jvmarg value="-Demma.coverage.out.merge=true" />
|
||||||
|
|
||||||
<!-- Added this to test IVY-65 -->
|
<!-- Added this to test IVY-65 -->
|
||||||
<jvmarg value="-Duser.region=TR" />
|
<jvmarg value="-Duser.region=TR" />
|
||||||
<jvmarg value="-Duser.language=tr" />
|
<jvmarg value="-Duser.language=tr" />
|
||||||
|
|
||||||
<formatter type="xml"/>
|
<formatter type="xml"/>
|
||||||
<batchtest todir="${test.xml.dir}">
|
<batchtest todir="${test.xml.dir}">
|
||||||
<fileset refid="test.fileset" />
|
<fileset refid="test.fileset" />
|
||||||
</batchtest>
|
</batchtest>
|
||||||
</junit>
|
</junit>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="x" depends="init,build-test">
|
||||||
|
<java classname="org.apache.ivy.plugins.resolver.FileSystemResolverTest">
|
||||||
|
<classpath>
|
||||||
|
<path refid="test.classpath" />
|
||||||
|
<pathelement path="${ant.home}/lib/ant-nodeps.jar"/>
|
||||||
|
<pathelement path="${ant.home}/lib/ant-trax.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="test" depends="test-internal" description="Run the test">
|
<target name="test" depends="test-internal" description="Run the test">
|
||||||
<fail if="test.failed"
|
<fail if="test.failed"
|
||||||
message="At least one test has failed. See logs (in ${test.xml.dir}) for details (use the target test-report to run the test with a report)" />
|
message="At least one test has failed. See logs (in ${test.xml.dir}) for details (use the target test-report to run the test with a report)" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- =================================================================
|
<!-- =================================================================
|
||||||
REPORTS AND DOCUMENTATION
|
REPORTS AND DOCUMENTATION
|
||||||
================================================================= -->
|
================================================================= -->
|
||||||
|
|
@ -496,7 +506,7 @@
|
||||||
<fail if="test.failed"
|
<fail if="test.failed"
|
||||||
message="At least one test has failed. See logs (in ${test.xml.dir}) or report (in ${test.report.dir})" />
|
message="At least one test has failed. See logs (in ${test.xml.dir}) or report (in ${test.report.dir})" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="coverage-report" depends="emma, test-report" unless="skip.test"
|
<target name="coverage-report" depends="emma, test-report" unless="skip.test"
|
||||||
description="run tests with instrumentation and generate coverage report">
|
description="run tests with instrumentation and generate coverage report">
|
||||||
<mkdir dir="${coverage.report.dir}" />
|
<mkdir dir="${coverage.report.dir}" />
|
||||||
|
|
@ -511,19 +521,19 @@
|
||||||
</report>
|
</report>
|
||||||
</emma>
|
</emma>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="ivy-report" depends="resolve">
|
<target name="ivy-report" depends="resolve">
|
||||||
<ivy:report todir="${ivy.report.dir}"/>
|
<ivy:report todir="${ivy.report.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="javadoc" unless="skip.javadoc">
|
<target name="javadoc" unless="skip.javadoc">
|
||||||
<javadoc destdir="${javadoc.build.dir}" useexternalfile="true">
|
<javadoc destdir="${javadoc.build.dir}" useexternalfile="true">
|
||||||
<fileset dir="${src.dir}" includes="**/*.java" />
|
<fileset dir="${src.dir}" includes="**/*.java" />
|
||||||
</javadoc>
|
</javadoc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="sources" depends="default-version" description="Create source archive files">
|
<target name="sources" depends="default-version" description="Create source archive files">
|
||||||
<mkdir dir="${artifacts.build.dir}/sources/"/>
|
<mkdir dir="${artifacts.build.dir}/sources/"/>
|
||||||
<jar destfile="${artifacts.build.dir}/sources/${final.name}">
|
<jar destfile="${artifacts.build.dir}/sources/${final.name}">
|
||||||
<metainf dir="${basedir}" includes="LICENSE,NOTICE" />
|
<metainf dir="${basedir}" includes="LICENSE,NOTICE" />
|
||||||
<manifest>
|
<manifest>
|
||||||
|
|
@ -533,21 +543,21 @@
|
||||||
</manifest>
|
</manifest>
|
||||||
<fileset dir="${src.dir}" />
|
<fileset dir="${src.dir}" />
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="fixcrlf">
|
<target name="fixcrlf">
|
||||||
<property name="eol.native.includes"
|
<property name="eol.native.includes"
|
||||||
value="**/*.html,**/*.json,**/*.java,**/*.xml,**/*.txt,**/*.MF,**/*.properties,**/*.patterns,**/*.pom,**/*.xsl,**/*.css" />
|
value="**/*.html,**/*.json,**/*.java,**/*.xml,**/*.txt,**/*.MF,**/*.properties,**/*.patterns,**/*.pom,**/*.xsl,**/*.css" />
|
||||||
<property name="eol.native.excludes"
|
<property name="eol.native.excludes"
|
||||||
value="build/**,bin/**,lib/**" />
|
value="build/**,bin/**,lib/**" />
|
||||||
|
|
||||||
<fileset id="eol.native.fileset"
|
<fileset id="eol.native.fileset"
|
||||||
dir="${basedir}"
|
dir="${basedir}"
|
||||||
includes="${eol.native.includes}"
|
includes="${eol.native.includes}"
|
||||||
excludes="${eol.native.excludes}" />
|
excludes="${eol.native.excludes}" />
|
||||||
|
|
||||||
<fixcrlf srcdir="${basedir}"
|
<fixcrlf srcdir="${basedir}"
|
||||||
includes="${eol.native.includes}"
|
includes="${eol.native.includes}"
|
||||||
excludes="${eol.native.excludes}" />
|
excludes="${eol.native.excludes}" />
|
||||||
<apply executable="svn">
|
<apply executable="svn">
|
||||||
<fileset refid="eol.native.fileset" />
|
<fileset refid="eol.native.fileset" />
|
||||||
|
|
@ -556,20 +566,20 @@
|
||||||
<arg value='"native"' />
|
<arg value='"native"' />
|
||||||
</apply>
|
</apply>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config -->
|
<!-- Checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config -->
|
||||||
<target name="checkstyle-internal" depends="jar">
|
<target name="checkstyle-internal" depends="jar">
|
||||||
<ivy:cachepath organisation="checkstyle" module="checkstyle" revision="5.0"
|
<ivy:cachepath organisation="checkstyle" module="checkstyle" revision="5.0"
|
||||||
inline="true" conf="default" pathid="checkstyle.classpath" transitive="true"
|
inline="true" conf="default" pathid="checkstyle.classpath" transitive="true"
|
||||||
log="download-only"/>
|
log="download-only"/>
|
||||||
<taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath" />
|
<taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath" />
|
||||||
|
|
||||||
<mkdir dir="${checkstyle.report.dir}" />
|
<mkdir dir="${checkstyle.report.dir}" />
|
||||||
<checkstyle config="${checkstyle.src.dir}/checkstyle-config"
|
<checkstyle config="${checkstyle.src.dir}/checkstyle-config"
|
||||||
failOnViolation="false" failureProperty="checkstyle.failed">
|
failOnViolation="false" failureProperty="checkstyle.failed">
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="run.classpath" />
|
<path refid="run.classpath" />
|
||||||
</classpath>
|
</classpath>
|
||||||
<formatter type="xml" toFile="${checkstyle.report.dir}/checkstyle.xml" />
|
<formatter type="xml" toFile="${checkstyle.report.dir}/checkstyle.xml" />
|
||||||
<fileset dir="${src.dir}">
|
<fileset dir="${src.dir}">
|
||||||
<include name="**/*.java" />
|
<include name="**/*.java" />
|
||||||
|
|
@ -578,11 +588,11 @@
|
||||||
<include name="**/*.java" />
|
<include name="**/*.java" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</checkstyle>
|
</checkstyle>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="checkstyle" depends="checkstyle-internal" description="checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config">
|
<target name="checkstyle" depends="checkstyle-internal" description="checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config">
|
||||||
<fail if="checkstyle.failed"
|
<fail if="checkstyle.failed"
|
||||||
message="Checkstyle has errors. See report in ${checkstyle.report.dir}" />
|
message="Checkstyle has errors. See report in ${checkstyle.report.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="checkstyle-report" depends="checkstyle-internal">
|
<target name="checkstyle-report" depends="checkstyle-internal">
|
||||||
|
|
@ -596,37 +606,40 @@
|
||||||
|
|
||||||
<target name="init-findbugs" unless="findbugs.home">
|
<target name="init-findbugs" unless="findbugs.home">
|
||||||
<!-- Findbugs: Getting Findbugs -->
|
<!-- Findbugs: Getting Findbugs -->
|
||||||
<property name="findbugs.download.name"
|
<property name="findbugs.version"
|
||||||
value="findbugs-1.3.5"
|
value="1.3.5"
|
||||||
|
description="Version of Findbugs to use"/>
|
||||||
|
<property name="findbugs.download.name"
|
||||||
|
value="findbugs-${findbugs.version}"
|
||||||
description="Name of the download file without suffix. Also the internal root directory of the ZIP."/>
|
description="Name of the download file without suffix. Also the internal root directory of the ZIP."/>
|
||||||
<property name="findbugs.download.file"
|
<property name="findbugs.download.file"
|
||||||
value="${findbugs.download.name}.zip"
|
value="${findbugs.download.name}.zip"
|
||||||
description="The filename of the ZIP."/>
|
description="The filename of the ZIP."/>
|
||||||
<property name="findbugs.download.url"
|
<property name="findbugs.download.url"
|
||||||
value="http://garr.dl.sourceforge.net/sourceforge/findbugs/${findbugs.download.file}"
|
value="https://jaist.dl.sourceforge.net/project/findbugs/findbugs/${findbugs.version}/${findbugs.download.file}"
|
||||||
description="The download adress at a mirror of Sourceforge."/>
|
description="The download adress at a mirror of Sourceforge."/>
|
||||||
<property name="findbugs.download.to"
|
<property name="findbugs.download.to"
|
||||||
value="${build.dir}/.downloads"
|
value="${build.dir}/.downloads"
|
||||||
description="Where to store the download and 'install' Findbugs."/>
|
description="Where to store the download and 'install' Findbugs."/>
|
||||||
<available
|
<available
|
||||||
property="findbugs.home"
|
property="findbugs.home"
|
||||||
value="${findbugs.download.to}/${findbugs.download.name}"
|
value="${findbugs.download.to}/${findbugs.download.name}"
|
||||||
file="${findbugs.download.to}/${findbugs.download.name}/lib/findbugs.jar"
|
file="${findbugs.download.to}/${findbugs.download.name}/lib/findbugs.jar"
|
||||||
description="Check if Findbugs is already installed."
|
description="Check if Findbugs is already installed."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Findbugs: Running Findbugs -->
|
<!-- Findbugs: Running Findbugs -->
|
||||||
<property name="findbugs.reportdir"
|
<property name="findbugs.reportdir"
|
||||||
location="${reports.dir}/findbugs"
|
location="${reports.dir}/findbugs"
|
||||||
description="Where to store Findbugs results"/>
|
description="Where to store Findbugs results"/>
|
||||||
<property name="findbugs.raw"
|
<property name="findbugs.raw"
|
||||||
value="raw.xml"
|
value="raw.xml"
|
||||||
description="Findbugs Output xml-file"/>
|
description="Findbugs Output xml-file"/>
|
||||||
<property name="findbugs.xsl"
|
<property name="findbugs.xsl"
|
||||||
value="fancy.xsl"
|
value="fancy.xsl"
|
||||||
description="Which XSL to use for generating Output: default, fancy, plain, summary"/>
|
description="Which XSL to use for generating Output: default, fancy, plain, summary"/>
|
||||||
<property name="findbugs.jvmargs"
|
<property name="findbugs.jvmargs"
|
||||||
value="-Xms128m -Xmx512m"
|
value="-Xms128m -Xmx512m"
|
||||||
description="JVMArgs for invoking Findbugs"/>
|
description="JVMArgs for invoking Findbugs"/>
|
||||||
|
|
||||||
<mkdir dir="${findbugs.download.to}"/>
|
<mkdir dir="${findbugs.download.to}"/>
|
||||||
|
|
@ -635,15 +648,15 @@
|
||||||
<property name="findbugs.home" location="${findbugs.download.to}/${findbugs.download.name}"/>
|
<property name="findbugs.home" location="${findbugs.download.to}/${findbugs.download.name}"/>
|
||||||
<mkdir dir="${findbugs.home}/plugin"/>
|
<mkdir dir="${findbugs.home}/plugin"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="findbugs" description="checks Ivy codebase with Findbugs" depends="init-findbugs,compile-core" xmlns:fb="http://findbugs.sourceforge.net/">
|
<target name="findbugs" description="checks Ivy codebase with Findbugs" depends="init-findbugs,compile-core" xmlns:fb="http://findbugs.sourceforge.net/">
|
||||||
<path id="findbugs.real.classpath">
|
<path id="findbugs.real.classpath">
|
||||||
<fileset dir="${findbugs.home}/lib" includes="*.jar"/>
|
<fileset dir="${findbugs.home}/lib" includes="*.jar"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- Load the Findbugs AntTasks -->
|
<!-- Load the Findbugs AntTasks -->
|
||||||
<taskdef uri="http://findbugs.sourceforge.net/" resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpathref="findbugs.real.classpath" />
|
<taskdef uri="http://findbugs.sourceforge.net/" resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpathref="findbugs.real.classpath" />
|
||||||
|
|
||||||
<!-- Start Findbugs -->
|
<!-- Start Findbugs -->
|
||||||
<mkdir dir="${findbugs.reportdir}"/>
|
<mkdir dir="${findbugs.reportdir}"/>
|
||||||
<fb:findbugs home="${findbugs.home}"
|
<fb:findbugs home="${findbugs.home}"
|
||||||
|
|
@ -655,27 +668,27 @@
|
||||||
<class location="${core.classes.build.dir}" />
|
<class location="${core.classes.build.dir}" />
|
||||||
<sourcePath path="${src.dir}" />
|
<sourcePath path="${src.dir}" />
|
||||||
</fb:findbugs>
|
</fb:findbugs>
|
||||||
|
|
||||||
<!-- Generate (human) readable output -->
|
<!-- Generate (human) readable output -->
|
||||||
<xslt basedir="${findbugs.reportdir}" includes="${findbugs.raw}" destdir="${findbugs.reportdir}">
|
<xslt basedir="${findbugs.reportdir}" includes="${findbugs.raw}" destdir="${findbugs.reportdir}">
|
||||||
<style>
|
<style>
|
||||||
<javaresource name="${findbugs.xsl}" classpathref="findbugs.real.classpath"/>
|
<javaresource name="${findbugs.xsl}" classpathref="findbugs.real.classpath"/>
|
||||||
</style>
|
</style>
|
||||||
</xslt>
|
</xslt>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- =================================================================
|
<!-- =================================================================
|
||||||
IDE SPECIFIC
|
IDE SPECIFIC
|
||||||
================================================================= -->
|
================================================================= -->
|
||||||
<available file="${basedir}/.classpath" property="eclipse.classpath.exists" />
|
<available file="${basedir}/.classpath" property="eclipse.classpath.exists" />
|
||||||
<target name="check-eclipse-classpath-overwrite" if="eclipse.classpath.exists">
|
<target name="check-eclipse-classpath-overwrite" if="eclipse.classpath.exists">
|
||||||
<input message=".classpath file already exists.${line.separator}Are you sure you want to overwrite it and loose your original file?"
|
<input message=".classpath file already exists.${line.separator}Are you sure you want to overwrite it and loose your original file?"
|
||||||
validargs="Y,N,y,n" addproperty="eclipse.classpath.confirm" />
|
validargs="Y,N,y,n" addproperty="eclipse.classpath.confirm" />
|
||||||
<condition property="eclipse.classpath.abort">
|
<condition property="eclipse.classpath.abort">
|
||||||
<equals arg1="${eclipse.classpath.confirm}" arg2="N" casesensitive="false" />
|
<equals arg1="${eclipse.classpath.confirm}" arg2="N" casesensitive="false" />
|
||||||
</condition>
|
</condition>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="eclipse-default" depends="resolve, check-eclipse-classpath-overwrite"
|
<target name="eclipse-default" depends="resolve, check-eclipse-classpath-overwrite"
|
||||||
unless="eclipse.classpath.abort"
|
unless="eclipse.classpath.abort"
|
||||||
description="creates a default .classpath for eclipse, using jars resolved by this ant build">
|
description="creates a default .classpath for eclipse, using jars resolved by this ant build">
|
||||||
|
|
|
||||||
30
doap_Ivy.rdf
30
doap_Ivy.rdf
|
|
@ -34,13 +34,41 @@
|
||||||
<download-page rdf:resource="http://ant.apache.org/ivy/download.cgi" />
|
<download-page rdf:resource="http://ant.apache.org/ivy/download.cgi" />
|
||||||
<programming-language>Java</programming-language>
|
<programming-language>Java</programming-language>
|
||||||
<category rdf:resource="http://projects.apache.org/category/build-management" />
|
<category rdf:resource="http://projects.apache.org/category/build-management" />
|
||||||
|
<release>
|
||||||
|
<Version>
|
||||||
|
<name>Apache Ivy 2.4.0</name>
|
||||||
|
<created>2014-12-26</created>
|
||||||
|
<revision>2.4.0</revision>
|
||||||
|
</Version>
|
||||||
|
</release>
|
||||||
<release>
|
<release>
|
||||||
<Version>
|
<Version>
|
||||||
<name>Apache Ivy 2.3.0</name>
|
<name>Apache Ivy 2.3.0</name>
|
||||||
<created>2013-01-20</created>
|
<created>2013-01-24</created>
|
||||||
<revision>2.3.0</revision>
|
<revision>2.3.0</revision>
|
||||||
</Version>
|
</Version>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<Version>
|
||||||
|
<name>Apache Ivy 2.2.0</name>
|
||||||
|
<created>2010-10-07</created>
|
||||||
|
<revision>2.2.0</revision>
|
||||||
|
</Version>
|
||||||
|
</release>
|
||||||
|
<release>
|
||||||
|
<Version>
|
||||||
|
<name>Apache Ivy 2.1.0</name>
|
||||||
|
<created>2009-10-13</created>
|
||||||
|
<revision>2.1.0</revision>
|
||||||
|
</Version>
|
||||||
|
</release>
|
||||||
|
<release>
|
||||||
|
<Version>
|
||||||
|
<name>Apache Ivy 2.0.0</name>
|
||||||
|
<created>2009-01-22</created>
|
||||||
|
<revision>2.0.0</revision>
|
||||||
|
</Version>
|
||||||
|
</release>
|
||||||
<repository>
|
<repository>
|
||||||
<GitRepository>
|
<GitRepository>
|
||||||
<location rdf:resource="https://git-wip-us.apache.org/repos/asf/ant-ivy.git"/>
|
<location rdf:resource="https://git-wip-us.apache.org/repos/asf/ant-ivy.git"/>
|
||||||
|
|
|
||||||
|
|
@ -200,20 +200,27 @@ If you don't want to use xml namespaces, it's possible but you will need to disa
|
||||||
<span class="since">since 1.4</span>
|
<span class="since">since 1.4</span>
|
||||||
Ivy allows the use of checksums, also known as digests, to verify the correctness of a downloaded file.
|
Ivy allows the use of checksums, also known as digests, to verify the correctness of a downloaded file.
|
||||||
|
|
||||||
For the moment Ivy supports the md5 and sha1 algorithms.
|
The configuration of using the algorithm can be done globally or by dependency resolver.
|
||||||
|
Globally, use the ivy.checksums variable to list the check to be done.
|
||||||
The configuration of using md5 and/or sha1 can be done globally or by dependency resolver.
|
|
||||||
Globally, use the ivy.checksums variable to list the check to be done (only md5 and sha1 are supported).
|
|
||||||
On each resolver you can use the checksums attribute to override the global setting.
|
On each resolver you can use the checksums attribute to override the global setting.
|
||||||
|
|
||||||
The setting is a comma separated list of checksum algorithms to use.
|
The setting is a comma separated list of checksum algorithms to use.
|
||||||
During checking (at download time), the first checksum found is checked, and that's all. This means that if you have a "sha1, md5" setting, then if ivy finds a sha1 file, it will compare the downloaded file sha1 against this sha1, and if the comparison is ok, it will assume the file is ok. If no sha1 file is found, it will look for an md5 file. If none is found no checking is done.
|
During checking (at download time), the first checksum found is checked, and that's all. This means that if you have a "SHA-256, sha1, md5" setting, then if ivy finds a SHA-256 file, it will compare the downloaded file SHA-256 against this SHA-256, and if the comparison is ok, it will assume the file is ok. If no SHA-256 file is found, it will look for an sha1 file. If that isn't found, then it checks for md5 and so on. If none is found no checking is done.
|
||||||
During publish, all listed checksum algorithms are computed and uploaded.
|
During publish, all listed checksum algorithms are computed and uploaded.
|
||||||
|
|
||||||
By default checksum algorithms are "sha1, md5".
|
By default checksum algorithms are "sha1, md5".
|
||||||
|
|
||||||
If you want to change this default, you can set the variable ivy.checksums. Hence, to disable checksum validation you just have to set ivy.checksums to "".
|
If you want to change this default, you can set the variable ivy.checksums. Hence, to disable checksum validation you just have to set ivy.checksums to "".
|
||||||
|
|
||||||
|
<h2>Supported algorithms</h2>
|
||||||
|
<span class="since">since 1.4</span>
|
||||||
|
<ul>
|
||||||
|
<li>md5</li>
|
||||||
|
<li>sha1</li>
|
||||||
|
</ul>
|
||||||
|
<span class="since">since 2.5</span>
|
||||||
|
Starting 2.5 version, in addition to md5 and sha1, Ivy supports SHA-256, SHA-512 and SHA-384 algorithms, if the Java runtime in which Ivy is running, supports those. For example, Java 6 runtime supports SHA-256 and SHA-512 as standard algorithms. If Ivy 2.5 and later versions are run under Java 6 or higher runtimes, these algorithms are supported by Ivy too.
|
||||||
|
|
||||||
<h1><a name="event">Events and Triggers</a></h1>
|
<h1><a name="event">Events and Triggers</a></h1>
|
||||||
<span class="since">since 1.4</span>
|
<span class="since">since 1.4</span>
|
||||||
When Ivy performs the dependency resolution and some other tasks, it fires events before and after the most important steps. You can listen to these events using Ivy API, or you can even register a trigger to perform a particular action when a particular event occur.
|
When Ivy performs the dependency resolution and some other tasks, it fires events before and after the most important steps. You can listen to these events using Ivy API, or you can even register a trigger to perform a particular action when a particular event occur.
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,9 @@ In Ivy 2.1.0 and earlier, if both defaultconf and defaultconfmapping are defined
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h1>Child elements</h1>
|
<h1>Child elements</h1>
|
||||||
|
|
||||||
|
Note: as specified by the ivy.xsd, the children elements are ordered; must come first the <tt><a href="../ivyfile/dependency.html">dependency</a></tt> elements, then the <tt><a href="../ivyfile/exclude.html">exclude</a></tt> elements, then the <tt><a href="../ivyfile/override.html">override</a></tt> elements, and then the <tt><a href="../ivyfile/conflict.html">conflict</a></tt> elements.
|
||||||
|
|
||||||
<table class="ivy-children">
|
<table class="ivy-children">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th class="ivy-chld">Element</th><th class="ivy-chld-desc">Description</th><th class="ivy-chld-card">Cardinality</th></tr>
|
<tr><th class="ivy-chld">Element</th><th class="ivy-chld-desc">Description</th><th class="ivy-chld-card">Cardinality</th></tr>
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
<div id="footer-message" class="footer">
|
<div id="footer-message" class="footer">
|
||||||
<hr />
|
<hr />
|
||||||
<i>Copyright © 2014 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
|
<i>Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
|
||||||
<i>Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.</i><br />
|
<i>Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.</i><br />
|
||||||
<i>All other marks mentioned may be trademarks or registered trademarks of their respective owners. </i>
|
<i>All other marks mentioned may be trademarks or registered trademarks of their respective owners. </i>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ reporting) project dependencies, characterized by flexibility,
|
||||||
configurability, and tight integration with Apache Ant.
|
configurability, and tight integration with Apache Ant.
|
||||||
|
|
||||||
Key features of this 2.5.0 release are
|
Key features of this 2.5.0 release are
|
||||||
|
* Ivy nows uses BoucyCastle 1.52. Due to the non backward compatibility of that library, earlier versions are not supported.
|
||||||
* TODO
|
* TODO
|
||||||
* TODO
|
* TODO
|
||||||
* TODO
|
* TODO
|
||||||
|
|
@ -57,7 +58,27 @@ http://issues.apache.org/jira/browse/ivy
|
||||||
|
|
||||||
List of changes since Ivy 2.4.0:
|
List of changes since Ivy 2.4.0:
|
||||||
|
|
||||||
|
- FIX: Made the maven 'test' configuration public so we can use the test-jar as dependency (IVY-1444)
|
||||||
|
- FIX: NullPointerException in dependencytree with no dependencies (IVY-1539)
|
||||||
|
- FIX: checkIfChanged is not settable attribute for checkdepsupdate ant task (IVY-1549)
|
||||||
- FIX: ArrayIndexOutOfBoundsException when using a p2 repository for dependencies (IVY-1504)
|
- FIX: ArrayIndexOutOfBoundsException when using a p2 repository for dependencies (IVY-1504)
|
||||||
|
- FIX: fixdeps remove transitive 'kept' dependencies
|
||||||
|
- FIX: PomModuleDescriptorParser should parse licenses from parent POM (IVY-1526) (Thanks to Jaikiran Pai)
|
||||||
|
- FIX: dynamic revisions are not cached per resolver (IVY-1430) (Thanks to Stephen Haberman)
|
||||||
|
- FIX: Dependencies failed using branch attribute (and extra attributes) (IVY-1141) (Thanks to Stephen Haberman)
|
||||||
|
- FIX: useCacheOnly should allow lookup of changing dependencies in cache (IVY-1515) (Thanks to Ilya)
|
||||||
|
- FIX: Translation of POM to Ivy XML with * exclusion is removing main artifact (IVY-1531) (Thanks to Jaikiran Pai)
|
||||||
|
- FIX: Have makepom task take description from ivy-module > info > description element (IVY-1520)
|
||||||
|
- FIX: Fix RetrieveEngine to take into account the correct extension while dealing with unpacked artifacts (IVY-1478) (Thanks to Jaikiran Pai)
|
||||||
|
- FIX: ParseException "Unsupported repository, resources names are not uris" for ivy.xml with parent on Windows (IVY-1448) (Thanks to Riccardo Foschia and Jaikiran Pai)
|
||||||
|
|
||||||
|
- IMPROVEMENT: Throw an IllegalStateException when retrieving the resolutionCacheRoot on the DefaultResolutionCacheManager if the basedir (or IvySettings) is not set (IVY-1482)
|
||||||
|
- IMPROVEMENT: Optimization: limit the revision numbers scanned if revision prefix is specified (Thanks to Ernestas Vaiciukevičius)
|
||||||
|
- IMPROVEMENT: Update bouncycastle to 1.52 (IVY-1521) (Thanks to Michal Srb)
|
||||||
|
|
||||||
|
- NEW: Lets ssh-based resolvers use an ~/.ssh/config file to find username/hostname/keyfile options (Thanks to Colin Stanfill)
|
||||||
|
- NEW: Add ivy.maven.lookup.sources and ivy.maven.lookup.javadoc variables to control the lookup of the additional artifacts. Defaults to true, for backward compatibility (IVY-1529)
|
||||||
|
- NEW: Add (conditional) support for SHA-256 SHA-512 and SHA-384 checksum algorithms (IVY-1554) (Thanks to Jaikiran Pai)
|
||||||
|
|
||||||
<!-- Samples :
|
<!-- Samples :
|
||||||
- NEW: bla bla bla (IVY-1234) (Thanks to Jane Doe)
|
- NEW: bla bla bla (IVY-1234) (Thanks to Jane Doe)
|
||||||
|
|
@ -115,6 +136,7 @@ Here is the list of people who have contributed source code and documentation up
|
||||||
<li>Robin Fernandes</li>
|
<li>Robin Fernandes</li>
|
||||||
<li>Gregory Fernandez</li>
|
<li>Gregory Fernandez</li>
|
||||||
<li>Danno Ferrin</li>
|
<li>Danno Ferrin</li>
|
||||||
|
<li>Riccardo Foschia</li>
|
||||||
<li>Benjamin Francisoud</li>
|
<li>Benjamin Francisoud</li>
|
||||||
<li>Wolfgang Frank</li>
|
<li>Wolfgang Frank</li>
|
||||||
<li>Jacob Grydholt Jensen</li>
|
<li>Jacob Grydholt Jensen</li>
|
||||||
|
|
@ -122,7 +144,7 @@ Here is the list of people who have contributed source code and documentation up
|
||||||
<li>Mitch Gitman</li>
|
<li>Mitch Gitman</li>
|
||||||
<li>Evgeny Goldin</li>
|
<li>Evgeny Goldin</li>
|
||||||
<li>Scott Goldstein</li>
|
<li>Scott Goldstein</li>
|
||||||
<li>Pierre Hägnestrand</li>
|
<li>Pierre Hägnestrand</li>
|
||||||
<li>Scott Hebert</li>
|
<li>Scott Hebert</li>
|
||||||
<li>Tobias Himstedt</li>
|
<li>Tobias Himstedt</li>
|
||||||
<li>Aaron Hachez</li>
|
<li>Aaron Hachez</li>
|
||||||
|
|
@ -132,6 +154,7 @@ Here is the list of people who have contributed source code and documentation up
|
||||||
<li>Scott Hebert</li>
|
<li>Scott Hebert</li>
|
||||||
<li>Payam Hekmat</li>
|
<li>Payam Hekmat</li>
|
||||||
<li>Achim Huegen</li>
|
<li>Achim Huegen</li>
|
||||||
|
<li>Ilya</li>
|
||||||
<li>Matt Inger</li>
|
<li>Matt Inger</li>
|
||||||
<li>Anders Jacobsson</li>
|
<li>Anders Jacobsson</li>
|
||||||
<li>Anders Janmyr</li>
|
<li>Anders Janmyr</li>
|
||||||
|
|
@ -167,6 +190,7 @@ Here is the list of people who have contributed source code and documentation up
|
||||||
<li>Mathias Muller</li>
|
<li>Mathias Muller</li>
|
||||||
<li>Randy Nott</li>
|
<li>Randy Nott</li>
|
||||||
<li>Peter Oxenham</li>
|
<li>Peter Oxenham</li>
|
||||||
|
<li>Jaikiran Pai</li>
|
||||||
<li>Douglas Palmer</li>
|
<li>Douglas Palmer</li>
|
||||||
<li>Jesper Pedersen</li>
|
<li>Jesper Pedersen</li>
|
||||||
<li>Emmanuel Pellereau</li>
|
<li>Emmanuel Pellereau</li>
|
||||||
|
|
@ -190,12 +214,15 @@ Here is the list of people who have contributed source code and documentation up
|
||||||
<li>John Shields</li>
|
<li>John Shields</li>
|
||||||
<li>Nihal Sinha</li>
|
<li>Nihal Sinha</li>
|
||||||
<li>Gene Smith</li>
|
<li>Gene Smith</li>
|
||||||
|
<li>Michal Srb</li>
|
||||||
|
<li>Colin Stanfill</li>
|
||||||
<li>Simon Steiner</li>
|
<li>Simon Steiner</li>
|
||||||
<li>Johan Stuyts</li>
|
<li>Johan Stuyts</li>
|
||||||
<li>John Tinetti</li>
|
<li>John Tinetti</li>
|
||||||
<li>Erwin Tratar</li>
|
<li>Erwin Tratar</li>
|
||||||
<li>Jason Trump</li>
|
<li>Jason Trump</li>
|
||||||
<li>David Turner</li>
|
<li>David Turner</li>
|
||||||
|
<li>Ernestas Vaiciukevičius</li>
|
||||||
<li>Tjeerd Verhagen</li>
|
<li>Tjeerd Verhagen</li>
|
||||||
<li>Richard Vowles</li>
|
<li>Richard Vowles</li>
|
||||||
<li>Sven Walter</li>
|
<li>Sven Walter</li>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td>subject</td><td>Bintray username of a repository owner.</td>
|
<tr><td>subject</td><td>Bintray username of a repository owner.</td>
|
||||||
<td>No, defaults to JCenter</td></tr>
|
<td>No, defaults to Bintray</td></tr>
|
||||||
<tr><td>repo</td><td>User's repository name.</td>
|
<tr><td>repo</td><td>User's repository name.</td>
|
||||||
<td>No, defaults to JCenter</td></tr>
|
<td>No, defaults to JCenter</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,14 @@ If your server supports ssh but not sftp, there is also an <a href="../resolver/
|
||||||
|
|
||||||
Note that sftp is also supported by vfs, so you can use a vfs resolver instead. The advantage of this resolver is that you have a better control over authentication, it can prompt for username/password credentials, or you can use private/public key authentication, which is not possible with the vfs resolver. When it prompts for username/password, it uses a Swing dialog, which is not possible in a headless environment. If you want to prompt for the credentials on the command line, use ant input task for example before calling ivy.
|
Note that sftp is also supported by vfs, so you can use a vfs resolver instead. The advantage of this resolver is that you have a better control over authentication, it can prompt for username/password credentials, or you can use private/public key authentication, which is not possible with the vfs resolver. When it prompts for username/password, it uses a Swing dialog, which is not possible in a headless environment. If you want to prompt for the credentials on the command line, use ant input task for example before calling ivy.
|
||||||
|
|
||||||
All necessary connection parameters can be set here via attributes.
|
All necessary connection parameters can be set here via attributes, or via an OpenSSH-style config file specified by sshConfig.
|
||||||
However all attributes defined in the pattern url of the resolver will have higher priority and will overwrite the values given here. To specify connection parameters in the pattern, you have to specify a full url and not just a path as pattern.
|
However all attributes defined in the pattern url of the resolver will have higher priority and will overwrite the values given here. To specify connection parameters in the pattern, you have to specify a full url and not just a path as pattern.
|
||||||
e.g. pattern="/path/to/my/repos/[artifact].[ext]" will use all connection parameters from this class
|
e.g. pattern="/path/to/my/repos/[artifact].[ext]" will use all connection parameters from this class
|
||||||
e.g. pattern="sftp://myserver.com/path/to/my/repos/[artifact].[ext]" will use all parameters from the attributes with the exception of the host, which will be "myserver.com"
|
e.g. pattern="sftp://myserver.com/path/to/my/repos/[artifact].[ext]" will use all parameters from the attributes with the exception of the host, which will be "myserver.com"
|
||||||
e.g. pattern="sftp://user:geheim@myserver.com:8022/path/to/my/repos/[artifact].[ext]" will use only the keyFile and keyFilePassword from the attributes (if needed). Rest will come from the url.
|
e.g. pattern="sftp://user:geheim@myserver.com:8022/path/to/my/repos/[artifact].[ext]" will use only the keyFile and keyFilePassword from the attributes (if needed). Rest will come from the url.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Note that the authentication features of this resolver are exactly the same as the ssh resolver. Choosing between the two is often a matter of server implementation. If your server supports sftp, usually it's preferrable.
|
Note that the authentication features of this resolver are exactly the same as the ssh resolver. Choosing between the two is often a matter of server implementation. If your server supports sftp, usually it's preferrable.
|
||||||
|
|
||||||
Internally this resolver relies on <a href="http://www.jcraft.com/jsch/">jsch</a> as ssh client, which is a popular java ssh client, used for example in eclipse.
|
Internally this resolver relies on <a href="http://www.jcraft.com/jsch/">jsch</a> as ssh client, which is a popular java ssh client, used for example in eclipse.
|
||||||
|
|
@ -67,6 +68,9 @@ This resolver shares the <a href="../settings/resolvers.html#common">common attr
|
||||||
<td>No, defaults to host given on the patterns, fail if none is set</td></tr>
|
<td>No, defaults to host given on the patterns, fail if none is set</td></tr>
|
||||||
<tr><td>port</td><td>The port to connect to</td>
|
<tr><td>port</td><td>The port to connect to</td>
|
||||||
<td>No, defaults to 22</td></tr>
|
<td>No, defaults to 22</td></tr>
|
||||||
|
<tr><td>sshConfig</td><td>Path to an OpenSSH-style config file containing additional
|
||||||
|
configuration</td>
|
||||||
|
<td>No</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h1>Child elements</h1>
|
<h1>Child elements</h1>
|
||||||
|
|
@ -115,6 +119,14 @@ Will connect to yourserver.com on port 8022 with user 'user' and password 'gehei
|
||||||
</code>
|
</code>
|
||||||
Will connect to yourserver.com on port 8022 with user 'user' and use keyFile path/to/key/file for keyFile and the value of password variable for keyFilePassword authentication for ivy files, and to myserver.com on port 8022 using user 'user' with the same keyFile/keyFilePassword pair for the artifacts.
|
Will connect to yourserver.com on port 8022 with user 'user' and use keyFile path/to/key/file for keyFile and the value of password variable for keyFilePassword authentication for ivy files, and to myserver.com on port 8022 using user 'user' with the same keyFile/keyFilePassword pair for the artifacts.
|
||||||
|
|
||||||
|
<code type="xml">
|
||||||
|
<sftp host="myhost" sshConfig="/path/to/.ssh/config">
|
||||||
|
<ivy pattern="/path/to/ivy/[module]/ivy.xml"/>
|
||||||
|
<artifact pattern="/path/to/[organisation]/[module]/[artifact].[ext]"/>
|
||||||
|
</ssh>
|
||||||
|
</code>
|
||||||
|
Will connect to the host named by myhost according to the config file in /path/to/.ssh/config, using the hostname, username, and optionally IdentityFile specified in the config section "Host myhost". For example, if the corresponding Host section contains "Hostname yourserver.com" and "User myremoteusername", it will connect to yourserver.com using username myremoteusername.
|
||||||
|
|
||||||
</textarea>
|
</textarea>
|
||||||
<script type="text/javascript">xooki.postProcess();</script>
|
<script type="text/javascript">xooki.postProcess();</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ This resolver shares the <a href="../settings/resolvers.html#common">common attr
|
||||||
<td>No, defaults to host given on the patterns, fail if none is set</td></tr>
|
<td>No, defaults to host given on the patterns, fail if none is set</td></tr>
|
||||||
<tr><td>port</td><td>The port to connect to</td>
|
<tr><td>port</td><td>The port to connect to</td>
|
||||||
<td>No, defaults to 22</td></tr>
|
<td>No, defaults to 22</td></tr>
|
||||||
|
<tr><td>sshConfig</td><td>Path to an OpenSSH-style config file containing additional
|
||||||
|
configuration</td>
|
||||||
|
<td>No</td></tr>
|
||||||
|
|
||||||
<tr><td>publishPermissions</td><td>A four digit string (e.g., 0644, see "man chmod", "man open") specifying the permissions of the published files. <span class="since">(since 2.0)</span>
|
<tr><td>publishPermissions</td><td>A four digit string (e.g., 0644, see "man chmod", "man open") specifying the permissions of the published files. <span class="since">(since 2.0)</span>
|
||||||
</td><td>No, defaults to scp standard behaviour</td></tr>
|
</td><td>No, defaults to scp standard behaviour</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
@ -89,6 +93,13 @@ Will connect to myhost.com using myuser and prompt for the password.
|
||||||
</code>
|
</code>
|
||||||
Will connect to yourserver.com on port 8022 with user geheim and use keyFile path/to/key/file for keyFile and the value of password variable for keyFilePassword authentication for ivy files, and to myserver.com on port 8022 using user geheim with the same keyFile/keyFilePassword pair for the artifacts.
|
Will connect to yourserver.com on port 8022 with user geheim and use keyFile path/to/key/file for keyFile and the value of password variable for keyFilePassword authentication for ivy files, and to myserver.com on port 8022 using user geheim with the same keyFile/keyFilePassword pair for the artifacts.
|
||||||
|
|
||||||
|
<code type="xml">
|
||||||
|
<ssh host="myhost" sshConfig="/path/to/.ssh/config">
|
||||||
|
<ivy pattern="/path/to/ivy/[module]/ivy.xml"/>
|
||||||
|
<artifact pattern="/path/to/[organisation]/[module]/[artifact].[ext]"/>
|
||||||
|
</ssh>
|
||||||
|
</code>
|
||||||
|
Will connect to the host named by myhost according to the config file in /path/to/.ssh/config, using the hostname, username, and optionally IdentityFile specified in the config section "Host myhost". For example, if the corresponding Host section contains "Hostname yourserver.com" and "User myremoteusername", it will connect to yourserver.com using username myremoteusername.
|
||||||
</textarea>
|
</textarea>
|
||||||
<script type="text/javascript">xooki.postProcess();</script>
|
<script type="text/javascript">xooki.postProcess();</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,13 @@ Any standard resolver can be used in force mode, which is used mainly to handle
|
||||||
By using such a resolver at the beginning of a chain, you can be sure that Ivy will pick up whatever module is available in this resolver (usually a private local build) instead of the real requested revision. This allows to handle use case like a developer working on modules A and C, where A -> B -> C, and pick up the local build for C without having to publish a local version of B.
|
By using such a resolver at the beginning of a chain, you can be sure that Ivy will pick up whatever module is available in this resolver (usually a private local build) instead of the real requested revision. This allows to handle use case like a developer working on modules A and C, where A -> B -> C, and pick up the local build for C without having to publish a local version of B.
|
||||||
<span class="since">since 2.0</span>
|
<span class="since">since 2.0</span>
|
||||||
|
|
||||||
|
<h3>Maven</h3>
|
||||||
|
|
||||||
|
Any resolver which is able to parse a Maven pom.xml file has to detect the related sources or javadocs artifacts. This often involves sevrals network connection even if neither the sources nor the javadoc are requested to be downloaded.
|
||||||
|
|
||||||
|
<span class="since">since 2.5</span> Setting the property <tt>ivy.maven.lookup.sources<tt> to <tt>false</tt> disable the lookup of the sources artifact.
|
||||||
|
And setting the property <tt>ivy.maven.lookup.javadoc<tt> to <tt>false</tt> disable the lookup of the javadoc artifact.
|
||||||
|
|
||||||
<h2>Attributes</h2>
|
<h2>Attributes</h2>
|
||||||
<table class="ivy-attributes">
|
<table class="ivy-attributes">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
<div id="footer-message" class="footer">
|
<div id="footer-message" class="footer">
|
||||||
<hr />
|
<hr />
|
||||||
<i>Copyright © 2014 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
|
<i>Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License, Version 2.0</a>.</i><br />
|
||||||
<i>Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.</i><br />
|
<i>Apache Ivy, Apache Ant, Ivy, Ant, Apache, the Apache Ivy logo, the Apache Ant logo and the Apache feather logo are trademarks of The Apache Software Foundation.</i><br />
|
||||||
<i>All other marks mentioned may be trademarks or registered trademarks of their respective owners. </i>
|
<i>All other marks mentioned may be trademarks or registered trademarks of their respective owners. </i>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ ${ivy.pom.header}
|
||||||
<tr><td>headerFile</td><td>the header of the generated pom file</td>
|
<tr><td>headerFile</td><td>the header of the generated pom file</td>
|
||||||
<td>No</td></tr>
|
<td>No</td></tr>
|
||||||
<tr><td>description</td><td>The description that will be added to the generated pom. <span class="since">(since 2.2)</span></td>
|
<tr><td>description</td><td>The description that will be added to the generated pom. <span class="since">(since 2.2)</span></td>
|
||||||
<td>No, defaults to no description.</td></tr>
|
<td>No, defaults to no description. Since 2.5, defaults to the description in the source ivy file.</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h1>Child elements</h1>
|
<h1>Child elements</h1>
|
||||||
|
|
|
||||||
96
ivy.xml
96
ivy.xml
|
|
@ -19,56 +19,54 @@
|
||||||
<ivy-module version="1.0"
|
<ivy-module version="1.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
|
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
|
||||||
<info organisation="org.apache.ivy"
|
<info organisation="org.apache.ivy"
|
||||||
module="ivy"
|
module="ivy"
|
||||||
status="integration">
|
status="integration">
|
||||||
<description homepage="http://ant.apache.org/ivy/">
|
<description homepage="http://ant.apache.org/ivy/">
|
||||||
Apache Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.
|
Apache Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.
|
||||||
</description>
|
</description>
|
||||||
</info>
|
</info>
|
||||||
<configurations>
|
<configurations>
|
||||||
<conf name="core" description="only ivy jar, without any dependencies"/>
|
<conf name="core" description="only ivy jar, without any dependencies"/>
|
||||||
<conf name="httpclient" extends="core" description="core + optional httpclient for better http handling"/>
|
<conf name="httpclient" extends="core" description="core + optional httpclient for better http handling"/>
|
||||||
<conf name="oro" extends="core" description="to use optional glob matcher"/>
|
<conf name="oro" extends="core" description="to use optional glob matcher"/>
|
||||||
<conf name="vfs" extends="core" description="core + optional VirtualFileSystem(VFS) support" />
|
<conf name="vfs" extends="core" description="core + optional VirtualFileSystem(VFS) support" />
|
||||||
<conf name="sftp" extends="core" description="core + optional SFTP support" />
|
<conf name="sftp" extends="core" description="core + optional SFTP support" />
|
||||||
<conf name="standalone" extends="core" description="to launch in standalone mode (from command line)"/>
|
<conf name="standalone" extends="core" description="to launch in standalone mode (from command line)"/>
|
||||||
<conf name="ant" extends="core" description="core + ant jar provided as a dependency"/>
|
<conf name="ant" extends="core" description="core + ant jar provided as a dependency"/>
|
||||||
<conf name="default" extends="core" description="full ivy with all dependencies"/>
|
<conf name="default" extends="core" description="full ivy with all dependencies"/>
|
||||||
<conf name="test" description="dependencies used for junit testing ivy" visibility="private" />
|
<conf name="test" description="dependencies used for junit testing ivy" visibility="private" />
|
||||||
<conf name="source" description="ivy sources" />
|
<conf name="source" description="ivy sources" />
|
||||||
</configurations>
|
</configurations>
|
||||||
<publications>
|
<publications>
|
||||||
<artifact name="ivy" type="jar" conf="core"/>
|
<artifact name="ivy" type="jar" conf="core"/>
|
||||||
<artifact name="ivy" type="source" ext="jar" conf="source"/>
|
<artifact name="ivy" type="source" ext="jar" conf="source"/>
|
||||||
</publications>
|
</publications>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency org="org.apache.ant" name="ant" rev="1.7.1" conf="default,ant->default"/>
|
<dependency org="org.apache.ant" name="ant" rev="1.9.9" conf="default,ant->default"/>
|
||||||
<dependency org="org.apache.ant" name="ant-nodeps" rev="1.7.1" conf="default"/>
|
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.0" conf="default,httpclient->runtime,master" />
|
||||||
<dependency org="org.apache.ant" name="ant-trax" rev="1.7.1" conf="default"/>
|
<dependency org="oro" name="oro" rev="2.0.8" conf="default,oro->default"/>
|
||||||
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.0" conf="default,httpclient->runtime,master" />
|
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default" />
|
||||||
<dependency org="oro" name="oro" rev="2.0.8" conf="default,oro->default"/>
|
<dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp->default" />
|
||||||
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default" />
|
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp->default" />
|
||||||
<dependency org="com.jcraft" name="jsch" rev="0.1.50" conf="default,sftp->default" />
|
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp->default" />
|
||||||
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.6" conf="default,sftp->default" />
|
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp->default" />
|
||||||
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.6" conf="default,sftp->default" />
|
<dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default" />
|
||||||
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.6" conf="default,sftp->default" />
|
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default" />
|
||||||
<dependency org="org.bouncycastle" name="bcpg-jdk14" rev="1.45" conf="default" />
|
|
||||||
<dependency org="org.bouncycastle" name="bcprov-jdk14" rev="1.45" conf="default" />
|
|
||||||
|
|
||||||
<!-- Test dependencies -->
|
<!-- Test dependencies -->
|
||||||
<dependency org="junit" name="junit" rev="3.8.2" conf="test->default" />
|
<dependency org="junit" name="junit" rev="3.8.2" conf="test->default" />
|
||||||
<dependency org="commons-lang" name="commons-lang" rev="2.6" conf="test->default" />
|
<dependency org="commons-lang" name="commons-lang" rev="2.6" conf="test->default" />
|
||||||
<dependency org="org.apache.ant" name="ant-testutil" rev="1.7.0" conf="test->default" transitive="false" />
|
<dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test->default" transitive="false" />
|
||||||
<dependency org="ant" name="ant-launcher" rev="1.6.2" conf="test->default" transitive="false"/>
|
<dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" conf="test->default" transitive="false"/>
|
||||||
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test->default" transitive="false"/>
|
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test->default" transitive="false"/>
|
||||||
<dependency org="xmlunit" name="xmlunit" rev="1.5" conf="test->default" transitive="false"/>
|
<dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test->default" transitive="false"/>
|
||||||
|
|
||||||
<!-- This dependency is necessary for having validation in junit tests when running with JDK1.4 -->
|
<!-- This dependency is necessary for having validation in junit tests when running with JDK1.4 -->
|
||||||
<dependency org="xerces" name="xercesImpl" rev="2.6.2" conf="test->default" />
|
<dependency org="xerces" name="xercesImpl" rev="2.6.2" conf="test->default" />
|
||||||
<dependency org="xerces" name="xmlParserAPIs" rev="2.6.2" conf="test->default" />
|
<dependency org="xerces" name="xmlParserAPIs" rev="2.6.2" conf="test->default" />
|
||||||
|
|
||||||
<!-- Global exclude for junit -->
|
<!-- Global exclude for junit -->
|
||||||
<exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant" />
|
<exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</ivy-module>
|
</ivy-module>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import java.net.URL;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
@ -38,6 +37,7 @@ import org.apache.ivy.core.deliver.DeliverOptions;
|
||||||
import org.apache.ivy.core.event.EventManager;
|
import org.apache.ivy.core.event.EventManager;
|
||||||
import org.apache.ivy.core.install.InstallEngine;
|
import org.apache.ivy.core.install.InstallEngine;
|
||||||
import org.apache.ivy.core.install.InstallOptions;
|
import org.apache.ivy.core.install.InstallOptions;
|
||||||
|
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||||
import org.apache.ivy.core.module.id.ModuleId;
|
import org.apache.ivy.core.module.id.ModuleId;
|
||||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||||
|
|
@ -45,6 +45,7 @@ import org.apache.ivy.core.publish.PublishEngine;
|
||||||
import org.apache.ivy.core.publish.PublishOptions;
|
import org.apache.ivy.core.publish.PublishOptions;
|
||||||
import org.apache.ivy.core.report.ResolveReport;
|
import org.apache.ivy.core.report.ResolveReport;
|
||||||
import org.apache.ivy.core.repository.RepositoryManagementEngine;
|
import org.apache.ivy.core.repository.RepositoryManagementEngine;
|
||||||
|
import org.apache.ivy.core.resolve.IvyNode;
|
||||||
import org.apache.ivy.core.resolve.ResolveData;
|
import org.apache.ivy.core.resolve.ResolveData;
|
||||||
import org.apache.ivy.core.resolve.ResolveEngine;
|
import org.apache.ivy.core.resolve.ResolveEngine;
|
||||||
import org.apache.ivy.core.resolve.ResolveOptions;
|
import org.apache.ivy.core.resolve.ResolveOptions;
|
||||||
|
|
@ -614,8 +615,9 @@ public class Ivy {
|
||||||
// PUBLISH
|
// PUBLISH
|
||||||
// ///////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public Collection publish(ModuleRevisionId mrid, Collection srcArtifactPattern,
|
public Collection<Artifact> publish(ModuleRevisionId mrid,
|
||||||
String resolverName, PublishOptions options) throws IOException {
|
Collection<String> srcArtifactPattern, String resolverName, PublishOptions options)
|
||||||
|
throws IOException {
|
||||||
pushContext();
|
pushContext();
|
||||||
try {
|
try {
|
||||||
return publishEngine.publish(mrid, srcArtifactPattern, resolverName, options);
|
return publishEngine.publish(mrid, srcArtifactPattern, resolverName, options);
|
||||||
|
|
@ -631,7 +633,7 @@ public class Ivy {
|
||||||
/**
|
/**
|
||||||
* Sorts the collection of IvyNode from the less dependent to the more dependent
|
* Sorts the collection of IvyNode from the less dependent to the more dependent
|
||||||
*/
|
*/
|
||||||
public List sortNodes(Collection nodes, SortOptions options) {
|
public List<IvyNode> sortNodes(Collection<IvyNode> nodes, SortOptions options) {
|
||||||
pushContext();
|
pushContext();
|
||||||
try {
|
try {
|
||||||
return getSortEngine().sortNodes(nodes, options);
|
return getSortEngine().sortNodes(nodes, options);
|
||||||
|
|
@ -654,7 +656,8 @@ public class Ivy {
|
||||||
* if a circular dependency exists and circular dependency strategy decide to throw
|
* if a circular dependency exists and circular dependency strategy decide to throw
|
||||||
* an exception
|
* an exception
|
||||||
*/
|
*/
|
||||||
public List sortModuleDescriptors(Collection moduleDescriptors, SortOptions options) {
|
public List<ModuleDescriptor> sortModuleDescriptors(
|
||||||
|
Collection<ModuleDescriptor> moduleDescriptors, SortOptions options) {
|
||||||
pushContext();
|
pushContext();
|
||||||
try {
|
try {
|
||||||
return getSortEngine().sortModuleDescriptors(moduleDescriptors, options);
|
return getSortEngine().sortModuleDescriptors(moduleDescriptors, options);
|
||||||
|
|
@ -750,7 +753,7 @@ public class Ivy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] listTokenValues(String token, Map otherTokenValues) {
|
public String[] listTokenValues(String token, Map<String, Object> otherTokenValues) {
|
||||||
pushContext();
|
pushContext();
|
||||||
try {
|
try {
|
||||||
return searchEngine.listTokenValues(token, otherTokenValues);
|
return searchEngine.listTokenValues(token, otherTokenValues);
|
||||||
|
|
@ -833,14 +836,12 @@ public class Ivy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postConfigure() {
|
private void postConfigure() {
|
||||||
Collection triggers = settings.getTriggers();
|
List<Trigger> triggers = settings.getTriggers();
|
||||||
for (Iterator iter = triggers.iterator(); iter.hasNext();) {
|
for (Trigger trigger : triggers) {
|
||||||
Trigger trigger = (Trigger) iter.next();
|
|
||||||
eventManager.addIvyListener(trigger, trigger.getEventFilter());
|
eventManager.addIvyListener(trigger, trigger.getEventFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
|
||||||
if (resolver instanceof BasicResolver) {
|
if (resolver instanceof BasicResolver) {
|
||||||
((BasicResolver) resolver).setEventManager(eventManager);
|
((BasicResolver) resolver).setEventManager(eventManager);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,236 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.apache.ivy.ant;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||||
|
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
|
||||||
|
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||||
|
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||||
|
import org.apache.ivy.core.report.ArtifactDownloadReport;
|
||||||
|
import org.apache.ivy.core.report.DownloadReport;
|
||||||
|
import org.apache.ivy.core.report.DownloadStatus;
|
||||||
|
import org.apache.ivy.core.resolve.DownloadOptions;
|
||||||
|
import org.apache.ivy.core.resolve.ResolveData;
|
||||||
|
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
|
||||||
|
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
|
||||||
|
import org.apache.ivy.plugins.resolver.AbstractWorkspaceResolver;
|
||||||
|
import org.apache.ivy.util.Message;
|
||||||
|
import org.apache.tools.ant.BuildException;
|
||||||
|
import org.apache.tools.ant.types.DataType;
|
||||||
|
import org.apache.tools.ant.types.ResourceCollection;
|
||||||
|
import org.apache.tools.ant.types.resources.FileResource;
|
||||||
|
|
||||||
|
public class AntWorkspaceResolver extends DataType {
|
||||||
|
|
||||||
|
public static final class WorkspaceArtifact {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String ext;
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExt(String ext) {
|
||||||
|
this.ext = ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ResourceCollection> allResources = new ArrayList<ResourceCollection>();
|
||||||
|
|
||||||
|
private boolean haltOnError = true;
|
||||||
|
|
||||||
|
private Resolver resolver;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private List<WorkspaceArtifact> artifacts = new ArrayList<WorkspaceArtifact>();
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHaltonerror(boolean haltOnError) {
|
||||||
|
this.haltOnError = haltOnError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addConfigured(ResourceCollection resources) {
|
||||||
|
if (!resources.isFilesystemOnly()) {
|
||||||
|
throw new BuildException("Only filesystem resource collection is supported");
|
||||||
|
}
|
||||||
|
allResources.add(resources);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkspaceArtifact createArtifact() {
|
||||||
|
WorkspaceArtifact a = new WorkspaceArtifact();
|
||||||
|
artifacts.add(a);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resolver getResolver() {
|
||||||
|
if (resolver == null) {
|
||||||
|
if (name == null) {
|
||||||
|
throw new BuildException("A name is required");
|
||||||
|
}
|
||||||
|
resolver = new Resolver();
|
||||||
|
resolver.setName(name);
|
||||||
|
}
|
||||||
|
return resolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getProjectName(File ivyFile) {
|
||||||
|
return ivyFile.getParentFile().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Resolver extends AbstractWorkspaceResolver {
|
||||||
|
|
||||||
|
private Map<ModuleDescriptor, File> md2IvyFile;
|
||||||
|
|
||||||
|
private synchronized Map<ModuleDescriptor, File> getModuleDescriptors() {
|
||||||
|
if (md2IvyFile == null) {
|
||||||
|
md2IvyFile = new HashMap<ModuleDescriptor, File>();
|
||||||
|
for (ResourceCollection resources : allResources) {
|
||||||
|
for (Iterator it = resources.iterator(); it.hasNext();) {
|
||||||
|
File ivyFile = ((FileResource) it.next()).getFile();
|
||||||
|
try {
|
||||||
|
ModuleDescriptor md = ModuleDescriptorParserRegistry.getInstance()
|
||||||
|
.parseDescriptor(getParserSettings(), ivyFile.toURI().toURL(),
|
||||||
|
isValidate());
|
||||||
|
md2IvyFile.put(md, ivyFile);
|
||||||
|
Message.debug("Add " + md.getModuleRevisionId().getModuleId());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (haltOnError) {
|
||||||
|
throw new BuildException("impossible to parse ivy file " + ivyFile
|
||||||
|
+ " exception=" + ex, ex);
|
||||||
|
} else {
|
||||||
|
Message.warn("impossible to parse ivy file " + ivyFile
|
||||||
|
+ " exception=" + ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return md2IvyFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||||
|
throws ParseException {
|
||||||
|
Map<ModuleDescriptor, File> mds = getModuleDescriptors();
|
||||||
|
for (Entry<ModuleDescriptor, File> md : mds.entrySet()) {
|
||||||
|
ResolvedModuleRevision rmr = checkCandidate(dd, md.getKey(),
|
||||||
|
getProjectName(md.getValue()));
|
||||||
|
if (rmr != null) {
|
||||||
|
return rmr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Artifact> createWorkspaceArtifacts(ModuleDescriptor md) {
|
||||||
|
List<Artifact> res = new ArrayList<Artifact>();
|
||||||
|
|
||||||
|
for (WorkspaceArtifact wa : artifacts) {
|
||||||
|
String name = wa.name;
|
||||||
|
String type = wa.type;
|
||||||
|
String ext = wa.ext;
|
||||||
|
String path = wa.path;
|
||||||
|
if (name == null) {
|
||||||
|
name = md.getModuleRevisionId().getName();
|
||||||
|
}
|
||||||
|
if (type == null) {
|
||||||
|
type = "jar";
|
||||||
|
}
|
||||||
|
if (ext == null) {
|
||||||
|
ext = "jar";
|
||||||
|
}
|
||||||
|
if (path == null) {
|
||||||
|
path = "target" + File.separator + "dist" + File.separator + type + "s"
|
||||||
|
+ File.separator + name + "." + ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
URL url;
|
||||||
|
File ivyFile = md2IvyFile.get(md);
|
||||||
|
File artifactFile = new File(ivyFile.getParentFile(), path);
|
||||||
|
try {
|
||||||
|
url = artifactFile.toURI().toURL();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
throw new RuntimeException("Unsupported file path : " + artifactFile, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.add(new DefaultArtifact(md.getModuleRevisionId(), new Date(), name, type, ext,
|
||||||
|
url, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
|
||||||
|
// Not much to do here - downloads are not required for workspace projects.
|
||||||
|
DownloadReport dr = new DownloadReport();
|
||||||
|
for (int i = 0; i < artifacts.length; i++) {
|
||||||
|
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
|
||||||
|
dr.addArtifactReport(adr);
|
||||||
|
URL url = artifacts[i].getUrl();
|
||||||
|
if (url == null || !url.getProtocol().equals("file")) {
|
||||||
|
// this is not an artifact managed by this resolver
|
||||||
|
adr.setDownloadStatus(DownloadStatus.FAILED);
|
||||||
|
return dr;
|
||||||
|
}
|
||||||
|
File f;
|
||||||
|
try {
|
||||||
|
f = new File(url.toURI());
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
f = new File(url.getPath());
|
||||||
|
}
|
||||||
|
adr.setLocalFile(f);
|
||||||
|
adr.setDownloadStatus(DownloadStatus.NO);
|
||||||
|
adr.setSize(0);
|
||||||
|
Message.verbose("\t[IN WORKSPACE] " + artifacts[i]);
|
||||||
|
}
|
||||||
|
return dr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ public class FixDepsTask extends IvyPostResolveTask {
|
||||||
|
|
||||||
private File dest;
|
private File dest;
|
||||||
|
|
||||||
private List/* <Keep> */keeps = new ArrayList();
|
private List<Keep> keeps = new ArrayList<Keep>();
|
||||||
|
|
||||||
public void setToFile(File dest) {
|
public void setToFile(File dest) {
|
||||||
this.dest = dest;
|
this.dest = dest;
|
||||||
|
|
@ -59,6 +59,7 @@ public class FixDepsTask extends IvyPostResolveTask {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doExecute() throws BuildException {
|
public void doExecute() throws BuildException {
|
||||||
prepareAndCheck();
|
prepareAndCheck();
|
||||||
|
|
||||||
|
|
@ -72,10 +73,9 @@ public class FixDepsTask extends IvyPostResolveTask {
|
||||||
|
|
||||||
ResolveReport report = getResolvedReport();
|
ResolveReport report = getResolvedReport();
|
||||||
|
|
||||||
List/* <ModuleId> */midToKeep = new ArrayList();
|
List<ModuleId> midToKeep = new ArrayList<ModuleId>();
|
||||||
for (int i = 0; i < keeps.size(); i++) {
|
for (Keep keep : keeps) {
|
||||||
midToKeep.add(ModuleId.newInstance(((Keep) keeps.get(i)).org,
|
midToKeep.add(ModuleId.newInstance(keep.org, keep.module));
|
||||||
((Keep) keeps.get(i)).module));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleDescriptor md = report.toFixedModuleDescriptor(getSettings(), midToKeep);
|
ModuleDescriptor md = report.toFixedModuleDescriptor(getSettings(), midToKeep);
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,8 @@ public class IvyAntSettings extends DataType {
|
||||||
|
|
||||||
private boolean autoRegistered = false;
|
private boolean autoRegistered = false;
|
||||||
|
|
||||||
|
private AntWorkspaceResolver antWorkspaceResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default ivy settings of this classloader. If it doesn't exist yet, a new one is
|
* Returns the default ivy settings of this classloader. If it doesn't exist yet, a new one is
|
||||||
* created using the given project to back the VariableContainer.
|
* created using the given project to back the VariableContainer.
|
||||||
|
|
@ -275,6 +277,10 @@ public class IvyAntSettings extends DataType {
|
||||||
defineDefaultSettingFile(ivyAntVariableContainer, task);
|
defineDefaultSettingFile(ivyAntVariableContainer, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (antWorkspaceResolver != null) {
|
||||||
|
settings.addConfigured(antWorkspaceResolver.getResolver());
|
||||||
|
}
|
||||||
|
|
||||||
Ivy ivy = Ivy.newInstance(settings);
|
Ivy ivy = Ivy.newInstance(settings);
|
||||||
try {
|
try {
|
||||||
ivy.pushContext();
|
ivy.pushContext();
|
||||||
|
|
@ -388,4 +394,7 @@ public class IvyAntSettings extends DataType {
|
||||||
URLHandlerRegistry.setDefault(dispatcher);
|
URLHandlerRegistry.setDefault(dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addConfiguredWorkspaceResolver(AntWorkspaceResolver antWorkspaceResolver) {
|
||||||
|
this.antWorkspaceResolver = antWorkspaceResolver;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
@ -66,7 +65,7 @@ public class IvyBuildList extends IvyTask {
|
||||||
|
|
||||||
public static final String DESCRIPTOR_REQUIRED = "required";
|
public static final String DESCRIPTOR_REQUIRED = "required";
|
||||||
|
|
||||||
private List buildFileSets = new ArrayList(); // List (FileSet)
|
private List<FileSet> buildFileSets = new ArrayList<FileSet>();
|
||||||
|
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
|
|
@ -152,6 +151,7 @@ public class IvyBuildList extends IvyTask {
|
||||||
this.onlydirectdep = onlydirectdep;
|
this.onlydirectdep = onlydirectdep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doExecute() throws BuildException {
|
public void doExecute() throws BuildException {
|
||||||
if (reference == null) {
|
if (reference == null) {
|
||||||
throw new BuildException("reference should be provided in ivy build list");
|
throw new BuildException("reference should be provided in ivy build list");
|
||||||
|
|
@ -168,12 +168,12 @@ public class IvyBuildList extends IvyTask {
|
||||||
|
|
||||||
Path path = new Path(getProject());
|
Path path = new Path(getProject());
|
||||||
|
|
||||||
Map buildFiles = new HashMap(); // Map (ModuleDescriptor -> File buildFile)
|
Map<ModuleDescriptor, File> buildFiles = new HashMap<ModuleDescriptor, File>();
|
||||||
List independent = new ArrayList();
|
List<File> independent = new ArrayList<File>();
|
||||||
List noDescriptor = new ArrayList();
|
List<File> noDescriptor = new ArrayList<File>();
|
||||||
Collection mds = new ArrayList();
|
Collection<ModuleDescriptor> mds = new ArrayList<ModuleDescriptor>();
|
||||||
|
|
||||||
Set rootModuleNames = new LinkedHashSet();
|
Set<String> rootModuleNames = new LinkedHashSet<String>();
|
||||||
if (!"*".equals(root)) {
|
if (!"*".equals(root)) {
|
||||||
StringTokenizer st = new StringTokenizer(root, delimiter);
|
StringTokenizer st = new StringTokenizer(root, delimiter);
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
|
|
@ -181,7 +181,7 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set leafModuleNames = new LinkedHashSet();
|
Set<String> leafModuleNames = new LinkedHashSet<String>();
|
||||||
if (!"*".equals(leaf)) {
|
if (!"*".equals(leaf)) {
|
||||||
StringTokenizer st = new StringTokenizer(leaf, delimiter);
|
StringTokenizer st = new StringTokenizer(leaf, delimiter);
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
|
|
@ -189,15 +189,14 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set restartFromModuleNames = new LinkedHashSet();
|
Set<String> restartFromModuleNames = new LinkedHashSet<String>();
|
||||||
if (!"*".equals(restartFrom)) {
|
if (!"*".equals(restartFrom)) {
|
||||||
StringTokenizer st = new StringTokenizer(restartFrom, delimiter);
|
StringTokenizer st = new StringTokenizer(restartFrom, delimiter);
|
||||||
// Only accept one (first) module
|
// Only accept one (first) module
|
||||||
restartFromModuleNames.add(st.nextToken());
|
restartFromModuleNames.add(st.nextToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ListIterator iter = buildFileSets.listIterator(); iter.hasNext();) {
|
for (FileSet fs : buildFileSets) {
|
||||||
FileSet fs = (FileSet) iter.next();
|
|
||||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||||
String[] builds = ds.getIncludedFiles();
|
String[] builds = ds.getIncludedFiles();
|
||||||
for (int i = 0; i < builds.length; i++) {
|
for (int i = 0; i < builds.length; i++) {
|
||||||
|
|
@ -228,12 +227,12 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List leafModuleDescriptors = convertModuleNamesToModuleDescriptors(mds, leafModuleNames,
|
List<ModuleDescriptor> leafModuleDescriptors = convertModuleNamesToModuleDescriptors(mds,
|
||||||
"leaf");
|
leafModuleNames, "leaf");
|
||||||
List rootModuleDescriptors = convertModuleNamesToModuleDescriptors(mds, rootModuleNames,
|
List<ModuleDescriptor> rootModuleDescriptors = convertModuleNamesToModuleDescriptors(mds,
|
||||||
"root");
|
rootModuleNames, "root");
|
||||||
List restartFromModuleDescriptors = convertModuleNamesToModuleDescriptors(mds,
|
List<ModuleDescriptor> restartFromModuleDescriptors = convertModuleNamesToModuleDescriptors(
|
||||||
restartFromModuleNames, "restartFrom");
|
mds, restartFromModuleNames, "restartFrom");
|
||||||
|
|
||||||
if (!rootModuleDescriptors.isEmpty()) {
|
if (!rootModuleDescriptors.isEmpty()) {
|
||||||
Message.info("Filtering modules based on roots " + rootModuleNames);
|
Message.info("Filtering modules based on roots " + rootModuleNames);
|
||||||
|
|
@ -244,16 +243,14 @@ public class IvyBuildList extends IvyTask {
|
||||||
mds = filterModulesFromLeaf(mds, leafModuleDescriptors);
|
mds = filterModulesFromLeaf(mds, leafModuleDescriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
List sortedModules = ivy.sortModuleDescriptors(mds, SortOptions.DEFAULT);
|
List<ModuleDescriptor> sortedModules = ivy.sortModuleDescriptors(mds, SortOptions.DEFAULT);
|
||||||
|
|
||||||
if (!OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
|
if (!OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
|
||||||
for (ListIterator iter = noDescriptor.listIterator(); iter.hasNext();) {
|
for (File buildFile : noDescriptor) {
|
||||||
File buildFile = (File) iter.next();
|
|
||||||
addBuildFile(path, buildFile);
|
addBuildFile(path, buildFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ListIterator iter = independent.listIterator(); iter.hasNext();) {
|
for (File buildFile : independent) {
|
||||||
File buildFile = (File) iter.next();
|
|
||||||
addBuildFile(path, buildFile);
|
addBuildFile(path, buildFile);
|
||||||
}
|
}
|
||||||
if (isReverse()) {
|
if (isReverse()) {
|
||||||
|
|
@ -264,11 +261,9 @@ public class IvyBuildList extends IvyTask {
|
||||||
// so they are not removed from build path.
|
// so they are not removed from build path.
|
||||||
if (!restartFromModuleDescriptors.isEmpty()) {
|
if (!restartFromModuleDescriptors.isEmpty()) {
|
||||||
boolean foundRestartFrom = false;
|
boolean foundRestartFrom = false;
|
||||||
List keptModules = new ArrayList();
|
List<ModuleDescriptor> keptModules = new ArrayList<ModuleDescriptor>();
|
||||||
ModuleDescriptor restartFromModuleDescriptor = (ModuleDescriptor) restartFromModuleDescriptors
|
ModuleDescriptor restartFromModuleDescriptor = restartFromModuleDescriptors.get(0);
|
||||||
.get(0);
|
for (ModuleDescriptor md : sortedModules) {
|
||||||
for (ListIterator iter = sortedModules.listIterator(); iter.hasNext();) {
|
|
||||||
ModuleDescriptor md = (ModuleDescriptor) iter.next();
|
|
||||||
if (md.equals(restartFromModuleDescriptor)) {
|
if (md.equals(restartFromModuleDescriptor)) {
|
||||||
foundRestartFrom = true;
|
foundRestartFrom = true;
|
||||||
}
|
}
|
||||||
|
|
@ -279,18 +274,17 @@ public class IvyBuildList extends IvyTask {
|
||||||
sortedModules = keptModules;
|
sortedModules = keptModules;
|
||||||
}
|
}
|
||||||
StringBuffer order = new StringBuffer();
|
StringBuffer order = new StringBuffer();
|
||||||
for (ListIterator iter = sortedModules.listIterator(); iter.hasNext();) {
|
for (ListIterator<ModuleDescriptor> iter = sortedModules.listIterator(); iter.hasNext();) {
|
||||||
ModuleDescriptor md = (ModuleDescriptor) iter.next();
|
ModuleDescriptor md = iter.next();
|
||||||
order.append(md.getModuleRevisionId().getModuleId());
|
order.append(md.getModuleRevisionId().getModuleId());
|
||||||
if (iter.hasNext()) {
|
if (iter.hasNext()) {
|
||||||
order.append(", ");
|
order.append(", ");
|
||||||
}
|
}
|
||||||
File buildFile = (File) buildFiles.get(md);
|
File buildFile = buildFiles.get(md);
|
||||||
addBuildFile(path, buildFile);
|
addBuildFile(path, buildFile);
|
||||||
}
|
}
|
||||||
if (OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
|
if (OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
|
||||||
for (ListIterator iter = noDescriptor.listIterator(); iter.hasNext();) {
|
for (File buildFile : noDescriptor) {
|
||||||
File buildFile = (File) iter.next();
|
|
||||||
addBuildFile(path, buildFile);
|
addBuildFile(path, buildFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +293,7 @@ public class IvyBuildList extends IvyTask {
|
||||||
getProject().setProperty("ivy.sorted.modules", order.toString());
|
getProject().setProperty("ivy.sorted.modules", order.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMissingDescriptor(File buildFile, File ivyFile, List noDescriptor) {
|
private void onMissingDescriptor(File buildFile, File ivyFile, List<File> noDescriptor) {
|
||||||
if (OnMissingDescriptor.SKIP.equals(onMissingDescriptor)) {
|
if (OnMissingDescriptor.SKIP.equals(onMissingDescriptor)) {
|
||||||
Message.debug("skipping " + buildFile + ": descriptor " + ivyFile + " doesn't exist");
|
Message.debug("skipping " + buildFile + ": descriptor " + ivyFile + " doesn't exist");
|
||||||
} else if (OnMissingDescriptor.FAIL.equals(onMissingDescriptor)) {
|
} else if (OnMissingDescriptor.FAIL.equals(onMissingDescriptor)) {
|
||||||
|
|
@ -323,12 +317,12 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List convertModuleNamesToModuleDescriptors(Collection mds, Set moduleNames, String kind) {
|
private List<ModuleDescriptor> convertModuleNamesToModuleDescriptors(
|
||||||
List result = new ArrayList();
|
Collection<ModuleDescriptor> mds, Set<String> moduleNames, String kind) {
|
||||||
Set foundModuleNames = new HashSet();
|
List<ModuleDescriptor> result = new ArrayList<ModuleDescriptor>();
|
||||||
|
Set<String> foundModuleNames = new HashSet<String>();
|
||||||
|
|
||||||
for (Iterator it = mds.iterator(); it.hasNext();) {
|
for (ModuleDescriptor md : mds) {
|
||||||
ModuleDescriptor md = (ModuleDescriptor) it.next();
|
|
||||||
String name = md.getModuleRevisionId().getModuleId().getName();
|
String name = md.getModuleRevisionId().getModuleId().getName();
|
||||||
if (moduleNames.contains(name)) {
|
if (moduleNames.contains(name)) {
|
||||||
foundModuleNames.add(name);
|
foundModuleNames.add(name);
|
||||||
|
|
@ -337,14 +331,14 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundModuleNames.size() < moduleNames.size()) {
|
if (foundModuleNames.size() < moduleNames.size()) {
|
||||||
Set missingModules = new HashSet(moduleNames);
|
Set<String> missingModules = new HashSet<String>(moduleNames);
|
||||||
missingModules.removeAll(foundModuleNames);
|
missingModules.removeAll(foundModuleNames);
|
||||||
|
|
||||||
StringBuffer missingNames = new StringBuffer();
|
StringBuffer missingNames = new StringBuffer();
|
||||||
String sep = "";
|
String sep = "";
|
||||||
for (Iterator it = missingModules.iterator(); it.hasNext();) {
|
for (String name : missingModules) {
|
||||||
missingNames.append(sep);
|
missingNames.append(sep);
|
||||||
missingNames.append(it.next());
|
missingNames.append(name);
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -365,20 +359,17 @@ public class IvyBuildList extends IvyTask {
|
||||||
* root module
|
* root module
|
||||||
* @return filtered list of modules
|
* @return filtered list of modules
|
||||||
*/
|
*/
|
||||||
private Collection filterModulesFromRoot(Collection mds, List rootmds) {
|
private Collection<ModuleDescriptor> filterModulesFromRoot(Collection<ModuleDescriptor> mds,
|
||||||
// Make a map of ModuleId objects -> ModuleDescriptors
|
List<ModuleDescriptor> rootmds) {
|
||||||
Map moduleIdMap = new HashMap();
|
Map<ModuleId, ModuleDescriptor> moduleIdMap = new HashMap<ModuleId, ModuleDescriptor>();
|
||||||
for (Iterator iter = mds.iterator(); iter.hasNext();) {
|
for (ModuleDescriptor md : mds) {
|
||||||
ModuleDescriptor md = ((ModuleDescriptor) iter.next());
|
|
||||||
moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);
|
moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursively process the nodes
|
// recursively process the nodes
|
||||||
Set toKeep = new LinkedHashSet();
|
Set<ModuleDescriptor> toKeep = new LinkedHashSet<ModuleDescriptor>();
|
||||||
|
|
||||||
Iterator it = rootmds.iterator();
|
for (ModuleDescriptor rootmd : rootmds) {
|
||||||
while (it.hasNext()) {
|
|
||||||
ModuleDescriptor rootmd = (ModuleDescriptor) it.next();
|
|
||||||
processFilterNodeFromRoot(rootmd, toKeep, moduleIdMap);
|
processFilterNodeFromRoot(rootmd, toKeep, moduleIdMap);
|
||||||
// With the excluderoot attribute set to true, take the rootmd out of the toKeep set.
|
// With the excluderoot attribute set to true, take the rootmd out of the toKeep set.
|
||||||
if (excludeRoot) {
|
if (excludeRoot) {
|
||||||
|
|
@ -391,8 +382,7 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
// just for logging
|
// just for logging
|
||||||
for (Iterator iter = toKeep.iterator(); iter.hasNext();) {
|
for (ModuleDescriptor md : toKeep) {
|
||||||
ModuleDescriptor md = ((ModuleDescriptor) iter.next());
|
|
||||||
Message.verbose("Kept module " + md.getModuleRevisionId().getModuleId().getName());
|
Message.verbose("Kept module " + md.getModuleRevisionId().getModuleId().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,13 +401,14 @@ public class IvyBuildList extends IvyTask {
|
||||||
* @param moduleIdMap
|
* @param moduleIdMap
|
||||||
* reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
|
* reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
|
||||||
*/
|
*/
|
||||||
private void processFilterNodeFromRoot(ModuleDescriptor node, Set toKeep, Map moduleIdMap) {
|
private void processFilterNodeFromRoot(ModuleDescriptor node, Set<ModuleDescriptor> toKeep,
|
||||||
|
Map<ModuleId, ModuleDescriptor> moduleIdMap) {
|
||||||
// toKeep.add(node);
|
// toKeep.add(node);
|
||||||
|
|
||||||
DependencyDescriptor[] deps = node.getDependencies();
|
DependencyDescriptor[] deps = node.getDependencies();
|
||||||
for (int i = 0; i < deps.length; i++) {
|
for (int i = 0; i < deps.length; i++) {
|
||||||
ModuleId id = deps[i].getDependencyId();
|
ModuleId id = deps[i].getDependencyId();
|
||||||
ModuleDescriptor md = (ModuleDescriptor) moduleIdMap.get(id);
|
ModuleDescriptor md = moduleIdMap.get(id);
|
||||||
// we test if this module id has a module descriptor, and if it isn't already in the
|
// we test if this module id has a module descriptor, and if it isn't already in the
|
||||||
// toKeep Set, in which there's probably a circular dependency
|
// toKeep Set, in which there's probably a circular dependency
|
||||||
if (md != null && !toKeep.contains(md)) {
|
if (md != null && !toKeep.contains(md)) {
|
||||||
|
|
@ -439,19 +430,16 @@ public class IvyBuildList extends IvyTask {
|
||||||
* leaf module
|
* leaf module
|
||||||
* @return filtered list of modules
|
* @return filtered list of modules
|
||||||
*/
|
*/
|
||||||
private Collection filterModulesFromLeaf(Collection mds, List leafmds) {
|
private Collection<ModuleDescriptor> filterModulesFromLeaf(Collection<ModuleDescriptor> mds,
|
||||||
// Make a map of ModuleId objects -> ModuleDescriptors
|
List<ModuleDescriptor> leafmds) {
|
||||||
Map moduleIdMap = new HashMap();
|
Map<ModuleId, ModuleDescriptor> moduleIdMap = new HashMap<ModuleId, ModuleDescriptor>();
|
||||||
for (Iterator iter = mds.iterator(); iter.hasNext();) {
|
for (ModuleDescriptor md : mds) {
|
||||||
ModuleDescriptor md = ((ModuleDescriptor) iter.next());
|
|
||||||
moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);
|
moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursively process the nodes
|
// recursively process the nodes
|
||||||
Set toKeep = new LinkedHashSet();
|
Set<ModuleDescriptor> toKeep = new LinkedHashSet<ModuleDescriptor>();
|
||||||
Iterator it = leafmds.iterator();
|
for (ModuleDescriptor leafmd : leafmds) {
|
||||||
while (it.hasNext()) {
|
|
||||||
ModuleDescriptor leafmd = (ModuleDescriptor) it.next();
|
|
||||||
// With the excludeleaf attribute set to true, take the rootmd out of the toKeep set.
|
// With the excludeleaf attribute set to true, take the rootmd out of the toKeep set.
|
||||||
if (excludeLeaf) {
|
if (excludeLeaf) {
|
||||||
Message.verbose("Excluded module "
|
Message.verbose("Excluded module "
|
||||||
|
|
@ -463,8 +451,7 @@ public class IvyBuildList extends IvyTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
// just for logging
|
// just for logging
|
||||||
for (Iterator iter = toKeep.iterator(); iter.hasNext();) {
|
for (ModuleDescriptor md : toKeep) {
|
||||||
ModuleDescriptor md = ((ModuleDescriptor) iter.next());
|
|
||||||
Message.verbose("Kept module " + md.getModuleRevisionId().getModuleId().getName());
|
Message.verbose("Kept module " + md.getModuleRevisionId().getModuleId().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -482,9 +469,9 @@ public class IvyBuildList extends IvyTask {
|
||||||
* @param moduleIdMap
|
* @param moduleIdMap
|
||||||
* reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
|
* reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
|
||||||
*/
|
*/
|
||||||
private void processFilterNodeFromLeaf(ModuleDescriptor node, Set toKeep, Map moduleIdMap) {
|
private void processFilterNodeFromLeaf(ModuleDescriptor node, Set<ModuleDescriptor> toKeep,
|
||||||
for (Iterator iter = moduleIdMap.values().iterator(); iter.hasNext();) {
|
Map<ModuleId, ModuleDescriptor> moduleIdMap) {
|
||||||
ModuleDescriptor md = (ModuleDescriptor) iter.next();
|
for (ModuleDescriptor md : moduleIdMap.values()) {
|
||||||
DependencyDescriptor[] deps = md.getDependencies();
|
DependencyDescriptor[] deps = md.getDependencies();
|
||||||
for (int i = 0; i < deps.length; i++) {
|
for (int i = 0; i < deps.length; i++) {
|
||||||
ModuleId id = deps[i].getDependencyId();
|
ModuleId id = deps[i].getDependencyId();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package org.apache.ivy.ant;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.ivy.Ivy;
|
import org.apache.ivy.Ivy;
|
||||||
import org.apache.ivy.core.module.id.ModuleId;
|
import org.apache.ivy.core.module.id.ModuleId;
|
||||||
|
|
@ -169,25 +170,32 @@ public class IvyBuildNumber extends IvyTask {
|
||||||
if (expression.equals(organisation) || expression.equals(module)
|
if (expression.equals(organisation) || expression.equals(module)
|
||||||
|| expression.equals(branch)) {
|
|| expression.equals(branch)) {
|
||||||
return exact.getMatcher(expression);
|
return exact.getMatcher(expression);
|
||||||
|
} else {
|
||||||
|
return regexp.getMatcher(expression);
|
||||||
}
|
}
|
||||||
return regexp.getMatcher(expression);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "buildnumber-matcher";
|
return "buildnumber-matcher";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String revisionPattern = ".*";
|
||||||
|
if (revision.endsWith("+")) {
|
||||||
|
revisionPattern = Pattern.quote(revision.substring(0, revision.length() - 1)) + ".*";
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation, module, branch,
|
||||||
|
revisionPattern);
|
||||||
ModuleRevisionId[] revisions;
|
ModuleRevisionId[] revisions;
|
||||||
if (resolver == null) {
|
if (resolver == null) {
|
||||||
revisions = searcher.listModules(
|
revisions = searcher.listModules(mrid, patternMatcher);
|
||||||
ModuleRevisionId.newInstance(organisation, module, branch, ".*"), patternMatcher);
|
|
||||||
} else {
|
} else {
|
||||||
DependencyResolver depResolver = settings.getResolver(resolver);
|
DependencyResolver depResolver = settings.getResolver(resolver);
|
||||||
if (depResolver == null) {
|
if (depResolver == null) {
|
||||||
throw new BuildException("Unknown resolver: " + resolver);
|
throw new BuildException("Unknown resolver: " + resolver);
|
||||||
}
|
}
|
||||||
revisions = searcher.listModules(depResolver,
|
revisions = searcher.listModules(depResolver, mrid, patternMatcher);
|
||||||
ModuleRevisionId.newInstance(organisation, module, branch, ".*"), patternMatcher);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtifactInfo[] infos = new ArtifactInfo[revisions.length];
|
ArtifactInfo[] infos = new ArtifactInfo[revisions.length];
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,11 @@ public class IvyConfigure extends Task {
|
||||||
settings.setPasswd(passwd);
|
settings.setPasswd(passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addConfiguredWorkspaceResolver(AntWorkspaceResolver resolver) {
|
||||||
|
settings.addConfiguredWorkspaceResolver(resolver);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void execute() throws BuildException {
|
public void execute() throws BuildException {
|
||||||
String settingsId = settings.getId();
|
String settingsId = settings.getId();
|
||||||
Object otherRef = getProject().getReference(settingsId);
|
Object otherRef = getProject().getReference(settingsId);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
package org.apache.ivy.ant;
|
package org.apache.ivy.ant;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
||||||
|
|
@ -32,13 +31,13 @@ import org.apache.tools.ant.BuildException;
|
||||||
|
|
||||||
public class IvyDependency {
|
public class IvyDependency {
|
||||||
|
|
||||||
private List/* <IvyDependencyConf> */confs = new ArrayList();
|
private List<IvyDependencyConf> confs = new ArrayList<IvyDependencyConf>();
|
||||||
|
|
||||||
private List/* <IvyDependencyArtifact> */artifacts = new ArrayList();
|
private List<IvyDependencyArtifact> artifacts = new ArrayList<IvyDependencyArtifact>();
|
||||||
|
|
||||||
private List/* <IvyDependencyExclude> */excludes = new ArrayList();
|
private List<IvyDependencyExclude> excludes = new ArrayList<IvyDependencyExclude>();
|
||||||
|
|
||||||
private List/* <IvyDependencyIncludes> */includes = new ArrayList();
|
private List<IvyDependencyInclude> includes = new ArrayList<IvyDependencyInclude>();
|
||||||
|
|
||||||
private String org;
|
private String org;
|
||||||
|
|
||||||
|
|
@ -161,28 +160,20 @@ public class IvyDependency {
|
||||||
dd.addDependencyConfiguration(masterConf, "*");
|
dd.addDependencyConfiguration(masterConf, "*");
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator itConfs = confs.iterator();
|
for (IvyDependencyConf c : confs) {
|
||||||
while (itConfs.hasNext()) {
|
|
||||||
IvyDependencyConf c = (IvyDependencyConf) itConfs.next();
|
|
||||||
c.addConf(dd, masterConf);
|
c.addConf(dd, masterConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator itArtifacts = artifacts.iterator();
|
for (IvyDependencyArtifact artifact : artifacts) {
|
||||||
while (itArtifacts.hasNext()) {
|
|
||||||
IvyDependencyArtifact artifact = (IvyDependencyArtifact) itArtifacts.next();
|
|
||||||
artifact.addArtifact(dd, masterConf);
|
artifact.addArtifact(dd, masterConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator itExcludes = excludes.iterator();
|
for (IvyDependencyExclude exclude : excludes) {
|
||||||
while (itExcludes.hasNext()) {
|
|
||||||
IvyDependencyExclude exclude = (IvyDependencyExclude) itExcludes.next();
|
|
||||||
DefaultExcludeRule rule = exclude.asRule(settings);
|
DefaultExcludeRule rule = exclude.asRule(settings);
|
||||||
dd.addExcludeRule(masterConf, rule);
|
dd.addExcludeRule(masterConf, rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator itIncludes = includes.iterator();
|
for (IvyDependencyInclude include : includes) {
|
||||||
while (itIncludes.hasNext()) {
|
|
||||||
IvyDependencyInclude include = (IvyDependencyInclude) itIncludes.next();
|
|
||||||
DefaultIncludeRule rule = include.asRule(settings);
|
DefaultIncludeRule rule = include.asRule(settings);
|
||||||
dd.addIncludeRule(masterConf, rule);
|
dd.addIncludeRule(masterConf, rule);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,10 @@ public class IvyDependencyTree extends IvyPostResolveTask {
|
||||||
IvyNode dependency = (IvyNode) iterator.next();
|
IvyNode dependency = (IvyNode) iterator.next();
|
||||||
populateDependencyTree(dependency, mrid, report);
|
populateDependencyTree(dependency, mrid, report);
|
||||||
}
|
}
|
||||||
printDependencies((List) dependencies.get(mrid), 0);
|
List dependencyList = (List) dependencies.get(mrid);
|
||||||
|
if (dependencyList != null) {
|
||||||
|
printDependencies(dependencyList, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printDependencies(List/* <IvyNode> */dependencyList, int indent) {
|
private void printDependencies(List/* <IvyNode> */dependencyList, int indent) {
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,11 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
|
||||||
this.showTransitive = showTransitive;
|
this.showTransitive = showTransitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCheckIfChanged() {
|
||||||
|
return checkIfChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheckIfChanged(boolean checkIfChanged) {
|
||||||
|
this.checkIfChanged = checkIfChanged;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,14 @@ import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||||
import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorWriter;
|
import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorWriter;
|
||||||
import org.apache.ivy.plugins.parser.m2.PomWriterOptions;
|
import org.apache.ivy.plugins.parser.m2.PomWriterOptions;
|
||||||
|
import org.apache.ivy.plugins.parser.m2.PomWriterOptions.ExtraDependency;
|
||||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
||||||
import org.apache.ivy.util.FileUtil;
|
import org.apache.ivy.util.FileUtil;
|
||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
|
|
@ -152,9 +151,9 @@ public class IvyMakePom extends IvyTask {
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private Collection mappings = new ArrayList();
|
private List<Mapping> mappings = new ArrayList<Mapping>();
|
||||||
|
|
||||||
private Collection dependencies = new ArrayList();
|
private List<Dependency> dependencies = new ArrayList<Dependency>();
|
||||||
|
|
||||||
public File getPomFile() {
|
public File getPomFile() {
|
||||||
return pomFile;
|
return pomFile;
|
||||||
|
|
@ -240,6 +239,7 @@ public class IvyMakePom extends IvyTask {
|
||||||
return dependency;
|
return dependency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doExecute() throws BuildException {
|
public void doExecute() throws BuildException {
|
||||||
try {
|
try {
|
||||||
if (ivyFile == null) {
|
if (ivyFile == null) {
|
||||||
|
|
@ -281,10 +281,9 @@ public class IvyMakePom extends IvyTask {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getMappingsMap() {
|
private Map<String, String> getMappingsMap() {
|
||||||
Map mappingsMap = new HashMap();
|
Map<String, String> mappingsMap = new LinkedHashMap<String, String>();
|
||||||
for (Iterator iter = mappings.iterator(); iter.hasNext();) {
|
for (Mapping mapping : mappings) {
|
||||||
Mapping mapping = (Mapping) iter.next();
|
|
||||||
String[] mappingConfs = splitConfs(mapping.getConf());
|
String[] mappingConfs = splitConfs(mapping.getConf());
|
||||||
for (int i = 0; i < mappingConfs.length; i++) {
|
for (int i = 0; i < mappingConfs.length; i++) {
|
||||||
if (!mappingsMap.containsKey(mappingConfs[i])) {
|
if (!mappingsMap.containsKey(mappingConfs[i])) {
|
||||||
|
|
@ -295,13 +294,12 @@ public class IvyMakePom extends IvyTask {
|
||||||
return mappingsMap;
|
return mappingsMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getDependencies() {
|
private List<ExtraDependency> getDependencies() {
|
||||||
List result = new ArrayList();
|
List<ExtraDependency> result = new ArrayList<ExtraDependency>();
|
||||||
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
|
for (Dependency dependency : dependencies) {
|
||||||
Dependency dependency = (Dependency) iter.next();
|
result.add(new ExtraDependency(dependency.getGroup(), dependency.getArtifact(),
|
||||||
result.add(new PomWriterOptions.ExtraDependency(dependency.getGroup(), dependency
|
dependency.getVersion(), dependency.getScope(), dependency.getType(),
|
||||||
.getArtifact(), dependency.getVersion(), dependency.getScope(), dependency
|
dependency.getClassifier(), dependency.getOptional()));
|
||||||
.getType(), dependency.getClassifier(), dependency.getOptional()));
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class IvyPublish extends IvyTask {
|
||||||
|
|
||||||
private String publishResolverName = null;
|
private String publishResolverName = null;
|
||||||
|
|
||||||
private List artifactspattern = new ArrayList();
|
private List<String> artifactspattern = new ArrayList<String>();
|
||||||
|
|
||||||
private File deliveryList;
|
private File deliveryList;
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class IvyPublish extends IvyTask {
|
||||||
|
|
||||||
private boolean forcedeliver;
|
private boolean forcedeliver;
|
||||||
|
|
||||||
private Collection artifacts = new ArrayList();
|
private Collection<Artifact> artifacts = new ArrayList<Artifact>();
|
||||||
|
|
||||||
private String pubBranch;
|
private String pubBranch;
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ public class IvyPublish extends IvyTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArtifactspattern() {
|
public String getArtifactspattern() {
|
||||||
return (String) (artifactspattern.isEmpty() ? null : artifactspattern.get(0));
|
return artifactspattern.isEmpty() ? null : artifactspattern.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArtifactspattern(String artifactsPattern) {
|
public void setArtifactspattern(String artifactsPattern) {
|
||||||
|
|
@ -222,6 +222,7 @@ public class IvyPublish extends IvyTask {
|
||||||
this.merge = merge;
|
this.merge = merge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doExecute() throws BuildException {
|
public void doExecute() throws BuildException {
|
||||||
Ivy ivy = getIvyInstance();
|
Ivy ivy = getIvyInstance();
|
||||||
IvySettings settings = ivy.getSettings();
|
IvySettings settings = ivy.getSettings();
|
||||||
|
|
@ -312,14 +313,10 @@ public class IvyPublish extends IvyTask {
|
||||||
mrid,
|
mrid,
|
||||||
artifactspattern,
|
artifactspattern,
|
||||||
publishResolverName,
|
publishResolverName,
|
||||||
new PublishOptions()
|
new PublishOptions().setPubrevision(getPubrevision()).setPubbranch(getPubbranch())
|
||||||
.setPubrevision(getPubrevision())
|
.setSrcIvyPattern(publishivy ? srcivypattern : null).setStatus(getStatus())
|
||||||
.setPubbranch(getPubbranch())
|
|
||||||
.setSrcIvyPattern(publishivy ? srcivypattern : null)
|
|
||||||
.setStatus(getStatus())
|
|
||||||
.setPubdate(pubdate)
|
.setPubdate(pubdate)
|
||||||
.setExtraArtifacts(
|
.setExtraArtifacts(artifacts.toArray(new Artifact[artifacts.size()]))
|
||||||
(Artifact[]) artifacts.toArray(new Artifact[artifacts.size()]))
|
|
||||||
.setValidate(doValidate(settings)).setOverwrite(overwrite)
|
.setValidate(doValidate(settings)).setOverwrite(overwrite)
|
||||||
.setUpdate(update).setMerge(merge).setWarnOnMissing(warnonmissing)
|
.setUpdate(update).setMerge(merge).setWarnOnMissing(warnonmissing)
|
||||||
.setHaltOnMissing(haltonmissing).setConfs(splitConfs(conf)));
|
.setHaltOnMissing(haltonmissing).setConfs(splitConfs(conf)));
|
||||||
|
|
@ -392,7 +389,7 @@ public class IvyPublish extends IvyTask {
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private Map extra = new HashMap();
|
private Map<String, String> extra = new HashMap<String, String>();
|
||||||
|
|
||||||
public String[] getConfigurations() {
|
public String[] getConfigurations() {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -439,22 +436,22 @@ public class IvyPublish extends IvyTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAttribute(String attName) {
|
public String getAttribute(String attName) {
|
||||||
return (String) extra.get(attName);
|
return extra.get(attName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return extra;
|
return extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtraAttribute(String attName) {
|
public String getExtraAttribute(String attName) {
|
||||||
return (String) extra.get(attName);
|
return extra.get(attName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getExtraAttributes() {
|
public Map<String, String> getExtraAttributes() {
|
||||||
return extra;
|
return extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getQualifiedExtraAttributes() {
|
public Map<String, String> getQualifiedExtraAttributes() {
|
||||||
return extra;
|
return extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.ivy.Ivy;
|
import org.apache.ivy.Ivy;
|
||||||
|
|
@ -91,11 +90,11 @@ public class IvyResolve extends IvyTask {
|
||||||
|
|
||||||
private boolean checkIfChanged = true; // for backward compatibility
|
private boolean checkIfChanged = true; // for backward compatibility
|
||||||
|
|
||||||
private List/* <IvyDependency> */dependencies = new ArrayList();
|
private List<IvyDependency> dependencies = new ArrayList<IvyDependency>();
|
||||||
|
|
||||||
private List/* <IvyExclude> */excludes = new ArrayList();
|
private List<IvyExclude> excludes = new ArrayList<IvyExclude>();
|
||||||
|
|
||||||
private List/* <IvyConflict> */conflicts = new ArrayList();
|
private List<IvyConflict> conflicts = new ArrayList<IvyConflict>();
|
||||||
|
|
||||||
public boolean isUseOrigin() {
|
public boolean isUseOrigin() {
|
||||||
return useOrigin;
|
return useOrigin;
|
||||||
|
|
@ -229,11 +228,13 @@ public class IvyResolve extends IvyTask {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void prepareTask() {
|
protected void prepareTask() {
|
||||||
super.prepareTask();
|
super.prepareTask();
|
||||||
Message.setShowProgress(showProgress);
|
Message.setShowProgress(showProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doExecute() throws BuildException {
|
public void doExecute() throws BuildException {
|
||||||
Ivy ivy = getIvyInstance();
|
Ivy ivy = getIvyInstance();
|
||||||
IvySettings settings = ivy.getSettings();
|
IvySettings settings = ivy.getSettings();
|
||||||
|
|
@ -267,24 +268,18 @@ public class IvyResolve extends IvyTask {
|
||||||
Ivy.getWorkingRevision());
|
Ivy.getWorkingRevision());
|
||||||
DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(mrid, null);
|
DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(mrid, null);
|
||||||
|
|
||||||
Iterator itDeps = dependencies.iterator();
|
for (IvyDependency dep : dependencies) {
|
||||||
while (itDeps.hasNext()) {
|
|
||||||
IvyDependency dep = (IvyDependency) itDeps.next();
|
|
||||||
DependencyDescriptor dd = dep.asDependencyDescriptor(md, "default", settings);
|
DependencyDescriptor dd = dep.asDependencyDescriptor(md, "default", settings);
|
||||||
md.addDependency(dd);
|
md.addDependency(dd);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator itExcludes = excludes.iterator();
|
for (IvyExclude exclude : excludes) {
|
||||||
while (itExcludes.hasNext()) {
|
|
||||||
IvyExclude exclude = (IvyExclude) itExcludes.next();
|
|
||||||
DefaultExcludeRule rule = exclude.asRule(settings);
|
DefaultExcludeRule rule = exclude.asRule(settings);
|
||||||
rule.addConfiguration("default");
|
rule.addConfiguration("default");
|
||||||
md.addExcludeRule(rule);
|
md.addExcludeRule(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator itConflicts = conflicts.iterator();
|
for (IvyConflict conflict : conflicts) {
|
||||||
while (itConflicts.hasNext()) {
|
|
||||||
IvyConflict conflict = (IvyConflict) itConflicts.next();
|
|
||||||
conflict.addConflict(md, settings);
|
conflict.addConflict(md, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -426,9 +421,9 @@ public class IvyResolve extends IvyTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Collection/* <String> */getAllowedLogOptions() {
|
protected Collection<String> getAllowedLogOptions() {
|
||||||
return Arrays.asList(new String[] {LogOptions.LOG_DEFAULT, LogOptions.LOG_DOWNLOAD_ONLY,
|
return Arrays.asList(LogOptions.LOG_DEFAULT, LogOptions.LOG_DOWNLOAD_ONLY,
|
||||||
LogOptions.LOG_QUIET});
|
LogOptions.LOG_QUIET);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResolveOptions getResolveOptions(Ivy ivy, String[] confs, IvySettings settings) {
|
private ResolveOptions getResolveOptions(Ivy ivy, String[] confs, IvySettings settings) {
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,7 @@ public abstract class IvyTask extends Task {
|
||||||
/**
|
/**
|
||||||
* Ant task execute. Calls prepareTask, doExecute, finalzeTask
|
* Ant task execute. Calls prepareTask, doExecute, finalzeTask
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void execute() throws BuildException {
|
public final void execute() throws BuildException {
|
||||||
try {
|
try {
|
||||||
prepareTask();
|
prepareTask();
|
||||||
|
|
@ -282,6 +283,7 @@ public abstract class IvyTask extends Task {
|
||||||
*/
|
*/
|
||||||
public abstract void doExecute() throws BuildException;
|
public abstract void doExecute() throws BuildException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getName() + ":" + getTaskName();
|
return getClass().getName() + ":" + getTaskName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,5 @@
|
||||||
<taskdef name="fixdeps" classname="org.apache.ivy.ant.FixDepsTask" />
|
<taskdef name="fixdeps" classname="org.apache.ivy.ant.FixDepsTask" />
|
||||||
<taskdef name="dependencytree" classname="org.apache.ivy.ant.IvyDependencyTree"/>
|
<taskdef name="dependencytree" classname="org.apache.ivy.ant.IvyDependencyTree"/>
|
||||||
<taskdef name="checkdepsupdate" classname="org.apache.ivy.ant.IvyDependencyUpdateChecker"/>
|
<taskdef name="checkdepsupdate" classname="org.apache.ivy.ant.IvyDependencyUpdateChecker"/>
|
||||||
|
<typedef name="workspaceresolver" classname="org.apache.ivy.ant.AntWorkspaceResolver" />
|
||||||
</antlib>
|
</antlib>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ public class CacheMetadataOptions extends CacheDownloadOptions {
|
||||||
|
|
||||||
private boolean checkTTL = true;
|
private boolean checkTTL = true;
|
||||||
|
|
||||||
|
private boolean useCacheOnly = false;
|
||||||
|
|
||||||
public Namespace getNamespace() {
|
public Namespace getNamespace() {
|
||||||
return namespace;
|
return namespace;
|
||||||
}
|
}
|
||||||
|
|
@ -85,4 +87,13 @@ public class CacheMetadataOptions extends CacheDownloadOptions {
|
||||||
public boolean isCheckTTL() {
|
public boolean isCheckTTL() {
|
||||||
return checkTTL;
|
return checkTTL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CacheMetadataOptions setUseCacheOnly(boolean useCacheOnly) {
|
||||||
|
this.useCacheOnly = useCacheOnly;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUseCacheOnly() {
|
||||||
|
return useCacheOnly;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
@ -114,7 +113,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
|
|
||||||
private Boolean useOrigin;
|
private Boolean useOrigin;
|
||||||
|
|
||||||
private ModuleRules/* <Long> */ttlRules = new ModuleRules();
|
private ModuleRules<Long> ttlRules = new ModuleRules<Long>();
|
||||||
|
|
||||||
private Long defaultTTL = null;
|
private Long defaultTTL = null;
|
||||||
|
|
||||||
|
|
@ -188,17 +187,17 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
|
|
||||||
public long getDefaultTTL() {
|
public long getDefaultTTL() {
|
||||||
if (defaultTTL == null) {
|
if (defaultTTL == null) {
|
||||||
defaultTTL = new Long(parseDuration(settings.getVariable("ivy.cache.ttl.default")));
|
defaultTTL = Long.valueOf(parseDuration(settings.getVariable("ivy.cache.ttl.default")));
|
||||||
}
|
}
|
||||||
return defaultTTL.longValue();
|
return defaultTTL.longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultTTL(long defaultTTL) {
|
public void setDefaultTTL(long defaultTTL) {
|
||||||
this.defaultTTL = new Long(defaultTTL);
|
this.defaultTTL = Long.valueOf(defaultTTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultTTL(String defaultTTL) {
|
public void setDefaultTTL(String defaultTTL) {
|
||||||
this.defaultTTL = new Long(parseDuration(defaultTTL));
|
this.defaultTTL = Long.valueOf(parseDuration(defaultTTL));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataFilePattern() {
|
public String getDataFilePattern() {
|
||||||
|
|
@ -239,16 +238,16 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
this.changingPattern = changingPattern;
|
this.changingPattern = changingPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTTL(Map attributes, PatternMatcher matcher, long duration) {
|
public void addTTL(Map<String, String> attributes, PatternMatcher matcher, long duration) {
|
||||||
ttlRules.defineRule(new MapMatcher(attributes, matcher), new Long(duration));
|
ttlRules.defineRule(new MapMatcher(attributes, matcher), new Long(duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConfiguredTtl(Map/* <String,String> */attributes) {
|
public void addConfiguredTtl(Map<String, String> attributes) {
|
||||||
String duration = (String) attributes.remove("duration");
|
String duration = attributes.remove("duration");
|
||||||
if (duration == null) {
|
if (duration == null) {
|
||||||
throw new IllegalArgumentException("'duration' attribute is mandatory for ttl");
|
throw new IllegalArgumentException("'duration' attribute is mandatory for ttl");
|
||||||
}
|
}
|
||||||
String matcher = (String) attributes.remove("matcher");
|
String matcher = attributes.remove("matcher");
|
||||||
addTTL(attributes,
|
addTTL(attributes,
|
||||||
matcher == null ? ExactPatternMatcher.INSTANCE : settings.getMatcher(matcher),
|
matcher == null ? ExactPatternMatcher.INSTANCE : settings.getMatcher(matcher),
|
||||||
parseDuration(duration));
|
parseDuration(duration));
|
||||||
|
|
@ -295,10 +294,9 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
|
|
||||||
return days * MILLIS_IN_DAY + hours * MILLIS_IN_HOUR + minutes * MILLIS_IN_MINUTES
|
return days * MILLIS_IN_DAY + hours * MILLIS_IN_HOUR + minutes * MILLIS_IN_MINUTES
|
||||||
+ seconds * MILLIS_IN_SECONDS + millis;
|
+ seconds * MILLIS_IN_SECONDS + millis;
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("invalid duration '" + duration
|
|
||||||
+ "': it must match " + DURATION_PATTERN.pattern() + " or 'eternal'");
|
|
||||||
}
|
}
|
||||||
|
throw new IllegalArgumentException("invalid duration '" + duration
|
||||||
|
+ "': it must match " + DURATION_PATTERN.pattern() + " or 'eternal'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getGroupIntValue(java.util.regex.Matcher m, int groupNumber) {
|
private int getGroupIntValue(java.util.regex.Matcher m, int groupNumber) {
|
||||||
|
|
@ -309,19 +307,14 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
/**
|
/**
|
||||||
* True if this cache should check lastmodified date to know if ivy files are up to date.
|
* True if this cache should check lastmodified date to know if ivy files are up to date.
|
||||||
*
|
*
|
||||||
* @return
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isCheckmodified() {
|
public boolean isCheckmodified() {
|
||||||
if (checkmodified == null) {
|
if (checkmodified == null) {
|
||||||
if (getSettings() != null) {
|
return getSettings() != null && Boolean
|
||||||
String check = getSettings().getVariable("ivy.resolver.default.check.modified");
|
.parseBoolean(getSettings().getVariable("ivy.resolver.default.check.modified"));
|
||||||
return check != null ? Boolean.valueOf(check).booleanValue() : false;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return checkmodified.booleanValue();
|
|
||||||
}
|
}
|
||||||
|
return checkmodified.booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCheckmodified(boolean check) {
|
public void setCheckmodified(boolean check) {
|
||||||
|
|
@ -334,14 +327,9 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
*/
|
*/
|
||||||
public boolean isUseOrigin() {
|
public boolean isUseOrigin() {
|
||||||
if (useOrigin == null) {
|
if (useOrigin == null) {
|
||||||
if (getSettings() != null) {
|
return getSettings() != null && getSettings().isDefaultUseOrigin();
|
||||||
return getSettings().isDefaultUseOrigin();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return useOrigin.booleanValue();
|
|
||||||
}
|
}
|
||||||
|
return useOrigin.booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOrigin(boolean b) {
|
public void setUseOrigin(boolean b) {
|
||||||
|
|
@ -384,9 +372,8 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
private File getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin, boolean useOrigin) {
|
private File getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin, boolean useOrigin) {
|
||||||
if (useOrigin && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
|
if (useOrigin && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
|
||||||
return Checks.checkAbsolute(origin.getLocation(), artifact + " origin location");
|
return Checks.checkAbsolute(origin.getLocation(), artifact + " origin location");
|
||||||
} else {
|
|
||||||
return new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
|
|
||||||
}
|
}
|
||||||
|
return new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArchivePathInCache(Artifact artifact) {
|
public String getArchivePathInCache(Artifact artifact) {
|
||||||
|
|
@ -396,9 +383,8 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
public String getArchivePathInCache(Artifact artifact, ArtifactOrigin origin) {
|
public String getArchivePathInCache(Artifact artifact, ArtifactOrigin origin) {
|
||||||
if (isOriginalMetadataArtifact(artifact)) {
|
if (isOriginalMetadataArtifact(artifact)) {
|
||||||
return IvyPatternHelper.substitute(getIvyPattern() + ".original", artifact, origin);
|
return IvyPatternHelper.substitute(getIvyPattern() + ".original", artifact, origin);
|
||||||
} else {
|
|
||||||
return IvyPatternHelper.substitute(getArtifactPattern(), artifact, origin);
|
|
||||||
}
|
}
|
||||||
|
return IvyPatternHelper.substitute(getArtifactPattern(), artifact, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -423,7 +409,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
*
|
*
|
||||||
* @param md
|
* @param md
|
||||||
* the module descriptor resolved
|
* the module descriptor resolved
|
||||||
* @param name
|
* @param artifactResolverName
|
||||||
* artifact resolver name
|
* artifact resolver name
|
||||||
*/
|
*/
|
||||||
public void saveResolvers(ModuleDescriptor md, String metadataResolverName,
|
public void saveResolvers(ModuleDescriptor md, String metadataResolverName,
|
||||||
|
|
@ -531,10 +517,8 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
// try to find other cached artifact info with same location. This must be the
|
// try to find other cached artifact info with same location. This must be the
|
||||||
// origin. We must parse the key as we do not know for sure what the original
|
// origin. We must parse the key as we do not know for sure what the original
|
||||||
// artifact is named.
|
// artifact is named.
|
||||||
Iterator it = cdf.entrySet().iterator();
|
|
||||||
String ownLocationKey = getLocationKey(artifact);
|
String ownLocationKey = getLocationKey(artifact);
|
||||||
while (it.hasNext()) {
|
for (Map.Entry<Object, Object> entry : cdf.entrySet()) {
|
||||||
Map.Entry entry = (Map.Entry) it.next();
|
|
||||||
if (entry.getValue().equals(location)
|
if (entry.getValue().equals(location)
|
||||||
&& !ownLocationKey.equals(entry.getKey())) {
|
&& !ownLocationKey.equals(entry.getKey())) {
|
||||||
// found a match, key is
|
// found a match, key is
|
||||||
|
|
@ -576,7 +560,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
origin.setLastChecked(Long.valueOf(lastChecked));
|
origin.setLastChecked(Long.valueOf(lastChecked));
|
||||||
}
|
}
|
||||||
if (exists != null) {
|
if (exists != null) {
|
||||||
origin.setExist(Boolean.valueOf(exists).booleanValue());
|
origin.setExist(Boolean.parseBoolean(exists));
|
||||||
}
|
}
|
||||||
|
|
||||||
return origin;
|
return origin;
|
||||||
|
|
@ -669,6 +653,17 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
getDataFilePattern(), mRevId)), "ivy cached data file for " + mRevId);
|
getDataFilePattern(), mRevId)), "ivy cached data file for " + mRevId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A resolver-specific ivydata file, only used for caching dynamic revisions, e.g.
|
||||||
|
* integration-repo.
|
||||||
|
*/
|
||||||
|
private PropertiesFile getCachedDataFile(String resolverName, ModuleRevisionId mRevId) {
|
||||||
|
// we append ".${resolverName} onto the end of the regular ivydata location
|
||||||
|
return new PropertiesFile(new File(getRepositoryCacheRoot(),
|
||||||
|
IvyPatternHelper.substitute(getDataFilePattern(), mRevId) + "." + resolverName),
|
||||||
|
"ivy cached data file for " + mRevId);
|
||||||
|
}
|
||||||
|
|
||||||
public ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd,
|
public ResolvedModuleRevision findModuleInCache(DependencyDescriptor dd,
|
||||||
ModuleRevisionId requestedRevisionId, CacheMetadataOptions options,
|
ModuleRevisionId requestedRevisionId, CacheMetadataOptions options,
|
||||||
String expectedResolver) {
|
String expectedResolver) {
|
||||||
|
|
@ -677,7 +672,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
Message.verbose("don't use cache for " + mrid + ": checkModified=true");
|
Message.verbose("don't use cache for " + mrid + ": checkModified=true");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isChanging(dd, requestedRevisionId, options)) {
|
if (!options.isUseCacheOnly() && isChanging(dd, requestedRevisionId, options)) {
|
||||||
Message.verbose("don't use cache for " + mrid + ": changing=true");
|
Message.verbose("don't use cache for " + mrid + ": changing=true");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -695,25 +690,24 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (settings.getVersionMatcher().isDynamic(mrid)) {
|
if (settings.getVersionMatcher().isDynamic(mrid)) {
|
||||||
String resolvedRevision = getResolvedRevision(mrid, options);
|
String resolvedRevision = getResolvedRevision(expectedResolver, mrid, options);
|
||||||
if (resolvedRevision != null) {
|
if (resolvedRevision == null) {
|
||||||
Message.verbose("found resolved revision in cache: " + mrid + " => "
|
return null;
|
||||||
+ resolvedRevision);
|
}
|
||||||
|
Message.verbose("found resolved revision in cache: " + mrid + " => "
|
||||||
|
+ resolvedRevision);
|
||||||
|
|
||||||
// we have found another module in the cache, make sure we unlock
|
// we have found another module in the cache, make sure we unlock
|
||||||
// the original module
|
// the original module
|
||||||
unlockMetadataArtifact(mrid);
|
unlockMetadataArtifact(mrid);
|
||||||
mrid = ModuleRevisionId.newInstance(mrid, resolvedRevision);
|
mrid = ModuleRevisionId.newInstance(mrid, resolvedRevision);
|
||||||
|
|
||||||
// don't forget to request a lock on the new module!
|
// don't forget to request a lock on the new module!
|
||||||
if (!lockMetadataArtifact(mrid)) {
|
if (!lockMetadataArtifact(mrid)) {
|
||||||
Message.error("impossible to acquire lock for " + mrid);
|
Message.error("impossible to acquire lock for " + mrid);
|
||||||
|
|
||||||
// we couldn't lock the new module, so no need to unlock it
|
// we couldn't lock the new module, so no need to unlock it
|
||||||
unlock = false;
|
unlock = false;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -766,11 +760,10 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ResolvedModuleRevision(resolver, artResolver, depMD, madr);
|
return new ResolvedModuleRevision(resolver, artResolver, depMD, madr);
|
||||||
} else {
|
|
||||||
Message.debug("found module in cache but with a different resolver: "
|
|
||||||
+ "discarding: " + mrid + "; expected resolver="
|
|
||||||
+ expectedResolver + "; resolver=" + resolver.getName());
|
|
||||||
}
|
}
|
||||||
|
Message.debug("found module in cache but with a different resolver: "
|
||||||
|
+ "discarding: " + mrid + "; expected resolver="
|
||||||
|
+ expectedResolver + "; resolver=" + resolver.getName());
|
||||||
} else {
|
} else {
|
||||||
Message.debug("\tresolver not found: " + resolverName
|
Message.debug("\tresolver not found: " + resolverName
|
||||||
+ " => cannot use cached ivy file for " + mrid);
|
+ " => cannot use cached ivy file for " + mrid);
|
||||||
|
|
@ -834,19 +827,28 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
return cache.getStale(ivyFile, settings, options.isValidate(), mdProvider);
|
return cache.getStale(ivyFile, settings, options.isValidate(), mdProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getResolvedRevision(ModuleRevisionId mrid, CacheMetadataOptions options) {
|
/**
|
||||||
|
* Called by doFindModuleInCache to lookup the dynamic {@code mrid} in the ivycache's ivydata
|
||||||
|
* file.
|
||||||
|
*/
|
||||||
|
private String getResolvedRevision(String expectedResolver, ModuleRevisionId mrid, CacheMetadataOptions options) {
|
||||||
if (!lockMetadataArtifact(mrid)) {
|
if (!lockMetadataArtifact(mrid)) {
|
||||||
Message.error("impossible to acquire lock for " + mrid);
|
Message.error("impossible to acquire lock for " + mrid);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String resolvedRevision = null;
|
|
||||||
if (options.isForce()) {
|
if (options.isForce()) {
|
||||||
Message.verbose("refresh mode: no check for cached resolved revision for " + mrid);
|
Message.verbose("refresh mode: no check for cached resolved revision for " + mrid);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PropertiesFile cachedResolvedRevision = getCachedDataFile(mrid);
|
// If a resolver is asking for its specific dynamic revision, avoid looking at a different one
|
||||||
resolvedRevision = cachedResolvedRevision.getProperty("resolved.revision");
|
PropertiesFile cachedResolvedRevision;
|
||||||
|
if (expectedResolver != null) {
|
||||||
|
cachedResolvedRevision = getCachedDataFile(expectedResolver, mrid);
|
||||||
|
} else {
|
||||||
|
cachedResolvedRevision = getCachedDataFile(mrid);
|
||||||
|
}
|
||||||
|
String resolvedRevision = cachedResolvedRevision.getProperty("resolved.revision");
|
||||||
if (resolvedRevision == null) {
|
if (resolvedRevision == null) {
|
||||||
Message.verbose(getName() + ": no cached resolved revision for " + mrid);
|
Message.verbose(getName() + ": no cached resolved revision for " + mrid);
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -875,15 +877,27 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveResolvedRevision(ModuleRevisionId mrid, String revision) {
|
public void saveResolvedRevision(ModuleRevisionId mrid, String revision) {
|
||||||
|
saveResolvedRevision(null, mrid, revision);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveResolvedRevision(String resolverName, ModuleRevisionId mrid, String revision) {
|
||||||
if (!lockMetadataArtifact(mrid)) {
|
if (!lockMetadataArtifact(mrid)) {
|
||||||
Message.error("impossible to acquire lock for " + mrid);
|
Message.error("impossible to acquire lock for " + mrid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PropertiesFile cachedResolvedRevision = getCachedDataFile(mrid);
|
PropertiesFile cachedResolvedRevision;
|
||||||
|
if (resolverName == null) {
|
||||||
|
cachedResolvedRevision = getCachedDataFile(mrid);
|
||||||
|
} else {
|
||||||
|
cachedResolvedRevision = getCachedDataFile(resolverName, mrid);
|
||||||
|
}
|
||||||
cachedResolvedRevision.setProperty("resolved.time",
|
cachedResolvedRevision.setProperty("resolved.time",
|
||||||
String.valueOf(System.currentTimeMillis()));
|
String.valueOf(System.currentTimeMillis()));
|
||||||
cachedResolvedRevision.setProperty("resolved.revision", revision);
|
cachedResolvedRevision.setProperty("resolved.revision", revision);
|
||||||
|
if (resolverName != null) {
|
||||||
|
cachedResolvedRevision.setProperty("resolver", resolverName);
|
||||||
|
}
|
||||||
cachedResolvedRevision.save();
|
cachedResolvedRevision.save();
|
||||||
} finally {
|
} finally {
|
||||||
unlockMetadataArtifact(mrid);
|
unlockMetadataArtifact(mrid);
|
||||||
|
|
@ -891,10 +905,11 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTTL(ModuleRevisionId mrid) {
|
public long getTTL(ModuleRevisionId mrid) {
|
||||||
Long ttl = (Long) ttlRules.getRule(mrid);
|
Long ttl = ttlRules.getRule(mrid);
|
||||||
return ttl == null ? getDefaultTTL() : ttl.longValue();
|
return ttl == null ? getDefaultTTL() : ttl.longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
@ -1028,11 +1043,13 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
File archiveFile = getArchiveFileInCache(unpacked, null, false);
|
File archiveFile = getArchiveFileInCache(unpacked, null, false);
|
||||||
if (archiveFile.exists() && !options.isForce()) {
|
if (archiveFile.exists() && !options.isForce()) {
|
||||||
adr.setUnpackedLocalFile(archiveFile);
|
adr.setUnpackedLocalFile(archiveFile);
|
||||||
|
adr.setUnpackedArtifact(unpacked);
|
||||||
} else {
|
} else {
|
||||||
Message.info("\tUnpacking " + artifact.getId());
|
Message.info("\tUnpacking " + artifact.getId());
|
||||||
try {
|
try {
|
||||||
packagingManager.unpackArtifact(artifact, adr.getLocalFile(), archiveFile);
|
final Artifact unpackedArtifact = packagingManager.unpackArtifact(artifact, adr.getLocalFile(), archiveFile);
|
||||||
adr.setUnpackedLocalFile(archiveFile);
|
adr.setUnpackedLocalFile(archiveFile);
|
||||||
|
adr.setUnpackedArtifact(unpackedArtifact);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Message.debug(e);
|
Message.debug(e);
|
||||||
adr.setDownloadStatus(DownloadStatus.FAILED);
|
adr.setDownloadStatus(DownloadStatus.FAILED);
|
||||||
|
|
@ -1141,13 +1158,12 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
* @return the hash
|
* @return the hash
|
||||||
*/
|
*/
|
||||||
private String computeResourceNameHash(Resource resource) {
|
private String computeResourceNameHash(Resource resource) {
|
||||||
byte[] shaDigest;
|
|
||||||
try {
|
try {
|
||||||
shaDigest = SHA_DIGEST.digest(resource.getName().getBytes("UTF-8"));
|
byte[] shaDigest = SHA_DIGEST.digest(resource.getName().getBytes("UTF-8"));
|
||||||
|
return HexEncoder.encode(shaDigest);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RuntimeException("UTF-8 not supported", e);
|
throw new RuntimeException("UTF-8 not supported", e);
|
||||||
}
|
}
|
||||||
return HexEncoder.encode(shaDigest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1171,18 +1187,13 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
if (savedOrigin.getLastChecked() != null
|
if (savedOrigin.getLastChecked() != null
|
||||||
&& (time - savedOrigin.getLastChecked().longValue()) < ttl) {
|
&& (time - savedOrigin.getLastChecked().longValue()) < ttl) {
|
||||||
// still in the ttl period, no need to check, trust the cache
|
// still in the ttl period, no need to check, trust the cache
|
||||||
if (!archiveFile.exists()) {
|
return archiveFile.exists() || !savedOrigin.isExists();
|
||||||
// but if the local archive doesn't exist, trust the cache only if the cached origin
|
|
||||||
// says that the remote resource doesn't exist either
|
|
||||||
return !savedOrigin.isExists();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (!archiveFile.exists()) {
|
if (!archiveFile.exists()) {
|
||||||
// the the file doesn't exist in the cache, obviously not up to date
|
// the the file doesn't exist in the cache, obviously not up to date
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
origin.setLastChecked(new Long(time));
|
origin.setLastChecked(Long.valueOf(time));
|
||||||
// check if the local resource is up to date regarding the remote one
|
// check if the local resource is up to date regarding the remote one
|
||||||
return archiveFile.lastModified() >= resource.getLastModified();
|
return archiveFile.lastModified() >= resource.getLastModified();
|
||||||
}
|
}
|
||||||
|
|
@ -1285,16 +1296,15 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
+ mrid);
|
+ mrid);
|
||||||
rmr.getReport().setSearched(true);
|
rmr.getReport().setSearched(true);
|
||||||
return rmr;
|
return rmr;
|
||||||
} else {
|
}
|
||||||
Message.verbose("\t" + getName()
|
Message.verbose("\t" + getName()
|
||||||
+ ": revision in cache is not up to date: " + mrid);
|
+ ": revision in cache is not up to date: " + mrid);
|
||||||
if (isChanging(dd, mrid, options)) {
|
if (isChanging(dd, mrid, options)) {
|
||||||
// ivy file has been updated, we should see if it has a new publication
|
// ivy file has been updated, we should see if it has a new publication
|
||||||
// date to see if a new download is required (in case the dependency is
|
// date to see if a new download is required (in case the dependency is
|
||||||
// a changing one)
|
// a changing one)
|
||||||
cachedPublicationDate = rmr.getDescriptor()
|
cachedPublicationDate = rmr.getDescriptor()
|
||||||
.getResolvedPublicationDate();
|
.getResolvedPublicationDate();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1327,9 +1337,8 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
parserSettings);
|
parserSettings);
|
||||||
if (md == null) {
|
if (md == null) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"module descriptor parser returned a null module descriptor, "
|
"module descriptor parser returned a null module descriptor, which is not allowed. parser="
|
||||||
+ "which is not allowed. " + "parser=" + parser
|
+ parser + "; parser class=" + parser.getClass().getName()
|
||||||
+ "; parser class=" + parser.getClass().getName()
|
|
||||||
+ "; module descriptor resource=" + mdRef.getResource());
|
+ "; module descriptor resource=" + mdRef.getResource());
|
||||||
}
|
}
|
||||||
Message.debug("\t" + getName() + ": parsed downloaded md file for " + mrid
|
Message.debug("\t" + getName() + ": parsed downloaded md file for " + mrid
|
||||||
|
|
@ -1344,11 +1353,9 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
deleteOldArtifacts = true;
|
deleteOldArtifacts = true;
|
||||||
}
|
}
|
||||||
if (deleteOldArtifacts) {
|
if (deleteOldArtifacts) {
|
||||||
String[] confs = md.getConfigurationsNames();
|
for (String conf : md.getConfigurationsNames()) {
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (Artifact art : md.getArtifacts(conf)) {
|
||||||
Artifact[] arts = md.getArtifacts(confs[i]);
|
Artifact transformedArtifact = NameSpaceHelper.transform(art,
|
||||||
for (int j = 0; j < arts.length; j++) {
|
|
||||||
Artifact transformedArtifact = NameSpaceHelper.transform(arts[j],
|
|
||||||
options.getNamespace().getToSystemTransformer());
|
options.getNamespace().getToSystemTransformer());
|
||||||
ArtifactOrigin origin = getSavedArtifactOrigin(transformedArtifact);
|
ArtifactOrigin origin = getSavedArtifactOrigin(transformedArtifact);
|
||||||
File artFile = getArchiveFileInCache(transformedArtifact, origin, false);
|
File artFile = getArchiveFileInCache(transformedArtifact, origin, false);
|
||||||
|
|
@ -1430,7 +1437,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
return new DefaultArtifact(mrid, new Date(), "metadata", "metadata", "ivy", true);
|
return new DefaultArtifact(mrid, new Date(), "metadata", "metadata", "ivy", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not used any more, but maybe useful for finer grain locking when downloading artifacts
|
// not used any more, but may be useful for finer grained locking when downloading artifacts
|
||||||
// private boolean lockArtifact(Artifact artifact) {
|
// private boolean lockArtifact(Artifact artifact) {
|
||||||
// try {
|
// try {
|
||||||
// return getLockStrategy().lockArtifact(artifact,
|
// return getLockStrategy().lockArtifact(artifact,
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,12 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getResolutionCacheRoot() {
|
public File getResolutionCacheRoot() {
|
||||||
|
if (basedir == null) {
|
||||||
|
if (settings == null) {
|
||||||
|
throw new IllegalStateException("The 'basedir' or 'IvySettings' has not been set on the ResolutionCacheManager");
|
||||||
|
}
|
||||||
|
basedir = settings.getDefaultResolutionCacheBasedir();
|
||||||
|
}
|
||||||
return basedir;
|
return basedir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,7 +219,7 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clean() {
|
public void clean() {
|
||||||
FileUtil.forceDelete(getBasedir());
|
FileUtil.forceDelete(getResolutionCacheRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CacheParserSettings implements ParserSettings {
|
private static class CacheParserSettings implements ParserSettings {
|
||||||
|
|
@ -274,6 +280,10 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
|
||||||
public Namespace getContextNamespace() {
|
public Namespace getContextNamespace() {
|
||||||
return delegate.getContextNamespace();
|
return delegate.getContextNamespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVariable(String value) {
|
||||||
|
return delegate.getVariable(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MapURLResolver extends RelativeUrlResolver {
|
private static class MapURLResolver extends RelativeUrlResolver {
|
||||||
|
|
|
||||||
|
|
@ -150,5 +150,9 @@ class ParserSettingsMonitor {
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVariable(String value) {
|
||||||
|
return delegatedSettings.getVariable(value);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,22 @@ public interface RepositoryCacheManager {
|
||||||
* the dynamic module revision id
|
* the dynamic module revision id
|
||||||
* @param revision
|
* @param revision
|
||||||
* the resolved revision
|
* the resolved revision
|
||||||
|
* @deprecated See {@link #saveResolvedRevision(String, ModuleRevisionId, String)} which
|
||||||
|
* prevents cache + * thrashing when multiple resolvers store the same dynamicMrid
|
||||||
*/
|
*/
|
||||||
public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision);
|
public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Caches a dynamic revision constraint resolution for a specific resolver.
|
||||||
|
*
|
||||||
|
* @param resolverName
|
||||||
|
* the resolver in which this dynamic revision was resolved
|
||||||
|
* @param dynamicMrid
|
||||||
|
* the dynamic module revision id
|
||||||
|
* @param revision
|
||||||
|
* the resolved revision
|
||||||
|
*/
|
||||||
|
public void saveResolvedRevision(String resolverName, ModuleRevisionId dynamicMrid,
|
||||||
|
String revision);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,15 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection/* <Configuration> */findConfigurationExtending(String conf,
|
public static Collection<Configuration> findConfigurationExtending(String conf,
|
||||||
Configuration[] confs) {
|
Configuration[] confs) {
|
||||||
Collection extendingConfs = new ArrayList();
|
Collection<Configuration> extendingConfs = new ArrayList<Configuration>();
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (int i = 0; i < confs.length; i++) {
|
||||||
if (confs[i] != null && Arrays.asList(confs[i].getExtends()).contains(conf)) {
|
if (confs[i] != null && Arrays.asList(confs[i].getExtends()).contains(conf)) {
|
||||||
extendingConfs.add(confs[i]);
|
extendingConfs.add(confs[i]);
|
||||||
|
|
@ -120,9 +121,9 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
|
||||||
this(null, null, name, visibility, description, ext, transitive, deprecated, null);
|
this(null, null, name, visibility, description, ext, transitive, deprecated, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Configuration(Map attributes, Map extraAttributes, String name, Visibility visibility,
|
private Configuration(Map<String, String> attributes, Map<String, String> extraAttributes,
|
||||||
String description, String[] ext, boolean transitive, String deprecated,
|
String name, Visibility visibility, String description, String[] ext,
|
||||||
ModuleRevisionId sourceModule) {
|
boolean transitive, String deprecated, ModuleRevisionId sourceModule) {
|
||||||
super(attributes, extraAttributes);
|
super(attributes, extraAttributes);
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
|
@ -195,10 +196,12 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
|
||||||
return sourceModule;
|
return sourceModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof Configuration)) {
|
if (!(obj instanceof Configuration)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -206,6 +209,7 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
|
||||||
return ((Configuration) obj).getName().equals(getName());
|
return ((Configuration) obj).getName().equals(getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getName().hashCode();
|
return getName().hashCode();
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +222,7 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
|
||||||
|
|
||||||
Configuration[] configs = md.getConfigurations();
|
Configuration[] configs = md.getConfigurations();
|
||||||
|
|
||||||
Set newExtends = new LinkedHashSet();
|
Set<String> newExtends = new LinkedHashSet<String>();
|
||||||
for (int j = 0; j < extendsFrom.length; j++) {
|
for (int j = 0; j < extendsFrom.length; j++) {
|
||||||
if ("*".equals(extendsFrom[j])) {
|
if ("*".equals(extendsFrom[j])) {
|
||||||
addOther(configs, null, newExtends);
|
addOther(configs, null, newExtends);
|
||||||
|
|
@ -231,10 +235,10 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.extendsFrom = (String[]) newExtends.toArray(new String[newExtends.size()]);
|
this.extendsFrom = newExtends.toArray(new String[newExtends.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOther(Configuration[] allConfigs, Visibility visibility, Set configs) {
|
private void addOther(Configuration[] allConfigs, Visibility visibility, Set<String> configs) {
|
||||||
for (int i = 0; i < allConfigs.length; i++) {
|
for (int i = 0; i < allConfigs.length; i++) {
|
||||||
String currentName = allConfigs[i].getName();
|
String currentName = allConfigs[i].getName();
|
||||||
if (!name.equals(currentName)
|
if (!name.equals(currentName)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -210,13 +209,13 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
|
|
||||||
private Date resolvedPublicationDate;
|
private Date resolvedPublicationDate;
|
||||||
|
|
||||||
private List dependencies = new ArrayList(); // List (DependencyDescriptor)
|
private List<DependencyDescriptor> dependencies = new ArrayList<DependencyDescriptor>();
|
||||||
|
|
||||||
private Map configurations = new LinkedHashMap(); // Map(String conf -> Configuration)
|
private Map<String, Configuration> configurations = new LinkedHashMap<String, Configuration>();
|
||||||
|
|
||||||
private Map artifactsByConf = new HashMap(); // Map (String conf -> Collection(Artifact))
|
private Map<String, Collection<Artifact>> artifactsByConf = new HashMap<String, Collection<Artifact>>();
|
||||||
|
|
||||||
private Collection artifacts = new LinkedHashSet(); // Collection(Artifact)
|
private Collection<Artifact> artifacts = new LinkedHashSet<Artifact>();
|
||||||
|
|
||||||
// all artifacts could also be found in the artifactsByConf map, but here we can
|
// all artifacts could also be found in the artifactsByConf map, but here we can
|
||||||
// preserve the order
|
// preserve the order
|
||||||
|
|
@ -227,7 +226,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
|
|
||||||
private ModuleRules dependencyDescriptorMediators = new ModuleRules();
|
private ModuleRules dependencyDescriptorMediators = new ModuleRules();
|
||||||
|
|
||||||
private List licenses = new ArrayList(); // List(License)
|
private List<License> licenses = new ArrayList<License>();
|
||||||
|
|
||||||
private String homePage;
|
private String homePage;
|
||||||
|
|
||||||
|
|
@ -247,13 +246,13 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
|
|
||||||
private Resource resource;
|
private Resource resource;
|
||||||
|
|
||||||
private List excludeRules = new ArrayList(); // List(ExcludeRule)
|
private List<ExcludeRule> excludeRules = new ArrayList<ExcludeRule>();
|
||||||
|
|
||||||
private Artifact metadataArtifact;
|
private Artifact metadataArtifact;
|
||||||
|
|
||||||
private List inheritedDescriptors = new ArrayList(); // List(ExtendsDescriptor)
|
private List<ExtendsDescriptor> inheritedDescriptors = new ArrayList<ExtendsDescriptor>();
|
||||||
|
|
||||||
private Map/* <String,String> */extraAttributesNamespaces = new LinkedHashMap();
|
private Map<String, String> extraAttributesNamespaces = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
private List<ExtraInfoHolder> extraInfos = new ArrayList<ExtraInfoHolder>();
|
private List<ExtraInfoHolder> extraInfos = new ArrayList<ExtraInfoHolder>();
|
||||||
|
|
||||||
|
|
@ -381,9 +380,9 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
addArtifact(members[i], artifact);
|
addArtifact(members[i], artifact);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Collection artifacts = (Collection) artifactsByConf.get(conf);
|
Collection<Artifact> artifacts = artifactsByConf.get(conf);
|
||||||
if (artifacts == null) {
|
if (artifacts == null) {
|
||||||
artifacts = new ArrayList();
|
artifacts = new ArrayList<Artifact>();
|
||||||
artifactsByConf.put(conf, artifacts);
|
artifactsByConf.put(conf, artifacts);
|
||||||
}
|
}
|
||||||
artifacts.add(artifact);
|
artifacts.add(artifact);
|
||||||
|
|
@ -404,28 +403,25 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendsDescriptor[] getInheritedDescriptors() {
|
public ExtendsDescriptor[] getInheritedDescriptors() {
|
||||||
return (ExtendsDescriptor[]) inheritedDescriptors
|
return inheritedDescriptors.toArray(new ExtendsDescriptor[inheritedDescriptors.size()]);
|
||||||
.toArray(new ExtendsDescriptor[inheritedDescriptors.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configuration[] getConfigurations() {
|
public Configuration[] getConfigurations() {
|
||||||
return (Configuration[]) configurations.values().toArray(
|
return configurations.values().toArray(new Configuration[configurations.size()]);
|
||||||
new Configuration[configurations.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getConfigurationsNames() {
|
public String[] getConfigurationsNames() {
|
||||||
return (String[]) configurations.keySet().toArray(new String[configurations.size()]);
|
return configurations.keySet().toArray(new String[configurations.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPublicConfigurationsNames() {
|
public String[] getPublicConfigurationsNames() {
|
||||||
List ret = new ArrayList();
|
List<String> ret = new ArrayList<String>();
|
||||||
for (Iterator iter = configurations.values().iterator(); iter.hasNext();) {
|
for (Configuration conf : configurations.values()) {
|
||||||
Configuration conf = (Configuration) iter.next();
|
|
||||||
if (conf.getVisibility() == Configuration.Visibility.PUBLIC) {
|
if (conf.getVisibility() == Configuration.Visibility.PUBLIC) {
|
||||||
ret.add(conf.getName());
|
ret.add(conf.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (String[]) ret.toArray(new String[ret.size()]);
|
return ret.toArray(new String[ret.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -433,7 +429,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
* if not found.
|
* if not found.
|
||||||
*/
|
*/
|
||||||
public Configuration getConfiguration(String confName) {
|
public Configuration getConfiguration(String confName) {
|
||||||
Configuration configuration = (Configuration) configurations.get(confName);
|
Configuration configuration = configurations.get(confName);
|
||||||
if (configuration == null && confName != null) {
|
if (configuration == null && confName != null) {
|
||||||
// let's first check if the configuration is a conf group
|
// let's first check if the configuration is a conf group
|
||||||
Matcher m = Pattern.compile("\\*\\[([^=]+)\\=([^\\]]+)\\]").matcher(confName);
|
Matcher m = Pattern.compile("\\*\\[([^=]+)\\=([^\\]]+)\\]").matcher(confName);
|
||||||
|
|
@ -442,9 +438,8 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
String attValue = m.group(2);
|
String attValue = m.group(2);
|
||||||
|
|
||||||
// this is a conf group, let's search for its members
|
// this is a conf group, let's search for its members
|
||||||
Map /* <String,Configuration> */members = new LinkedHashMap();
|
Map<String, Configuration> members = new LinkedHashMap<String, Configuration>();
|
||||||
for (Iterator it = configurations.values().iterator(); it.hasNext();) {
|
for (Configuration conf : configurations.values()) {
|
||||||
Configuration conf = (Configuration) it.next();
|
|
||||||
if (attValue.equals(conf.getAttribute(attName))) {
|
if (attValue.equals(conf.getAttribute(attName))) {
|
||||||
members.put(conf.getName(), conf);
|
members.put(conf.getName(), conf);
|
||||||
}
|
}
|
||||||
|
|
@ -457,9 +452,9 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
if (confs.length <= 1) {
|
if (confs.length <= 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map /* <String,Configuration> */intersectedConfs = new LinkedHashMap();
|
Map<String, Configuration> intersectedConfs = new LinkedHashMap<String, Configuration>();
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (int i = 0; i < confs.length; i++) {
|
||||||
Configuration c = (Configuration) configurations.get(confs[i]);
|
Configuration c = configurations.get(confs[i]);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
Message.verbose("missing configuration '" + confs[i] + "' from intersection "
|
Message.verbose("missing configuration '" + confs[i] + "' from intersection "
|
||||||
+ confName + " in " + this);
|
+ confName + " in " + this);
|
||||||
|
|
@ -477,13 +472,13 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
return new Artifact[0];
|
return new Artifact[0];
|
||||||
}
|
}
|
||||||
Collection artifacts = (Collection) artifactsByConf.get(conf);
|
Collection<Artifact> artifacts = artifactsByConf.get(conf);
|
||||||
if (c instanceof ConfigurationIntersection) {
|
if (c instanceof ConfigurationIntersection) {
|
||||||
ConfigurationIntersection intersection = (ConfigurationIntersection) c;
|
ConfigurationIntersection intersection = (ConfigurationIntersection) c;
|
||||||
String[] intersected = intersection.getIntersectedConfigurationNames();
|
String[] intersected = intersection.getIntersectedConfigurationNames();
|
||||||
Set/* <Artifact> */intersectedArtifacts = new LinkedHashSet();
|
Set<Artifact> intersectedArtifacts = new LinkedHashSet<Artifact>();
|
||||||
for (int j = 0; j < intersected.length; j++) {
|
for (int j = 0; j < intersected.length; j++) {
|
||||||
Collection arts = getArtifactsIncludingExtending(intersected[j]);
|
Collection<Artifact> arts = getArtifactsIncludingExtending(intersected[j]);
|
||||||
if (intersectedArtifacts.isEmpty()) {
|
if (intersectedArtifacts.isEmpty()) {
|
||||||
intersectedArtifacts.addAll(arts);
|
intersectedArtifacts.addAll(arts);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -493,39 +488,37 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
if (artifacts != null) {
|
if (artifacts != null) {
|
||||||
intersectedArtifacts.addAll(artifacts);
|
intersectedArtifacts.addAll(artifacts);
|
||||||
}
|
}
|
||||||
return (Artifact[]) intersectedArtifacts.toArray(new Artifact[intersectedArtifacts
|
return intersectedArtifacts.toArray(new Artifact[intersectedArtifacts.size()]);
|
||||||
.size()]);
|
|
||||||
} else if (c instanceof ConfigurationGroup) {
|
} else if (c instanceof ConfigurationGroup) {
|
||||||
ConfigurationGroup group = (ConfigurationGroup) c;
|
ConfigurationGroup group = (ConfigurationGroup) c;
|
||||||
String[] members = group.getMembersConfigurationNames();
|
String[] members = group.getMembersConfigurationNames();
|
||||||
Set/* <Artifact> */groupArtifacts = new LinkedHashSet();
|
Set<Artifact> groupArtifacts = new LinkedHashSet<Artifact>();
|
||||||
for (int i = 0; i < members.length; i++) {
|
for (int i = 0; i < members.length; i++) {
|
||||||
groupArtifacts.addAll(getArtifactsIncludingExtending(members[i]));
|
groupArtifacts.addAll(getArtifactsIncludingExtending(members[i]));
|
||||||
}
|
}
|
||||||
if (artifacts != null) {
|
if (artifacts != null) {
|
||||||
groupArtifacts.addAll(artifacts);
|
groupArtifacts.addAll(artifacts);
|
||||||
}
|
}
|
||||||
return (Artifact[]) groupArtifacts.toArray(new Artifact[groupArtifacts.size()]);
|
return groupArtifacts.toArray(new Artifact[groupArtifacts.size()]);
|
||||||
} else {
|
} else {
|
||||||
if (artifacts == null) {
|
if (artifacts == null) {
|
||||||
return new Artifact[0];
|
return new Artifact[0];
|
||||||
} else {
|
} else {
|
||||||
return (Artifact[]) artifacts.toArray(new Artifact[artifacts.size()]);
|
return artifacts.toArray(new Artifact[artifacts.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection/* <Artifact> */getArtifactsIncludingExtending(String conf) {
|
private Collection<Artifact> getArtifactsIncludingExtending(String conf) {
|
||||||
Collection extendingConfs = Configuration.findConfigurationExtending(conf,
|
Collection<Configuration> extendingConfs = Configuration.findConfigurationExtending(conf,
|
||||||
getConfigurations());
|
getConfigurations());
|
||||||
Set/* <Artifact> */artifacts = new LinkedHashSet();
|
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
|
||||||
Collection arts = (Collection) artifactsByConf.get(conf);
|
Collection<Artifact> arts = artifactsByConf.get(conf);
|
||||||
if (arts != null) {
|
if (arts != null) {
|
||||||
artifacts.addAll(arts);
|
artifacts.addAll(arts);
|
||||||
}
|
}
|
||||||
for (Iterator it = extendingConfs.iterator(); it.hasNext();) {
|
for (Configuration extendingConf : extendingConfs) {
|
||||||
Configuration extendingConf = (Configuration) it.next();
|
arts = artifactsByConf.get(extendingConf.getName());
|
||||||
arts = (Collection) artifactsByConf.get(extendingConf.getName());
|
|
||||||
if (arts != null) {
|
if (arts != null) {
|
||||||
artifacts.addAll(arts);
|
artifacts.addAll(arts);
|
||||||
}
|
}
|
||||||
|
|
@ -534,17 +527,15 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Artifact[] getAllArtifacts() {
|
public Artifact[] getAllArtifacts() {
|
||||||
return (Artifact[]) artifacts.toArray(new Artifact[artifacts.size()]);
|
return artifacts.toArray(new Artifact[artifacts.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DependencyDescriptor[] getDependencies() {
|
public DependencyDescriptor[] getDependencies() {
|
||||||
return (DependencyDescriptor[]) dependencies.toArray(new DependencyDescriptor[dependencies
|
return dependencies.toArray(new DependencyDescriptor[dependencies.size()]);
|
||||||
.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean dependsOn(VersionMatcher matcher, ModuleDescriptor md) {
|
public boolean dependsOn(VersionMatcher matcher, ModuleDescriptor md) {
|
||||||
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
|
for (DependencyDescriptor dd : dependencies) {
|
||||||
DependencyDescriptor dd = (DependencyDescriptor) iter.next();
|
|
||||||
if (dd.getDependencyId().equals(md.getModuleRevisionId().getModuleId())) {
|
if (dd.getDependencyId().equals(md.getModuleRevisionId().getModuleId())) {
|
||||||
if (md.getResolvedModuleRevisionId().getRevision() == null) {
|
if (md.getResolvedModuleRevisionId().getRevision() == null) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -564,6 +555,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
@ -571,6 +563,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -592,6 +585,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "module: " + revId + " status=" + status + " publication=" + publicationDate
|
return "module: " + revId + " status=" + status + " publication=" + publicationDate
|
||||||
+ " configurations=" + configurations + " artifacts=" + artifactsByConf
|
+ " configurations=" + configurations + " artifacts=" + artifactsByConf
|
||||||
|
|
@ -633,7 +627,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
return dd;
|
return dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModuleRules/* <DependencyDescriptorMediator> */getAllDependencyDescriptorMediators() {
|
public ModuleRules getAllDependencyDescriptorMediators() {
|
||||||
return (ModuleRules) dependencyDescriptorMediators.clone();
|
return (ModuleRules) dependencyDescriptorMediators.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -642,7 +636,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public License[] getLicenses() {
|
public License[] getLicenses() {
|
||||||
return (License[]) licenses.toArray(new License[licenses.size()]);
|
return licenses.toArray(new License[licenses.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHomePage() {
|
public String getHomePage() {
|
||||||
|
|
@ -674,8 +668,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNamespaceUseful() {
|
public boolean isNamespaceUseful() {
|
||||||
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
|
for (DependencyDescriptor dd : dependencies) {
|
||||||
DependencyDescriptor dd = (DependencyDescriptor) iter.next();
|
|
||||||
if (dd.getAllExcludeRules().length > 0) {
|
if (dd.getAllExcludeRules().length > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -692,9 +685,8 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
* configurations existence and cycles are checked
|
* configurations existence and cycles are checked
|
||||||
*/
|
*/
|
||||||
public void check() {
|
public void check() {
|
||||||
Stack confs = new Stack();
|
Stack<String> confs = new Stack<String>();
|
||||||
for (Iterator iter = configurations.values().iterator(); iter.hasNext();) {
|
for (Configuration conf : configurations.values()) {
|
||||||
Configuration conf = (Configuration) iter.next();
|
|
||||||
String[] ext = conf.getExtends();
|
String[] ext = conf.getExtends();
|
||||||
for (int i = 0; i < ext.length; i++) {
|
for (int i = 0; i < ext.length; i++) {
|
||||||
confs.push(conf.getName());
|
confs.push(conf.getName());
|
||||||
|
|
@ -704,7 +696,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkConf(Stack confs, String confName) {
|
private void checkConf(Stack<String> confs, String confName) {
|
||||||
int index = confs.indexOf(confName);
|
int index = confs.indexOf(confName);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
StringBuffer cycle = new StringBuffer();
|
StringBuffer cycle = new StringBuffer();
|
||||||
|
|
@ -756,7 +748,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
return resolvedRevId.getAttribute(attName);
|
return resolvedRevId.getAttribute(attName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return resolvedRevId.getAttributes();
|
return resolvedRevId.getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -764,11 +756,11 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
return resolvedRevId.getExtraAttribute(attName);
|
return resolvedRevId.getExtraAttribute(attName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getExtraAttributes() {
|
public Map<String, String> getExtraAttributes() {
|
||||||
return resolvedRevId.getExtraAttributes();
|
return resolvedRevId.getExtraAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getQualifiedExtraAttributes() {
|
public Map<String, String> getQualifiedExtraAttributes() {
|
||||||
return resolvedRevId.getQualifiedExtraAttributes();
|
return resolvedRevId.getQualifiedExtraAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -807,26 +799,25 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExcludeRule[] getAllExcludeRules() {
|
public ExcludeRule[] getAllExcludeRules() {
|
||||||
return (ExcludeRule[]) excludeRules.toArray(new ExcludeRule[excludeRules.size()]);
|
return excludeRules.toArray(new ExcludeRule[excludeRules.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExcludeRule[] getExcludeRules(String[] moduleConfigurations) {
|
public ExcludeRule[] getExcludeRules(String[] moduleConfigurations) {
|
||||||
Set rules = new LinkedHashSet();
|
Set<ExcludeRule> rules = new LinkedHashSet<ExcludeRule>();
|
||||||
for (Iterator iter = excludeRules.iterator(); iter.hasNext();) {
|
for (ExcludeRule rule : excludeRules) {
|
||||||
ExcludeRule rule = (ExcludeRule) iter.next();
|
|
||||||
String[] ruleConfs = rule.getConfigurations();
|
String[] ruleConfs = rule.getConfigurations();
|
||||||
if (containsAny(ruleConfs, moduleConfigurations)) {
|
if (containsAny(ruleConfs, moduleConfigurations)) {
|
||||||
rules.add(rule);
|
rules.add(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ExcludeRule[]) rules.toArray(new ExcludeRule[rules.size()]);
|
return rules.toArray(new ExcludeRule[rules.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean containsAny(String[] arr1, String[] arr2) {
|
private boolean containsAny(String[] arr1, String[] arr2) {
|
||||||
return new ArrayList(Arrays.asList(arr1)).removeAll(Arrays.asList(arr2));
|
return new ArrayList<String>(Arrays.asList(arr1)).removeAll(Arrays.asList(arr2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getExtraAttributesNamespaces() {
|
public Map<String, String> getExtraAttributesNamespaces() {
|
||||||
return extraAttributesNamespaces;
|
return extraAttributesNamespaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.apache.ivy.core.module.descriptor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||||
|
import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
|
||||||
|
import org.apache.ivy.plugins.repository.Resource;
|
||||||
|
|
||||||
|
public class DefaultWorkspaceModuleDescriptor extends DefaultModuleDescriptor implements
|
||||||
|
WorkspaceModuleDescriptor {
|
||||||
|
|
||||||
|
public DefaultWorkspaceModuleDescriptor(ModuleDescriptorParser parser, Resource res) {
|
||||||
|
super(parser, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultWorkspaceModuleDescriptor(ModuleRevisionId id, String status, Date pubDate) {
|
||||||
|
super(id, status, pubDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultWorkspaceModuleDescriptor(ModuleRevisionId id, String status, Date pubDate,
|
||||||
|
boolean isDefault) {
|
||||||
|
super(id, status, pubDate, isDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -15,20 +15,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.apache.ivy.ant;
|
package org.apache.ivy.core.module.descriptor;
|
||||||
|
|
||||||
import org.apache.tools.ant.DefaultLogger;
|
/**
|
||||||
import org.apache.tools.ant.Project;
|
* Marker interface for module descriptor of a module in a workspace, then having special semantics,
|
||||||
|
* like artifacts declared by the resolver rather than the descriptor
|
||||||
|
*/
|
||||||
|
public interface WorkspaceModuleDescriptor extends ModuleDescriptor {
|
||||||
|
|
||||||
public class AntTestHelper {
|
|
||||||
// this is probably already available in some Ant class or helper...
|
|
||||||
public static Project newProject() {
|
|
||||||
Project project = new Project();
|
|
||||||
DefaultLogger logger = new DefaultLogger();
|
|
||||||
logger.setMessageOutputLevel(Project.MSG_INFO);
|
|
||||||
logger.setOutputPrintStream(System.out);
|
|
||||||
logger.setErrorPrintStream(System.out);
|
|
||||||
project.addBuildListener(logger);
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,6 @@ package org.apache.ivy.core.module.id;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -56,13 +55,13 @@ import org.apache.ivy.plugins.matcher.PatternMatcher;
|
||||||
*/
|
*/
|
||||||
public class MatcherLookup {
|
public class MatcherLookup {
|
||||||
|
|
||||||
//private static final String FORMAT = "{org:%s, module:%s}";
|
// private static final String FORMAT = "{org:%s, module:%s}";
|
||||||
|
|
||||||
private static final String DEFAULT = "{org:" + "default" + ", module:" + "default" + "}";
|
private static final String DEFAULT = "{org:" + "default" + ", module:" + "default" + "}";
|
||||||
|
|
||||||
private Map/* <String, List<MapMatcher>> */lookup = new HashMap();
|
private Map<String, List<MapMatcher>> lookup = new HashMap<String, List<MapMatcher>>();
|
||||||
|
|
||||||
private List/* <MapMatcher> */non_exact_matchers = new ArrayList();
|
private List<MapMatcher> non_exact_matchers = new ArrayList<MapMatcher>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add matcher.
|
* Add matcher.
|
||||||
|
|
@ -79,10 +78,10 @@ public class MatcherLookup {
|
||||||
non_exact_matchers.add(matcher);
|
non_exact_matchers.add(matcher);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object key = key(matcher.getAttributes());
|
String key = key(matcher.getAttributes());
|
||||||
List exact_matchers = (List) lookup.get(key);
|
List<MapMatcher> exact_matchers = lookup.get(key);
|
||||||
if (exact_matchers == null) {
|
if (exact_matchers == null) {
|
||||||
exact_matchers = new ArrayList();
|
exact_matchers = new ArrayList<MapMatcher>();
|
||||||
lookup.put(key, exact_matchers);
|
lookup.put(key, exact_matchers);
|
||||||
}
|
}
|
||||||
exact_matchers.add(matcher);
|
exact_matchers.add(matcher);
|
||||||
|
|
@ -96,23 +95,21 @@ public class MatcherLookup {
|
||||||
*
|
*
|
||||||
* @return list A list of candidate matchers that matches specified attributes
|
* @return list A list of candidate matchers that matches specified attributes
|
||||||
*/
|
*/
|
||||||
public List get(Map attrs) {
|
public List<MapMatcher> get(Map<String, String> attrs) {
|
||||||
List matchers = new ArrayList();
|
List<MapMatcher> matchers = new ArrayList<MapMatcher>();
|
||||||
// Step 1: find matchers from non_exact_matchers list
|
// Step 1: find matchers from non_exact_matchers list
|
||||||
if (!non_exact_matchers.isEmpty()) {
|
if (!non_exact_matchers.isEmpty()) {
|
||||||
for (Iterator iter = non_exact_matchers.iterator(); iter.hasNext();) {
|
for (MapMatcher matcher : non_exact_matchers) {
|
||||||
MapMatcher matcher = (MapMatcher) iter.next();
|
|
||||||
if (matcher.matches(attrs)) {
|
if (matcher.matches(attrs)) {
|
||||||
matchers.add(matcher);
|
matchers.add(matcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Step 2: find matchers from exact_matchers list of key
|
// Step 2: find matchers from exact_matchers list of key
|
||||||
Object key = key(attrs);
|
String key = key(attrs);
|
||||||
List exact_matchers = (List) lookup.get(key);
|
List<MapMatcher> exact_matchers = lookup.get(key);
|
||||||
if (exact_matchers != null) {
|
if (exact_matchers != null) {
|
||||||
for (Iterator iter = exact_matchers.iterator(); iter.hasNext();) {
|
for (MapMatcher matcher : exact_matchers) {
|
||||||
MapMatcher matcher = (MapMatcher) iter.next();
|
|
||||||
if (matcher.matches(attrs)) {
|
if (matcher.matches(attrs)) {
|
||||||
matchers.add(matcher);
|
matchers.add(matcher);
|
||||||
}
|
}
|
||||||
|
|
@ -120,10 +117,9 @@ public class MatcherLookup {
|
||||||
}
|
}
|
||||||
// Step 3: (iff key != DEFAULT) find matchers from exact_matchers of DEFAULT
|
// Step 3: (iff key != DEFAULT) find matchers from exact_matchers of DEFAULT
|
||||||
if (key != DEFAULT) {
|
if (key != DEFAULT) {
|
||||||
List default_exact_matchers = (List) lookup.get(DEFAULT);
|
List<MapMatcher> default_exact_matchers = lookup.get(DEFAULT);
|
||||||
if (default_exact_matchers != null) {
|
if (default_exact_matchers != null) {
|
||||||
for (Iterator iter = default_exact_matchers.iterator(); iter.hasNext();) {
|
for (MapMatcher matcher : default_exact_matchers) {
|
||||||
MapMatcher matcher = (MapMatcher) iter.next();
|
|
||||||
if (matcher.matches(attrs)) {
|
if (matcher.matches(attrs)) {
|
||||||
matchers.add(matcher);
|
matchers.add(matcher);
|
||||||
}
|
}
|
||||||
|
|
@ -140,9 +136,9 @@ public class MatcherLookup {
|
||||||
* A map of attributes
|
* A map of attributes
|
||||||
* @return key object
|
* @return key object
|
||||||
*/
|
*/
|
||||||
private Object key(Map attrs) {
|
private String key(Map<String, String> attrs) {
|
||||||
Object org = attrs.get(IvyPatternHelper.ORGANISATION_KEY);
|
String org = attrs.get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
Object module = attrs.get(IvyPatternHelper.MODULE_KEY);
|
String module = attrs.get(IvyPatternHelper.MODULE_KEY);
|
||||||
if (org == null || PatternMatcher.ANY_EXPRESSION.equals(org) || module == null
|
if (org == null || PatternMatcher.ANY_EXPRESSION.equals(org) || module == null
|
||||||
|| PatternMatcher.ANY_EXPRESSION.equals(module)) {
|
|| PatternMatcher.ANY_EXPRESSION.equals(module)) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,11 @@ import org.apache.ivy.core.IvyPatternHelper;
|
||||||
*
|
*
|
||||||
* @see <a href="package-summary.html">org.apache.ivy.core.module.id</a>
|
* @see <a href="package-summary.html">org.apache.ivy.core.module.id</a>
|
||||||
*/
|
*/
|
||||||
public class ModuleId implements Comparable {
|
public class ModuleId implements Comparable<ModuleId> {
|
||||||
|
|
||||||
static final String ENCODE_SEPARATOR = ":#@#:";
|
static final String ENCODE_SEPARATOR = ":#@#:";
|
||||||
|
|
||||||
private static final Map/* <ModuleId, WeakReference<ModuleId>> */CACHE = new WeakHashMap();
|
private static final Map<ModuleId, WeakReference<ModuleId>> CACHE = new WeakHashMap<ModuleId, WeakReference<ModuleId>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a ModuleId for the given organization and module name.
|
* Returns a ModuleId for the given organization and module name.
|
||||||
|
|
@ -65,13 +66,13 @@ public class ModuleId implements Comparable {
|
||||||
ModuleId r = null;
|
ModuleId r = null;
|
||||||
|
|
||||||
synchronized (CACHE) {
|
synchronized (CACHE) {
|
||||||
WeakReference ref = (WeakReference) CACHE.get(moduleId);
|
WeakReference<ModuleId> ref = CACHE.get(moduleId);
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
r = (ModuleId) ref.get();
|
r = ref.get();
|
||||||
}
|
}
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
r = moduleId;
|
r = moduleId;
|
||||||
CACHE.put(r, new WeakReference(r));
|
CACHE.put(r, new WeakReference<ModuleId>(r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,7 +85,7 @@ public class ModuleId implements Comparable {
|
||||||
|
|
||||||
private int hash;
|
private int hash;
|
||||||
|
|
||||||
private Map/* <String, String> */attributes = new HashMap();
|
private Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
@ -122,7 +123,7 @@ public class ModuleId implements Comparable {
|
||||||
return organisation;
|
return organisation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof ModuleId)) {
|
if (!(obj instanceof ModuleId)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -135,7 +136,7 @@ public class ModuleId implements Comparable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
if (hash == 0) {
|
if (hash == 0) {
|
||||||
// CheckStyle:MagicNumber| OFF
|
// CheckStyle:MagicNumber| OFF
|
||||||
|
|
@ -147,14 +148,12 @@ public class ModuleId implements Comparable {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return organisation + "#" + name;
|
return organisation + "#" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
public int compareTo(ModuleId that) {
|
||||||
public int compareTo(Object obj) {
|
|
||||||
ModuleId that = (ModuleId) obj;
|
|
||||||
int result = organisation.compareTo(that.organisation);
|
int result = organisation.compareTo(that.organisation);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = name.compareTo(that.name);
|
result = name.compareTo(that.name);
|
||||||
|
|
@ -177,7 +176,7 @@ public class ModuleId implements Comparable {
|
||||||
*
|
*
|
||||||
* @return A Map instance containing all the attributes and their values.
|
* @return A Map instance containing all the attributes and their values.
|
||||||
*/
|
*/
|
||||||
public Map getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ package org.apache.ivy.core.module.id;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
@ -36,6 +36,7 @@ import org.apache.ivy.util.extendable.UnmodifiableExtendableItem;
|
||||||
* @see <a href="package-summary.html">org.apache.ivy.core.module.id</a>
|
* @see <a href="package-summary.html">org.apache.ivy.core.module.id</a>
|
||||||
*/
|
*/
|
||||||
public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
|
|
||||||
private static final String ENCODE_SEPARATOR = ModuleId.ENCODE_SEPARATOR;
|
private static final String ENCODE_SEPARATOR = ModuleId.ENCODE_SEPARATOR;
|
||||||
|
|
||||||
private static final String ENCODE_PREFIX = "+";
|
private static final String ENCODE_PREFIX = "+";
|
||||||
|
|
@ -46,7 +47,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
|
|
||||||
private static final String REV_STRICT_CHARS_PATTERN = "[a-zA-Z0-9\\-/\\._+=,\\[\\]\\{\\}\\(\\):@]";
|
private static final String REV_STRICT_CHARS_PATTERN = "[a-zA-Z0-9\\-/\\._+=,\\[\\]\\{\\}\\(\\):@]";
|
||||||
|
|
||||||
private static final Map/* <ModuleRevisionId, ModuleRevisionId> */CACHE = new WeakHashMap();
|
private static final Map<ModuleRevisionId, WeakReference<ModuleRevisionId>> CACHE = new WeakHashMap<ModuleRevisionId, WeakReference<ModuleRevisionId>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pattern to use to matched mrid text representation.
|
* Pattern to use to matched mrid text representation.
|
||||||
|
|
@ -97,7 +98,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModuleRevisionId newInstance(String organisation, String name, String revision,
|
public static ModuleRevisionId newInstance(String organisation, String name, String revision,
|
||||||
Map extraAttributes) {
|
Map<String, String> extraAttributes) {
|
||||||
return intern(new ModuleRevisionId(ModuleId.newInstance(organisation, name), revision,
|
return intern(new ModuleRevisionId(ModuleId.newInstance(organisation, name), revision,
|
||||||
extraAttributes));
|
extraAttributes));
|
||||||
}
|
}
|
||||||
|
|
@ -109,13 +110,14 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModuleRevisionId newInstance(String organisation, String name, String branch,
|
public static ModuleRevisionId newInstance(String organisation, String name, String branch,
|
||||||
String revision, Map extraAttributes) {
|
String revision, Map<String, String> extraAttributes) {
|
||||||
return intern(new ModuleRevisionId(ModuleId.newInstance(organisation, name), branch,
|
return intern(new ModuleRevisionId(ModuleId.newInstance(organisation, name), branch,
|
||||||
revision, extraAttributes));
|
revision, extraAttributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModuleRevisionId newInstance(String organisation, String name, String branch,
|
public static ModuleRevisionId newInstance(String organisation, String name, String branch,
|
||||||
String revision, Map extraAttributes, boolean replaceNullBranchWithDefault) {
|
String revision, Map<String, String> extraAttributes,
|
||||||
|
boolean replaceNullBranchWithDefault) {
|
||||||
return intern(new ModuleRevisionId(ModuleId.newInstance(organisation, name), branch,
|
return intern(new ModuleRevisionId(ModuleId.newInstance(organisation, name), branch,
|
||||||
revision, extraAttributes, replaceNullBranchWithDefault));
|
revision, extraAttributes, replaceNullBranchWithDefault));
|
||||||
}
|
}
|
||||||
|
|
@ -149,13 +151,13 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
ModuleRevisionId r = null;
|
ModuleRevisionId r = null;
|
||||||
|
|
||||||
synchronized (CACHE) {
|
synchronized (CACHE) {
|
||||||
WeakReference ref = (WeakReference) CACHE.get(moduleRevisionId);
|
WeakReference<ModuleRevisionId> ref = CACHE.get(moduleRevisionId);
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
r = (ModuleRevisionId) ref.get();
|
r = ref.get();
|
||||||
}
|
}
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
r = moduleRevisionId;
|
r = moduleRevisionId;
|
||||||
CACHE.put(r, new WeakReference(r));
|
CACHE.put(r, new WeakReference<ModuleRevisionId>(r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,16 +182,17 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
this(moduleId, branch, revision, null);
|
this(moduleId, branch, revision, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleRevisionId(ModuleId moduleId, String revision, Map extraAttributes) {
|
private ModuleRevisionId(ModuleId moduleId, String revision, Map<String, String> extraAttributes) {
|
||||||
this(moduleId, null, revision, extraAttributes);
|
this(moduleId, null, revision, extraAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleRevisionId(ModuleId moduleId, String branch, String revision, Map extraAttributes) {
|
private ModuleRevisionId(ModuleId moduleId, String branch, String revision,
|
||||||
|
Map<String, String> extraAttributes) {
|
||||||
this(moduleId, branch, revision, extraAttributes, true);
|
this(moduleId, branch, revision, extraAttributes, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleRevisionId(ModuleId moduleId, String branch, String revision,
|
private ModuleRevisionId(ModuleId moduleId, String branch, String revision,
|
||||||
Map extraAttributes, boolean replaceNullBranchWithDefault) {
|
Map<String, String> extraAttributes, boolean replaceNullBranchWithDefault) {
|
||||||
super(null, extraAttributes);
|
super(null, extraAttributes);
|
||||||
this.moduleId = moduleId;
|
this.moduleId = moduleId;
|
||||||
IvyContext context = IvyContext.getContext();
|
IvyContext context = IvyContext.getContext();
|
||||||
|
|
@ -221,6 +224,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
return revision;
|
return revision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof ModuleRevisionId)) {
|
if (!(obj instanceof ModuleRevisionId)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -240,6 +244,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
if (hash == 0) {
|
if (hash == 0) {
|
||||||
// CheckStyle:MagicNumber| OFF
|
// CheckStyle:MagicNumber| OFF
|
||||||
|
|
@ -253,6 +258,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return moduleId + (branch == null || branch.length() == 0 ? "" : "#" + branch) + ";"
|
return moduleId + (branch == null || branch.length() == 0 ? "" : "#" + branch) + ";"
|
||||||
+ (revision == null ? "NONE" : revision);
|
+ (revision == null ? "NONE" : revision);
|
||||||
|
|
@ -260,13 +266,13 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
|
|
||||||
public String encodeToString() {
|
public String encodeToString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
Map attributes = new HashMap(getAttributes());
|
Map<String, String> attributes = new HashMap<String, String>(getAttributes());
|
||||||
attributes.keySet().removeAll(getExtraAttributes().keySet());
|
attributes.keySet().removeAll(getExtraAttributes().keySet());
|
||||||
attributes.putAll(getQualifiedExtraAttributes());
|
attributes.putAll(getQualifiedExtraAttributes());
|
||||||
|
|
||||||
for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) {
|
for (Entry<String, String> att : attributes.entrySet()) {
|
||||||
String attName = (String) iter.next();
|
String attName = att.getKey();
|
||||||
String value = (String) attributes.get(attName);
|
String value = att.getValue();
|
||||||
value = value == null ? NULL_ENCODE : value;
|
value = value == null ? NULL_ENCODE : value;
|
||||||
buf.append(ENCODE_PREFIX).append(attName).append(ENCODE_SEPARATOR)
|
buf.append(ENCODE_PREFIX).append(attName).append(ENCODE_SEPARATOR)
|
||||||
.append(ENCODE_PREFIX).append(value).append(ENCODE_SEPARATOR);
|
.append(ENCODE_PREFIX).append(value).append(ENCODE_SEPARATOR);
|
||||||
|
|
@ -280,7 +286,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
throw new IllegalArgumentException("badly encoded module revision id: '" + encoded
|
throw new IllegalArgumentException("badly encoded module revision id: '" + encoded
|
||||||
+ "'");
|
+ "'");
|
||||||
}
|
}
|
||||||
Map attributes = new HashMap();
|
Map<String, String> attributes = new HashMap<String, String>();
|
||||||
for (int i = 0; i < parts.length; i += 2) {
|
for (int i = 0; i < parts.length; i += 2) {
|
||||||
String attName = parts[i];
|
String attName = parts[i];
|
||||||
if (!attName.startsWith(ENCODE_PREFIX)) {
|
if (!attName.startsWith(ENCODE_PREFIX)) {
|
||||||
|
|
@ -301,10 +307,10 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
|
||||||
}
|
}
|
||||||
attributes.put(attName, attValue);
|
attributes.put(attName, attValue);
|
||||||
}
|
}
|
||||||
String org = (String) attributes.remove(IvyPatternHelper.ORGANISATION_KEY);
|
String org = attributes.remove(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
String mod = (String) attributes.remove(IvyPatternHelper.MODULE_KEY);
|
String mod = attributes.remove(IvyPatternHelper.MODULE_KEY);
|
||||||
String rev = (String) attributes.remove(IvyPatternHelper.REVISION_KEY);
|
String rev = attributes.remove(IvyPatternHelper.REVISION_KEY);
|
||||||
String branch = (String) attributes.remove(IvyPatternHelper.BRANCH_KEY);
|
String branch = attributes.remove(IvyPatternHelper.BRANCH_KEY);
|
||||||
if (org == null) {
|
if (org == null) {
|
||||||
throw new IllegalArgumentException("badly encoded module revision id: '" + encoded
|
throw new IllegalArgumentException("badly encoded module revision id: '" + encoded
|
||||||
+ "': no organisation");
|
+ "': no organisation");
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ package org.apache.ivy.core.module.id;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.apache.ivy.plugins.matcher.MapMatcher;
|
import org.apache.ivy.plugins.matcher.MapMatcher;
|
||||||
import org.apache.ivy.util.Checks;
|
import org.apache.ivy.util.Checks;
|
||||||
|
|
@ -49,8 +49,9 @@ import org.apache.ivy.util.filter.NoFilter;
|
||||||
* which resolver to use, which TTL in cache, ...)
|
* which resolver to use, which TTL in cache, ...)
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public class ModuleRules {
|
public class ModuleRules<T> {
|
||||||
private Map/* <MapMatcher,Object> */rules = new LinkedHashMap();
|
|
||||||
|
private Map<MapMatcher, T> rules = new LinkedHashMap<MapMatcher, T>();
|
||||||
|
|
||||||
private MatcherLookup matcher_lookup = new MatcherLookup();
|
private MatcherLookup matcher_lookup = new MatcherLookup();
|
||||||
|
|
||||||
|
|
@ -60,10 +61,10 @@ public class ModuleRules {
|
||||||
public ModuleRules() {
|
public ModuleRules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleRules(Map/* <MapMatcher,Object> */rules) {
|
private ModuleRules(Map<MapMatcher, T> rules) {
|
||||||
this.rules = new LinkedHashMap(rules);
|
this.rules = new LinkedHashMap<MapMatcher, T>(rules);
|
||||||
for (Iterator iter = rules.keySet().iterator(); iter.hasNext();) {
|
for (MapMatcher matcher : rules.keySet()) {
|
||||||
matcher_lookup.add((MapMatcher) iter.next());
|
matcher_lookup.add(matcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,7 +76,7 @@ public class ModuleRules {
|
||||||
* @param rule
|
* @param rule
|
||||||
* the rule to apply. Must not be <code>null</code>.
|
* the rule to apply. Must not be <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public void defineRule(MapMatcher condition, Object rule) {
|
public void defineRule(MapMatcher condition, T rule) {
|
||||||
Checks.checkNotNull(condition, "condition");
|
Checks.checkNotNull(condition, "condition");
|
||||||
Checks.checkNotNull(rule, "rule");
|
Checks.checkNotNull(rule, "rule");
|
||||||
|
|
||||||
|
|
@ -93,8 +94,8 @@ public class ModuleRules {
|
||||||
* applies.
|
* applies.
|
||||||
* @see #getRule(ModuleId, Filter)
|
* @see #getRule(ModuleId, Filter)
|
||||||
*/
|
*/
|
||||||
public Object getRule(ModuleId mid) {
|
public T getRule(ModuleId mid) {
|
||||||
return getRule(mid, NoFilter.INSTANCE);
|
return getRule(mid, NoFilter.<T> instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,8 +106,8 @@ public class ModuleRules {
|
||||||
* the {@link ModuleId} to search the rule for. Must not be <code>null</code>.
|
* the {@link ModuleId} to search the rule for. Must not be <code>null</code>.
|
||||||
* @return an array of rule objects matching the given {@link ModuleId}.
|
* @return an array of rule objects matching the given {@link ModuleId}.
|
||||||
*/
|
*/
|
||||||
public Object[] getRules(ModuleId mid) {
|
public T[] getRules(ModuleId mid) {
|
||||||
return getRules(mid.getAttributes(), NoFilter.INSTANCE);
|
return getRules(mid.getAttributes(), NoFilter.<T> instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -120,8 +121,8 @@ public class ModuleRules {
|
||||||
* no rule applies.
|
* no rule applies.
|
||||||
* @see #getRule(ModuleRevisionId, Filter)
|
* @see #getRule(ModuleRevisionId, Filter)
|
||||||
*/
|
*/
|
||||||
public Object getRule(ModuleRevisionId mrid) {
|
public T getRule(ModuleRevisionId mrid) {
|
||||||
return getRule(mrid, NoFilter.INSTANCE);
|
return getRule(mrid, NoFilter.<T> instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -140,7 +141,7 @@ public class ModuleRules {
|
||||||
* applies.
|
* applies.
|
||||||
* @see #getRule(ModuleRevisionId, Filter)
|
* @see #getRule(ModuleRevisionId, Filter)
|
||||||
*/
|
*/
|
||||||
public Object getRule(ModuleId mid, Filter filter) {
|
public T getRule(ModuleId mid, Filter<T> filter) {
|
||||||
Checks.checkNotNull(mid, "mid");
|
Checks.checkNotNull(mid, "mid");
|
||||||
return getRule(mid.getAttributes(), filter);
|
return getRule(mid.getAttributes(), filter);
|
||||||
}
|
}
|
||||||
|
|
@ -161,18 +162,17 @@ public class ModuleRules {
|
||||||
* no rule applies.
|
* no rule applies.
|
||||||
* @see #getRule(ModuleRevisionId)
|
* @see #getRule(ModuleRevisionId)
|
||||||
*/
|
*/
|
||||||
public Object getRule(ModuleRevisionId mrid, Filter filter) {
|
public T getRule(ModuleRevisionId mrid, Filter<T> filter) {
|
||||||
Checks.checkNotNull(mrid, "mrid");
|
Checks.checkNotNull(mrid, "mrid");
|
||||||
Checks.checkNotNull(filter, "filter");
|
Checks.checkNotNull(filter, "filter");
|
||||||
Map moduleAttributes = mrid.getAttributes();
|
Map<String, String> moduleAttributes = mrid.getAttributes();
|
||||||
return getRule(moduleAttributes, filter);
|
return getRule(moduleAttributes, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getRule(Map moduleAttributes, Filter filter) {
|
private T getRule(Map<String, String> moduleAttributes, Filter<T> filter) {
|
||||||
List matchers = matcher_lookup.get(moduleAttributes);
|
List<MapMatcher> matchers = matcher_lookup.get(moduleAttributes);
|
||||||
for (Iterator iter = matchers.iterator(); iter.hasNext();) {
|
for (MapMatcher midm : matchers) {
|
||||||
MapMatcher midm = (MapMatcher) iter.next();
|
T rule = rules.get(midm);
|
||||||
Object rule = rules.get(midm);
|
|
||||||
if (filter.accept(rule)) {
|
if (filter.accept(rule)) {
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
@ -193,24 +193,23 @@ public class ModuleRules {
|
||||||
* {@link ModuleRevisionId}. Must not be <code>null</code>.
|
* {@link ModuleRevisionId}. Must not be <code>null</code>.
|
||||||
* @return an array of rule objects matching the given {@link ModuleRevisionId}.
|
* @return an array of rule objects matching the given {@link ModuleRevisionId}.
|
||||||
*/
|
*/
|
||||||
public Object[] getRules(ModuleRevisionId mrid, Filter filter) {
|
public T[] getRules(ModuleRevisionId mrid, Filter<T> filter) {
|
||||||
Checks.checkNotNull(mrid, "mrid");
|
Checks.checkNotNull(mrid, "mrid");
|
||||||
Checks.checkNotNull(filter, "filter");
|
Checks.checkNotNull(filter, "filter");
|
||||||
Map moduleAttributes = mrid.getAttributes();
|
Map<String, String> moduleAttributes = mrid.getAttributes();
|
||||||
return getRules(moduleAttributes, filter);
|
return getRules(moduleAttributes, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] getRules(Map moduleAttributes, Filter filter) {
|
private T[] getRules(Map<String, String> moduleAttributes, Filter<T> filter) {
|
||||||
List matchers = matcher_lookup.get(moduleAttributes);
|
List<MapMatcher> matchers = matcher_lookup.get(moduleAttributes);
|
||||||
List matchingRules = new ArrayList();
|
List<T> matchingRules = new ArrayList<T>();
|
||||||
for (Iterator iter = matchers.iterator(); iter.hasNext();) {
|
for (MapMatcher midm : matchers) {
|
||||||
MapMatcher midm = (MapMatcher) iter.next();
|
T rule = rules.get(midm);
|
||||||
Object rule = rules.get(midm);
|
|
||||||
if (filter.accept(rule)) {
|
if (filter.accept(rule)) {
|
||||||
matchingRules.add(rule);
|
matchingRules.add(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matchingRules.toArray();
|
return matchingRules.toArray((T[]) new Object[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -223,9 +222,9 @@ public class ModuleRules {
|
||||||
if (rules.isEmpty()) {
|
if (rules.isEmpty()) {
|
||||||
Message.debug(prefix + "NONE");
|
Message.debug(prefix + "NONE");
|
||||||
} else {
|
} else {
|
||||||
for (Iterator iter = rules.keySet().iterator(); iter.hasNext();) {
|
for (Entry<MapMatcher, T> entry : rules.entrySet()) {
|
||||||
MapMatcher midm = (MapMatcher) iter.next();
|
MapMatcher midm = entry.getKey();
|
||||||
Object rule = rules.get(midm);
|
T rule = entry.getValue();
|
||||||
Message.debug(prefix + midm + " -> " + rule);
|
Message.debug(prefix + midm + " -> " + rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -240,11 +239,12 @@ public class ModuleRules {
|
||||||
*
|
*
|
||||||
* @return an unmodifiable view of all the rules defined on this ModuleRules.
|
* @return an unmodifiable view of all the rules defined on this ModuleRules.
|
||||||
*/
|
*/
|
||||||
public Map/* <MapMatcher,Object> */getAllRules() {
|
public Map<MapMatcher, T> getAllRules() {
|
||||||
return Collections.unmodifiableMap(rules);
|
return Collections.unmodifiableMap(rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
return new ModuleRules(rules);
|
return new ModuleRules<T>(rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,14 @@ public class StatusManager {
|
||||||
return IvyContext.getContext().getSettings().getStatusManager();
|
return IvyContext.getContext().getSettings().getStatusManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List status = new ArrayList();
|
private List<Status> status = new ArrayList<Status>();
|
||||||
|
|
||||||
private String defaultStatus;
|
private String defaultStatus;
|
||||||
|
|
||||||
// for easier querying only
|
// for easier querying only
|
||||||
private Map statusPriorityMap;
|
private Map<String, Integer> statusPriorityMap;
|
||||||
|
|
||||||
private Map statusIntegrationMap;
|
private Map<String, Boolean> statusIntegrationMap;
|
||||||
|
|
||||||
private String deliveryStatusListString;
|
private String deliveryStatusListString;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ public class StatusManager {
|
||||||
this.defaultStatus = defaultStatus;
|
this.defaultStatus = defaultStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getStatuses() {
|
public List<Status> getStatuses() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,14 +79,14 @@ public class StatusManager {
|
||||||
if (status.isEmpty()) {
|
if (status.isEmpty()) {
|
||||||
throw new IllegalStateException("badly configured statuses: no status found");
|
throw new IllegalStateException("badly configured statuses: no status found");
|
||||||
}
|
}
|
||||||
statusPriorityMap = new HashMap();
|
statusPriorityMap = new HashMap<String, Integer>();
|
||||||
for (ListIterator iter = status.listIterator(); iter.hasNext();) {
|
for (ListIterator<Status> iter = status.listIterator(); iter.hasNext();) {
|
||||||
Status status = (Status) iter.next();
|
Status status = iter.next();
|
||||||
statusPriorityMap.put(status.getName(), new Integer(iter.previousIndex()));
|
statusPriorityMap.put(status.getName(), new Integer(iter.previousIndex()));
|
||||||
}
|
}
|
||||||
statusIntegrationMap = new HashMap();
|
statusIntegrationMap = new HashMap<String, Boolean>();
|
||||||
for (Iterator iter = status.iterator(); iter.hasNext();) {
|
for (Iterator<Status> iter = status.iterator(); iter.hasNext();) {
|
||||||
Status status = (Status) iter.next();
|
Status status = iter.next();
|
||||||
statusIntegrationMap.put(status.getName(), Boolean.valueOf(status.isIntegration()));
|
statusIntegrationMap.put(status.getName(), Boolean.valueOf(status.isIntegration()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,8 +125,7 @@ public class StatusManager {
|
||||||
public String getDeliveryStatusListString() {
|
public String getDeliveryStatusListString() {
|
||||||
if (deliveryStatusListString == null) {
|
if (deliveryStatusListString == null) {
|
||||||
StringBuffer ret = new StringBuffer();
|
StringBuffer ret = new StringBuffer();
|
||||||
for (Iterator iter = status.iterator(); iter.hasNext();) {
|
for (Status status : this.status) {
|
||||||
Status status = (Status) iter.next();
|
|
||||||
if (!status.isIntegration()) {
|
if (!status.isIntegration()) {
|
||||||
ret.append(status.getName()).append(",");
|
ret.append(status.getName()).append(",");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,14 +71,14 @@ public class PackagingManager implements IvySettingsAware {
|
||||||
return unpacked;
|
return unpacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unpackArtifact(Artifact artifact, File localFile, File archiveFile)
|
public Artifact unpackArtifact(Artifact artifact, File localFile, File archiveFile)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String packaging = artifact.getExtraAttribute("packaging");
|
String packaging = artifact.getExtraAttribute("packaging");
|
||||||
if (packaging == null) {
|
if (packaging == null) {
|
||||||
// not declared as packed, nothing to do
|
// not declared as packed, nothing to do
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
String ext = artifact.getExt();
|
||||||
String[] packings = packaging.split(",");
|
String[] packings = packaging.split(",");
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -94,6 +94,7 @@ public class PackagingManager implements IvySettingsAware {
|
||||||
+ packings[i] + "' in the streamed chain: " + packaging);
|
+ packings[i] + "' in the streamed chain: " + packaging);
|
||||||
}
|
}
|
||||||
in = ((StreamPacking) packing).unpack(in);
|
in = ((StreamPacking) packing).unpack(in);
|
||||||
|
ext = packing.getUnpackedExtension(ext);
|
||||||
}
|
}
|
||||||
ArchivePacking packing = settings.getPackingRegistry().get(packings[0]);
|
ArchivePacking packing = settings.getPackingRegistry().get(packings[0]);
|
||||||
if (packing == null) {
|
if (packing == null) {
|
||||||
|
|
@ -101,6 +102,7 @@ public class PackagingManager implements IvySettingsAware {
|
||||||
+ "' in the packing chain: " + packaging);
|
+ "' in the packing chain: " + packaging);
|
||||||
}
|
}
|
||||||
packing.unpack(in, archiveFile);
|
packing.unpack(in, archiveFile);
|
||||||
|
ext = packing.getUnpackedExtension(ext);
|
||||||
} finally {
|
} finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -110,6 +112,12 @@ public class PackagingManager implements IvySettingsAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final DefaultArtifact unpacked = new DefaultArtifact(artifact.getModuleRevisionId(),
|
||||||
|
artifact.getPublicationDate(), artifact.getName(),
|
||||||
|
artifact.getType() + "_unpacked", ext);
|
||||||
|
|
||||||
|
return unpacked;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -75,8 +74,9 @@ public class PublishEngine {
|
||||||
* the name, type, ext url and extra attributes of the artifacts are really used. Other methods
|
* the name, type, ext url and extra attributes of the artifacts are really used. Other methods
|
||||||
* can return null safely.
|
* can return null safely.
|
||||||
*/
|
*/
|
||||||
public Collection publish(ModuleRevisionId mrid, Collection srcArtifactPattern,
|
public Collection<Artifact> publish(ModuleRevisionId mrid,
|
||||||
String resolverName, PublishOptions options) throws IOException {
|
Collection<String> srcArtifactPattern, String resolverName, PublishOptions options)
|
||||||
|
throws IOException {
|
||||||
Message.info(":: publishing :: " + mrid.getModuleId());
|
Message.info(":: publishing :: " + mrid.getModuleId());
|
||||||
Message.verbose("\tvalidate = " + options.isValidate());
|
Message.verbose("\tvalidate = " + options.isValidate());
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
@ -111,7 +111,8 @@ public class PublishEngine {
|
||||||
tmp.deleteOnExit();
|
tmp.deleteOnExit();
|
||||||
|
|
||||||
String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
|
String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
|
||||||
Set confsToRemove = new HashSet(Arrays.asList(md.getConfigurationsNames()));
|
Set<String> confsToRemove = new HashSet<String>(Arrays.asList(md
|
||||||
|
.getConfigurationsNames()));
|
||||||
confsToRemove.removeAll(Arrays.asList(confs));
|
confsToRemove.removeAll(Arrays.asList(confs));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -131,8 +132,7 @@ public class PublishEngine {
|
||||||
.setMerge(options.isMerge())
|
.setMerge(options.isMerge())
|
||||||
.setMergedDescriptor(md)
|
.setMergedDescriptor(md)
|
||||||
.setConfsToExclude(
|
.setConfsToExclude(
|
||||||
(String[]) confsToRemove.toArray(new String[confsToRemove
|
confsToRemove.toArray(new String[confsToRemove.size()])));
|
||||||
.size()])));
|
|
||||||
ivyFile = tmp;
|
ivyFile = tmp;
|
||||||
// we parse the new file to get updated module descriptor
|
// we parse the new file to get updated module descriptor
|
||||||
md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||||
|
|
@ -169,15 +169,15 @@ public class PublishEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect all declared artifacts of this module
|
// collect all declared artifacts of this module
|
||||||
Collection missing = publish(md, srcArtifactPattern, resolver, options);
|
Collection<Artifact> missing = publish(md, srcArtifactPattern, resolver, options);
|
||||||
Message.verbose("\tpublish done (" + (System.currentTimeMillis() - start) + "ms)");
|
Message.verbose("\tpublish done (" + (System.currentTimeMillis() - start) + "ms)");
|
||||||
return missing;
|
return missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection publish(ModuleDescriptor md, Collection srcArtifactPattern,
|
public Collection<Artifact> publish(ModuleDescriptor md, Collection<String> srcArtifactPattern,
|
||||||
DependencyResolver resolver, PublishOptions options) throws IOException {
|
DependencyResolver resolver, PublishOptions options) throws IOException {
|
||||||
Collection missing = new ArrayList();
|
Collection<Artifact> missing = new ArrayList<Artifact>();
|
||||||
Set artifactsSet = new LinkedHashSet();
|
Set<Artifact> artifactsSet = new LinkedHashSet<Artifact>();
|
||||||
String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
|
String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
|
||||||
|
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (int i = 0; i < confs.length; i++) {
|
||||||
|
|
@ -195,11 +195,9 @@ public class PublishEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now collects artifacts files
|
// now collects artifacts files
|
||||||
Map/* <Artifact,File> */artifactsFiles = new LinkedHashMap();
|
Map<Artifact, File> artifactsFiles = new LinkedHashMap<Artifact, File>();
|
||||||
for (Iterator iter = artifactsSet.iterator(); iter.hasNext();) {
|
for (Artifact artifact : artifactsSet) {
|
||||||
Artifact artifact = (Artifact) iter.next();
|
for (String pattern : srcArtifactPattern) {
|
||||||
for (Iterator iterator = srcArtifactPattern.iterator(); iterator.hasNext();) {
|
|
||||||
String pattern = (String) iterator.next();
|
|
||||||
File artifactFile = settings.resolveFile(IvyPatternHelper.substitute(
|
File artifactFile = settings.resolveFile(IvyPatternHelper.substitute(
|
||||||
settings.substitute(pattern), artifact));
|
settings.substitute(pattern), artifact));
|
||||||
if (artifactFile.exists()) {
|
if (artifactFile.exists()) {
|
||||||
|
|
@ -210,8 +208,7 @@ public class PublishEngine {
|
||||||
if (!artifactsFiles.containsKey(artifact)) {
|
if (!artifactsFiles.containsKey(artifact)) {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("missing artifact " + artifact + ":\n");
|
sb.append("missing artifact " + artifact + ":\n");
|
||||||
for (Iterator iterator = srcArtifactPattern.iterator(); iterator.hasNext();) {
|
for (String pattern : srcArtifactPattern) {
|
||||||
String pattern = (String) iterator.next();
|
|
||||||
sb.append("\t"
|
sb.append("\t"
|
||||||
+ settings.resolveFile(IvyPatternHelper.substitute(pattern, artifact))
|
+ settings.resolveFile(IvyPatternHelper.substitute(pattern, artifact))
|
||||||
+ " file does not exist\n");
|
+ " file does not exist\n");
|
||||||
|
|
@ -253,10 +250,9 @@ public class PublishEngine {
|
||||||
try {
|
try {
|
||||||
resolver.beginPublishTransaction(md.getModuleRevisionId(), options.isOverwrite());
|
resolver.beginPublishTransaction(md.getModuleRevisionId(), options.isOverwrite());
|
||||||
// for each declared published artifact in this descriptor, do:
|
// for each declared published artifact in this descriptor, do:
|
||||||
for (Iterator iter = artifactsFiles.entrySet().iterator(); iter.hasNext();) {
|
for (Entry<Artifact, File> entry : artifactsFiles.entrySet()) {
|
||||||
Map.Entry entry = (Entry) iter.next();
|
Artifact artifact = entry.getKey();
|
||||||
Artifact artifact = (Artifact) entry.getKey();
|
File artifactFile = entry.getValue();
|
||||||
File artifactFile = (File) entry.getValue();
|
|
||||||
publish(artifact, artifactFile, resolver, options.isOverwrite());
|
publish(artifact, artifactFile, resolver, options.isOverwrite());
|
||||||
}
|
}
|
||||||
resolver.commitPublishTransaction();
|
resolver.commitPublishTransaction();
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ public class ArtifactDownloadReport {
|
||||||
|
|
||||||
private File unpackedLocalFile;
|
private File unpackedLocalFile;
|
||||||
|
|
||||||
|
private Artifact unpackedArtifact;
|
||||||
|
|
||||||
public ArtifactDownloadReport(Artifact artifact) {
|
public ArtifactDownloadReport(Artifact artifact) {
|
||||||
this.artifact = artifact;
|
this.artifact = artifact;
|
||||||
}
|
}
|
||||||
|
|
@ -164,6 +166,14 @@ public class ArtifactDownloadReport {
|
||||||
return unpackedLocalFile;
|
return unpackedLocalFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUnpackedArtifact(final Artifact unpackedArtifact) {
|
||||||
|
this.unpackedArtifact = unpackedArtifact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Artifact getUnpackedArtifact() {
|
||||||
|
return this.unpackedArtifact;
|
||||||
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
|
||||||
|
|
@ -23,18 +23,18 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.ivy.core.cache.ResolutionCacheManager;
|
import org.apache.ivy.core.cache.ResolutionCacheManager;
|
||||||
|
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||||
import org.apache.ivy.core.module.descriptor.Configuration;
|
import org.apache.ivy.core.module.descriptor.Configuration;
|
||||||
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
||||||
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
|
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
|
||||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
|
||||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||||
import org.apache.ivy.core.module.id.ModuleId;
|
import org.apache.ivy.core.module.id.ModuleId;
|
||||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||||
|
|
@ -50,17 +50,16 @@ import org.apache.ivy.util.filter.Filter;
|
||||||
public class ResolveReport {
|
public class ResolveReport {
|
||||||
private ModuleDescriptor md;
|
private ModuleDescriptor md;
|
||||||
|
|
||||||
/** String conf -> ConfigurationResolveReport report */
|
private Map<String, ConfigurationResolveReport> confReports = new LinkedHashMap<String, ConfigurationResolveReport>();
|
||||||
private Map confReports = new LinkedHashMap();
|
|
||||||
|
|
||||||
private List problemMessages = new ArrayList();
|
private List<String> problemMessages = new ArrayList<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the list of all dependencies resolved, ordered from the more dependent to the less dependent
|
* the list of all dependencies resolved, ordered from the more dependent to the less dependent
|
||||||
*/
|
*/
|
||||||
private List/* <IvyNode> */dependencies = new ArrayList();
|
private List<IvyNode> dependencies = new ArrayList<IvyNode>();
|
||||||
|
|
||||||
private List/* <Artifact> */artifacts = new ArrayList();
|
private List<Artifact> artifacts = new ArrayList<Artifact>();
|
||||||
|
|
||||||
private long resolveTime;
|
private long resolveTime;
|
||||||
|
|
||||||
|
|
@ -84,20 +83,20 @@ public class ResolveReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurationResolveReport getConfigurationReport(String conf) {
|
public ConfigurationResolveReport getConfigurationReport(String conf) {
|
||||||
return (ConfigurationResolveReport) confReports.get(conf);
|
return confReports.get(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getConfigurations() {
|
public String[] getConfigurations() {
|
||||||
return (String[]) confReports.keySet().toArray(new String[confReports.size()]);
|
return confReports.keySet().toArray(new String[confReports.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasError() {
|
public boolean hasError() {
|
||||||
boolean hasError = false;
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
for (Iterator it = confReports.values().iterator(); it.hasNext() && !hasError;) {
|
if (report.hasError()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) it.next();
|
return true;
|
||||||
hasError |= report.hasError();
|
}
|
||||||
}
|
}
|
||||||
return hasError;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void output(ReportOutputter[] outputters, ResolutionCacheManager cacheMgr,
|
public void output(ReportOutputter[] outputters, ResolutionCacheManager cacheMgr,
|
||||||
|
|
@ -112,21 +111,19 @@ public class ResolveReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IvyNode[] getEvictedNodes() {
|
public IvyNode[] getEvictedNodes() {
|
||||||
Collection all = new LinkedHashSet();
|
Collection<IvyNode> all = new LinkedHashSet<IvyNode>();
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
|
|
||||||
all.addAll(Arrays.asList(report.getEvictedNodes()));
|
all.addAll(Arrays.asList(report.getEvictedNodes()));
|
||||||
}
|
}
|
||||||
return (IvyNode[]) all.toArray(new IvyNode[all.size()]);
|
return all.toArray(new IvyNode[all.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IvyNode[] getUnresolvedDependencies() {
|
public IvyNode[] getUnresolvedDependencies() {
|
||||||
Collection all = new LinkedHashSet();
|
Collection<IvyNode> all = new LinkedHashSet<IvyNode>();
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
|
|
||||||
all.addAll(Arrays.asList(report.getUnresolvedDependencies()));
|
all.addAll(Arrays.asList(report.getUnresolvedDependencies()));
|
||||||
}
|
}
|
||||||
return (IvyNode[]) all.toArray(new IvyNode[all.size()]);
|
return all.toArray(new IvyNode[all.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -164,36 +161,32 @@ public class ResolveReport {
|
||||||
*/
|
*/
|
||||||
public ArtifactDownloadReport[] getArtifactsReports(DownloadStatus downloadStatus,
|
public ArtifactDownloadReport[] getArtifactsReports(DownloadStatus downloadStatus,
|
||||||
boolean withEvicted) {
|
boolean withEvicted) {
|
||||||
Collection all = new LinkedHashSet();
|
Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
|
|
||||||
ArtifactDownloadReport[] reports = report.getArtifactsReports(downloadStatus,
|
ArtifactDownloadReport[] reports = report.getArtifactsReports(downloadStatus,
|
||||||
withEvicted);
|
withEvicted);
|
||||||
all.addAll(Arrays.asList(reports));
|
all.addAll(Arrays.asList(reports));
|
||||||
}
|
}
|
||||||
return (ArtifactDownloadReport[]) all.toArray(new ArtifactDownloadReport[all.size()]);
|
return all.toArray(new ArtifactDownloadReport[all.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactDownloadReport[] getArtifactsReports(ModuleRevisionId mrid) {
|
public ArtifactDownloadReport[] getArtifactsReports(ModuleRevisionId mrid) {
|
||||||
Collection all = new LinkedHashSet();
|
Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
|
|
||||||
all.addAll(Arrays.asList(report.getDownloadReports(mrid)));
|
all.addAll(Arrays.asList(report.getDownloadReports(mrid)));
|
||||||
}
|
}
|
||||||
return (ArtifactDownloadReport[]) all.toArray(new ArtifactDownloadReport[all.size()]);
|
return all.toArray(new ArtifactDownloadReport[all.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkIfChanged() {
|
public void checkIfChanged() {
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
|
|
||||||
report.checkIfChanged();
|
report.checkIfChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Can only be called if checkIfChanged has been called */
|
/** Can only be called if checkIfChanged has been called */
|
||||||
public boolean hasChanged() {
|
public boolean hasChanged() {
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport report : confReports.values()) {
|
||||||
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
|
|
||||||
if (report.hasChanged()) {
|
if (report.hasChanged()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -201,18 +194,17 @@ public class ResolveReport {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProblemMessages(List problems) {
|
public void setProblemMessages(List<String> problems) {
|
||||||
problemMessages = problems;
|
problemMessages = problems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getProblemMessages() {
|
public List<String> getProblemMessages() {
|
||||||
return problemMessages;
|
return problemMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getAllProblemMessages() {
|
public List<String> getAllProblemMessages() {
|
||||||
List ret = new ArrayList(problemMessages);
|
List<String> ret = new ArrayList<String>(problemMessages);
|
||||||
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
|
for (ConfigurationResolveReport r : confReports.values()) {
|
||||||
ConfigurationResolveReport r = (ConfigurationResolveReport) iter.next();
|
|
||||||
IvyNode[] unresolved = r.getUnresolvedDependencies();
|
IvyNode[] unresolved = r.getUnresolvedDependencies();
|
||||||
for (int i = 0; i < unresolved.length; i++) {
|
for (int i = 0; i < unresolved.length; i++) {
|
||||||
String errMsg = unresolved[i].getProblemMessage();
|
String errMsg = unresolved[i].getProblemMessage();
|
||||||
|
|
@ -230,12 +222,11 @@ public class ResolveReport {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDependencies(List dependencies, Filter artifactFilter) {
|
public void setDependencies(List<IvyNode> dependencies, Filter<Artifact> artifactFilter) {
|
||||||
this.dependencies = dependencies;
|
this.dependencies = dependencies;
|
||||||
// collect list of artifacts
|
// collect list of artifacts
|
||||||
artifacts = new ArrayList();
|
artifacts = new ArrayList<Artifact>();
|
||||||
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
|
for (IvyNode dependency : dependencies) {
|
||||||
IvyNode dependency = (IvyNode) iter.next();
|
|
||||||
if (!dependency.isCompletelyEvicted() && !dependency.hasProblem()) {
|
if (!dependency.isCompletelyEvicted() && !dependency.hasProblem()) {
|
||||||
artifacts.addAll(Arrays.asList(dependency.getSelectedArtifacts(artifactFilter)));
|
artifacts.addAll(Arrays.asList(dependency.getSelectedArtifacts(artifactFilter)));
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +248,7 @@ public class ResolveReport {
|
||||||
*
|
*
|
||||||
* @return The list of all dependencies.
|
* @return The list of all dependencies.
|
||||||
*/
|
*/
|
||||||
public List/* <IvyNode> */getDependencies() {
|
public List<IvyNode> getDependencies() {
|
||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -267,7 +258,7 @@ public class ResolveReport {
|
||||||
*
|
*
|
||||||
* @return The list of all artifacts.
|
* @return The list of all artifacts.
|
||||||
*/
|
*/
|
||||||
public List/* <Artifact> */getArtifacts() {
|
public List<Artifact> getArtifacts() {
|
||||||
return artifacts;
|
return artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,11 +267,10 @@ public class ResolveReport {
|
||||||
*
|
*
|
||||||
* @return a list of ModuleId
|
* @return a list of ModuleId
|
||||||
*/
|
*/
|
||||||
public List getModuleIds() {
|
public List<ModuleId> getModuleIds() {
|
||||||
List ret = new ArrayList();
|
List<ModuleId> ret = new ArrayList<ModuleId>();
|
||||||
List sortedDependencies = new ArrayList(dependencies);
|
List<IvyNode> sortedDependencies = new ArrayList<IvyNode>(dependencies);
|
||||||
for (Iterator iter = sortedDependencies.iterator(); iter.hasNext();) {
|
for (IvyNode dependency : sortedDependencies) {
|
||||||
IvyNode dependency = (IvyNode) iter.next();
|
|
||||||
ModuleId mid = dependency.getResolvedId().getModuleId();
|
ModuleId mid = dependency.getResolvedId().getModuleId();
|
||||||
if (!ret.contains(mid)) {
|
if (!ret.contains(mid)) {
|
||||||
ret.add(mid);
|
ret.add(mid);
|
||||||
|
|
@ -371,6 +361,15 @@ public class ResolveReport {
|
||||||
public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings, List<ModuleId> midToKeep) {
|
public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings, List<ModuleId> midToKeep) {
|
||||||
DefaultModuleDescriptor fixedmd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
|
DefaultModuleDescriptor fixedmd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
|
||||||
md.getStatus(), new Date());
|
md.getStatus(), new Date());
|
||||||
|
|
||||||
|
// copy namespaces
|
||||||
|
for (Entry<String, String> ns : md.getExtraAttributesNamespaces().entrySet()) {
|
||||||
|
fixedmd.addExtraAttributeNamespace(ns.getKey(), ns.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy info
|
||||||
|
fixedmd.setDescription(md.getDescription());
|
||||||
|
fixedmd.setHomePage(md.getHomePage());
|
||||||
fixedmd.getExtraInfos().addAll(md.getExtraInfos());
|
fixedmd.getExtraInfos().addAll(md.getExtraInfos());
|
||||||
|
|
||||||
// copy configurations
|
// copy configurations
|
||||||
|
|
@ -379,55 +378,38 @@ public class ResolveReport {
|
||||||
fixedmd.addConfiguration(new Configuration(conf));
|
fixedmd.addConfiguration(new Configuration(conf));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (midToKeep != null && !midToKeep.isEmpty()) {
|
// copy artifacts
|
||||||
// add dependency we want to keep from the original module descriptor
|
for (String conf : resolvedConfs) {
|
||||||
DependencyDescriptor[] deps = md.getDependencies();
|
for (Artifact a : md.getArtifacts(conf)) {
|
||||||
for (int i = 0; i < deps.length; i++) {
|
fixedmd.addArtifact(conf, a);
|
||||||
if (midToKeep.contains(deps[i].getDependencyId())) {
|
|
||||||
DefaultDependencyDescriptor dep = new DefaultDependencyDescriptor(fixedmd,
|
|
||||||
deps[i].getDependencyRevisionId(), true, false, false);
|
|
||||||
List<String> confs = Arrays.asList(deps[i].getModuleConfigurations());
|
|
||||||
if (confs.size() == 1 && confs.get(0).equals("*")) {
|
|
||||||
confs = resolvedConfs;
|
|
||||||
}
|
|
||||||
for (String conf : confs) {
|
|
||||||
String[] extendedConfs = getExtendingConfs(conf);
|
|
||||||
String[] depConfs = deps[i].getDependencyConfigurations(conf);
|
|
||||||
for (String extendedConf : extendedConfs) {
|
|
||||||
if (resolvedConfs.contains(extendedConf)) {
|
|
||||||
for (String depConf : depConfs) {
|
|
||||||
dep.addDependencyConfiguration(extendedConf, depConf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fixedmd.addDependency(dep);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resolved dependencies
|
// add resolved dependencies
|
||||||
for (int i = 0; i < dependencies.size(); i++) {
|
for (IvyNode dep : dependencies) {
|
||||||
IvyNode node = (IvyNode) dependencies.get(i);
|
ModuleRevisionId depMrid;
|
||||||
if (midToKeep != null && midToKeep.contains(node.getModuleId())) {
|
boolean force;
|
||||||
continue;
|
if (midToKeep != null && midToKeep.contains(dep.getModuleId())) {
|
||||||
|
depMrid = dep.getId();
|
||||||
|
force = false;
|
||||||
|
} else {
|
||||||
|
depMrid = dep.getResolvedId();
|
||||||
|
force = true;
|
||||||
}
|
}
|
||||||
String[] rootConfs = node.getRootModuleConfigurations();
|
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(fixedmd, depMrid,
|
||||||
for (int j = 0; j < rootConfs.length; j++) {
|
force, false, false);
|
||||||
if (node.isEvicted(rootConfs[j])) {
|
boolean evicted = true;
|
||||||
|
for (String rootConf : dep.getRootModuleConfigurations()) {
|
||||||
|
if (dep.isEvicted(rootConf)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (node.getAllArtifacts().length == 0) {
|
evicted = false;
|
||||||
// no artifact: it was probably useful transitively, hence it is useless here
|
for (String targetConf : dep.getConfigurations(rootConf)) {
|
||||||
break;
|
dd.addDependencyConfiguration(rootConf, targetConf);
|
||||||
}
|
}
|
||||||
DefaultDependencyDescriptor dep = new DefaultDependencyDescriptor(fixedmd,
|
}
|
||||||
node.getResolvedId(), true, false, false);
|
if (!evicted) {
|
||||||
String[] targetConfs = node.getConfigurations(rootConfs[j]);
|
fixedmd.addDependency(dd);
|
||||||
for (int k = 0; k < targetConfs.length; k++) {
|
|
||||||
dep.addDependencyConfiguration(rootConfs[j], targetConfs[k]);
|
|
||||||
}
|
|
||||||
fixedmd.addDependency(dep);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.apache.ivy.core.resolve;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
@ -191,8 +192,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
if (settings.getVersionMatcher().isDynamic(getId())
|
if (settings.getVersionMatcher().isDynamic(getId())
|
||||||
&& settings.getVersionMatcher().isDynamic(module.getId())) {
|
&& settings.getVersionMatcher().isDynamic(module.getId())) {
|
||||||
Message.error("impossible to resolve dynamic revision for " + getId()
|
Message.error("impossible to resolve dynamic revision for " + getId()
|
||||||
+ ": check your configuration and "
|
+ ": check your configuration and make sure revision is part of your pattern");
|
||||||
+ "make sure revision is part of your pattern");
|
|
||||||
problem = new RuntimeException("impossible to resolve dynamic revision");
|
problem = new RuntimeException("impossible to resolve dynamic revision");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -254,13 +254,12 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
if (hasProblem()) {
|
if (hasProblem()) {
|
||||||
Message.debug("problem : " + problem.getMessage());
|
Message.debug("problem : " + problem.getMessage());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
DependencyDescriptor dd = getDependencyDescriptor(parent);
|
|
||||||
if (dd != null) {
|
|
||||||
usage.addUsage(rootModuleConf, dd, parentConf);
|
|
||||||
}
|
|
||||||
return loaded;
|
|
||||||
}
|
}
|
||||||
|
DependencyDescriptor dd = getDependencyDescriptor(parent);
|
||||||
|
if (dd != null) {
|
||||||
|
usage.addUsage(rootModuleConf, dd, parentConf);
|
||||||
|
}
|
||||||
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveToRealNode(String rootModuleConf, IvyNode parent, String parentConf,
|
private void moveToRealNode(String rootModuleConf, IvyNode parent, String parentConf,
|
||||||
|
|
@ -320,7 +319,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
* the configuration to load of this node
|
* the configuration to load of this node
|
||||||
* @param requestedConf
|
* @param requestedConf
|
||||||
* the actual node conf requested, possibly extending the <code>conf</code> one.
|
* the actual node conf requested, possibly extending the <code>conf</code> one.
|
||||||
* @return
|
* @return {@link Collection} of {@link IvyNode}
|
||||||
*/
|
*/
|
||||||
public Collection<IvyNode> getDependencies(String rootModuleConf, String conf,
|
public Collection<IvyNode> getDependencies(String rootModuleConf, String conf,
|
||||||
String requestedConf) {
|
String requestedConf) {
|
||||||
|
|
@ -331,8 +330,8 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
DependencyDescriptor[] dds = md.getDependencies();
|
DependencyDescriptor[] dds = md.getDependencies();
|
||||||
// it's important to respect order => LinkedHashMap
|
// it's important to respect order => LinkedHashMap
|
||||||
Map<ModuleRevisionId, IvyNode> dependencies = new LinkedHashMap<ModuleRevisionId, IvyNode>();
|
Map<ModuleRevisionId, IvyNode> dependencies = new LinkedHashMap<ModuleRevisionId, IvyNode>();
|
||||||
for (int i = 0; i < dds.length; i++) {
|
for (DependencyDescriptor dependencyDescriptor : dds) {
|
||||||
DependencyDescriptor dd = data.mediate(dds[i]);
|
DependencyDescriptor dd = data.mediate(dependencyDescriptor);
|
||||||
String[] dependencyConfigurations = dd.getDependencyConfigurations(conf, requestedConf);
|
String[] dependencyConfigurations = dd.getDependencyConfigurations(conf, requestedConf);
|
||||||
if (dependencyConfigurations.length == 0) {
|
if (dependencyConfigurations.length == 0) {
|
||||||
// no configuration of the dependency is required for current confs :
|
// no configuration of the dependency is required for current confs :
|
||||||
|
|
@ -416,9 +415,8 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Boolean.valueOf(c.doesCallersExclude(rootModuleConf, artifact, callersStack));
|
return Boolean.valueOf(c.doesCallersExclude(rootModuleConf, artifact, callersStack));
|
||||||
} else {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
}
|
||||||
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasConfigurationsToLoad() {
|
public boolean hasConfigurationsToLoad() {
|
||||||
|
|
@ -438,23 +436,24 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
if (md != null) {
|
if (md != null) {
|
||||||
String[] confs = getRealConfs(conf);
|
String[] confs = getRealConfs(conf);
|
||||||
addRootModuleConfigurations(usage, rootModuleConf, confs);
|
addRootModuleConfigurations(usage, rootModuleConf, confs);
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (String realConf : confs) {
|
||||||
Configuration c = md.getConfiguration(confs[i]);
|
Configuration c = md.getConfiguration(realConf);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
confsToFetch.remove(conf);
|
confsToFetch.remove(conf);
|
||||||
if (isConfRequiredByMergedUsageOnly(rootModuleConf, conf)) {
|
if (isConfRequiredByMergedUsageOnly(rootModuleConf, conf)) {
|
||||||
Message.verbose("configuration required by evicted revision is not available in "
|
Message.verbose("configuration required by evicted revision is not available in "
|
||||||
+ "selected revision. skipping " + conf + " in " + this);
|
+ "selected revision. skipping " + conf + " in " + this);
|
||||||
} else if (!conf.equals(confs[i])) {
|
} else if (!conf.equals(realConf)) {
|
||||||
problem = new RuntimeException("configuration not found in " + this + ": '"
|
problem = new RuntimeException("configuration not found in " + this + ": '"
|
||||||
+ conf + "'. Missing configuration: '" + confs[i]
|
+ conf + "'. Missing configuration: '" + realConf
|
||||||
+ "'. It was required from " + parent + " " + parentConf);
|
+ "'. It was required from " + parent + " " + parentConf);
|
||||||
} else {
|
} else {
|
||||||
problem = new RuntimeException("configuration not found in " + this + ": '"
|
problem = new RuntimeException("configuration not found in " + this + ": '"
|
||||||
+ confs[i] + "'. It was required from " + parent + " " + parentConf);
|
+ realConf + "'. It was required from " + parent + " " + parentConf);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (shouldBePublic && !isRoot()
|
}
|
||||||
|
if (shouldBePublic && !isRoot()
|
||||||
&& c.getVisibility() != Configuration.Visibility.PUBLIC) {
|
&& c.getVisibility() != Configuration.Visibility.PUBLIC) {
|
||||||
confsToFetch.remove(conf);
|
confsToFetch.remove(conf);
|
||||||
if (isConfRequiredByMergedUsageOnly(rootModuleConf, conf)) {
|
if (isConfRequiredByMergedUsageOnly(rootModuleConf, conf)) {
|
||||||
|
|
@ -479,20 +478,12 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
|
|
||||||
private String getDefaultConf(String conf) {
|
private String getDefaultConf(String conf) {
|
||||||
Matcher m = FALLBACK_CONF_PATTERN.matcher(conf);
|
Matcher m = FALLBACK_CONF_PATTERN.matcher(conf);
|
||||||
if (m.matches()) {
|
return m.matches() ? m.group(2) : conf;
|
||||||
return m.group(2);
|
|
||||||
} else {
|
|
||||||
return conf;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMainConf(String conf) {
|
private String getMainConf(String conf) {
|
||||||
Matcher m = FALLBACK_CONF_PATTERN.matcher(conf);
|
Matcher m = FALLBACK_CONF_PATTERN.matcher(conf);
|
||||||
if (m.matches()) {
|
return m.matches() ? m.group(1) : null;
|
||||||
return m.group(1);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfsToFetch(Collection<String> confs) {
|
public void updateConfsToFetch(Collection<String> confs) {
|
||||||
|
|
@ -526,7 +517,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
* returns the required configurations from the given node
|
* returns the required configurations from the given node
|
||||||
*
|
*
|
||||||
* @param in
|
* @param in
|
||||||
* @return
|
* @return array of configuration names
|
||||||
*/
|
*/
|
||||||
public String[] getRequiredConfigurations(IvyNode in, String inConf) {
|
public String[] getRequiredConfigurations(IvyNode in, String inConf) {
|
||||||
Collection<String> req = new LinkedHashSet<String>();
|
Collection<String> req = new LinkedHashSet<String>();
|
||||||
|
|
@ -534,7 +525,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
for (IvyNodeUsage usage : mergedUsages.values()) {
|
for (IvyNodeUsage usage : mergedUsages.values()) {
|
||||||
addAllIfNotNull(req, usage.getRequiredConfigurations(in, inConf));
|
addAllIfNotNull(req, usage.getRequiredConfigurations(in, inConf));
|
||||||
}
|
}
|
||||||
return req == null ? new String[0] : req.toArray(new String[req.size()]);
|
return req.toArray(new String[req.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void addAllIfNotNull(Collection<T> into, Collection<T> col) {
|
private <T> void addAllIfNotNull(Collection<T> into, Collection<T> col) {
|
||||||
|
|
@ -546,7 +537,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
/**
|
/**
|
||||||
* returns all the current required configurations of the node
|
* returns all the current required configurations of the node
|
||||||
*
|
*
|
||||||
* @return
|
* @return array of configuration names
|
||||||
*/
|
*/
|
||||||
public String[] getRequiredConfigurations() {
|
public String[] getRequiredConfigurations() {
|
||||||
Collection<String> required = new ArrayList<String>(confsToFetch.size()
|
Collection<String> required = new ArrayList<String>(confsToFetch.size()
|
||||||
|
|
@ -574,7 +565,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
* Returns the configurations of the dependency required in a given root module configuration.
|
* Returns the configurations of the dependency required in a given root module configuration.
|
||||||
*
|
*
|
||||||
* @param rootModuleConf
|
* @param rootModuleConf
|
||||||
* @return
|
* @return array of configuration names
|
||||||
*/
|
*/
|
||||||
public String[] getConfigurations(String rootModuleConf) {
|
public String[] getConfigurations(String rootModuleConf) {
|
||||||
Set<String> depConfs = new LinkedHashSet<String>();
|
Set<String> depConfs = new LinkedHashSet<String>();
|
||||||
|
|
@ -613,29 +604,23 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
|
|
||||||
private void addRootModuleConfigurations(IvyNodeUsage usage, String rootModuleConf,
|
private void addRootModuleConfigurations(IvyNodeUsage usage, String rootModuleConf,
|
||||||
String[] dependencyConfs) {
|
String[] dependencyConfs) {
|
||||||
Set<String> depConfs = usage.addAndGetConfigurations(rootModuleConf);
|
|
||||||
if (md != null) {
|
if (md != null) {
|
||||||
// add all given dependency configurations to the set + extended ones
|
// add all given dependency configurations to the set + extended ones
|
||||||
for (int i = 0; i < dependencyConfs.length; i++) {
|
for (String dependencyConf : dependencyConfs) {
|
||||||
depConfs.add(dependencyConfs[i]);
|
Configuration conf = md.getConfiguration(dependencyConf);
|
||||||
Configuration conf = md.getConfiguration(dependencyConfs[i]);
|
|
||||||
if (conf != null) {
|
if (conf != null) {
|
||||||
String[] exts = conf.getExtends();
|
|
||||||
// recursive add of extended
|
// recursive add of extended
|
||||||
addRootModuleConfigurations(usage, rootModuleConf, exts);
|
addRootModuleConfigurations(usage, rootModuleConf, conf.getExtends());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (int i = 0; i < dependencyConfs.length; i++) {
|
|
||||||
depConfs.add(dependencyConfs[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Collections.addAll(usage.addAndGetConfigurations(rootModuleConf), dependencyConfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root module configurations in which this dependency is required
|
* Returns the root module configurations in which this dependency is required
|
||||||
*
|
*
|
||||||
* @return
|
* @return array of configuration names
|
||||||
*/
|
*/
|
||||||
public String[] getRootModuleConfigurations() {
|
public String[] getRootModuleConfigurations() {
|
||||||
Set<String> confs = getRootModuleConfigurationsSet();
|
Set<String> confs = getRootModuleConfigurationsSet();
|
||||||
|
|
@ -645,7 +630,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
/**
|
/**
|
||||||
* Returns the root module configurations in which this dependency is required
|
* Returns the root module configurations in which this dependency is required
|
||||||
*
|
*
|
||||||
* @return
|
* @return {@link Set} of configuration names
|
||||||
*/
|
*/
|
||||||
public Set<String> getRootModuleConfigurationsSet() {
|
public Set<String> getRootModuleConfigurationsSet() {
|
||||||
Set<String> confs = new LinkedHashSet<String>();
|
Set<String> confs = new LinkedHashSet<String>();
|
||||||
|
|
@ -674,9 +659,10 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
}
|
}
|
||||||
conf = defaultConf;
|
conf = defaultConf;
|
||||||
}
|
}
|
||||||
if (conf.startsWith("*")) {
|
if (conf.charAt(0) == '*') {
|
||||||
return resolveSpecialConfigurations(new String[] {conf});
|
return resolveSpecialConfigurations(new String[] {conf});
|
||||||
} else if (conf.indexOf(',') != -1) {
|
}
|
||||||
|
if (conf.indexOf(',') != -1) {
|
||||||
String[] confs = conf.split(",");
|
String[] confs = conf.split(",");
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (int i = 0; i < confs.length; i++) {
|
||||||
confs[i] = confs[i].trim();
|
confs[i] = confs[i].trim();
|
||||||
|
|
@ -705,8 +691,9 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
}
|
}
|
||||||
if (path.contains(parent)) {
|
if (path.contains(parent)) {
|
||||||
path.add(0, parent);
|
path.add(0, parent);
|
||||||
Message.verbose("circular dependency found while looking for the path for another one: "
|
Message.verbose(
|
||||||
+ "was looking for " + from + " as a caller of " + path.get(path.size() - 1));
|
"circular dependency found while looking for the path for another one: was looking for "
|
||||||
|
+ from + " as a caller of " + path.get(path.size() - 1));
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
path.add(0, parent);
|
path.add(0, parent);
|
||||||
|
|
@ -761,7 +748,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
/**
|
/**
|
||||||
* Returns all the artifacts of this dependency required in all the root module configurations
|
* Returns all the artifacts of this dependency required in all the root module configurations
|
||||||
*
|
*
|
||||||
* @return
|
* @return array of {@link Artifact}s
|
||||||
*/
|
*/
|
||||||
public Artifact[] getAllArtifacts() {
|
public Artifact[] getAllArtifacts() {
|
||||||
Set<Artifact> ret = new HashSet<Artifact>();
|
Set<Artifact> ret = new HashSet<Artifact>();
|
||||||
|
|
@ -776,7 +763,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
* which the node is not evicted nor blacklisted
|
* which the node is not evicted nor blacklisted
|
||||||
*
|
*
|
||||||
* @param artifactFilter
|
* @param artifactFilter
|
||||||
* @return
|
* @return array of {@link Artifact}s
|
||||||
*/
|
*/
|
||||||
public Artifact[] getSelectedArtifacts(Filter<Artifact> artifactFilter) {
|
public Artifact[] getSelectedArtifacts(Filter<Artifact> artifactFilter) {
|
||||||
Collection<Artifact> ret = new HashSet<Artifact>();
|
Collection<Artifact> ret = new HashSet<Artifact>();
|
||||||
|
|
@ -794,7 +781,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
* in the given root module configuration
|
* in the given root module configuration
|
||||||
*
|
*
|
||||||
* @param rootModuleConf
|
* @param rootModuleConf
|
||||||
* @return
|
* @return array of {@link Artifact}s
|
||||||
*/
|
*/
|
||||||
public Artifact[] getArtifacts(String rootModuleConf) {
|
public Artifact[] getArtifacts(String rootModuleConf) {
|
||||||
// first we look for the dependency configurations required
|
// first we look for the dependency configurations required
|
||||||
|
|
@ -807,7 +794,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
if (md == null) {
|
if (md == null) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"impossible to get artifacts when data has not been loaded. IvyNode = "
|
"impossible to get artifacts when data has not been loaded. IvyNode = "
|
||||||
+ this.toString());
|
+ this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Artifact> artifacts = new HashSet<Artifact>(); // the set we fill before returning
|
Set<Artifact> artifacts = new HashSet<Artifact>(); // the set we fill before returning
|
||||||
|
|
@ -966,7 +953,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
if (md == null) {
|
if (md == null) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"impossible to get conflict manager when data has not been loaded. IvyNode = "
|
"impossible to get conflict manager when data has not been loaded. IvyNode = "
|
||||||
+ this.toString());
|
+ this);
|
||||||
}
|
}
|
||||||
ConflictManager cm = md.getConflictManager(mid);
|
ConflictManager cm = md.getConflictManager(mid);
|
||||||
return cm == null ? settings.getConflictManager(mid) : cm;
|
return cm == null ? settings.getConflictManager(mid) : cm;
|
||||||
|
|
@ -1020,11 +1007,11 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
public ModuleRevisionId getResolvedId() {
|
public ModuleRevisionId getResolvedId() {
|
||||||
if (md != null && md.getResolvedModuleRevisionId().getRevision() != null) {
|
if (md != null && md.getResolvedModuleRevisionId().getRevision() != null) {
|
||||||
return md.getResolvedModuleRevisionId();
|
return md.getResolvedModuleRevisionId();
|
||||||
} else if (module != null) {
|
|
||||||
return module.getId();
|
|
||||||
} else {
|
|
||||||
return getId();
|
|
||||||
}
|
}
|
||||||
|
if (module != null) {
|
||||||
|
return module.getId();
|
||||||
|
}
|
||||||
|
return getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1039,9 +1026,8 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
// /////////////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
boolean canExclude(String rootModuleConf) {
|
boolean canExclude(String rootModuleConf) {
|
||||||
Caller[] callers = getCallers(rootModuleConf);
|
for (Caller caller : getCallers(rootModuleConf)) {
|
||||||
for (int i = 0; i < callers.length; i++) {
|
if (caller.canExclude()) {
|
||||||
if (callers[i].canExclude()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1250,10 +1236,8 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearEvictionDataInAllCallers(String rootModuleConf, Stack<IvyNode> callerStack) {
|
private void clearEvictionDataInAllCallers(String rootModuleConf, Stack<IvyNode> callerStack) {
|
||||||
IvyNode node = callerStack.peek();
|
for (Caller caller : callerStack.peek().getCallers(rootModuleConf)) {
|
||||||
Caller[] callers = node.getCallers(rootModuleConf);
|
IvyNode callerNode = findNode(caller.getModuleRevisionId());
|
||||||
for (int i = 0; i < callers.length; i++) {
|
|
||||||
IvyNode callerNode = findNode(callers[i].getModuleRevisionId());
|
|
||||||
if (callerNode != null) {
|
if (callerNode != null) {
|
||||||
callerNode.eviction = new IvyNodeEviction(callerNode);
|
callerNode.eviction = new IvyNodeEviction(callerNode);
|
||||||
if (!callerStack.contains(callerNode)) {
|
if (!callerStack.contains(callerNode)) {
|
||||||
|
|
@ -1291,9 +1275,8 @@ public class IvyNode implements Comparable<IvyNode> {
|
||||||
if (isRoot()) {
|
if (isRoot()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String[] rootModuleConfigurations = getRootModuleConfigurations();
|
for (String rootModuleConfiguration : getRootModuleConfigurations()) {
|
||||||
for (int i = 0; i < rootModuleConfigurations.length; i++) {
|
if (!isBlacklisted(rootModuleConfiguration)) {
|
||||||
if (!isBlacklisted(rootModuleConfigurations[i])) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import java.util.Set;
|
||||||
import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor;
|
import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor;
|
||||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||||
import org.apache.ivy.core.module.descriptor.IncludeRule;
|
import org.apache.ivy.core.module.descriptor.IncludeRule;
|
||||||
|
import org.apache.ivy.core.module.descriptor.WorkspaceModuleDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class collecting usage data for an IvyNode.
|
* Class collecting usage data for an IvyNode.
|
||||||
|
|
@ -219,6 +220,10 @@ public class IvyNodeUsage {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<DependencyArtifactDescriptor> getDependencyArtifactsSet(String rootModuleConf) {
|
protected Set<DependencyArtifactDescriptor> getDependencyArtifactsSet(String rootModuleConf) {
|
||||||
|
if (node.getDescriptor() instanceof WorkspaceModuleDescriptor) {
|
||||||
|
// for a module in the "workspace" artifacts will be actually declared by the resolver
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Collection<Depender> dependersInConf = dependers.get(rootModuleConf);
|
Collection<Depender> dependersInConf = dependers.get(rootModuleConf);
|
||||||
if (dependersInConf == null) {
|
if (dependersInConf == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ import org.apache.ivy.util.Message;
|
||||||
public class ResolveData {
|
public class ResolveData {
|
||||||
private ResolveEngine engine;
|
private ResolveEngine engine;
|
||||||
|
|
||||||
private Map visitData; // shared map of all visit data: Map (ModuleRevisionId -> VisitData)
|
// shared map of all visit data
|
||||||
|
private Map<ModuleRevisionId, VisitData> visitData;
|
||||||
|
|
||||||
private ConfigurationResolveReport report;
|
private ConfigurationResolveReport report;
|
||||||
|
|
||||||
|
|
@ -55,16 +56,16 @@ public class ResolveData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolveData(ResolveEngine engine, ResolveOptions options) {
|
public ResolveData(ResolveEngine engine, ResolveOptions options) {
|
||||||
this(engine, options, null, new LinkedHashMap());
|
this(engine, options, null, new LinkedHashMap<ModuleRevisionId, VisitData>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolveData(ResolveEngine engine, ResolveOptions options,
|
public ResolveData(ResolveEngine engine, ResolveOptions options,
|
||||||
ConfigurationResolveReport report) {
|
ConfigurationResolveReport report) {
|
||||||
this(engine, options, report, new LinkedHashMap());
|
this(engine, options, report, new LinkedHashMap<ModuleRevisionId, VisitData>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolveData(ResolveEngine engine, ResolveOptions options,
|
public ResolveData(ResolveEngine engine, ResolveOptions options,
|
||||||
ConfigurationResolveReport report, Map visitData) {
|
ConfigurationResolveReport report, Map<ModuleRevisionId, VisitData> visitData) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.report = report;
|
this.report = report;
|
||||||
this.visitData = visitData;
|
this.visitData = visitData;
|
||||||
|
|
@ -80,30 +81,28 @@ public class ResolveData {
|
||||||
return visitData == null ? null : visitData.getNode();
|
return visitData == null ? null : visitData.getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection getNodes() {
|
public Collection<IvyNode> getNodes() {
|
||||||
Collection nodes = new ArrayList();
|
Collection<IvyNode> nodes = new ArrayList<IvyNode>();
|
||||||
for (Iterator iter = visitData.values().iterator(); iter.hasNext();) {
|
for (VisitData vdata : visitData.values()) {
|
||||||
VisitData vdata = (VisitData) iter.next();
|
|
||||||
nodes.add(vdata.getNode());
|
nodes.add(vdata.getNode());
|
||||||
}
|
}
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection getNodeIds() {
|
public Collection<ModuleRevisionId> getNodeIds() {
|
||||||
return visitData.keySet();
|
return visitData.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public VisitData getVisitData(ModuleRevisionId mrid) {
|
public VisitData getVisitData(ModuleRevisionId mrid) {
|
||||||
VisitData result = (VisitData) visitData.get(mrid);
|
VisitData result = visitData.get(mrid);
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
// search again, now ignore the missing extra attributes
|
// search again, now ignore the missing extra attributes
|
||||||
for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
|
for (Entry<ModuleRevisionId, VisitData> entry : visitData.entrySet()) {
|
||||||
Map.Entry entry = (Entry) it.next();
|
ModuleRevisionId current = entry.getKey();
|
||||||
ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
|
|
||||||
|
|
||||||
if (isSubMap(mrid.getAttributes(), current.getAttributes())) {
|
if (isSubMap(mrid.getAttributes(), current.getAttributes())) {
|
||||||
result = (VisitData) entry.getValue();
|
result = entry.getValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +114,7 @@ public class ResolveData {
|
||||||
/**
|
/**
|
||||||
* Checks whether one map is a sub-map of the other.
|
* Checks whether one map is a sub-map of the other.
|
||||||
*/
|
*/
|
||||||
private static boolean isSubMap(Map map1, Map map2) {
|
private static <K, V> boolean isSubMap(Map<K, V> map1, Map<K, V> map2) {
|
||||||
int map1Size = map1.size();
|
int map1Size = map1.size();
|
||||||
int map2Size = map2.size();
|
int map2Size = map2.size();
|
||||||
|
|
||||||
|
|
@ -123,11 +122,10 @@ public class ResolveData {
|
||||||
return map1.equals(map2);
|
return map1.equals(map2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map smallest = map1Size < map2Size ? map1 : map2;
|
Map<K, V> smallest = map1Size < map2Size ? map1 : map2;
|
||||||
Map largest = map1Size < map2Size ? map2 : map1;
|
Map<K, V> largest = map1Size < map2Size ? map2 : map1;
|
||||||
|
|
||||||
for (Iterator it = smallest.entrySet().iterator(); it.hasNext();) {
|
for (Entry<K, V> entry : smallest.entrySet()) {
|
||||||
Map.Entry entry = (Entry) it.next();
|
|
||||||
|
|
||||||
if (!largest.containsKey(entry.getKey())) {
|
if (!largest.containsKey(entry.getKey())) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -258,9 +256,10 @@ public class ResolveData {
|
||||||
}
|
}
|
||||||
|
|
||||||
void blacklist(IvyNode node) {
|
void blacklist(IvyNode node) {
|
||||||
for (Iterator iter = visitData.entrySet().iterator(); iter.hasNext();) {
|
for (Iterator<Entry<ModuleRevisionId, VisitData>> iter = visitData.entrySet().iterator(); iter
|
||||||
Entry entry = (Entry) iter.next();
|
.hasNext();) {
|
||||||
VisitData vdata = (VisitData) entry.getValue();
|
Entry<ModuleRevisionId, VisitData> entry = iter.next();
|
||||||
|
VisitData vdata = entry.getValue();
|
||||||
if (vdata.getNode() == node && !node.getResolvedId().equals(entry.getKey())) {
|
if (vdata.getNode() == node && !node.getResolvedId().equals(entry.getKey())) {
|
||||||
// this visit data was associated with the blacklisted node,
|
// this visit data was associated with the blacklisted node,
|
||||||
// we discard this association
|
// we discard this association
|
||||||
|
|
@ -298,14 +297,13 @@ public class ResolveData {
|
||||||
VisitNode current = getCurrentVisitNode();
|
VisitNode current = getCurrentVisitNode();
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
// mediating dd through dependers stack
|
// mediating dd through dependers stack
|
||||||
List dependers = new ArrayList(current.getPath());
|
List<VisitNode> dependers = new ArrayList<VisitNode>(current.getPath());
|
||||||
// the returned path contains the currently visited node, we are only interested in
|
// the returned path contains the currently visited node, we are only interested in
|
||||||
// the dependers, so we remove the currently visted node from the end
|
// the dependers, so we remove the currently visted node from the end
|
||||||
dependers.remove(dependers.size() - 1);
|
dependers.remove(dependers.size() - 1);
|
||||||
// we want to apply mediation going up in the dependers stack, not the opposite
|
// we want to apply mediation going up in the dependers stack, not the opposite
|
||||||
Collections.reverse(dependers);
|
Collections.reverse(dependers);
|
||||||
for (Iterator iterator = dependers.iterator(); iterator.hasNext();) {
|
for (VisitNode n : dependers) {
|
||||||
VisitNode n = (VisitNode) iterator.next();
|
|
||||||
ModuleDescriptor md = n.getDescriptor();
|
ModuleDescriptor md = n.getDescriptor();
|
||||||
if (md != null) {
|
if (md != null) {
|
||||||
dd = md.mediate(dd);
|
dd = md.mediate(dd);
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,8 @@ import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -88,7 +86,7 @@ public class ResolveEngine {
|
||||||
|
|
||||||
private SortEngine sortEngine;
|
private SortEngine sortEngine;
|
||||||
|
|
||||||
private Set fetchedSet = new HashSet();
|
private Set<String> fetchedSet = new HashSet<String>();
|
||||||
|
|
||||||
private DependencyResolver dictatorResolver;
|
private DependencyResolver dictatorResolver;
|
||||||
|
|
||||||
|
|
@ -251,7 +249,7 @@ public class ResolveEngine {
|
||||||
.getResolvedModuleRevisionId());
|
.getResolvedModuleRevisionId());
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
if (dependencies.length > 0) {
|
if (dependencies.length > 0) {
|
||||||
Map forcedRevisions = new HashMap();
|
Map<ModuleId, ModuleRevisionId> forcedRevisions = new HashMap<ModuleId, ModuleRevisionId>();
|
||||||
for (int i = 0; i < dependencies.length; i++) {
|
for (int i = 0; i < dependencies.length; i++) {
|
||||||
if (dependencies[i].getModuleRevision() != null
|
if (dependencies[i].getModuleRevision() != null
|
||||||
&& dependencies[i].getModuleRevision().isForce()) {
|
&& dependencies[i].getModuleRevision().isForce()) {
|
||||||
|
|
@ -262,8 +260,7 @@ public class ResolveEngine {
|
||||||
|
|
||||||
IvyNode root = dependencies[0].getRoot();
|
IvyNode root = dependencies[0].getRoot();
|
||||||
|
|
||||||
// <ModuleId,IvyNode>();
|
Map<ModuleId, IvyNode> topLevelDeps = new HashMap<ModuleId, IvyNode>();
|
||||||
Map topLevelDeps = new HashMap(); //
|
|
||||||
for (int i = 0; i < dependencies.length; i++) {
|
for (int i = 0; i < dependencies.length; i++) {
|
||||||
if (!dependencies[i].hasProblem()) {
|
if (!dependencies[i].hasProblem()) {
|
||||||
DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
|
DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
|
||||||
|
|
@ -279,7 +276,7 @@ public class ResolveEngine {
|
||||||
DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
|
DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
|
||||||
if (dd == null) {
|
if (dd == null) {
|
||||||
ModuleId mid = dependencies[i].getModuleId();
|
ModuleId mid = dependencies[i].getModuleId();
|
||||||
IvyNode tlDep = (IvyNode) topLevelDeps.get(mid);
|
IvyNode tlDep = topLevelDeps.get(mid);
|
||||||
if (tlDep != null) {
|
if (tlDep != null) {
|
||||||
dd = tlDep.getDependencyDescriptor(root);
|
dd = tlDep.getDependencyDescriptor(root);
|
||||||
}
|
}
|
||||||
|
|
@ -288,8 +285,8 @@ public class ResolveEngine {
|
||||||
ModuleRevisionId depResolvedId = dependencies[i].getResolvedId();
|
ModuleRevisionId depResolvedId = dependencies[i].getResolvedId();
|
||||||
ModuleDescriptor depDescriptor = dependencies[i].getDescriptor();
|
ModuleDescriptor depDescriptor = dependencies[i].getDescriptor();
|
||||||
ModuleRevisionId depRevisionId = dd.getDependencyRevisionId();
|
ModuleRevisionId depRevisionId = dd.getDependencyRevisionId();
|
||||||
ModuleRevisionId forcedRevisionId = (ModuleRevisionId) forcedRevisions
|
ModuleRevisionId forcedRevisionId = forcedRevisions.get(dependencies[i]
|
||||||
.get(dependencies[i].getModuleId());
|
.getModuleId());
|
||||||
|
|
||||||
if (dependencies[i].getModuleRevision() != null
|
if (dependencies[i].getModuleRevision() != null
|
||||||
&& dependencies[i].getModuleRevision().isForce()
|
&& dependencies[i].getModuleRevision().isForce()
|
||||||
|
|
@ -373,14 +370,14 @@ public class ResolveEngine {
|
||||||
report.output(settings.getReportOutputters(), cacheMgr, options);
|
report.output(settings.getReportOutputters(), cacheMgr, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadArtifacts(ResolveReport report, Filter artifactFilter,
|
public void downloadArtifacts(ResolveReport report, Filter<Artifact> artifactFilter,
|
||||||
DownloadOptions options) {
|
DownloadOptions options) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
IvyNode[] dependencies = (IvyNode[]) report.getDependencies().toArray(
|
IvyNode[] dependencies = report.getDependencies().toArray(
|
||||||
new IvyNode[report.getDependencies().size()]);
|
new IvyNode[report.getDependencies().size()]);
|
||||||
|
|
||||||
eventManager.fireIvyEvent(new PrepareDownloadEvent((Artifact[]) report.getArtifacts()
|
eventManager.fireIvyEvent(new PrepareDownloadEvent(report.getArtifacts().toArray(
|
||||||
.toArray(new Artifact[report.getArtifacts().size()])));
|
new Artifact[report.getArtifacts().size()])));
|
||||||
|
|
||||||
long totalSize = 0;
|
long totalSize = 0;
|
||||||
for (int i = 0; i < dependencies.length; i++) {
|
for (int i = 0; i < dependencies.length; i++) {
|
||||||
|
|
@ -541,7 +538,7 @@ public class ResolveEngine {
|
||||||
throw new NullPointerException("module descriptor must not be null");
|
throw new NullPointerException("module descriptor must not be null");
|
||||||
}
|
}
|
||||||
String[] confs = options.getConfs(md);
|
String[] confs = options.getConfs(md);
|
||||||
Collection missingConfs = new ArrayList();
|
Collection<String> missingConfs = new ArrayList<String>();
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (int i = 0; i < confs.length; i++) {
|
||||||
if (confs[i] == null) {
|
if (confs[i] == null) {
|
||||||
throw new NullPointerException("null conf not allowed: confs where: "
|
throw new NullPointerException("null conf not allowed: confs where: "
|
||||||
|
|
@ -608,41 +605,39 @@ public class ResolveEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean data
|
// clean data
|
||||||
for (Iterator iter = data.getNodes().iterator(); iter.hasNext();) {
|
for (IvyNode dep : data.getNodes()) {
|
||||||
IvyNode dep = (IvyNode) iter.next();
|
|
||||||
dep.clean();
|
dep.clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// prune and reverse sort fectched dependencies
|
// prune and reverse sort fectched dependencies
|
||||||
Collection nodes = data.getNodes();
|
Collection<IvyNode> nodes = data.getNodes();
|
||||||
// use a Set to avoid duplicates, linked to preserve order
|
// use a Set to avoid duplicates, linked to preserve order
|
||||||
Collection dependencies = new LinkedHashSet(nodes.size());
|
Collection<IvyNode> dependencies = new LinkedHashSet<IvyNode>(nodes.size());
|
||||||
for (Iterator iter = nodes.iterator(); iter.hasNext();) {
|
for (IvyNode node : nodes) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
if (node != null && !node.isRoot() && !node.isCompletelyBlacklisted()) {
|
if (node != null && !node.isRoot() && !node.isCompletelyBlacklisted()) {
|
||||||
dependencies.add(node);
|
dependencies.add(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List sortedDependencies = sortEngine.sortNodes(dependencies, SortOptions.SILENT);
|
List<IvyNode> sortedDependencies = sortEngine.sortNodes(dependencies,
|
||||||
|
SortOptions.SILENT);
|
||||||
Collections.reverse(sortedDependencies);
|
Collections.reverse(sortedDependencies);
|
||||||
|
|
||||||
handleTransiviteEviction(md, confs, data, sortedDependencies);
|
handleTransiviteEviction(md, confs, data, sortedDependencies);
|
||||||
|
|
||||||
return (IvyNode[]) dependencies.toArray(new IvyNode[dependencies.size()]);
|
return dependencies.toArray(new IvyNode[dependencies.size()]);
|
||||||
} finally {
|
} finally {
|
||||||
IvyContext.popContext();
|
IvyContext.popContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleTransiviteEviction(ModuleDescriptor md, String[] confs, ResolveData data,
|
private void handleTransiviteEviction(ModuleDescriptor md, String[] confs, ResolveData data,
|
||||||
List sortedDependencies) {
|
List<IvyNode> sortedDependencies) {
|
||||||
// handle transitive eviction now:
|
// handle transitive eviction now:
|
||||||
// if a module has been evicted then all its dependencies required only by it should be
|
// if a module has been evicted then all its dependencies required only by it should be
|
||||||
// evicted too. Since nodes are now sorted from the more dependent to the less one, we
|
// evicted too. Since nodes are now sorted from the more dependent to the less one, we
|
||||||
// can traverse the list and check only the direct parent and not all the ancestors
|
// can traverse the list and check only the direct parent and not all the ancestors
|
||||||
for (ListIterator iter = sortedDependencies.listIterator(); iter.hasNext();) {
|
for (IvyNode node : sortedDependencies) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
if (!node.isCompletelyEvicted()) {
|
if (!node.isCompletelyEvicted()) {
|
||||||
for (int i = 0; i < confs.length; i++) {
|
for (int i = 0; i < confs.length; i++) {
|
||||||
IvyNodeCallers.Caller[] callers = node.getCallers(confs[i]);
|
IvyNodeCallers.Caller[] callers = node.getCallers(confs[i]);
|
||||||
|
|
@ -740,8 +735,7 @@ public class ResolveEngine {
|
||||||
// update selected nodes with confs asked in evicted one
|
// update selected nodes with confs asked in evicted one
|
||||||
EvictionData ed = node.getEvictedData();
|
EvictionData ed = node.getEvictedData();
|
||||||
if (ed.getSelected() != null) {
|
if (ed.getSelected() != null) {
|
||||||
for (Iterator iter = ed.getSelected().iterator(); iter.hasNext();) {
|
for (IvyNode selected : ed.getSelected()) {
|
||||||
IvyNode selected = (IvyNode) iter.next();
|
|
||||||
if (!selected.isLoaded()) {
|
if (!selected.isLoaded()) {
|
||||||
// the node is not yet loaded, we can simply update its set of
|
// the node is not yet loaded, we can simply update its set of
|
||||||
// configurations to fetch
|
// configurations to fetch
|
||||||
|
|
@ -793,9 +787,8 @@ public class ResolveEngine {
|
||||||
|
|
||||||
// now we can actually resolve this configuration dependencies
|
// now we can actually resolve this configuration dependencies
|
||||||
if (!isDependenciesFetched(node.getNode(), conf) && node.isTransitive()) {
|
if (!isDependenciesFetched(node.getNode(), conf) && node.isTransitive()) {
|
||||||
Collection/* <VisitNode> */dependencies = node.getDependencies(conf);
|
Collection<VisitNode> dependencies = node.getDependencies(conf);
|
||||||
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
|
for (VisitNode dep : dependencies) {
|
||||||
VisitNode dep = (VisitNode) iter.next();
|
|
||||||
dep.useRealNode(); // the node may have been resolved to another real one while
|
dep.useRealNode(); // the node may have been resolved to another real one while
|
||||||
// resolving other deps
|
// resolving other deps
|
||||||
String[] confs = dep.getRequiredConfigurations(node, conf);
|
String[] confs = dep.getRequiredConfigurations(node, conf);
|
||||||
|
|
@ -853,7 +846,7 @@ public class ResolveEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveConflict(VisitNode node, String conf) {
|
private void resolveConflict(VisitNode node, String conf) {
|
||||||
resolveConflict(node, node.getParent(), conf, Collections.EMPTY_SET);
|
resolveConflict(node, node.getParent(), conf, Collections.<IvyNode> emptySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -870,7 +863,7 @@ public class ResolveEngine {
|
||||||
* @return true if conflict resolution has been done, false it can't be done yet
|
* @return true if conflict resolution has been done, false it can't be done yet
|
||||||
*/
|
*/
|
||||||
private boolean resolveConflict(VisitNode node, VisitNode ancestor, String conf,
|
private boolean resolveConflict(VisitNode node, VisitNode ancestor, String conf,
|
||||||
Collection toevict) {
|
Collection<IvyNode> toevict) {
|
||||||
if (ancestor == null || node == ancestor) {
|
if (ancestor == null || node == ancestor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -907,15 +900,16 @@ public class ResolveEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute conflicts
|
// compute conflicts
|
||||||
Set resolvedNodes = ancestor.getNode().getResolvedNodes(node.getModuleId(),
|
Set<IvyNode> resolvedNodes = ancestor.getNode().getResolvedNodes(node.getModuleId(),
|
||||||
node.getRootModuleConf());
|
node.getRootModuleConf());
|
||||||
resolvedNodes.addAll(ancestor.getNode().getPendingConflicts(node.getRootModuleConf(),
|
resolvedNodes.addAll(ancestor.getNode().getPendingConflicts(node.getRootModuleConf(),
|
||||||
node.getModuleId()));
|
node.getModuleId()));
|
||||||
Collection conflicts = computeConflicts(node, ancestor, conf, toevict, resolvedNodes);
|
Collection<IvyNode> conflicts = computeConflicts(node, ancestor, conf, toevict,
|
||||||
|
resolvedNodes);
|
||||||
|
|
||||||
ConflictManager conflictManager = ancestor.getNode().getConflictManager(node.getModuleId());
|
ConflictManager conflictManager = ancestor.getNode().getConflictManager(node.getModuleId());
|
||||||
|
|
||||||
Collection resolved = resolveConflicts(node, ancestor, conflicts, conflictManager);
|
Collection<IvyNode> resolved = resolveConflicts(node, ancestor, conflicts, conflictManager);
|
||||||
|
|
||||||
if (resolved == null) {
|
if (resolved == null) {
|
||||||
if (debugConflictResolution) {
|
if (debugConflictResolution) {
|
||||||
|
|
@ -939,8 +933,7 @@ public class ResolveEngine {
|
||||||
toevict = resolvedNodes;
|
toevict = resolvedNodes;
|
||||||
toevict.removeAll(resolved);
|
toevict.removeAll(resolved);
|
||||||
|
|
||||||
for (Iterator iter = toevict.iterator(); iter.hasNext();) {
|
for (IvyNode te : toevict) {
|
||||||
IvyNode te = (IvyNode) iter.next();
|
|
||||||
te.markEvicted(node.getRootModuleConf(), ancestor.getNode(), conflictManager,
|
te.markEvicted(node.getRootModuleConf(), ancestor.getNode(), conflictManager,
|
||||||
resolved);
|
resolved);
|
||||||
|
|
||||||
|
|
@ -956,14 +949,14 @@ public class ResolveEngine {
|
||||||
ancestor.getNode().setResolvedNodes(node.getModuleId(), node.getRootModuleConf(),
|
ancestor.getNode().setResolvedNodes(node.getModuleId(), node.getRootModuleConf(),
|
||||||
resolved);
|
resolved);
|
||||||
|
|
||||||
Collection evicted = new HashSet(ancestor.getNode().getEvictedNodes(node.getModuleId(),
|
Collection<IvyNode> evicted = new HashSet<IvyNode>(ancestor.getNode().getEvictedNodes(
|
||||||
node.getRootModuleConf()));
|
node.getModuleId(), node.getRootModuleConf()));
|
||||||
evicted.removeAll(resolved);
|
evicted.removeAll(resolved);
|
||||||
evicted.addAll(toevict);
|
evicted.addAll(toevict);
|
||||||
ancestor.getNode().setEvictedNodes(node.getModuleId(), node.getRootModuleConf(),
|
ancestor.getNode().setEvictedNodes(node.getModuleId(), node.getRootModuleConf(),
|
||||||
evicted);
|
evicted);
|
||||||
ancestor.getNode().setPendingConflicts(node.getModuleId(), node.getRootModuleConf(),
|
ancestor.getNode().setPendingConflicts(node.getModuleId(), node.getRootModuleConf(),
|
||||||
Collections.EMPTY_SET);
|
Collections.<IvyNode> emptySet());
|
||||||
|
|
||||||
return resolveConflict(node, ancestor.getParent(), conf, toevict);
|
return resolveConflict(node, ancestor.getParent(), conf, toevict);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -977,8 +970,8 @@ public class ResolveEngine {
|
||||||
|
|
||||||
// it's time to update parent resolved and evicted with what was found
|
// it's time to update parent resolved and evicted with what was found
|
||||||
|
|
||||||
Collection evicted = new HashSet(ancestor.getNode().getEvictedNodes(node.getModuleId(),
|
Collection<IvyNode> evicted = new HashSet<IvyNode>(ancestor.getNode().getEvictedNodes(
|
||||||
node.getRootModuleConf()));
|
node.getModuleId(), node.getRootModuleConf()));
|
||||||
toevict.removeAll(resolved);
|
toevict.removeAll(resolved);
|
||||||
evicted.removeAll(resolved);
|
evicted.removeAll(resolved);
|
||||||
evicted.addAll(toevict);
|
evicted.addAll(toevict);
|
||||||
|
|
@ -986,7 +979,7 @@ public class ResolveEngine {
|
||||||
ancestor.getNode().setEvictedNodes(node.getModuleId(), node.getRootModuleConf(),
|
ancestor.getNode().setEvictedNodes(node.getModuleId(), node.getRootModuleConf(),
|
||||||
evicted);
|
evicted);
|
||||||
ancestor.getNode().setPendingConflicts(node.getModuleId(), node.getRootModuleConf(),
|
ancestor.getNode().setPendingConflicts(node.getModuleId(), node.getRootModuleConf(),
|
||||||
Collections.EMPTY_SET);
|
Collections.<IvyNode> emptySet());
|
||||||
|
|
||||||
node.markEvicted(ancestor, conflictManager, resolved);
|
node.markEvicted(ancestor, conflictManager, resolved);
|
||||||
if (debugConflictResolution) {
|
if (debugConflictResolution) {
|
||||||
|
|
@ -994,14 +987,13 @@ public class ResolveEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if resolved changed we have to go up in the graph
|
// if resolved changed we have to go up in the graph
|
||||||
Collection prevResolved = ancestor.getNode().getResolvedNodes(node.getModuleId(),
|
Collection<IvyNode> prevResolved = ancestor.getNode().getResolvedNodes(
|
||||||
node.getRootModuleConf());
|
node.getModuleId(), node.getRootModuleConf());
|
||||||
boolean solved = true;
|
boolean solved = true;
|
||||||
if (!prevResolved.equals(resolved)) {
|
if (!prevResolved.equals(resolved)) {
|
||||||
ancestor.getNode().setResolvedNodes(node.getModuleId(), node.getRootModuleConf(),
|
ancestor.getNode().setResolvedNodes(node.getModuleId(), node.getRootModuleConf(),
|
||||||
resolved);
|
resolved);
|
||||||
for (Iterator iter = resolved.iterator(); iter.hasNext();) {
|
for (IvyNode sel : resolved) {
|
||||||
IvyNode sel = (IvyNode) iter.next();
|
|
||||||
if (!prevResolved.contains(sel)) {
|
if (!prevResolved.contains(sel)) {
|
||||||
solved &= resolveConflict(node.gotoNode(sel), ancestor.getParent(), conf,
|
solved &= resolveConflict(node.gotoNode(sel), ancestor.getParent(), conf,
|
||||||
toevict);
|
toevict);
|
||||||
|
|
@ -1012,8 +1004,8 @@ public class ResolveEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection resolveConflicts(VisitNode node, VisitNode ancestor, Collection conflicts,
|
private Collection<IvyNode> resolveConflicts(VisitNode node, VisitNode ancestor,
|
||||||
ConflictManager conflictManager) {
|
Collection<IvyNode> conflicts, ConflictManager conflictManager) {
|
||||||
if (node.getParent() != ancestor
|
if (node.getParent() != ancestor
|
||||||
// we are not handling the direct parent
|
// we are not handling the direct parent
|
||||||
|
|
||||||
|
|
@ -1064,9 +1056,9 @@ public class ResolveEngine {
|
||||||
* @return a collection of IvyNode which may be in conflict with the given node in the given
|
* @return a collection of IvyNode which may be in conflict with the given node in the given
|
||||||
* ancestor. This collection always contain at least the given node.
|
* ancestor. This collection always contain at least the given node.
|
||||||
*/
|
*/
|
||||||
private Collection computeConflicts(VisitNode node, VisitNode ancestor, String conf,
|
private Collection<IvyNode> computeConflicts(VisitNode node, VisitNode ancestor, String conf,
|
||||||
Collection toevict, Collection selectedNodes) {
|
Collection<IvyNode> toevict, Collection<IvyNode> selectedNodes) {
|
||||||
Collection conflicts = new LinkedHashSet();
|
Collection<IvyNode> conflicts = new LinkedHashSet<IvyNode>();
|
||||||
conflicts.add(node.getNode());
|
conflicts.add(node.getNode());
|
||||||
/*
|
/*
|
||||||
* We first try to remove all evicted nodes from the collection of selected nodes to update
|
* We first try to remove all evicted nodes from the collection of selected nodes to update
|
||||||
|
|
@ -1087,11 +1079,11 @@ public class ResolveEngine {
|
||||||
data.setCurrentVisitNode(ancestor);
|
data.setCurrentVisitNode(ancestor);
|
||||||
try {
|
try {
|
||||||
// In this case we need to compute selected nodes again.
|
// In this case we need to compute selected nodes again.
|
||||||
Collection deps = ancestor.getNode().getDependencies(node.getRootModuleConf(),
|
Collection<IvyNode> deps = ancestor.getNode().getDependencies(
|
||||||
|
node.getRootModuleConf(),
|
||||||
ancestor.getNode().getConfigurations(node.getRootModuleConf()),
|
ancestor.getNode().getConfigurations(node.getRootModuleConf()),
|
||||||
ancestor.getRequestedConf());
|
ancestor.getRequestedConf());
|
||||||
for (Iterator iter = deps.iterator(); iter.hasNext();) {
|
for (IvyNode dep : deps) {
|
||||||
IvyNode dep = (IvyNode) iter.next();
|
|
||||||
if (dep.getModuleId().equals(node.getModuleId())) {
|
if (dep.getModuleId().equals(node.getModuleId())) {
|
||||||
conflicts.add(dep);
|
conflicts.add(dep);
|
||||||
}
|
}
|
||||||
|
|
@ -1108,12 +1100,11 @@ public class ResolveEngine {
|
||||||
* the parent direct dependencies in current root module conf.
|
* the parent direct dependencies in current root module conf.
|
||||||
*/
|
*/
|
||||||
VisitNode parent = node.getParent();
|
VisitNode parent = node.getParent();
|
||||||
Collection parentDepIvyNodes = parent.getNode().getDependencies(
|
Collection<IvyNode> parentDepIvyNodes = parent.getNode().getDependencies(
|
||||||
node.getRootModuleConf(),
|
node.getRootModuleConf(),
|
||||||
parent.getNode().getConfigurations(node.getRootModuleConf()),
|
parent.getNode().getConfigurations(node.getRootModuleConf()),
|
||||||
parent.getRequestedConf());
|
parent.getRequestedConf());
|
||||||
for (Iterator it = parentDepIvyNodes.iterator(); it.hasNext();) {
|
for (IvyNode parentDep : parentDepIvyNodes) {
|
||||||
IvyNode parentDep = (IvyNode) it.next();
|
|
||||||
if (parentDep.getModuleId().equals(node.getModuleId())) {
|
if (parentDep.getModuleId().equals(node.getModuleId())) {
|
||||||
conflicts.add(parentDep);
|
conflicts.add(parentDep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.apache.ivy.core.resolve;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.ivy.core.LogOptions;
|
import org.apache.ivy.core.LogOptions;
|
||||||
|
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||||
import org.apache.ivy.core.module.id.ModuleId;
|
import org.apache.ivy.core.module.id.ModuleId;
|
||||||
import org.apache.ivy.util.ConfigurationUtils;
|
import org.apache.ivy.util.ConfigurationUtils;
|
||||||
|
|
@ -100,7 +101,7 @@ public class ResolveOptions extends LogOptions {
|
||||||
/**
|
/**
|
||||||
* A filter to use to avoid downloading all artifacts.
|
* A filter to use to avoid downloading all artifacts.
|
||||||
*/
|
*/
|
||||||
private Filter artifactFilter = FilterHelper.NO_FILTER;
|
private Filter<Artifact> artifactFilter = FilterHelper.NO_FILTER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resolve mode to use. Should be one of {@link #RESOLVEMODES}, or <code>null</code> to use
|
* The resolve mode to use. Should be one of {@link #RESOLVEMODES}, or <code>null</code> to use
|
||||||
|
|
@ -140,11 +141,11 @@ public class ResolveOptions extends LogOptions {
|
||||||
checkIfChanged = options.checkIfChanged;
|
checkIfChanged = options.checkIfChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Filter getArtifactFilter() {
|
public Filter<Artifact> getArtifactFilter() {
|
||||||
return artifactFilter;
|
return artifactFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolveOptions setArtifactFilter(Filter artifactFilter) {
|
public ResolveOptions setArtifactFilter(Filter<Artifact> artifactFilter) {
|
||||||
this.artifactFilter = artifactFilter;
|
this.artifactFilter = artifactFilter;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class VisitData {
|
||||||
* The associated visit nodes, per rootModuleConf Note that the value is a List, because a node
|
* The associated visit nodes, per rootModuleConf Note that the value is a List, because a node
|
||||||
* can be visited from several parents during the resolution process
|
* can be visited from several parents during the resolution process
|
||||||
*/
|
*/
|
||||||
private Map visitNodes = new HashMap(); // Map (String rootModuleConf -> List(VisitNode))
|
private Map<String, List<VisitNode>> visitNodes = new HashMap<String, List<VisitNode>>();
|
||||||
|
|
||||||
public VisitData(IvyNode node) {
|
public VisitData(IvyNode node) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
|
@ -49,10 +49,10 @@ public class VisitData {
|
||||||
getVisitNodes(rootModuleConf).add(node);
|
getVisitNodes(rootModuleConf).add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getVisitNodes(String rootModuleConf) {
|
public List<VisitNode> getVisitNodes(String rootModuleConf) {
|
||||||
List visits = (List) visitNodes.get(rootModuleConf);
|
List<VisitNode> visits = visitNodes.get(rootModuleConf);
|
||||||
if (visits == null) {
|
if (visits == null) {
|
||||||
visits = new ArrayList();
|
visits = new ArrayList<VisitNode>();
|
||||||
visitNodes.put(rootModuleConf, visits);
|
visitNodes.put(rootModuleConf, visits);
|
||||||
}
|
}
|
||||||
return visits;
|
return visits;
|
||||||
|
|
@ -66,7 +66,7 @@ public class VisitData {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVisitNodes(String rootModuleConf, List visitNodes) {
|
public void addVisitNodes(String rootModuleConf, List<VisitNode> visitNodes) {
|
||||||
getVisitNodes(rootModuleConf).addAll(visitNodes);
|
getVisitNodes(rootModuleConf).addAll(visitNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -70,7 +69,7 @@ public class VisitNode {
|
||||||
* Direct path from root to this node. Note that the colleciton is ordered but is not a list
|
* Direct path from root to this node. Note that the colleciton is ordered but is not a list
|
||||||
* implementation This collection is null until it is required, see getPath
|
* implementation This collection is null until it is required, see getPath
|
||||||
*/
|
*/
|
||||||
private Collection path = null; // Collection(VisitNode)
|
private Collection<VisitNode> path = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration of the parent module in the current visit
|
* The configuration of the parent module in the current visit
|
||||||
|
|
@ -159,16 +158,16 @@ public class VisitNode {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Collection/* <VisitNode> */getPath() {
|
public Collection<VisitNode> getPath() {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
path = computePath();
|
path = computePath();
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection/* <VisitNode> */computePath() {
|
private Collection<VisitNode> computePath() {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
Collection p = new LinkedHashSet(parent.getPath());
|
Collection<VisitNode> p = new LinkedHashSet<VisitNode>(parent.getPath());
|
||||||
p.add(this);
|
p.add(this);
|
||||||
return p;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -200,7 +199,7 @@ public class VisitNode {
|
||||||
|
|
||||||
public static VisitNode getRoot(VisitNode parent) {
|
public static VisitNode getRoot(VisitNode parent) {
|
||||||
VisitNode root = parent;
|
VisitNode root = parent;
|
||||||
Collection path = new HashSet();
|
Collection<VisitNode> path = new HashSet<VisitNode>();
|
||||||
path.add(root);
|
path.add(root);
|
||||||
while (root.getParent() != null && !root.getNode().isRoot()) {
|
while (root.getParent() != null && !root.getNode().isRoot()) {
|
||||||
if (path.contains(root.getParent())) {
|
if (path.contains(root.getParent())) {
|
||||||
|
|
@ -309,11 +308,10 @@ public class VisitNode {
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection/* <VisitNode> */getDependencies(String conf) {
|
public Collection<VisitNode> getDependencies(String conf) {
|
||||||
Collection/* <IvyNode> */deps = node.getDependencies(rootModuleConf, conf, requestedConf);
|
Collection<IvyNode> deps = node.getDependencies(rootModuleConf, conf, requestedConf);
|
||||||
Collection/* <VisitNode> */ret = new ArrayList(deps.size());
|
Collection<VisitNode> ret = new ArrayList<VisitNode>(deps.size());
|
||||||
for (Iterator iter = deps.iterator(); iter.hasNext();) {
|
for (IvyNode depNode : deps) {
|
||||||
IvyNode depNode = (IvyNode) iter.next();
|
|
||||||
ret.add(traverseChild(conf, depNode));
|
ret.add(traverseChild(conf, depNode));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -336,9 +334,8 @@ public class VisitNode {
|
||||||
}
|
}
|
||||||
VisitData visitData = data.getVisitData(node.getId());
|
VisitData visitData = data.getVisitData(node.getId());
|
||||||
if (visitData != null) {
|
if (visitData != null) {
|
||||||
List visitNodes = visitData.getVisitNodes(rootModuleConf);
|
List<VisitNode> visitNodes = visitData.getVisitNodes(rootModuleConf);
|
||||||
for (Iterator iter = visitNodes.iterator(); iter.hasNext();) {
|
for (VisitNode vnode : visitNodes) {
|
||||||
VisitNode vnode = (VisitNode) iter.next();
|
|
||||||
if ((parent == null && vnode.getParent() == null)
|
if ((parent == null && vnode.getParent() == null)
|
||||||
|| (parent != null && parent.getId().equals(vnode.getParent().getId()))) {
|
|| (parent != null && parent.getId().equals(vnode.getParent().getId()))) {
|
||||||
vnode.parentConf = parentConf;
|
vnode.parentConf = parentConf;
|
||||||
|
|
@ -371,11 +368,10 @@ public class VisitNode {
|
||||||
return new VisitNode(data, node, parent, rootModuleConf, parentConf, usage);
|
return new VisitNode(data, node, parent, rootModuleConf, parentConf, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleRevisionId[] toMrids(Collection path, ModuleRevisionId last) {
|
private ModuleRevisionId[] toMrids(Collection<VisitNode> path, ModuleRevisionId last) {
|
||||||
ModuleRevisionId[] ret = new ModuleRevisionId[path.size() + 1];
|
ModuleRevisionId[] ret = new ModuleRevisionId[path.size() + 1];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Iterator iter = path.iterator(); iter.hasNext(); i++) {
|
for (VisitNode node : path) {
|
||||||
VisitNode node = (VisitNode) iter.next();
|
|
||||||
ret[i] = node.getNode().getId();
|
ret[i] = node.getNode().getId();
|
||||||
}
|
}
|
||||||
ret[ret.length - 1] = last;
|
ret[ret.length - 1] = last;
|
||||||
|
|
@ -386,7 +382,7 @@ public class VisitNode {
|
||||||
return node.getResolvedId();
|
return node.getResolvedId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfsToFetch(Collection confs) {
|
public void updateConfsToFetch(Collection<String> confs) {
|
||||||
node.updateConfsToFetch(confs);
|
node.updateConfsToFetch(confs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -432,8 +428,7 @@ public class VisitNode {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
isCircular = Boolean.FALSE; // asumme it's false, and see if it isn't by checking
|
isCircular = Boolean.FALSE; // asumme it's false, and see if it isn't by checking
|
||||||
// the parent path
|
// the parent path
|
||||||
for (Iterator iter = parent.getPath().iterator(); iter.hasNext();) {
|
for (VisitNode ancestor : parent.getPath()) {
|
||||||
VisitNode ancestor = (VisitNode) iter.next();
|
|
||||||
if (getId().getModuleId().equals(ancestor.getId().getModuleId())) {
|
if (getId().getModuleId().equals(ancestor.getId().getModuleId())) {
|
||||||
isCircular = Boolean.TRUE;
|
isCircular = Boolean.TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -458,7 +453,7 @@ public class VisitNode {
|
||||||
return node.getModuleId();
|
return node.getModuleId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection getResolvedRevisions(ModuleId mid) {
|
public Collection<ModuleRevisionId> getResolvedRevisions(ModuleId mid) {
|
||||||
return node.getResolvedRevisions(mid, rootModuleConf);
|
return node.getResolvedRevisions(mid, rootModuleConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -481,7 +476,8 @@ public class VisitNode {
|
||||||
* @param selected
|
* @param selected
|
||||||
* a Collection of {@link IvyNode} which have been selected
|
* a Collection of {@link IvyNode} which have been selected
|
||||||
*/
|
*/
|
||||||
public void markEvicted(VisitNode parent, ConflictManager conflictMgr, Collection selected) {
|
public void markEvicted(VisitNode parent, ConflictManager conflictMgr,
|
||||||
|
Collection<IvyNode> selected) {
|
||||||
node.markEvicted(rootModuleConf, parent.getNode(), conflictMgr, selected);
|
node.markEvicted(rootModuleConf, parent.getNode(), conflictMgr, selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -493,7 +489,7 @@ public class VisitNode {
|
||||||
return node.getEvictionDataInRoot(rootModuleConf, ancestor.getNode());
|
return node.getEvictionDataInRoot(rootModuleConf, ancestor.getNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection getEvictedRevisions(ModuleId moduleId) {
|
public Collection<ModuleRevisionId> getEvictedRevisions(ModuleId moduleId) {
|
||||||
return node.getEvictedRevisions(moduleId, rootModuleConf);
|
return node.getEvictedRevisions(moduleId, rootModuleConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -508,6 +504,7 @@ public class VisitNode {
|
||||||
// rootModuleConf = rootModuleConf;
|
// rootModuleConf = rootModuleConf;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return node.toString();
|
return node.toString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||||
import org.apache.ivy.core.module.id.ArtifactRevisionId;
|
import org.apache.ivy.core.module.id.ArtifactRevisionId;
|
||||||
import org.apache.ivy.core.module.id.ModuleId;
|
import org.apache.ivy.core.module.id.ModuleId;
|
||||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||||
|
import org.apache.ivy.core.pack.PackagingManager;
|
||||||
import org.apache.ivy.core.report.ArtifactDownloadReport;
|
import org.apache.ivy.core.report.ArtifactDownloadReport;
|
||||||
import org.apache.ivy.core.resolve.ResolveOptions;
|
import org.apache.ivy.core.resolve.ResolveOptions;
|
||||||
import org.apache.ivy.plugins.report.XmlReportParser;
|
import org.apache.ivy.plugins.report.XmlReportParser;
|
||||||
|
|
@ -331,12 +332,29 @@ public class RetrieveEngine {
|
||||||
artifacts.add(parser.getMetadataArtifactReport(mrids[j]));
|
artifacts.add(parser.getMetadataArtifactReport(mrids[j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ArtifactDownloadReport adr : artifacts) {
|
final PackagingManager packagingManager = new PackagingManager();
|
||||||
|
packagingManager.setSettings(IvyContext.getContext().getSettings());
|
||||||
|
|
||||||
Artifact artifact = adr.getArtifact();
|
for (final ArtifactDownloadReport adr : artifacts) {
|
||||||
String ext = artifact.getExt();
|
|
||||||
if (adr.getUnpackedLocalFile() != null) {
|
final Artifact artifact = adr.getArtifact();
|
||||||
ext = "";
|
final String ext;
|
||||||
|
if (adr.getUnpackedLocalFile() == null) {
|
||||||
|
ext = artifact.getExt();
|
||||||
|
} else {
|
||||||
|
final Artifact unpackedArtifact;
|
||||||
|
// check if the download report is aware of the unpacked artifact
|
||||||
|
if (adr.getUnpackedArtifact() != null) {
|
||||||
|
unpackedArtifact = adr.getUnpackedArtifact();
|
||||||
|
} else {
|
||||||
|
// use the packaging manager to get hold of the unpacked artifact
|
||||||
|
unpackedArtifact = packagingManager.getUnpackedArtifact(artifact);
|
||||||
|
}
|
||||||
|
if (unpackedArtifact == null) {
|
||||||
|
throw new RuntimeException("Could not determine unpacked artifact for " + artifact +
|
||||||
|
" while determining artifacts to copy for module " + mrid);
|
||||||
|
}
|
||||||
|
ext = unpackedArtifact.getExt();
|
||||||
}
|
}
|
||||||
|
|
||||||
String destPattern = "ivy".equals(adr.getType()) ? destIvyPattern : destFilePattern;
|
String destPattern = "ivy".equals(adr.getType()) ? destIvyPattern : destFilePattern;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -56,125 +55,119 @@ public class SearchEngine {
|
||||||
* @param otherTokenValues
|
* @param otherTokenValues
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String[] listTokenValues(String token, Map otherTokenValues) {
|
public String[] listTokenValues(String token, Map<String, Object> otherTokenValues) {
|
||||||
Set entries = new LinkedHashSet();
|
Set<String> entries = new LinkedHashSet<String>();
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] values = resolver.listTokenValues(new String[] {token},
|
||||||
Map[] values = resolver.listTokenValues(new String[] {token}, otherTokenValues);
|
otherTokenValues);
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
entries.add(values[i].get(token));
|
entries.add(values[i].get(token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) entries.toArray(new String[entries.size()]);
|
return entries.toArray(new String[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrganisationEntry[] listOrganisationEntries() {
|
public OrganisationEntry[] listOrganisationEntries() {
|
||||||
Set entries = new HashSet();
|
Set<OrganisationEntry> entries = new HashSet<OrganisationEntry>();
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] orgs = resolver.listTokenValues(
|
||||||
Map[] orgs = resolver.listTokenValues(new String[] {IvyPatternHelper.ORGANISATION_KEY},
|
new String[] {IvyPatternHelper.ORGANISATION_KEY}, new HashMap<String, Object>());
|
||||||
new HashMap());
|
|
||||||
for (int i = 0; i < orgs.length; i++) {
|
for (int i = 0; i < orgs.length; i++) {
|
||||||
String org = (String) orgs[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
String org = orgs[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
entries.add(new OrganisationEntry(resolver, org));
|
entries.add(new OrganisationEntry(resolver, org));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (OrganisationEntry[]) entries.toArray(new OrganisationEntry[entries.size()]);
|
return entries.toArray(new OrganisationEntry[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] listOrganisations() {
|
public String[] listOrganisations() {
|
||||||
Set entries = new HashSet();
|
Set<String> entries = new HashSet<String>();
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] orgs = resolver.listTokenValues(
|
||||||
Map[] orgs = resolver.listTokenValues(new String[] {IvyPatternHelper.ORGANISATION_KEY},
|
new String[] {IvyPatternHelper.ORGANISATION_KEY}, new HashMap<String, Object>());
|
||||||
new HashMap());
|
|
||||||
for (int i = 0; i < orgs.length; i++) {
|
for (int i = 0; i < orgs.length; i++) {
|
||||||
entries.add(orgs[i].get(IvyPatternHelper.ORGANISATION_KEY));
|
entries.add(orgs[i].get(IvyPatternHelper.ORGANISATION_KEY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) entries.toArray(new String[entries.size()]);
|
return entries.toArray(new String[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
|
public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
|
||||||
Set entries = new HashSet();
|
Set<ModuleEntry> entries = new HashSet<ModuleEntry>();
|
||||||
|
|
||||||
Map tokenValues = new HashMap();
|
Map<String, Object> tokenValues = new HashMap<String, Object>();
|
||||||
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
|
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] modules = resolver.listTokenValues(
|
||||||
Map[] modules = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
|
new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
|
||||||
tokenValues);
|
|
||||||
for (int i = 0; i < modules.length; i++) {
|
for (int i = 0; i < modules.length; i++) {
|
||||||
String module = (String) modules[i].get(IvyPatternHelper.MODULE_KEY);
|
String module = modules[i].get(IvyPatternHelper.MODULE_KEY);
|
||||||
entries.add(new ModuleEntry(org, module));
|
entries.add(new ModuleEntry(org, module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ModuleEntry[]) entries.toArray(new ModuleEntry[entries.size()]);
|
return entries.toArray(new ModuleEntry[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] listModules(String org) {
|
public String[] listModules(String org) {
|
||||||
Set entries = new HashSet();
|
Set<String> entries = new HashSet<String>();
|
||||||
|
|
||||||
Map tokenValues = new HashMap();
|
Map<String, Object> tokenValues = new HashMap<String, Object>();
|
||||||
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
|
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] modules = resolver.listTokenValues(
|
||||||
Map[] modules = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
|
new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
|
||||||
tokenValues);
|
|
||||||
for (int i = 0; i < modules.length; i++) {
|
for (int i = 0; i < modules.length; i++) {
|
||||||
entries.add(modules[i].get(IvyPatternHelper.MODULE_KEY));
|
entries.add(modules[i].get(IvyPatternHelper.MODULE_KEY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) entries.toArray(new String[entries.size()]);
|
return entries.toArray(new String[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
|
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
|
||||||
Set entries = new HashSet();
|
Set<RevisionEntry> entries = new HashSet<RevisionEntry>();
|
||||||
|
|
||||||
Map tokenValues = new HashMap();
|
Map<String, Object> tokenValues = new HashMap<String, Object>();
|
||||||
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, module.getOrganisation());
|
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, module.getOrganisation());
|
||||||
tokenValues.put(IvyPatternHelper.MODULE_KEY, module.getModule());
|
tokenValues.put(IvyPatternHelper.MODULE_KEY, module.getModule());
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] revisions = resolver.listTokenValues(
|
||||||
Map[] revisions = resolver.listTokenValues(
|
|
||||||
new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
|
new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
|
||||||
for (int i = 0; i < revisions.length; i++) {
|
for (int i = 0; i < revisions.length; i++) {
|
||||||
String revision = (String) revisions[i].get(IvyPatternHelper.REVISION_KEY);
|
String revision = revisions[i].get(IvyPatternHelper.REVISION_KEY);
|
||||||
entries.add(new RevisionEntry(module, revision));
|
entries.add(new RevisionEntry(module, revision));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (RevisionEntry[]) entries.toArray(new RevisionEntry[entries.size()]);
|
return entries.toArray(new RevisionEntry[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] listRevisions(String org, String module) {
|
public String[] listRevisions(String org, String module) {
|
||||||
Set entries = new HashSet();
|
Set<String> entries = new HashSet<String>();
|
||||||
|
|
||||||
Map tokenValues = new HashMap();
|
Map<String, Object> tokenValues = new HashMap<String, Object>();
|
||||||
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
|
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
|
||||||
tokenValues.put(IvyPatternHelper.MODULE_KEY, module);
|
tokenValues.put(IvyPatternHelper.MODULE_KEY, module);
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] revisions = resolver.listTokenValues(
|
||||||
Map[] revisions = resolver.listTokenValues(
|
|
||||||
new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
|
new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
|
||||||
for (int i = 0; i < revisions.length; i++) {
|
for (int i = 0; i < revisions.length; i++) {
|
||||||
entries.add(revisions[i].get(IvyPatternHelper.REVISION_KEY));
|
entries.add(revisions[i].get(IvyPatternHelper.REVISION_KEY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) entries.toArray(new String[entries.size()]);
|
return entries.toArray(new String[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -189,9 +182,9 @@ public class SearchEngine {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ModuleId[] listModules(ModuleId moduleCrit, PatternMatcher matcher) {
|
public ModuleId[] listModules(ModuleId moduleCrit, PatternMatcher matcher) {
|
||||||
List ret = new ArrayList();
|
List<ModuleId> ret = new ArrayList<ModuleId>();
|
||||||
|
|
||||||
Map criteria = new HashMap();
|
Map<String, Object> criteria = new HashMap<String, Object>();
|
||||||
addMatcher(matcher, moduleCrit.getOrganisation(), criteria,
|
addMatcher(matcher, moduleCrit.getOrganisation(), criteria,
|
||||||
IvyPatternHelper.ORGANISATION_KEY);
|
IvyPatternHelper.ORGANISATION_KEY);
|
||||||
addMatcher(matcher, moduleCrit.getName(), criteria, IvyPatternHelper.MODULE_KEY);
|
addMatcher(matcher, moduleCrit.getName(), criteria, IvyPatternHelper.MODULE_KEY);
|
||||||
|
|
@ -199,19 +192,18 @@ public class SearchEngine {
|
||||||
String[] tokensToList = new String[] {IvyPatternHelper.ORGANISATION_KEY,
|
String[] tokensToList = new String[] {IvyPatternHelper.ORGANISATION_KEY,
|
||||||
IvyPatternHelper.MODULE_KEY};
|
IvyPatternHelper.MODULE_KEY};
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
|
||||||
Map[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
|
|
||||||
for (int i = 0; i < moduleIdAsMap.length; i++) {
|
for (int i = 0; i < moduleIdAsMap.length; i++) {
|
||||||
String org = (String) moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
String org = moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
String name = (String) moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
|
String name = moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
|
||||||
ModuleId modId = ModuleId.newInstance(org, name);
|
ModuleId modId = ModuleId.newInstance(org, name);
|
||||||
ret.add(NameSpaceHelper.transform(modId, resolver.getNamespace()
|
ret.add(NameSpaceHelper.transform(modId, resolver.getNamespace()
|
||||||
.getToSystemTransformer()));
|
.getToSystemTransformer()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ModuleId[]) ret.toArray(new ModuleId[ret.size()]);
|
return ret.toArray(new ModuleId[ret.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -226,37 +218,33 @@ public class SearchEngine {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ModuleRevisionId[] listModules(ModuleRevisionId moduleCrit, PatternMatcher matcher) {
|
public ModuleRevisionId[] listModules(ModuleRevisionId moduleCrit, PatternMatcher matcher) {
|
||||||
List ret = new ArrayList();
|
List<ModuleRevisionId> ret = new ArrayList<ModuleRevisionId>();
|
||||||
|
|
||||||
Map criteria = new HashMap();
|
Map<String, Object> criteria = new HashMap<String, Object>();
|
||||||
for (Iterator it = moduleCrit.getAttributes().entrySet().iterator(); it.hasNext();) {
|
for (Entry<String, String> entry : moduleCrit.getAttributes().entrySet()) {
|
||||||
Map.Entry entry = (Entry) it.next();
|
addMatcher(matcher, entry.getValue(), criteria, entry.getKey());
|
||||||
addMatcher(matcher, (String) entry.getValue(), criteria, (String) entry.getKey());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] tokensToList = (String[]) moduleCrit.getAttributes().keySet()
|
String[] tokensToList = moduleCrit.getAttributes().keySet()
|
||||||
.toArray(new String[moduleCrit.getAttributes().size()]);
|
.toArray(new String[moduleCrit.getAttributes().size()]);
|
||||||
|
|
||||||
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : settings.getResolvers()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
|
||||||
Map[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
|
|
||||||
for (int i = 0; i < moduleIdAsMap.length; i++) {
|
for (int i = 0; i < moduleIdAsMap.length; i++) {
|
||||||
String org = (String) moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
String org = moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
String name = (String) moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
|
String name = moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
|
||||||
String branch = (String) moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
|
String branch = moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
|
||||||
String rev = (String) moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
|
String rev = moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
|
||||||
|
|
||||||
Map foundExtraAtts = new HashMap();
|
Map<String, String> foundExtraAtts = new HashMap<String, String>();
|
||||||
Set qualAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
|
Set<String> qualAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
|
||||||
for (Iterator iter2 = qualAttributes.iterator(); iter2.hasNext();) {
|
for (String qualifiedKey : qualAttributes) {
|
||||||
String qualifiedKey = (String) iter2.next();
|
|
||||||
String value = null;
|
String value = null;
|
||||||
int colonIndex = qualifiedKey.indexOf(':');
|
int colonIndex = qualifiedKey.indexOf(':');
|
||||||
if (colonIndex == -1) {
|
if (colonIndex == -1) {
|
||||||
value = (String) moduleIdAsMap[i].get(qualifiedKey);
|
value = moduleIdAsMap[i].get(qualifiedKey);
|
||||||
} else {
|
} else {
|
||||||
value = (String) moduleIdAsMap[i].get(qualifiedKey
|
value = moduleIdAsMap[i].get(qualifiedKey.substring(colonIndex + 1));
|
||||||
.substring(colonIndex + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
|
@ -270,7 +258,7 @@ public class SearchEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ModuleRevisionId[]) ret.toArray(new ModuleRevisionId[ret.size()]);
|
return ret.toArray(new ModuleRevisionId[ret.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -289,33 +277,32 @@ public class SearchEngine {
|
||||||
*/
|
*/
|
||||||
public ModuleRevisionId[] listModules(DependencyResolver resolver, ModuleRevisionId moduleCrit,
|
public ModuleRevisionId[] listModules(DependencyResolver resolver, ModuleRevisionId moduleCrit,
|
||||||
PatternMatcher matcher) {
|
PatternMatcher matcher) {
|
||||||
Map criteria = new HashMap();
|
Map<String, Object> criteria = new HashMap<String, Object>();
|
||||||
for (Iterator it = moduleCrit.getAttributes().entrySet().iterator(); it.hasNext();) {
|
for (Entry<String, String> entry : moduleCrit.getAttributes().entrySet()) {
|
||||||
Map.Entry entry = (Entry) it.next();
|
addMatcher(matcher, entry.getValue(), criteria, entry.getKey());
|
||||||
addMatcher(matcher, (String) entry.getValue(), criteria, (String) entry.getKey());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] tokensToList = (String[]) moduleCrit.getAttributes().keySet()
|
String[] tokensToList = moduleCrit.getAttributes().keySet()
|
||||||
.toArray(new String[moduleCrit.getAttributes().size()]);
|
.toArray(new String[moduleCrit.getAttributes().size()]);
|
||||||
|
|
||||||
Map[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
|
Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
|
||||||
Set result = new LinkedHashSet(); // we use a Set to remove duplicates
|
Set<ModuleRevisionId> result = new LinkedHashSet<ModuleRevisionId>(); // we use a Set to
|
||||||
|
// remove duplicates
|
||||||
for (int i = 0; i < moduleIdAsMap.length; i++) {
|
for (int i = 0; i < moduleIdAsMap.length; i++) {
|
||||||
String org = (String) moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
String org = moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
String name = (String) moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
|
String name = moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
|
||||||
String branch = (String) moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
|
String branch = moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
|
||||||
String rev = (String) moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
|
String rev = moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
|
||||||
|
|
||||||
Map foundExtraAtts = new HashMap();
|
Map<String, String> foundExtraAtts = new HashMap<String, String>();
|
||||||
Set qualExtraAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
|
Set<String> qualExtraAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
|
||||||
for (Iterator iter2 = qualExtraAttributes.iterator(); iter2.hasNext();) {
|
for (String qualifiedKey : qualExtraAttributes) {
|
||||||
String qualifiedKey = (String) iter2.next();
|
|
||||||
String value = null;
|
String value = null;
|
||||||
int colonIndex = qualifiedKey.indexOf(':');
|
int colonIndex = qualifiedKey.indexOf(':');
|
||||||
if (colonIndex == -1) {
|
if (colonIndex == -1) {
|
||||||
value = (String) moduleIdAsMap[i].get(qualifiedKey);
|
value = moduleIdAsMap[i].get(qualifiedKey);
|
||||||
} else {
|
} else {
|
||||||
value = (String) moduleIdAsMap[i].get(qualifiedKey.substring(colonIndex + 1));
|
value = moduleIdAsMap[i].get(qualifiedKey.substring(colonIndex + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
|
@ -328,11 +315,11 @@ public class SearchEngine {
|
||||||
result.add(resolver.getNamespace().getToSystemTransformer().transform(modRevId));
|
result.add(resolver.getNamespace().getToSystemTransformer().transform(modRevId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ModuleRevisionId[]) result.toArray(new ModuleRevisionId[result.size()]);
|
return result.toArray(new ModuleRevisionId[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMatcher(PatternMatcher patternMatcher, String expression, Map criteria,
|
private void addMatcher(PatternMatcher patternMatcher, String expression,
|
||||||
String key) {
|
Map<String, Object> criteria, String key) {
|
||||||
if (expression == null) {
|
if (expression == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -345,9 +332,9 @@ public class SearchEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection findModuleRevisionIds(DependencyResolver resolver, ModuleRevisionId pattern,
|
public Collection<ModuleRevisionId> findModuleRevisionIds(DependencyResolver resolver,
|
||||||
PatternMatcher matcher) {
|
ModuleRevisionId pattern, PatternMatcher matcher) {
|
||||||
Collection mrids = new ArrayList();
|
Collection<ModuleRevisionId> mrids = new ArrayList<ModuleRevisionId>();
|
||||||
String resolverName = resolver.getName();
|
String resolverName = resolver.getName();
|
||||||
|
|
||||||
Message.verbose("looking for modules matching " + pattern + " using " + matcher.getName());
|
Message.verbose("looking for modules matching " + pattern + " using " + matcher.getName());
|
||||||
|
|
@ -356,7 +343,7 @@ public class SearchEngine {
|
||||||
fromNamespace = ((AbstractResolver) resolver).getNamespace();
|
fromNamespace = ((AbstractResolver) resolver).getNamespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection modules = new ArrayList();
|
Collection<ModuleEntry> modules = new ArrayList<ModuleEntry>();
|
||||||
|
|
||||||
OrganisationEntry[] orgs = resolver.listOrganisations();
|
OrganisationEntry[] orgs = resolver.listOrganisations();
|
||||||
if (orgs == null || orgs.length == 0) {
|
if (orgs == null || orgs.length == 0) {
|
||||||
|
|
@ -386,8 +373,7 @@ public class SearchEngine {
|
||||||
Message.debug("found " + modules.size() + " modules for " + pattern.getOrganisation()
|
Message.debug("found " + modules.size() + " modules for " + pattern.getOrganisation()
|
||||||
+ " on " + resolverName);
|
+ " on " + resolverName);
|
||||||
boolean foundModule = false;
|
boolean foundModule = false;
|
||||||
for (Iterator iter = modules.iterator(); iter.hasNext();) {
|
for (ModuleEntry mEntry : modules) {
|
||||||
ModuleEntry mEntry = (ModuleEntry) iter.next();
|
|
||||||
|
|
||||||
ModuleId foundMid = new ModuleId(mEntry.getOrganisation(), mEntry.getModule());
|
ModuleId foundMid = new ModuleId(mEntry.getOrganisation(), mEntry.getModule());
|
||||||
ModuleId systemMid = foundMid;
|
ModuleId systemMid = foundMid;
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.ivy.Ivy;
|
import org.apache.ivy.Ivy;
|
||||||
|
|
@ -76,6 +76,7 @@ import org.apache.ivy.plugins.latest.LatestLexicographicStrategy;
|
||||||
import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
|
import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
|
||||||
import org.apache.ivy.plugins.latest.LatestStrategy;
|
import org.apache.ivy.plugins.latest.LatestStrategy;
|
||||||
import org.apache.ivy.plugins.latest.LatestTimeStrategy;
|
import org.apache.ivy.plugins.latest.LatestTimeStrategy;
|
||||||
|
import org.apache.ivy.plugins.latest.WorkspaceLatestStrategy;
|
||||||
import org.apache.ivy.plugins.lock.CreateFileLockStrategy;
|
import org.apache.ivy.plugins.lock.CreateFileLockStrategy;
|
||||||
import org.apache.ivy.plugins.lock.LockStrategy;
|
import org.apache.ivy.plugins.lock.LockStrategy;
|
||||||
import org.apache.ivy.plugins.lock.NIOFileLockStrategy;
|
import org.apache.ivy.plugins.lock.NIOFileLockStrategy;
|
||||||
|
|
@ -92,10 +93,12 @@ import org.apache.ivy.plugins.parser.ParserSettings;
|
||||||
import org.apache.ivy.plugins.report.LogReportOutputter;
|
import org.apache.ivy.plugins.report.LogReportOutputter;
|
||||||
import org.apache.ivy.plugins.report.ReportOutputter;
|
import org.apache.ivy.plugins.report.ReportOutputter;
|
||||||
import org.apache.ivy.plugins.report.XmlReportOutputter;
|
import org.apache.ivy.plugins.report.XmlReportOutputter;
|
||||||
|
import org.apache.ivy.plugins.resolver.AbstractWorkspaceResolver;
|
||||||
import org.apache.ivy.plugins.resolver.ChainResolver;
|
import org.apache.ivy.plugins.resolver.ChainResolver;
|
||||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||||
import org.apache.ivy.plugins.resolver.DualResolver;
|
import org.apache.ivy.plugins.resolver.DualResolver;
|
||||||
import org.apache.ivy.plugins.resolver.ResolverSettings;
|
import org.apache.ivy.plugins.resolver.ResolverSettings;
|
||||||
|
import org.apache.ivy.plugins.resolver.WorkspaceChainResolver;
|
||||||
import org.apache.ivy.plugins.signer.SignatureGenerator;
|
import org.apache.ivy.plugins.signer.SignatureGenerator;
|
||||||
import org.apache.ivy.plugins.trigger.Trigger;
|
import org.apache.ivy.plugins.trigger.Trigger;
|
||||||
import org.apache.ivy.plugins.version.ChainVersionMatcher;
|
import org.apache.ivy.plugins.version.ChainVersionMatcher;
|
||||||
|
|
@ -115,9 +118,9 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
ResolveEngineSettings, RetrieveEngineSettings, RepositoryManagementEngineSettings {
|
ResolveEngineSettings, RetrieveEngineSettings, RepositoryManagementEngineSettings {
|
||||||
private static final long INTERUPT_TIMEOUT = 2000;
|
private static final long INTERUPT_TIMEOUT = 2000;
|
||||||
|
|
||||||
private Map typeDefs = new HashMap();
|
private Map<String, Class<?>> typeDefs = new HashMap<String, Class<?>>();
|
||||||
|
|
||||||
private Map resolversMap = new HashMap();
|
private Map<String, DependencyResolver> resolversMap = new HashMap<String, DependencyResolver>();
|
||||||
|
|
||||||
private DependencyResolver defaultResolver;
|
private DependencyResolver defaultResolver;
|
||||||
|
|
||||||
|
|
@ -131,40 +134,29 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
private boolean checkUpToDate = true;
|
private boolean checkUpToDate = true;
|
||||||
|
|
||||||
private ModuleRules moduleSettings = new ModuleRules();
|
private ModuleRules<ModuleSettings> moduleSettings = new ModuleRules<ModuleSettings>();
|
||||||
|
|
||||||
// Map (String conflictManagerName -> ConflictManager)
|
private Map<String, ConflictManager> conflictsManager = new HashMap<String, ConflictManager>();
|
||||||
private Map conflictsManager = new HashMap();
|
|
||||||
|
|
||||||
// Map (String latestStrategyName -> LatestStrategy)
|
private Map<String, LatestStrategy> latestStrategies = new HashMap<String, LatestStrategy>();
|
||||||
private Map latestStrategies = new HashMap();
|
|
||||||
|
|
||||||
// Map (String name -> LockStrategy)
|
private Map<String, LockStrategy> lockStrategies = new HashMap<String, LockStrategy>();
|
||||||
private Map lockStrategies = new HashMap();
|
|
||||||
|
|
||||||
// Map (String namespaceName -> Namespace)
|
private Map<String, Namespace> namespaces = new HashMap<String, Namespace>();
|
||||||
private Map namespaces = new HashMap();
|
|
||||||
|
|
||||||
// Map (String matcherName -> Matcher)
|
private Map<String, PatternMatcher> matchers = new HashMap<String, PatternMatcher>();
|
||||||
private Map matchers = new HashMap();
|
|
||||||
|
|
||||||
// Map (String outputterName -> ReportOutputter)
|
private Map<String, ReportOutputter> reportOutputters = new HashMap<String, ReportOutputter>();
|
||||||
private Map reportOutputters = new HashMap();
|
|
||||||
|
|
||||||
// Map (String matcherName -> VersionMatcher)
|
private Map<String, VersionMatcher> versionMatchers = new HashMap<String, VersionMatcher>();
|
||||||
private Map versionMatchers = new HashMap();
|
|
||||||
|
|
||||||
// Map (String name -> CircularDependencyStrategy)
|
private Map<String, CircularDependencyStrategy> circularDependencyStrategies = new HashMap<String, CircularDependencyStrategy>();
|
||||||
private Map circularDependencyStrategies = new HashMap();
|
|
||||||
|
|
||||||
// Map (String name -> RepositoryCacheManager)
|
private Map<String, RepositoryCacheManager> repositoryCacheManagers = new HashMap<String, RepositoryCacheManager>();
|
||||||
private Map repositoryCacheManagers = new HashMap();
|
|
||||||
|
|
||||||
// Map (String name -> SignatureGenerator)
|
private Map<String, SignatureGenerator> signatureGenerators = new HashMap<String, SignatureGenerator>();
|
||||||
private Map signatureGenerators = new HashMap();
|
|
||||||
|
|
||||||
// List (Trigger)
|
private List<Trigger> triggers = new ArrayList<Trigger>();
|
||||||
private List triggers = new ArrayList();
|
|
||||||
|
|
||||||
private IvyVariableContainer variableContainer = new IvyVariableContainerImpl();
|
private IvyVariableContainer variableContainer = new IvyVariableContainerImpl();
|
||||||
|
|
||||||
|
|
@ -182,7 +174,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
private ResolutionCacheManager resolutionCacheManager = null;
|
private ResolutionCacheManager resolutionCacheManager = null;
|
||||||
|
|
||||||
private List listingIgnore = new ArrayList();
|
private List<String> listingIgnore = new ArrayList<String>();
|
||||||
|
|
||||||
private boolean repositoriesConfigured;
|
private boolean repositoriesConfigured;
|
||||||
|
|
||||||
|
|
@ -192,7 +184,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
private File baseDir = new File(".").getAbsoluteFile();
|
private File baseDir = new File(".").getAbsoluteFile();
|
||||||
|
|
||||||
private List classpathURLs = new ArrayList();
|
private List<URL> classpathURLs = new ArrayList<URL>();
|
||||||
|
|
||||||
private ClassLoader classloader;
|
private ClassLoader classloader;
|
||||||
|
|
||||||
|
|
@ -218,6 +210,8 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
private PackingRegistry packingRegistry = new PackingRegistry();
|
private PackingRegistry packingRegistry = new PackingRegistry();
|
||||||
|
|
||||||
|
private AbstractWorkspaceResolver workspaceResolver;
|
||||||
|
|
||||||
public IvySettings() {
|
public IvySettings() {
|
||||||
this(new IvyVariableContainerImpl());
|
this(new IvyVariableContainerImpl());
|
||||||
}
|
}
|
||||||
|
|
@ -278,8 +272,10 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// GlobPatternMatcher is optional. Only add it when available.
|
// GlobPatternMatcher is optional. Only add it when available.
|
||||||
Class globClazz = IvySettings.class.getClassLoader().loadClass(
|
@SuppressWarnings("unchecked")
|
||||||
"org.apache.ivy.plugins.matcher.GlobPatternMatcher");
|
Class<? extends PatternMatcher> globClazz = (Class<? extends PatternMatcher>) IvySettings.class
|
||||||
|
.getClassLoader()
|
||||||
|
.loadClass("org.apache.ivy.plugins.matcher.GlobPatternMatcher");
|
||||||
Field instanceField = globClazz.getField("INSTANCE");
|
Field instanceField = globClazz.getField("INSTANCE");
|
||||||
addMatcher((PatternMatcher) instanceField.get(null));
|
addMatcher((PatternMatcher) instanceField.get(null));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -305,7 +301,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
private synchronized void addSystemProperties() {
|
private synchronized void addSystemProperties() {
|
||||||
try {
|
try {
|
||||||
addAllVariables((Map) System.getProperties().clone());
|
addAllVariables((Map<?, ?>) System.getProperties().clone());
|
||||||
} catch (AccessControlException ex) {
|
} catch (AccessControlException ex) {
|
||||||
Message.verbose("access denied to getting all system properties: they won't be available as Ivy variables."
|
Message.verbose("access denied to getting all system properties: they won't be available as Ivy variables."
|
||||||
+ "\nset " + ex.getPermission() + " permission if you want to access them");
|
+ "\nset " + ex.getPermission() + " permission if you want to access them");
|
||||||
|
|
@ -371,9 +367,9 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void typeDefs(Properties p, boolean silentFail) {
|
public synchronized void typeDefs(Properties p, boolean silentFail) {
|
||||||
for (Iterator iter = p.keySet().iterator(); iter.hasNext();) {
|
for (Entry<Object, Object> entry : p.entrySet()) {
|
||||||
String name = (String) iter.next();
|
String name = entry.getKey().toString();
|
||||||
typeDef(name, p.getProperty(name), silentFail);
|
typeDef(name, entry.getValue().toString(), silentFail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -532,13 +528,12 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
|
|
||||||
if (!classpathURLs.isEmpty()) {
|
if (!classpathURLs.isEmpty()) {
|
||||||
Message.verbose("\t-- " + classpathURLs.size() + " custom classpath urls:");
|
Message.verbose("\t-- " + classpathURLs.size() + " custom classpath urls:");
|
||||||
for (Iterator iter = classpathURLs.iterator(); iter.hasNext();) {
|
for (URL url : classpathURLs) {
|
||||||
Message.debug("\t\t" + iter.next());
|
Message.debug("\t\t" + url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message.verbose("\t-- " + resolversMap.size() + " resolvers:");
|
Message.verbose("\t-- " + resolversMap.size() + " resolvers:");
|
||||||
for (Iterator iter = resolversMap.values().iterator(); iter.hasNext();) {
|
for (DependencyResolver resolver : resolversMap.values()) {
|
||||||
DependencyResolver resolver = (DependencyResolver) iter.next();
|
|
||||||
resolver.dumpSettings();
|
resolver.dumpSettings();
|
||||||
}
|
}
|
||||||
Message.debug("\tmodule settings:");
|
Message.debug("\tmodule settings:");
|
||||||
|
|
@ -600,7 +595,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
variableContainer.setVariable(varName, value, overwrite);
|
variableContainer.setVariable(varName, value, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addAllVariables(Map variables) {
|
public synchronized void addAllVariables(Map<?, ?> variables) {
|
||||||
addAllVariables(variables, true);
|
addAllVariables(variables, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -635,11 +630,10 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
* @return a new map of strings in which all current ivy variables in values have been
|
* @return a new map of strings in which all current ivy variables in values have been
|
||||||
* substituted by their value
|
* substituted by their value
|
||||||
*/
|
*/
|
||||||
public synchronized Map/* <String, String> */substitute(Map/* <String, String> */strings) {
|
public synchronized Map<String, String> substitute(Map<String, String> strings) {
|
||||||
Map substituted = new LinkedHashMap();
|
Map<String, String> substituted = new LinkedHashMap<String, String>();
|
||||||
for (Iterator it = strings.entrySet().iterator(); it.hasNext();) {
|
for (Entry<String, String> entry : strings.entrySet()) {
|
||||||
Map.Entry entry = (Map.Entry) it.next();
|
substituted.put(entry.getKey(), substitute(entry.getValue()));
|
||||||
substituted.put(entry.getKey(), substitute((String) entry.getValue()));
|
|
||||||
}
|
}
|
||||||
return substituted;
|
return substituted;
|
||||||
}
|
}
|
||||||
|
|
@ -654,19 +648,19 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
return variableContainer;
|
return variableContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Class typeDef(String name, String className) {
|
public synchronized Class<?> typeDef(String name, String className) {
|
||||||
return typeDef(name, className, false);
|
return typeDef(name, className, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Class typeDef(String name, String className, boolean silentFail) {
|
public synchronized Class<?> typeDef(String name, String className, boolean silentFail) {
|
||||||
Class clazz = classForName(className, silentFail);
|
Class<?> clazz = classForName(className, silentFail);
|
||||||
if (clazz != null) {
|
if (clazz != null) {
|
||||||
typeDefs.put(name, clazz);
|
typeDefs.put(name, clazz);
|
||||||
}
|
}
|
||||||
return clazz;
|
return clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Class classForName(String className, boolean silentFail) {
|
private Class<?> classForName(String className, boolean silentFail) {
|
||||||
try {
|
try {
|
||||||
return getClassLoader().loadClass(className);
|
return getClassLoader().loadClass(className);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
|
|
@ -687,7 +681,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
classloader = Ivy.class.getClassLoader();
|
classloader = Ivy.class.getClassLoader();
|
||||||
} else {
|
} else {
|
||||||
classloader = new URLClassLoader(
|
classloader = new URLClassLoader(
|
||||||
(URL[]) classpathURLs.toArray(new URL[classpathURLs.size()]),
|
classpathURLs.toArray(new URL[classpathURLs.size()]),
|
||||||
Ivy.class.getClassLoader());
|
Ivy.class.getClassLoader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -699,12 +693,12 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
classloader = null;
|
classloader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Map getTypeDefs() {
|
public synchronized Map<String, Class<?>> getTypeDefs() {
|
||||||
return typeDefs;
|
return typeDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Class getTypeDef(String name) {
|
public synchronized Class<?> getTypeDef(String name) {
|
||||||
return (Class) typeDefs.get(name);
|
return typeDefs.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods which match ivy conf method signature specs
|
// methods which match ivy conf method signature specs
|
||||||
|
|
@ -726,7 +720,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized SignatureGenerator getSignatureGenerator(String name) {
|
public synchronized SignatureGenerator getSignatureGenerator(String name) {
|
||||||
return (SignatureGenerator) signatureGenerators.get(name);
|
return signatureGenerators.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addResolver(DependencyResolver resolver) {
|
public synchronized void addResolver(DependencyResolver resolver) {
|
||||||
|
|
@ -736,9 +730,8 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
init(resolver);
|
init(resolver);
|
||||||
resolversMap.put(resolver.getName(), resolver);
|
resolversMap.put(resolver.getName(), resolver);
|
||||||
if (resolver instanceof ChainResolver) {
|
if (resolver instanceof ChainResolver) {
|
||||||
List subresolvers = ((ChainResolver) resolver).getResolvers();
|
List<DependencyResolver> subresolvers = ((ChainResolver) resolver).getResolvers();
|
||||||
for (Iterator iter = subresolvers.iterator(); iter.hasNext();) {
|
for (DependencyResolver dr : subresolvers) {
|
||||||
DependencyResolver dr = (DependencyResolver) iter.next();
|
|
||||||
addResolver(dr);
|
addResolver(dr);
|
||||||
}
|
}
|
||||||
} else if (resolver instanceof DualResolver) {
|
} else if (resolver instanceof DualResolver) {
|
||||||
|
|
@ -783,8 +776,9 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
/**
|
/**
|
||||||
* regular expressions as explained in Pattern class may be used in attributes
|
* regular expressions as explained in Pattern class may be used in attributes
|
||||||
*/
|
*/
|
||||||
public synchronized void addModuleConfiguration(Map attributes, PatternMatcher matcher,
|
public synchronized void addModuleConfiguration(Map<String, String> attributes,
|
||||||
String resolverName, String branch, String conflictManager, String resolveMode) {
|
PatternMatcher matcher, String resolverName, String branch, String conflictManager,
|
||||||
|
String resolveMode) {
|
||||||
checkResolverName(resolverName);
|
checkResolverName(resolverName);
|
||||||
moduleSettings.defineRule(new MapMatcher(attributes, matcher), new ModuleSettings(
|
moduleSettings.defineRule(new MapMatcher(attributes, matcher), new ModuleSettings(
|
||||||
resolverName, branch, conflictManager, resolveMode));
|
resolverName, branch, conflictManager, resolveMode));
|
||||||
|
|
@ -890,9 +884,20 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
dictatorResolver = resolver;
|
dictatorResolver = resolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DependencyResolver getDictatorResolver() {
|
||||||
|
if (dictatorResolver == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (workspaceResolver != null && !(dictatorResolver instanceof WorkspaceChainResolver)) {
|
||||||
|
dictatorResolver = new WorkspaceChainResolver(this, dictatorResolver, workspaceResolver);
|
||||||
|
}
|
||||||
|
return dictatorResolver;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized DependencyResolver getResolver(ModuleRevisionId mrid) {
|
public synchronized DependencyResolver getResolver(ModuleRevisionId mrid) {
|
||||||
if (dictatorResolver != null) {
|
DependencyResolver r = getDictatorResolver();
|
||||||
return dictatorResolver;
|
if (r != null) {
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
String resolverName = getResolverName(mrid);
|
String resolverName = getResolverName(mrid);
|
||||||
return getResolver(resolverName);
|
return getResolver(resolverName);
|
||||||
|
|
@ -903,39 +908,48 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized DependencyResolver getResolver(String resolverName) {
|
public synchronized DependencyResolver getResolver(String resolverName) {
|
||||||
if (dictatorResolver != null) {
|
DependencyResolver r = getDictatorResolver();
|
||||||
return dictatorResolver;
|
if (r != null) {
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
DependencyResolver resolver = (DependencyResolver) resolversMap.get(resolverName);
|
DependencyResolver resolver = resolversMap.get(resolverName);
|
||||||
if (resolver == null) {
|
if (resolver == null) {
|
||||||
Message.error("unknown resolver " + resolverName);
|
Message.error("unknown resolver " + resolverName);
|
||||||
|
} else if (workspaceResolver != null && !(resolver instanceof WorkspaceChainResolver)) {
|
||||||
|
resolver = new WorkspaceChainResolver(this, resolver, workspaceResolver);
|
||||||
|
resolversMap.put(resolver.getName(), resolver);
|
||||||
|
resolversMap.put(resolverName, resolver);
|
||||||
}
|
}
|
||||||
return resolver;
|
return resolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized DependencyResolver getDefaultResolver() {
|
public synchronized DependencyResolver getDefaultResolver() {
|
||||||
if (dictatorResolver != null) {
|
DependencyResolver r = getDictatorResolver();
|
||||||
return dictatorResolver;
|
if (r != null) {
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
if (defaultResolver == null) {
|
if (defaultResolver == null) {
|
||||||
defaultResolver = (DependencyResolver) resolversMap.get(defaultResolverName);
|
defaultResolver = resolversMap.get(defaultResolverName);
|
||||||
|
}
|
||||||
|
if (workspaceResolver != null && !(defaultResolver instanceof WorkspaceChainResolver)) {
|
||||||
|
defaultResolver = new WorkspaceChainResolver(this, defaultResolver, workspaceResolver);
|
||||||
}
|
}
|
||||||
return defaultResolver;
|
return defaultResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized String getResolverName(ModuleRevisionId mrid) {
|
public synchronized String getResolverName(ModuleRevisionId mrid) {
|
||||||
ModuleSettings ms = (ModuleSettings) moduleSettings.getRule(mrid, new Filter() {
|
ModuleSettings ms = moduleSettings.getRule(mrid, new Filter<ModuleSettings>() {
|
||||||
public boolean accept(Object o) {
|
public boolean accept(ModuleSettings o) {
|
||||||
return ((ModuleSettings) o).getResolverName() != null;
|
return o.getResolverName() != null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ms == null ? defaultResolverName : ms.getResolverName();
|
return ms == null ? defaultResolverName : ms.getResolverName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized String getDefaultBranch(ModuleId moduleId) {
|
public synchronized String getDefaultBranch(ModuleId moduleId) {
|
||||||
ModuleSettings ms = (ModuleSettings) moduleSettings.getRule(moduleId, new Filter() {
|
ModuleSettings ms = moduleSettings.getRule(moduleId, new Filter<ModuleSettings>() {
|
||||||
public boolean accept(Object o) {
|
public boolean accept(ModuleSettings o) {
|
||||||
return ((ModuleSettings) o).getBranch() != null;
|
return o.getBranch() != null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ms == null ? getDefaultBranch() : ms.getBranch();
|
return ms == null ? getDefaultBranch() : ms.getBranch();
|
||||||
|
|
@ -950,9 +964,9 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ConflictManager getConflictManager(ModuleId moduleId) {
|
public synchronized ConflictManager getConflictManager(ModuleId moduleId) {
|
||||||
ModuleSettings ms = (ModuleSettings) moduleSettings.getRule(moduleId, new Filter() {
|
ModuleSettings ms = moduleSettings.getRule(moduleId, new Filter<ModuleSettings>() {
|
||||||
public boolean accept(Object o) {
|
public boolean accept(ModuleSettings o) {
|
||||||
return ((ModuleSettings) o).getConflictManager() != null;
|
return o.getConflictManager() != null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (ms == null) {
|
if (ms == null) {
|
||||||
|
|
@ -968,9 +982,9 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized String getResolveMode(ModuleId moduleId) {
|
public synchronized String getResolveMode(ModuleId moduleId) {
|
||||||
ModuleSettings ms = (ModuleSettings) moduleSettings.getRule(moduleId, new Filter() {
|
ModuleSettings ms = moduleSettings.getRule(moduleId, new Filter<ModuleSettings>() {
|
||||||
public boolean accept(Object o) {
|
public boolean accept(ModuleSettings o) {
|
||||||
return ((ModuleSettings) o).getResolveMode() != null;
|
return o.getResolveMode() != null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ms == null ? getDefaultResolveMode() : ms.getResolveMode();
|
return ms == null ? getDefaultResolveMode() : ms.getResolveMode();
|
||||||
|
|
@ -992,7 +1006,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
if ("default".equals(name)) {
|
if ("default".equals(name)) {
|
||||||
return getDefaultConflictManager();
|
return getDefaultConflictManager();
|
||||||
}
|
}
|
||||||
return (ConflictManager) conflictsManager.get(name);
|
return conflictsManager.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addConflictManager(String name, ConflictManager cm) {
|
public synchronized void addConflictManager(String name, ConflictManager cm) {
|
||||||
|
|
@ -1008,7 +1022,12 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
if ("default".equals(name)) {
|
if ("default".equals(name)) {
|
||||||
return getDefaultLatestStrategy();
|
return getDefaultLatestStrategy();
|
||||||
}
|
}
|
||||||
return (LatestStrategy) latestStrategies.get(name);
|
LatestStrategy strategy = latestStrategies.get(name);
|
||||||
|
if (workspaceResolver != null && !(strategy instanceof WorkspaceLatestStrategy)) {
|
||||||
|
strategy = new WorkspaceLatestStrategy(strategy);
|
||||||
|
latestStrategies.put(name, strategy);
|
||||||
|
}
|
||||||
|
return strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addLatestStrategy(String name, LatestStrategy latest) {
|
public synchronized void addLatestStrategy(String name, LatestStrategy latest) {
|
||||||
|
|
@ -1024,7 +1043,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
if ("default".equals(name)) {
|
if ("default".equals(name)) {
|
||||||
return getDefaultLockStrategy();
|
return getDefaultLockStrategy();
|
||||||
}
|
}
|
||||||
return (LockStrategy) lockStrategies.get(name);
|
return lockStrategies.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addLockStrategy(String name, LockStrategy lockStrategy) {
|
public synchronized void addLockStrategy(String name, LockStrategy lockStrategy) {
|
||||||
|
|
@ -1040,7 +1059,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
if ("system".equals(name)) {
|
if ("system".equals(name)) {
|
||||||
return getSystemNamespace();
|
return getSystemNamespace();
|
||||||
}
|
}
|
||||||
return (Namespace) namespaces.get(name);
|
return namespaces.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Namespace getSystemNamespace() {
|
public final Namespace getSystemNamespace() {
|
||||||
|
|
@ -1057,7 +1076,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized PatternMatcher getMatcher(String name) {
|
public synchronized PatternMatcher getMatcher(String name) {
|
||||||
return (PatternMatcher) matchers.get(name);
|
return matchers.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addMatcher(PatternMatcher m) {
|
public synchronized void addMatcher(PatternMatcher m) {
|
||||||
|
|
@ -1070,7 +1089,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized RepositoryCacheManager getRepositoryCacheManager(String name) {
|
public synchronized RepositoryCacheManager getRepositoryCacheManager(String name) {
|
||||||
return (RepositoryCacheManager) repositoryCacheManagers.get(name);
|
return repositoryCacheManagers.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addRepositoryCacheManager(RepositoryCacheManager c) {
|
public synchronized void addRepositoryCacheManager(RepositoryCacheManager c) {
|
||||||
|
|
@ -1079,7 +1098,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized RepositoryCacheManager[] getRepositoryCacheManagers() {
|
public synchronized RepositoryCacheManager[] getRepositoryCacheManagers() {
|
||||||
return (RepositoryCacheManager[]) repositoryCacheManagers.values().toArray(
|
return repositoryCacheManagers.values().toArray(
|
||||||
new RepositoryCacheManager[repositoryCacheManagers.size()]);
|
new RepositoryCacheManager[repositoryCacheManagers.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1088,7 +1107,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ReportOutputter getReportOutputter(String name) {
|
public synchronized ReportOutputter getReportOutputter(String name) {
|
||||||
return (ReportOutputter) reportOutputters.get(name);
|
return reportOutputters.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addReportOutputter(ReportOutputter outputter) {
|
public synchronized void addReportOutputter(ReportOutputter outputter) {
|
||||||
|
|
@ -1097,8 +1116,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ReportOutputter[] getReportOutputters() {
|
public synchronized ReportOutputter[] getReportOutputters() {
|
||||||
return (ReportOutputter[]) reportOutputters.values().toArray(
|
return reportOutputters.values().toArray(new ReportOutputter[reportOutputters.size()]);
|
||||||
new ReportOutputter[reportOutputters.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addConfigured(VersionMatcher vmatcher) {
|
public synchronized void addConfigured(VersionMatcher vmatcher) {
|
||||||
|
|
@ -1106,7 +1124,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized VersionMatcher getVersionMatcher(String name) {
|
public synchronized VersionMatcher getVersionMatcher(String name) {
|
||||||
return (VersionMatcher) versionMatchers.get(name);
|
return versionMatchers.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addVersionMatcher(VersionMatcher vmatcher) {
|
public synchronized void addVersionMatcher(VersionMatcher vmatcher) {
|
||||||
|
|
@ -1124,8 +1142,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized VersionMatcher[] getVersionMatchers() {
|
public synchronized VersionMatcher[] getVersionMatchers() {
|
||||||
return (VersionMatcher[]) versionMatchers.values().toArray(
|
return versionMatchers.values().toArray(new VersionMatcher[versionMatchers.size()]);
|
||||||
new VersionMatcher[versionMatchers.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized VersionMatcher getVersionMatcher() {
|
public synchronized VersionMatcher getVersionMatcher() {
|
||||||
|
|
@ -1152,7 +1169,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
if ("default".equals(name)) {
|
if ("default".equals(name)) {
|
||||||
name = "warn";
|
name = "warn";
|
||||||
}
|
}
|
||||||
return (CircularDependencyStrategy) circularDependencyStrategies.get(name);
|
return circularDependencyStrategies.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setCircularDependencyStrategy(CircularDependencyStrategy strategy) {
|
public synchronized void setCircularDependencyStrategy(CircularDependencyStrategy strategy) {
|
||||||
|
|
@ -1188,7 +1205,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
* Returns the file names of the files that should be ignored when creating a file listing.
|
* Returns the file names of the files that should be ignored when creating a file listing.
|
||||||
*/
|
*/
|
||||||
public synchronized String[] getIgnorableFilenames() {
|
public synchronized String[] getIgnorableFilenames() {
|
||||||
return (String[]) listingIgnore.toArray(new String[listingIgnore.size()]);
|
return listingIgnore.toArray(new String[listingIgnore.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1197,7 +1214,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
*
|
*
|
||||||
* @param names
|
* @param names
|
||||||
*/
|
*/
|
||||||
public synchronized void filterIgnore(Collection names) {
|
public synchronized void filterIgnore(Collection<String> names) {
|
||||||
names.removeAll(listingIgnore);
|
names.removeAll(listingIgnore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1237,6 +1254,10 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
if (defaultLatestStrategy == null) {
|
if (defaultLatestStrategy == null) {
|
||||||
defaultLatestStrategy = new LatestRevisionStrategy();
|
defaultLatestStrategy = new LatestRevisionStrategy();
|
||||||
}
|
}
|
||||||
|
if (workspaceResolver != null
|
||||||
|
&& !(defaultLatestStrategy instanceof WorkspaceLatestStrategy)) {
|
||||||
|
defaultLatestStrategy = new WorkspaceLatestStrategy(defaultLatestStrategy);
|
||||||
|
}
|
||||||
return defaultLatestStrategy;
|
return defaultLatestStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1286,7 +1307,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
triggers.add(trigger);
|
triggers.add(trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized List getTriggers() {
|
public synchronized List<Trigger> getTriggers() {
|
||||||
return triggers;
|
return triggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1375,6 +1396,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
this.resolveMode = resolveMode;
|
this.resolveMode = resolveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return (resolverName != null ? "resolver: " + resolverName : "")
|
return (resolverName != null ? "resolver: " + resolverName : "")
|
||||||
+ (branch != null ? "branch: " + branch : "")
|
+ (branch != null ? "branch: " + branch : "")
|
||||||
|
|
@ -1403,15 +1425,15 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
return INTERUPT_TIMEOUT;
|
return INTERUPT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Collection getResolvers() {
|
public synchronized Collection<DependencyResolver> getResolvers() {
|
||||||
return resolversMap.values();
|
return resolversMap.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Collection getResolverNames() {
|
public synchronized Collection<String> getResolverNames() {
|
||||||
return resolversMap.keySet();
|
return resolversMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Collection getMatcherNames() {
|
public synchronized Collection<String> getMatcherNames() {
|
||||||
return matchers.keySet();
|
return matchers.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1492,9 +1514,8 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
* @throws IllegalStateException
|
* @throws IllegalStateException
|
||||||
* if any of the objects is not valid.
|
* if any of the objects is not valid.
|
||||||
*/
|
*/
|
||||||
private void validateAll(Collection values) {
|
private void validateAll(Collection<?> values) {
|
||||||
for (Iterator iterator = values.iterator(); iterator.hasNext();) {
|
for (Object object : values) {
|
||||||
Object object = iterator.next();
|
|
||||||
if (object instanceof Validatable) {
|
if (object instanceof Validatable) {
|
||||||
((Validatable) object).validate();
|
((Validatable) object).validate();
|
||||||
}
|
}
|
||||||
|
|
@ -1513,4 +1534,20 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
|
||||||
public PackingRegistry getPackingRegistry() {
|
public PackingRegistry getPackingRegistry() {
|
||||||
return packingRegistry;
|
return packingRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addConfigured(AbstractWorkspaceResolver workspaceResolver) {
|
||||||
|
this.workspaceResolver = workspaceResolver;
|
||||||
|
if (workspaceResolver != null) {
|
||||||
|
workspaceResolver.setSettings(this);
|
||||||
|
DefaultRepositoryCacheManager cacheManager = new DefaultRepositoryCacheManager();
|
||||||
|
String cacheName = "workspace-resolver-cache-" + workspaceResolver.getName();
|
||||||
|
cacheManager.setBasedir(new File(getDefaultCache(), cacheName));
|
||||||
|
cacheManager.setCheckmodified(true);
|
||||||
|
cacheManager.setUseOrigin(true);
|
||||||
|
cacheManager.setName(cacheName);
|
||||||
|
addRepositoryCacheManager(cacheManager);
|
||||||
|
workspaceResolver.setCache(cacheName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,24 @@ public class OSGiManifestParser implements ModuleDescriptorParser {
|
||||||
|
|
||||||
public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL descriptorURL,
|
public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL descriptorURL,
|
||||||
Resource res, boolean validate) throws ParseException, IOException {
|
Resource res, boolean validate) throws ParseException, IOException {
|
||||||
Manifest m = new Manifest(res.openStream());
|
final InputStream resourceStream = res.openStream();
|
||||||
BundleInfo bundleInfo = ManifestParser.parseManifest(m);
|
final Manifest manifest;
|
||||||
try {
|
try {
|
||||||
bundleInfo.addArtifact(new BundleArtifact(false, new URI(res.getName()), null));
|
manifest = new Manifest(resourceStream);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
resourceStream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BundleInfo bundleInfo = ManifestParser.parseManifest(manifest);
|
||||||
|
try {
|
||||||
|
bundleInfo.addArtifact(new BundleArtifact(false, descriptorURL.toURI(), null));
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
throw new RuntimeException("Unsupported repository, resources names are not uris", e);
|
throw new RuntimeException("Unsupported repository, resources names are not uris", e);
|
||||||
}
|
}
|
||||||
return BundleInfoAdapter.toModuleDescriptor(this, null, bundleInfo, m, profileProvider);
|
return BundleInfoAdapter.toModuleDescriptor(this, null, bundleInfo, manifest, profileProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toIvyFile(InputStream is, Resource res, File destFile, ModuleDescriptor md)
|
public void toIvyFile(InputStream is, Resource res, File destFile, ModuleDescriptor md)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public class AndFilter extends MultiOperatorFilter {
|
||||||
super(filters);
|
super(filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected char operator() {
|
protected char operator() {
|
||||||
return '&';
|
return '&';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class CompareFilter extends OSGiFilter {
|
||||||
public static enum Operator {
|
public static enum Operator {
|
||||||
|
|
||||||
EQUALS("="), LOWER_THAN("<"), LOWER_OR_EQUAL("<="), GREATER_THAN(">"), GREATER_OR_EQUAL(
|
EQUALS("="), LOWER_THAN("<"), LOWER_OR_EQUAL("<="), GREATER_THAN(">"), GREATER_OR_EQUAL(
|
||||||
">=");
|
">="), APPROX("~="), PRESENT("=*");
|
||||||
|
|
||||||
private String op;
|
private String op;
|
||||||
|
|
||||||
|
|
@ -32,6 +32,7 @@ public class CompareFilter extends OSGiFilter {
|
||||||
this.op = op;
|
this.op = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
@ -43,10 +44,13 @@ public class CompareFilter extends OSGiFilter {
|
||||||
|
|
||||||
private final String leftValue;
|
private final String leftValue;
|
||||||
|
|
||||||
|
private boolean substring;
|
||||||
|
|
||||||
public CompareFilter(String leftValue, Operator operator, String rightValue) {
|
public CompareFilter(String leftValue, Operator operator, String rightValue) {
|
||||||
this.leftValue = leftValue;
|
this.leftValue = leftValue;
|
||||||
this.rightValue = rightValue;
|
this.rightValue = rightValue;
|
||||||
this.operator = operator;
|
this.operator = operator;
|
||||||
|
this.substring = operator == Operator.EQUALS && rightValue.contains("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLeftValue() {
|
public String getLeftValue() {
|
||||||
|
|
@ -61,6 +65,7 @@ public class CompareFilter extends OSGiFilter {
|
||||||
return rightValue;
|
return rightValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void append(StringBuffer builder) {
|
public void append(StringBuffer builder) {
|
||||||
builder.append("(");
|
builder.append("(");
|
||||||
builder.append(leftValue);
|
builder.append(leftValue);
|
||||||
|
|
@ -75,6 +80,17 @@ public class CompareFilter extends OSGiFilter {
|
||||||
if (actualValue == null) {
|
if (actualValue == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (operator == Operator.PRESENT) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (operator == Operator.APPROX) {
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (substring) {
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
int diff = rightValue.compareTo(actualValue);
|
int diff = rightValue.compareTo(actualValue);
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case EQUALS:
|
case EQUALS:
|
||||||
|
|
@ -92,6 +108,7 @@ public class CompareFilter extends OSGiFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
@ -101,6 +118,7 @@ public class CompareFilter extends OSGiFilter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public abstract class MultiOperatorFilter extends OSGiFilter {
|
||||||
|
|
||||||
abstract protected char operator();
|
abstract protected char operator();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void append(StringBuffer builder) {
|
public void append(StringBuffer builder) {
|
||||||
builder.append('(');
|
builder.append('(');
|
||||||
builder.append(operator());
|
builder.append(operator());
|
||||||
|
|
@ -54,6 +55,7 @@ public abstract class MultiOperatorFilter extends OSGiFilter {
|
||||||
return subFilters;
|
return subFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
@ -63,6 +65,7 @@ public abstract class MultiOperatorFilter extends OSGiFilter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ public class NotFilter extends UniOperatorFilter {
|
||||||
super(subFilter);
|
super(subFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected char operator() {
|
protected char operator() {
|
||||||
return '!';
|
return '!';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public abstract class OSGiFilter {
|
public abstract class OSGiFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer builder = new StringBuffer();
|
StringBuffer builder = new StringBuffer();
|
||||||
append(builder);
|
append(builder);
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,15 @@ public class OSGiFilterParser {
|
||||||
if (c != '(') {
|
if (c != '(') {
|
||||||
throw new ParseException("Expecting '(' as the start of the filter", pos);
|
throw new ParseException("Expecting '(' as the start of the filter", pos);
|
||||||
}
|
}
|
||||||
|
OSGiFilter filter = parseFilterComp();
|
||||||
|
readNext();
|
||||||
|
if (c != ')') {
|
||||||
|
throw new ParseException("Expecting ')' as the end of the filter", pos);
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private OSGiFilter parseFilterComp() throws ParseException {
|
||||||
OSGiFilter filter;
|
OSGiFilter filter;
|
||||||
switch (readNext()) {
|
switch (readNext()) {
|
||||||
case '&':
|
case '&':
|
||||||
|
|
@ -105,17 +114,13 @@ public class OSGiFilterParser {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
unread();
|
unread();
|
||||||
filter = parseCompare();
|
filter = parseOperation();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
readNext();
|
|
||||||
if (c != ')') {
|
|
||||||
throw new ParseException("Expecting ')' as the end of the filter", pos);
|
|
||||||
}
|
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OSGiFilter parseCompare() throws ParseException {
|
private OSGiFilter parseOperation() throws ParseException {
|
||||||
String leftValue = parseCompareValue();
|
String leftValue = parseCompareValue();
|
||||||
Operator operator = parseCompareOperator();
|
Operator operator = parseCompareOperator();
|
||||||
String rightValue = parseCompareValue();
|
String rightValue = parseCompareValue();
|
||||||
|
|
@ -137,12 +142,16 @@ public class OSGiFilterParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isOperator(char ch) {
|
private boolean isOperator(char ch) {
|
||||||
return ch == '=' || ch == '<' || ch == '>';
|
return ch == '=' || ch == '<' || ch == '>' || ch == '~';
|
||||||
}
|
}
|
||||||
|
|
||||||
private Operator parseCompareOperator() throws ParseException {
|
private Operator parseCompareOperator() throws ParseException {
|
||||||
switch (readNext()) {
|
switch (readNext()) {
|
||||||
case '=':
|
case '=':
|
||||||
|
if (readNext() == '*') {
|
||||||
|
return Operator.PRESENT;
|
||||||
|
}
|
||||||
|
unread();
|
||||||
return Operator.EQUALS;
|
return Operator.EQUALS;
|
||||||
case '>':
|
case '>':
|
||||||
if (readNext() == '=') {
|
if (readNext() == '=') {
|
||||||
|
|
@ -156,25 +165,30 @@ public class OSGiFilterParser {
|
||||||
}
|
}
|
||||||
unread();
|
unread();
|
||||||
return Operator.LOWER_THAN;
|
return Operator.LOWER_THAN;
|
||||||
|
case '~':
|
||||||
|
if (readNext() == '=') {
|
||||||
|
return Operator.LOWER_OR_EQUAL;
|
||||||
|
}
|
||||||
|
unread();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw new ParseException("Expecting an operator: =, <, <=, > or >=", pos);
|
throw new ParseException("Expecting an operator: =, <, <=, >, >=, ~= or =*", pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OSGiFilter parseAnd() throws ParseException {
|
private OSGiFilter parseAnd() throws ParseException {
|
||||||
AndFilter filter = new AndFilter();
|
AndFilter filter = new AndFilter();
|
||||||
parseMultiOperator(filter);
|
parseFilterList(filter);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OSGiFilter parseOr() throws ParseException {
|
private OSGiFilter parseOr() throws ParseException {
|
||||||
OrFilter filter = new OrFilter();
|
OrFilter filter = new OrFilter();
|
||||||
parseMultiOperator(filter);
|
parseFilterList(filter);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseMultiOperator(MultiOperatorFilter filter) throws ParseException {
|
private void parseFilterList(MultiOperatorFilter filter) throws ParseException {
|
||||||
do {
|
do {
|
||||||
skipWhiteSpace();
|
skipWhiteSpace();
|
||||||
readNext();
|
readNext();
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public class OrFilter extends MultiOperatorFilter {
|
||||||
super(filters);
|
super(filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected char operator() {
|
protected char operator() {
|
||||||
return '|';
|
return '|';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public abstract class UniOperatorFilter extends OSGiFilter {
|
||||||
|
|
||||||
abstract protected char operator();
|
abstract protected char operator();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void append(StringBuffer builder) {
|
public void append(StringBuffer builder) {
|
||||||
builder.append("(");
|
builder.append("(");
|
||||||
builder.append(operator());
|
builder.append(operator());
|
||||||
|
|
@ -38,6 +39,7 @@ public abstract class UniOperatorFilter extends OSGiFilter {
|
||||||
return subFilter;
|
return subFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
@ -45,6 +47,7 @@ public abstract class UniOperatorFilter extends OSGiFilter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import java.net.MalformedURLException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.ParseException;
|
|
||||||
|
|
||||||
import org.apache.ivy.core.cache.CacheResourceOptions;
|
import org.apache.ivy.core.cache.CacheResourceOptions;
|
||||||
import org.apache.ivy.core.event.EventManager;
|
import org.apache.ivy.core.event.EventManager;
|
||||||
|
|
@ -62,6 +61,7 @@ public class OBRResolver extends AbstractOSGiResolver {
|
||||||
this.forceMetadataUpdate = forceMetadataUpdate;
|
this.forceMetadataUpdate = forceMetadataUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
if (repoXmlFile != null && repoXmlURL != null) {
|
if (repoXmlFile != null && repoXmlURL != null) {
|
||||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||||
|
|
@ -125,10 +125,6 @@ public class OBRResolver extends AbstractOSGiResolver {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
setRepoDescriptor(OBRXMLParser.parse(baseUri, in));
|
setRepoDescriptor(OBRXMLParser.parse(baseUri, in));
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
|
||||||
+ " couldn't be configured: the file " + sourceLocation
|
|
||||||
+ " is incorrectly formed (" + e.getMessage() + ")", e);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||||
+ " couldn't be configured: the file " + sourceLocation
|
+ " couldn't be configured: the file " + sourceLocation
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ import org.xml.sax.SAXParseException;
|
||||||
|
|
||||||
public class OBRXMLParser {
|
public class OBRXMLParser {
|
||||||
|
|
||||||
public static BundleRepoDescriptor parse(URI baseUri, InputStream in) throws ParseException,
|
public static BundleRepoDescriptor parse(URI baseUri, InputStream in) throws IOException,
|
||||||
IOException, SAXException {
|
SAXException {
|
||||||
RepositoryHandler handler = new RepositoryHandler(baseUri);
|
RepositoryHandler handler = new RepositoryHandler(baseUri);
|
||||||
try {
|
try {
|
||||||
XMLHelper.parse(in, null, handler, null);
|
XMLHelper.parse(in, null, handler, null);
|
||||||
|
|
@ -68,12 +68,14 @@ public class OBRXMLParser {
|
||||||
super(REPOSITORY);
|
super(REPOSITORY);
|
||||||
this.baseUri = baseUri;
|
this.baseUri = baseUri;
|
||||||
addChild(new ResourceHandler(), new ChildElementHandler<ResourceHandler>() {
|
addChild(new ResourceHandler(), new ChildElementHandler<ResourceHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ResourceHandler child) {
|
public void childHanlded(ResourceHandler child) {
|
||||||
repo.addBundle(child.bundleInfo);
|
repo.addBundle(child.bundleInfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
repo = new BundleRepoDescriptor(baseUri,
|
repo = new BundleRepoDescriptor(baseUri,
|
||||||
ExecutionEnvironmentProfileProvider.getInstance());
|
ExecutionEnvironmentProfileProvider.getInstance());
|
||||||
|
|
@ -109,6 +111,7 @@ public class OBRXMLParser {
|
||||||
// resource
|
// resource
|
||||||
|
|
||||||
addChild(new ResourceSourceHandler(), new ChildElementHandler<ResourceSourceHandler>() {
|
addChild(new ResourceSourceHandler(), new ChildElementHandler<ResourceSourceHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ResourceSourceHandler child) {
|
public void childHanlded(ResourceSourceHandler child) {
|
||||||
String uri = child.getBufferedChars().trim();
|
String uri = child.getBufferedChars().trim();
|
||||||
if (!uri.endsWith(".jar")) {
|
if (!uri.endsWith(".jar")) {
|
||||||
|
|
@ -129,23 +132,27 @@ public class OBRXMLParser {
|
||||||
});
|
});
|
||||||
addChild(new ResourceDescriptionHandler(),
|
addChild(new ResourceDescriptionHandler(),
|
||||||
new ChildElementHandler<ResourceDescriptionHandler>() {
|
new ChildElementHandler<ResourceDescriptionHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ResourceDescriptionHandler child) {
|
public void childHanlded(ResourceDescriptionHandler child) {
|
||||||
bundleInfo.setDescription(child.getBufferedChars().trim());
|
bundleInfo.setDescription(child.getBufferedChars().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ResourceDocumentationHandler(),
|
addChild(new ResourceDocumentationHandler(),
|
||||||
new ChildElementHandler<ResourceDocumentationHandler>() {
|
new ChildElementHandler<ResourceDocumentationHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ResourceDocumentationHandler child) {
|
public void childHanlded(ResourceDocumentationHandler child) {
|
||||||
bundleInfo.setDocumentation(child.getBufferedChars().trim());
|
bundleInfo.setDocumentation(child.getBufferedChars().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ResourceLicenseHandler(),
|
addChild(new ResourceLicenseHandler(),
|
||||||
new ChildElementHandler<ResourceLicenseHandler>() {
|
new ChildElementHandler<ResourceLicenseHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ResourceLicenseHandler child) {
|
public void childHanlded(ResourceLicenseHandler child) {
|
||||||
bundleInfo.setLicense(child.getBufferedChars().trim());
|
bundleInfo.setLicense(child.getBufferedChars().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ResourceSizeHandler(), new ChildElementHandler<ResourceSizeHandler>() {
|
addChild(new ResourceSizeHandler(), new ChildElementHandler<ResourceSizeHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ResourceSizeHandler child) {
|
public void childHanlded(ResourceSizeHandler child) {
|
||||||
String size = child.getBufferedChars().trim();
|
String size = child.getBufferedChars().trim();
|
||||||
try {
|
try {
|
||||||
|
|
@ -158,6 +165,7 @@ public class OBRXMLParser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new CapabilityHandler(), new ChildElementHandler<CapabilityHandler>() {
|
addChild(new CapabilityHandler(), new ChildElementHandler<CapabilityHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(CapabilityHandler child) throws SAXParseException {
|
public void childHanlded(CapabilityHandler child) throws SAXParseException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -169,6 +177,7 @@ public class OBRXMLParser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new RequireHandler(), new ChildElementHandler<RequireHandler>() {
|
addChild(new RequireHandler(), new ChildElementHandler<RequireHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(RequireHandler child) throws SAXParseException {
|
public void childHanlded(RequireHandler child) throws SAXParseException {
|
||||||
try {
|
try {
|
||||||
RequirementAdapter.adapt(bundleInfo, child.requirement);
|
RequirementAdapter.adapt(bundleInfo, child.requirement);
|
||||||
|
|
@ -183,12 +192,14 @@ public class OBRXMLParser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ExtendHandler(), new ChildElementHandler<ExtendHandler>() {
|
addChild(new ExtendHandler(), new ChildElementHandler<ExtendHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ExtendHandler child) throws SAXParseException {
|
public void childHanlded(ExtendHandler child) throws SAXParseException {
|
||||||
// TODO handle fragment host
|
// TODO handle fragment host
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String symbolicname = atts.getValue(SYMBOLIC_NAME);
|
String symbolicname = atts.getValue(SYMBOLIC_NAME);
|
||||||
if (symbolicname == null) {
|
if (symbolicname == null) {
|
||||||
|
|
@ -224,6 +235,7 @@ public class OBRXMLParser {
|
||||||
bundleInfo.setId(atts.getValue(ID));
|
bundleInfo.setId(atts.getValue(ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected String getCurrentElementIdentifier() {
|
protected String getCurrentElementIdentifier() {
|
||||||
return bundleInfo.getSymbolicName() + "/" + bundleInfo.getVersion();
|
return bundleInfo.getSymbolicName() + "/" + bundleInfo.getVersion();
|
||||||
}
|
}
|
||||||
|
|
@ -295,6 +307,7 @@ public class OBRXMLParser {
|
||||||
super(CAPABILITY);
|
super(CAPABILITY);
|
||||||
addChild(new CapabilityPropertyHandler(),
|
addChild(new CapabilityPropertyHandler(),
|
||||||
new ChildElementHandler<CapabilityPropertyHandler>() {
|
new ChildElementHandler<CapabilityPropertyHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(CapabilityPropertyHandler child) {
|
public void childHanlded(CapabilityPropertyHandler child) {
|
||||||
String name = child.name;
|
String name = child.name;
|
||||||
String value = child.value;
|
String value = child.value;
|
||||||
|
|
@ -305,6 +318,7 @@ public class OBRXMLParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String name = getRequiredAttribute(atts, NAME);
|
String name = getRequiredAttribute(atts, NAME);
|
||||||
capability = new Capability(name);
|
capability = new Capability(name);
|
||||||
|
|
@ -332,6 +346,7 @@ public class OBRXMLParser {
|
||||||
super(CAPABILITY_PROPERTY);
|
super(CAPABILITY_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
name = getRequiredAttribute(atts, NAME);
|
name = getRequiredAttribute(atts, NAME);
|
||||||
value = getRequiredAttribute(atts, VALUE);
|
value = getRequiredAttribute(atts, VALUE);
|
||||||
|
|
@ -357,6 +372,7 @@ public class OBRXMLParser {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String name = getRequiredAttribute(atts, NAME);
|
String name = getRequiredAttribute(atts, NAME);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ public class P2ArtifactParser implements XMLInputParser {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
addChild(new MappingsHandler(), new ChildElementHandler<MappingsHandler>() {
|
addChild(new MappingsHandler(), new ChildElementHandler<MappingsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(MappingsHandler child) {
|
public void childHanlded(MappingsHandler child) {
|
||||||
for (Entry<String, String> entry : child.outputByFilter.entrySet()) {
|
for (Entry<String, String> entry : child.outputByFilter.entrySet()) {
|
||||||
OSGiFilter filter;
|
OSGiFilter filter;
|
||||||
|
|
@ -95,6 +96,7 @@ public class P2ArtifactParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
addChild(new ArtifactsHandler(p2Descriptor, artifactPatterns, repoUrl),
|
addChild(new ArtifactsHandler(p2Descriptor, artifactPatterns, repoUrl),
|
||||||
new ChildElementHandler<ArtifactsHandler>() {
|
new ChildElementHandler<ArtifactsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ArtifactsHandler child) {
|
public void childHanlded(ArtifactsHandler child) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
@ -118,12 +120,14 @@ public class P2ArtifactParser implements XMLInputParser {
|
||||||
public MappingsHandler() {
|
public MappingsHandler() {
|
||||||
super(MAPPINGS);
|
super(MAPPINGS);
|
||||||
addChild(new RuleHandler(), new ChildElementHandler<RuleHandler>() {
|
addChild(new RuleHandler(), new ChildElementHandler<RuleHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(RuleHandler child) {
|
public void childHanlded(RuleHandler child) {
|
||||||
outputByFilter.put(child.filter, child.output);
|
outputByFilter.put(child.filter, child.output);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
outputByFilter = new LinkedHashMap<String, String>(size);
|
outputByFilter = new LinkedHashMap<String, String>(size);
|
||||||
|
|
@ -147,6 +151,7 @@ public class P2ArtifactParser implements XMLInputParser {
|
||||||
super(RULE);
|
super(RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
filter = atts.getValue(FILTER);
|
filter = atts.getValue(FILTER);
|
||||||
output = atts.getValue(OUTPUT);
|
output = atts.getValue(OUTPUT);
|
||||||
|
|
@ -164,6 +169,7 @@ public class P2ArtifactParser implements XMLInputParser {
|
||||||
final Map<OSGiFilter, String> artifactPatterns, final String repoUrl) {
|
final Map<OSGiFilter, String> artifactPatterns, final String repoUrl) {
|
||||||
super(ARTIFACTS);
|
super(ARTIFACTS);
|
||||||
addChild(new ArtifactHandler(), new ChildElementHandler<ArtifactHandler>() {
|
addChild(new ArtifactHandler(), new ChildElementHandler<ArtifactHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ArtifactHandler child) throws SAXParseException {
|
public void childHanlded(ArtifactHandler child) throws SAXParseException {
|
||||||
String url = getPattern(child.p2Artifact, child.properties);
|
String url = getPattern(child.p2Artifact, child.properties);
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
|
|
@ -224,12 +230,14 @@ public class P2ArtifactParser implements XMLInputParser {
|
||||||
public ArtifactHandler() {
|
public ArtifactHandler() {
|
||||||
super(ARTIFACT);
|
super(ARTIFACT);
|
||||||
addChild(new PropertiesHandler(), new ChildElementHandler<PropertiesHandler>() {
|
addChild(new PropertiesHandler(), new ChildElementHandler<PropertiesHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(PropertiesHandler child) {
|
public void childHanlded(PropertiesHandler child) {
|
||||||
properties = child.properties;
|
properties = child.properties;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String id = atts.getValue(ID);
|
String id = atts.getValue(ID);
|
||||||
Version version;
|
Version version;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ public class P2CompositeParser implements XMLInputParser {
|
||||||
public RepositoryHandler() {
|
public RepositoryHandler() {
|
||||||
super(REPOSITORY);
|
super(REPOSITORY);
|
||||||
addChild(new ChildrenHandler(), new ChildElementHandler<ChildrenHandler>() {
|
addChild(new ChildrenHandler(), new ChildElementHandler<ChildrenHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ChildrenHandler child) {
|
public void childHanlded(ChildrenHandler child) {
|
||||||
childLocations = child.childLocations;
|
childLocations = child.childLocations;
|
||||||
}
|
}
|
||||||
|
|
@ -89,12 +90,14 @@ public class P2CompositeParser implements XMLInputParser {
|
||||||
public ChildrenHandler() {
|
public ChildrenHandler() {
|
||||||
super(CHILDREN);
|
super(CHILDREN);
|
||||||
addChild(new ChildHandler(), new ChildElementHandler<ChildHandler>() {
|
addChild(new ChildHandler(), new ChildElementHandler<ChildHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ChildHandler child) {
|
public void childHanlded(ChildHandler child) {
|
||||||
childLocations.add(child.location);
|
childLocations.add(child.location);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
childLocations = new ArrayList<String>(size);
|
childLocations = new ArrayList<String>(size);
|
||||||
|
|
@ -114,6 +117,7 @@ public class P2CompositeParser implements XMLInputParser {
|
||||||
super(CHILD);
|
super(CHILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
location = atts.getValue(LOCATION);
|
location = atts.getValue(LOCATION);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
addChild(new UnitsHandler(), new ChildElementHandler<UnitsHandler>() {
|
addChild(new UnitsHandler(), new ChildElementHandler<UnitsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(UnitsHandler child) {
|
public void childHanlded(UnitsHandler child) {
|
||||||
for (BundleInfo bundle : child.bundles) {
|
for (BundleInfo bundle : child.bundles) {
|
||||||
p2Descriptor.addBundle(bundle);
|
p2Descriptor.addBundle(bundle);
|
||||||
|
|
@ -100,6 +101,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ReferencesHandler(), new ChildElementHandler<ReferencesHandler>() {
|
addChild(new ReferencesHandler(), new ChildElementHandler<ReferencesHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ReferencesHandler child) {
|
public void childHanlded(ReferencesHandler child) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -126,12 +128,14 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
super(REFERENCES);
|
super(REFERENCES);
|
||||||
addChild(new RepositoryReferenceHandler(),
|
addChild(new RepositoryReferenceHandler(),
|
||||||
new ChildElementHandler<RepositoryReferenceHandler>() {
|
new ChildElementHandler<RepositoryReferenceHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(RepositoryReferenceHandler child) {
|
public void childHanlded(RepositoryReferenceHandler child) {
|
||||||
repositoryUris.add(child.uri);
|
repositoryUris.add(child.uri);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
repositoryUris = new ArrayList<URI>(size);
|
repositoryUris = new ArrayList<URI>(size);
|
||||||
|
|
@ -164,6 +168,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
|
|
||||||
URI uri;
|
URI uri;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
// type = Integer.parseInt(atts.getValue(TYPE));
|
// type = Integer.parseInt(atts.getValue(TYPE));
|
||||||
// options = Integer.parseInt(atts.getValue(OPTIONS));
|
// options = Integer.parseInt(atts.getValue(OPTIONS));
|
||||||
|
|
@ -202,6 +207,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
public UnitsHandler() {
|
public UnitsHandler() {
|
||||||
super(UNITS);
|
super(UNITS);
|
||||||
addChild(new UnitHandler(), new ChildElementHandler<UnitHandler>() {
|
addChild(new UnitHandler(), new ChildElementHandler<UnitHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(UnitHandler child) {
|
public void childHanlded(UnitHandler child) {
|
||||||
if (child.bundleInfo != null && !child.bundleInfo.getCapabilities().isEmpty()) {
|
if (child.bundleInfo != null && !child.bundleInfo.getCapabilities().isEmpty()) {
|
||||||
bundles.add(child.bundleInfo);
|
bundles.add(child.bundleInfo);
|
||||||
|
|
@ -210,6 +216,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
bundles = new ArrayList<BundleInfo>(size);
|
bundles = new ArrayList<BundleInfo>(size);
|
||||||
|
|
@ -239,6 +246,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
// });
|
// });
|
||||||
addChild(new PropertiesHandler(CATEGORY_PROPERTY),
|
addChild(new PropertiesHandler(CATEGORY_PROPERTY),
|
||||||
new ChildElementHandler<PropertiesHandler>() {
|
new ChildElementHandler<PropertiesHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(PropertiesHandler child) {
|
public void childHanlded(PropertiesHandler child) {
|
||||||
String category = child.properties.get(CATEGORY_PROPERTY);
|
String category = child.properties.get(CATEGORY_PROPERTY);
|
||||||
if (category != null && Boolean.valueOf(category).booleanValue()) {
|
if (category != null && Boolean.valueOf(category).booleanValue()) {
|
||||||
|
|
@ -249,6 +257,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ProvidesHandler(), new ChildElementHandler<ProvidesHandler>() {
|
addChild(new ProvidesHandler(), new ChildElementHandler<ProvidesHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ProvidesHandler child) {
|
public void childHanlded(ProvidesHandler child) {
|
||||||
if ("source".equals(child.eclipseType)) {
|
if ("source".equals(child.eclipseType)) {
|
||||||
// this is some source of some bundle
|
// this is some source of some bundle
|
||||||
|
|
@ -270,10 +279,12 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new FilterHandler(), new ChildElementHandler<FilterHandler>() {
|
addChild(new FilterHandler(), new ChildElementHandler<FilterHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(FilterHandler child) {
|
public void childHanlded(FilterHandler child) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() {
|
addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(RequiresHandler child) {
|
public void childHanlded(RequiresHandler child) {
|
||||||
for (BundleRequirement requirement : child.requirements) {
|
for (BundleRequirement requirement : child.requirements) {
|
||||||
bundleInfo.addRequirement(requirement);
|
bundleInfo.addRequirement(requirement);
|
||||||
|
|
@ -282,15 +293,18 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
addChild(new HostRequirementsHandler(),
|
addChild(new HostRequirementsHandler(),
|
||||||
new ChildElementHandler<HostRequirementsHandler>() {
|
new ChildElementHandler<HostRequirementsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(HostRequirementsHandler child) {
|
public void childHanlded(HostRequirementsHandler child) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new MetaRequirementsHandler(),
|
addChild(new MetaRequirementsHandler(),
|
||||||
new ChildElementHandler<MetaRequirementsHandler>() {
|
new ChildElementHandler<MetaRequirementsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(MetaRequirementsHandler child) {
|
public void childHanlded(MetaRequirementsHandler child) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new ArtifactsHandler(), new ChildElementHandler<ArtifactsHandler>() {
|
addChild(new ArtifactsHandler(), new ChildElementHandler<ArtifactsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ArtifactsHandler child) {
|
public void childHanlded(ArtifactsHandler child) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -299,6 +313,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
addChild(new TouchpointDataHandler(), new ChildElementHandler<TouchpointDataHandler>() {
|
addChild(new TouchpointDataHandler(), new ChildElementHandler<TouchpointDataHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(TouchpointDataHandler child) throws SAXParseException {
|
public void childHanlded(TouchpointDataHandler child) throws SAXParseException {
|
||||||
if (child.zipped != null) {
|
if (child.zipped != null) {
|
||||||
bundleInfo.setHasInnerClasspath(child.zipped.booleanValue());
|
bundleInfo.setHasInnerClasspath(child.zipped.booleanValue());
|
||||||
|
|
@ -375,6 +390,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String id = atts.getValue(ID);
|
String id = atts.getValue(ID);
|
||||||
String version = atts.getValue(VERSION);
|
String version = atts.getValue(VERSION);
|
||||||
|
|
@ -448,6 +464,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
public ProvidesHandler() {
|
public ProvidesHandler() {
|
||||||
super(PROVIDES);
|
super(PROVIDES);
|
||||||
addChild(new ProvidedHandler(), new ChildElementHandler<ProvidedHandler>() {
|
addChild(new ProvidedHandler(), new ChildElementHandler<ProvidedHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ProvidedHandler child) {
|
public void childHanlded(ProvidedHandler child) {
|
||||||
if (child.namespace.equals("org.eclipse.equinox.p2.eclipse.type")) {
|
if (child.namespace.equals("org.eclipse.equinox.p2.eclipse.type")) {
|
||||||
eclipseType = child.name;
|
eclipseType = child.name;
|
||||||
|
|
@ -472,6 +489,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
capabilities = new ArrayList<BundleCapability>(size);
|
capabilities = new ArrayList<BundleCapability>(size);
|
||||||
|
|
@ -499,6 +517,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
super(PROVIDED);
|
super(PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
namespace = atts.getValue(NAMESPACE);
|
namespace = atts.getValue(NAMESPACE);
|
||||||
name = atts.getValue(NAME);
|
name = atts.getValue(NAME);
|
||||||
|
|
@ -521,6 +540,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
public AbstractRequirementHandler(String name) {
|
public AbstractRequirementHandler(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
addChild(new RequiredHandler(), new ChildElementHandler<RequiredHandler>() {
|
addChild(new RequiredHandler(), new ChildElementHandler<RequiredHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(RequiredHandler child) {
|
public void childHanlded(RequiredHandler child) {
|
||||||
String name = child.name;
|
String name = child.name;
|
||||||
VersionRange range = child.range;
|
VersionRange range = child.range;
|
||||||
|
|
@ -538,6 +558,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
requirements = new ArrayList<BundleRequirement>(size);
|
requirements = new ArrayList<BundleRequirement>(size);
|
||||||
|
|
@ -590,6 +611,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXParseException {
|
protected void handleAttributes(Attributes atts) throws SAXParseException {
|
||||||
namespace = atts.getValue(NAMESPACE);
|
namespace = atts.getValue(NAMESPACE);
|
||||||
name = atts.getValue(NAME);
|
name = atts.getValue(NAME);
|
||||||
|
|
@ -635,12 +657,14 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
public ArtifactsHandler() {
|
public ArtifactsHandler() {
|
||||||
super(ARTIFACTS);
|
super(ARTIFACTS);
|
||||||
addChild(new ArtifactHandler(), new ChildElementHandler<ArtifactHandler>() {
|
addChild(new ArtifactHandler(), new ChildElementHandler<ArtifactHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ArtifactHandler child) {
|
public void childHanlded(ArtifactHandler child) {
|
||||||
artifacts.add(child.artifact);
|
artifacts.add(child.artifact);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
artifacts = new ArrayList<P2Artifact>(size);
|
artifacts = new ArrayList<P2Artifact>(size);
|
||||||
|
|
@ -664,6 +688,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
super(ARTIFACT);
|
super(ARTIFACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String id = atts.getValue(ID);
|
String id = atts.getValue(ID);
|
||||||
String version = atts.getValue(VERSION);
|
String version = atts.getValue(VERSION);
|
||||||
|
|
@ -710,6 +735,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
public TouchpointDataHandler() {
|
public TouchpointDataHandler() {
|
||||||
super(TOUCHPOINTDATA);
|
super(TOUCHPOINTDATA);
|
||||||
addChild(new InstructionsHandler(), new ChildElementHandler<InstructionsHandler>() {
|
addChild(new InstructionsHandler(), new ChildElementHandler<InstructionsHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(InstructionsHandler child) {
|
public void childHanlded(InstructionsHandler child) {
|
||||||
manifest = child.manifest;
|
manifest = child.manifest;
|
||||||
zipped = child.zipped;
|
zipped = child.zipped;
|
||||||
|
|
@ -717,6 +743,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
// String size = atts.getValue(SIZE);
|
// String size = atts.getValue(SIZE);
|
||||||
}
|
}
|
||||||
|
|
@ -736,6 +763,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
public InstructionsHandler() {
|
public InstructionsHandler() {
|
||||||
super(INSTRUCTIONS);
|
super(INSTRUCTIONS);
|
||||||
addChild(new InstructionHandler(), new ChildElementHandler<InstructionHandler>() {
|
addChild(new InstructionHandler(), new ChildElementHandler<InstructionHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(InstructionHandler child) {
|
public void childHanlded(InstructionHandler child) {
|
||||||
manifest = null;
|
manifest = null;
|
||||||
zipped = null;
|
zipped = null;
|
||||||
|
|
@ -749,6 +777,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
// String size = atts.getValue(SIZE);
|
// String size = atts.getValue(SIZE);
|
||||||
}
|
}
|
||||||
|
|
@ -768,6 +797,7 @@ public class P2MetadataParser implements XMLInputParser {
|
||||||
setBufferingChar(true);
|
setBufferingChar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
key = atts.getValue(KEY);
|
key = atts.getValue(KEY);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public class PropertiesParser {
|
||||||
super(PROPERTIES);
|
super(PROPERTIES);
|
||||||
final List<String> propList = Arrays.asList(props);
|
final List<String> propList = Arrays.asList(props);
|
||||||
addChild(new PropertyHandler(), new ChildElementHandler<PropertyHandler>() {
|
addChild(new PropertyHandler(), new ChildElementHandler<PropertyHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(PropertyHandler child) {
|
public void childHanlded(PropertyHandler child) {
|
||||||
if (propList.isEmpty() || propList.contains(child.name)) {
|
if (propList.isEmpty() || propList.contains(child.name)) {
|
||||||
properties.put(child.name, child.value);
|
properties.put(child.name, child.value);
|
||||||
|
|
@ -47,6 +48,7 @@ public class PropertiesParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
int size = Integer.parseInt(atts.getValue(SIZE));
|
int size = Integer.parseInt(atts.getValue(SIZE));
|
||||||
properties = new HashMap<String, String>(size);
|
properties = new HashMap<String, String>(size);
|
||||||
|
|
@ -70,6 +72,7 @@ public class PropertiesParser {
|
||||||
super(PROPERTY);
|
super(PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
name = atts.getValue(NAME);
|
name = atts.getValue(NAME);
|
||||||
value = atts.getValue(VALUE);
|
value = atts.getValue(VALUE);
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
|
public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
|
||||||
URL url = artifact.getUrl();
|
URL url = artifact.getUrl();
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
|
|
@ -313,20 +314,20 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection/* <String> */filterNames(Collection/* <String> */names) {
|
protected Collection<String> filterNames(Collection<String> names) {
|
||||||
getSettings().filterIgnore(names);
|
getSettings().filterIgnore(names);
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection findNames(Map tokenValues, String token) {
|
protected Collection<String> findNames(Map<String, String> tokenValues, String token) {
|
||||||
if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) {
|
if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) {
|
||||||
return getRepoDescriptor().getCapabilities();
|
return getRepoDescriptor().getCapabilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
String osgiType = (String) tokenValues.get(IvyPatternHelper.ORGANISATION_KEY);
|
String osgiType = tokenValues.get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
if (osgiType == null || osgiType.length() == 0) {
|
if (osgiType == null || osgiType.length() == 0) {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IvyPatternHelper.MODULE_KEY.equals(token)) {
|
if (IvyPatternHelper.MODULE_KEY.equals(token)) {
|
||||||
|
|
@ -334,7 +335,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IvyPatternHelper.REVISION_KEY.equals(token)) {
|
if (IvyPatternHelper.REVISION_KEY.equals(token)) {
|
||||||
String name = (String) tokenValues.get(IvyPatternHelper.MODULE_KEY);
|
String name = tokenValues.get(IvyPatternHelper.MODULE_KEY);
|
||||||
List<String> versions = new ArrayList<String>();
|
List<String> versions = new ArrayList<String>();
|
||||||
Set<ModuleDescriptorWrapper> mds = getRepoDescriptor().findModules(osgiType, name);
|
Set<ModuleDescriptorWrapper> mds = getRepoDescriptor().findModules(osgiType, name);
|
||||||
if (mds != null) {
|
if (mds != null) {
|
||||||
|
|
@ -346,9 +347,9 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IvyPatternHelper.CONF_KEY.equals(token)) {
|
if (IvyPatternHelper.CONF_KEY.equals(token)) {
|
||||||
String name = (String) tokenValues.get(IvyPatternHelper.MODULE_KEY);
|
String name = tokenValues.get(IvyPatternHelper.MODULE_KEY);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
if (osgiType.equals(BundleInfo.PACKAGE_TYPE)) {
|
if (osgiType.equals(BundleInfo.PACKAGE_TYPE)) {
|
||||||
return Collections.singletonList(BundleInfoAdapter.CONF_USE_PREFIX + name);
|
return Collections.singletonList(BundleInfoAdapter.CONF_USE_PREFIX + name);
|
||||||
|
|
@ -356,11 +357,11 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
|
Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
|
||||||
.findModules(osgiType, name));
|
.findModules(osgiType, name));
|
||||||
if (mds == null) {
|
if (mds == null) {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
String version = (String) tokenValues.get(IvyPatternHelper.REVISION_KEY);
|
String version = tokenValues.get(IvyPatternHelper.REVISION_KEY);
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
ModuleDescriptor found = null;
|
ModuleDescriptor found = null;
|
||||||
for (ModuleDescriptor md : mds) {
|
for (ModuleDescriptor md : mds) {
|
||||||
|
|
@ -369,12 +370,12 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<String> confs = Arrays.asList(found.getConfigurationsNames());
|
List<String> confs = Arrays.asList(found.getConfigurationsNames());
|
||||||
return confs;
|
return confs;
|
||||||
}
|
}
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -404,54 +405,62 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map[] listTokenValues(String[] tokens, Map criteria) {
|
public Map<String, String>[] listTokenValues(String[] tokens, Map<String, Object> criteria) {
|
||||||
Set<String> tokenSet = new HashSet<String>(Arrays.asList(tokens));
|
Set<String> tokenSet = new HashSet<String>(Arrays.asList(tokens));
|
||||||
Set<Map<String, String>> listTokenValues = listTokenValues(tokenSet, criteria);
|
Set<Map<String, String>> listTokenValues = listTokenValues(tokenSet, criteria);
|
||||||
return listTokenValues.toArray(new Map[listTokenValues.size()]);
|
return listTokenValues.toArray(new Map[listTokenValues.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Map<String, String>> listTokenValues(Set<String> tokens,
|
private Set<Map<String, String>> listTokenValues(Set<String> tokens,
|
||||||
Map<String, String> criteria) {
|
Map<String, Object> criteria) {
|
||||||
|
Map<String, String> stringCriteria = new HashMap<String, String>();
|
||||||
|
for (Entry<String, Object> entry : criteria.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
if (!(value instanceof String)) {
|
||||||
|
// no support for matcher for now
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
stringCriteria.put(key, (String) value);
|
||||||
|
}
|
||||||
|
|
||||||
if (tokens.isEmpty()) {
|
if (tokens.isEmpty()) {
|
||||||
return Collections.singleton(criteria);
|
// no more tokens to resolve
|
||||||
|
return Collections.singleton(stringCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> remainingTokens = new HashSet<String>(tokens);
|
Set<String> remainingTokens = new HashSet<String>(tokens);
|
||||||
|
|
||||||
Map<String, String> values = new HashMap<String, String>();
|
|
||||||
|
|
||||||
remainingTokens.remove(IvyPatternHelper.ORGANISATION_KEY);
|
remainingTokens.remove(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
String osgiType = criteria.get(IvyPatternHelper.ORGANISATION_KEY);
|
String osgiType = stringCriteria.get(IvyPatternHelper.ORGANISATION_KEY);
|
||||||
if (osgiType == null || osgiType.length() == 0) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
values.put(IvyPatternHelper.ORGANISATION_KEY, osgiType);
|
|
||||||
|
|
||||||
if (osgiType == null) {
|
if (osgiType == null) {
|
||||||
Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
|
Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
|
||||||
Map<String, String> newCriteria = new HashMap<String, String>(criteria);
|
Map<String, Object> newCriteria = new HashMap<String, Object>(criteria);
|
||||||
newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.BUNDLE_TYPE);
|
newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.BUNDLE_TYPE);
|
||||||
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
||||||
newCriteria = new HashMap<String, String>(criteria);
|
newCriteria = new HashMap<String, Object>(criteria);
|
||||||
newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.PACKAGE_TYPE);
|
newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.PACKAGE_TYPE);
|
||||||
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
||||||
newCriteria = new HashMap<String, String>(criteria);
|
newCriteria = new HashMap<String, Object>(criteria);
|
||||||
newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.SERVICE_TYPE);
|
newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.SERVICE_TYPE);
|
||||||
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
||||||
return tokenValues;
|
return tokenValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, String> values = new HashMap<String, String>();
|
||||||
|
values.put(IvyPatternHelper.ORGANISATION_KEY, osgiType);
|
||||||
|
|
||||||
Set<String> capabilities = getRepoDescriptor().getCapabilityValues(osgiType);
|
Set<String> capabilities = getRepoDescriptor().getCapabilityValues(osgiType);
|
||||||
if (capabilities == null || capabilities.isEmpty()) {
|
if (capabilities == null || capabilities.isEmpty()) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingTokens.remove(IvyPatternHelper.MODULE_KEY);
|
remainingTokens.remove(IvyPatternHelper.MODULE_KEY);
|
||||||
String module = criteria.get(IvyPatternHelper.MODULE_KEY);
|
String module = stringCriteria.get(IvyPatternHelper.MODULE_KEY);
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
|
Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
|
||||||
for (String name : capabilities) {
|
for (String name : capabilities) {
|
||||||
Map<String, String> newCriteria = new HashMap<String, String>(criteria);
|
Map<String, Object> newCriteria = new HashMap<String, Object>(criteria);
|
||||||
newCriteria.put(IvyPatternHelper.MODULE_KEY, name);
|
newCriteria.put(IvyPatternHelper.MODULE_KEY, name);
|
||||||
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
||||||
}
|
}
|
||||||
|
|
@ -460,7 +469,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
values.put(IvyPatternHelper.MODULE_KEY, module);
|
values.put(IvyPatternHelper.MODULE_KEY, module);
|
||||||
|
|
||||||
remainingTokens.remove(IvyPatternHelper.REVISION_KEY);
|
remainingTokens.remove(IvyPatternHelper.REVISION_KEY);
|
||||||
String rev = criteria.get(IvyPatternHelper.REVISION_KEY);
|
String rev = stringCriteria.get(IvyPatternHelper.REVISION_KEY);
|
||||||
if (rev == null) {
|
if (rev == null) {
|
||||||
Set<ModuleDescriptorWrapper> mdws = getRepoDescriptor().findModules(osgiType, module);
|
Set<ModuleDescriptorWrapper> mdws = getRepoDescriptor().findModules(osgiType, module);
|
||||||
if (mdws == null || mdws.isEmpty()) {
|
if (mdws == null || mdws.isEmpty()) {
|
||||||
|
|
@ -468,7 +477,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
}
|
}
|
||||||
Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
|
Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
|
||||||
for (ModuleDescriptorWrapper mdw : mdws) {
|
for (ModuleDescriptorWrapper mdw : mdws) {
|
||||||
Map<String, String> newCriteria = new HashMap<String, String>(criteria);
|
Map<String, Object> newCriteria = new HashMap<String, Object>(criteria);
|
||||||
newCriteria.put(IvyPatternHelper.REVISION_KEY, mdw.getBundleInfo().getVersion()
|
newCriteria.put(IvyPatternHelper.REVISION_KEY, mdw.getBundleInfo().getVersion()
|
||||||
.toString());
|
.toString());
|
||||||
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
|
||||||
|
|
@ -478,7 +487,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
values.put(IvyPatternHelper.REVISION_KEY, rev);
|
values.put(IvyPatternHelper.REVISION_KEY, rev);
|
||||||
|
|
||||||
remainingTokens.remove(IvyPatternHelper.CONF_KEY);
|
remainingTokens.remove(IvyPatternHelper.CONF_KEY);
|
||||||
String conf = criteria.get(IvyPatternHelper.CONF_KEY);
|
String conf = stringCriteria.get(IvyPatternHelper.CONF_KEY);
|
||||||
if (conf == null) {
|
if (conf == null) {
|
||||||
if (osgiType.equals(BundleInfo.PACKAGE_TYPE)) {
|
if (osgiType.equals(BundleInfo.PACKAGE_TYPE)) {
|
||||||
values.put(IvyPatternHelper.CONF_KEY, BundleInfoAdapter.CONF_USE_PREFIX + module);
|
values.put(IvyPatternHelper.CONF_KEY, BundleInfoAdapter.CONF_USE_PREFIX + module);
|
||||||
|
|
@ -508,7 +517,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
List<String> configurations = BundleInfoAdapter
|
List<String> configurations = BundleInfoAdapter
|
||||||
.getConfigurations(found.getBundleInfo());
|
.getConfigurations(found.getBundleInfo());
|
||||||
for (int i = 0; i < configurations.size(); i++) {
|
for (int i = 0; i < configurations.size(); i++) {
|
||||||
Map<String, String> newCriteria = new HashMap<String, String>(criteria);
|
Map<String, String> newCriteria = new HashMap<String, String>(stringCriteria);
|
||||||
newCriteria.put(IvyPatternHelper.CONF_KEY, configurations.get(i));
|
newCriteria.put(IvyPatternHelper.CONF_KEY, configurations.get(i));
|
||||||
tokenValues.add(newCriteria);
|
tokenValues.add(newCriteria);
|
||||||
}
|
}
|
||||||
|
|
@ -519,6 +528,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
return Collections.singleton(values);
|
return Collections.singleton(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected long get(Resource resource, File dest) throws IOException {
|
protected long get(Resource resource, File dest) throws IOException {
|
||||||
Message.verbose("\t" + getName() + ": downloading " + resource.getName());
|
Message.verbose("\t" + getName() + ": downloading " + resource.getName());
|
||||||
Message.debug("\t\tto " + dest);
|
Message.debug("\t\tto " + dest);
|
||||||
|
|
@ -529,6 +539,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
|
||||||
return dest.length();
|
return dest.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Resource getResource(String source) throws IOException {
|
protected Resource getResource(String source) throws IOException {
|
||||||
return getRepository().getResource(source);
|
return getRepository().getResource(source);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class EclipseUpdateSiteParser {
|
public class EclipseUpdateSiteParser {
|
||||||
|
|
||||||
public static UpdateSite parse(InputStream in) throws ParseException, IOException, SAXException {
|
public static UpdateSite parse(InputStream in) throws IOException, SAXException {
|
||||||
SiteHandler handler = new SiteHandler();
|
SiteHandler handler = new SiteHandler();
|
||||||
try {
|
try {
|
||||||
XMLHelper.parse(in, null, handler, null);
|
XMLHelper.parse(in, null, handler, null);
|
||||||
|
|
@ -68,6 +68,7 @@ public class EclipseUpdateSiteParser {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
addChild(new FeatureHandler(), new ChildElementHandler<FeatureHandler>() {
|
addChild(new FeatureHandler(), new ChildElementHandler<FeatureHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(FeatureHandler child) {
|
public void childHanlded(FeatureHandler child) {
|
||||||
updatesite.addFeature(child.feature);
|
updatesite.addFeature(child.feature);
|
||||||
}
|
}
|
||||||
|
|
@ -84,6 +85,7 @@ public class EclipseUpdateSiteParser {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) {
|
protected void handleAttributes(Attributes atts) {
|
||||||
updatesite = new UpdateSite();
|
updatesite = new UpdateSite();
|
||||||
|
|
||||||
|
|
@ -170,12 +172,14 @@ public class EclipseUpdateSiteParser {
|
||||||
public FeatureHandler() {
|
public FeatureHandler() {
|
||||||
super(FEATURE);
|
super(FEATURE);
|
||||||
addChild(new CategoryHandler(), new ChildElementHandler<CategoryHandler>() {
|
addChild(new CategoryHandler(), new ChildElementHandler<CategoryHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(CategoryHandler child) {
|
public void childHanlded(CategoryHandler child) {
|
||||||
feature.addCategory(child.name);
|
feature.addCategory(child.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String id = atts.getValue(ID);
|
String id = atts.getValue(ID);
|
||||||
String version = atts.getValue(VERSION);
|
String version = atts.getValue(VERSION);
|
||||||
|
|
@ -213,6 +217,7 @@ public class EclipseUpdateSiteParser {
|
||||||
super(CATEGORY);
|
super(CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
name = atts.getValue(NAME);
|
name = atts.getValue(NAME);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class FeatureParser {
|
public class FeatureParser {
|
||||||
|
|
||||||
public static EclipseFeature parse(InputStream in) throws ParseException, IOException,
|
public static EclipseFeature parse(InputStream in) throws IOException, SAXException {
|
||||||
SAXException {
|
|
||||||
FeatureHandler handler = new FeatureHandler();
|
FeatureHandler handler = new FeatureHandler();
|
||||||
try {
|
try {
|
||||||
XMLHelper.parse(in, null, handler, null);
|
XMLHelper.parse(in, null, handler, null);
|
||||||
|
|
@ -81,26 +80,31 @@ public class FeatureParser {
|
||||||
public FeatureHandler() {
|
public FeatureHandler() {
|
||||||
super(FEATURE);
|
super(FEATURE);
|
||||||
addChild(new DescriptionHandler(), new ChildElementHandler<DescriptionHandler>() {
|
addChild(new DescriptionHandler(), new ChildElementHandler<DescriptionHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(DescriptionHandler child) {
|
public void childHanlded(DescriptionHandler child) {
|
||||||
feature.setDescription(child.getBufferedChars().trim());
|
feature.setDescription(child.getBufferedChars().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new LicenseHandler(), new ChildElementHandler<LicenseHandler>() {
|
addChild(new LicenseHandler(), new ChildElementHandler<LicenseHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(LicenseHandler child) {
|
public void childHanlded(LicenseHandler child) {
|
||||||
feature.setLicense(child.getBufferedChars().trim());
|
feature.setLicense(child.getBufferedChars().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new CopyrightHandler(), new ChildElementHandler<CopyrightHandler>() {
|
addChild(new CopyrightHandler(), new ChildElementHandler<CopyrightHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(CopyrightHandler child) {
|
public void childHanlded(CopyrightHandler child) {
|
||||||
feature.setCopyright(child.getBufferedChars().trim());
|
feature.setCopyright(child.getBufferedChars().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new PluginHandler(), new ChildElementHandler<PluginHandler>() {
|
addChild(new PluginHandler(), new ChildElementHandler<PluginHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(PluginHandler child) {
|
public void childHanlded(PluginHandler child) {
|
||||||
feature.addPlugin(child.plugin);
|
feature.addPlugin(child.plugin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() {
|
addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(RequiresHandler child) {
|
public void childHanlded(RequiresHandler child) {
|
||||||
for (Require require : child.requires) {
|
for (Require require : child.requires) {
|
||||||
feature.addRequire(require);
|
feature.addRequire(require);
|
||||||
|
|
@ -113,6 +117,7 @@ public class FeatureParser {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
String id = atts.getValue(ID);
|
String id = atts.getValue(ID);
|
||||||
String version = atts.getValue(VERSION);
|
String version = atts.getValue(VERSION);
|
||||||
|
|
@ -159,6 +164,7 @@ public class FeatureParser {
|
||||||
super(PLUGIN);
|
super(PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
plugin = new EclipsePlugin();
|
plugin = new EclipsePlugin();
|
||||||
|
|
||||||
|
|
@ -189,6 +195,7 @@ public class FeatureParser {
|
||||||
setBufferingChar(true);
|
setBufferingChar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
// String url = atts.getValue(URL);
|
// String url = atts.getValue(URL);
|
||||||
}
|
}
|
||||||
|
|
@ -205,6 +212,7 @@ public class FeatureParser {
|
||||||
setBufferingChar(true);
|
setBufferingChar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
// String url = atts.getValue(URL);
|
// String url = atts.getValue(URL);
|
||||||
}
|
}
|
||||||
|
|
@ -222,6 +230,7 @@ public class FeatureParser {
|
||||||
setBufferingChar(true);
|
setBufferingChar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
// String url = atts.getValue(URL);
|
// String url = atts.getValue(URL);
|
||||||
}
|
}
|
||||||
|
|
@ -236,6 +245,7 @@ public class FeatureParser {
|
||||||
public RequiresHandler() {
|
public RequiresHandler() {
|
||||||
super(REQUIRES);
|
super(REQUIRES);
|
||||||
addChild(new ImportHandler(), new ChildElementHandler<ImportHandler>() {
|
addChild(new ImportHandler(), new ChildElementHandler<ImportHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(ImportHandler child) {
|
public void childHanlded(ImportHandler child) {
|
||||||
requires.add(child.require);
|
requires.add(child.require);
|
||||||
}
|
}
|
||||||
|
|
@ -263,6 +273,7 @@ public class FeatureParser {
|
||||||
super(IMPORT);
|
super(IMPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handleAttributes(Attributes atts) throws SAXException {
|
protected void handleAttributes(Attributes atts) throws SAXException {
|
||||||
require = new Require();
|
require = new Require();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package org.apache.ivy.osgi.updatesite.xml;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.ParseException;
|
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
|
@ -32,8 +31,8 @@ import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class UpdateSiteDigestParser {
|
public class UpdateSiteDigestParser {
|
||||||
|
|
||||||
public static UpdateSiteDescriptor parse(InputStream in, UpdateSite site)
|
public static UpdateSiteDescriptor parse(InputStream in, UpdateSite site) throws IOException,
|
||||||
throws ParseException, IOException, SAXException {
|
SAXException {
|
||||||
DigestHandler handler = new DigestHandler(site);
|
DigestHandler handler = new DigestHandler(site);
|
||||||
try {
|
try {
|
||||||
XMLHelper.parse(in, null, handler, null);
|
XMLHelper.parse(in, null, handler, null);
|
||||||
|
|
@ -54,6 +53,7 @@ public class UpdateSiteDigestParser {
|
||||||
repoDescriptor = new UpdateSiteDescriptor(site.getUri(),
|
repoDescriptor = new UpdateSiteDescriptor(site.getUri(),
|
||||||
ExecutionEnvironmentProfileProvider.getInstance());
|
ExecutionEnvironmentProfileProvider.getInstance());
|
||||||
addChild(new FeatureHandler(), new ChildElementHandler<FeatureHandler>() {
|
addChild(new FeatureHandler(), new ChildElementHandler<FeatureHandler>() {
|
||||||
|
@Override
|
||||||
public void childHanlded(FeatureHandler child) {
|
public void childHanlded(FeatureHandler child) {
|
||||||
repoDescriptor.addFeature(child.feature);
|
repoDescriptor.addFeature(child.feature);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
return charBuffer.toString();
|
return charBuffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDocumentLocator(Locator locator) {
|
public void setDocumentLocator(Locator locator) {
|
||||||
this.locator = locator;
|
this.locator = locator;
|
||||||
for (DelegatingHandler subHandler : saxHandlerMapping.values()) {
|
for (DelegatingHandler subHandler : saxHandlerMapping.values()) {
|
||||||
|
|
@ -146,6 +147,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void startDocument() throws SAXException {
|
public final void startDocument() throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -164,6 +166,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void endDocument() throws SAXException {
|
public final void endDocument() throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -182,6 +185,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void startElement(final String uri, final String localName, final String n,
|
public final void startElement(final String uri, final String localName, final String n,
|
||||||
final Attributes atts) throws SAXException {
|
final Attributes atts) throws SAXException {
|
||||||
// reset the char buffer
|
// reset the char buffer
|
||||||
|
|
@ -246,6 +250,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void endElement(final String uri, final String localName, final String n)
|
public final void endElement(final String uri, final String localName, final String n)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
|
|
@ -297,6 +302,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void characters(char[] ch, int start, int length) throws SAXException {
|
public final void characters(char[] ch, int start, int length) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -317,6 +323,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void startPrefixMapping(String prefix, String uri) throws SAXException {
|
public final void startPrefixMapping(String prefix, String uri) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -335,6 +342,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void endPrefixMapping(String prefix) throws SAXException {
|
public final void endPrefixMapping(String prefix) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -353,6 +361,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
|
public final void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -371,6 +380,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void notationDecl(String name, String publicId, String systemId)
|
public final void notationDecl(String name, String publicId, String systemId)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
|
|
@ -391,6 +401,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void processingInstruction(String target, String data) throws SAXException {
|
public final void processingInstruction(String target, String data) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -409,6 +420,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void skippedEntity(String name) throws SAXException {
|
public final void skippedEntity(String name) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -427,9 +439,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @throws SAXException
|
|
||||||
*/
|
|
||||||
public final void unparsedEntityDecl(String name, String publicId, String systemId,
|
public final void unparsedEntityDecl(String name, String publicId, String systemId,
|
||||||
String notationName) throws SAXException {
|
String notationName) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
|
|
@ -452,6 +462,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
|
|
||||||
// ERROR HANDLING
|
// ERROR HANDLING
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void warning(SAXParseException exception) throws SAXException {
|
public final void warning(SAXParseException exception) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -470,6 +481,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void error(SAXParseException exception) throws SAXException {
|
public final void error(SAXParseException exception) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -488,6 +500,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
|
||||||
// by default do nothing
|
// by default do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void fatalError(SAXParseException exception) throws SAXException {
|
public final void fatalError(SAXParseException exception) throws SAXException {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.apache.ivy.plugins.conflict;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||||
|
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||||
import org.apache.ivy.core.settings.IvySettings;
|
import org.apache.ivy.core.settings.IvySettings;
|
||||||
import org.apache.ivy.plugins.IvySettingsAware;
|
import org.apache.ivy.plugins.IvySettingsAware;
|
||||||
|
|
||||||
|
|
@ -44,10 +45,12 @@ public abstract class AbstractConflictManager implements ConflictManager, IvySet
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleAllBlacklistedRevisions(DependencyDescriptor dd, Collection foundBlacklisted) {
|
public void handleAllBlacklistedRevisions(DependencyDescriptor dd,
|
||||||
|
Collection<ModuleRevisionId> foundBlacklisted) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.apache.ivy.plugins.conflict;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||||
|
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||||
import org.apache.ivy.core.resolve.IvyNode;
|
import org.apache.ivy.core.resolve.IvyNode;
|
||||||
|
|
||||||
public interface ConflictManager {
|
public interface ConflictManager {
|
||||||
|
|
@ -38,7 +39,7 @@ public interface ConflictManager {
|
||||||
* @return a Collection of IvyNode which have not been evicted, or null if conflict management
|
* @return a Collection of IvyNode which have not been evicted, or null if conflict management
|
||||||
* resolution is not possible yet
|
* resolution is not possible yet
|
||||||
*/
|
*/
|
||||||
Collection resolveConflicts(IvyNode parent, Collection conflicts);
|
Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts);
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
|
@ -56,5 +57,5 @@ public interface ConflictManager {
|
||||||
* the list of all ModuleRevisionId found which are blacklisted
|
* the list of all ModuleRevisionId found which are blacklisted
|
||||||
*/
|
*/
|
||||||
void handleAllBlacklistedRevisions(DependencyDescriptor dd,
|
void handleAllBlacklistedRevisions(DependencyDescriptor dd,
|
||||||
Collection/* <ModuleRevisionId> */foundBlacklisted);
|
Collection<ModuleRevisionId> foundBlacklisted);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,22 +20,21 @@ package org.apache.ivy.plugins.conflict;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.apache.ivy.core.resolve.IvyNode;
|
import org.apache.ivy.core.resolve.IvyNode;
|
||||||
|
|
||||||
public class FixedConflictManager extends AbstractConflictManager {
|
public class FixedConflictManager extends AbstractConflictManager {
|
||||||
private Collection revisions;
|
|
||||||
|
private Collection<String> revisions;
|
||||||
|
|
||||||
public FixedConflictManager(String[] revs) {
|
public FixedConflictManager(String[] revs) {
|
||||||
revisions = Arrays.asList(revs);
|
revisions = Arrays.asList(revs);
|
||||||
setName("fixed" + revisions);
|
setName("fixed" + revisions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
|
public Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts) {
|
||||||
Collection resolved = new ArrayList(conflicts.size());
|
Collection<IvyNode> resolved = new ArrayList<IvyNode>(conflicts.size());
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
String revision = node.getResolvedId().getRevision();
|
String revision = node.getResolvedId().getRevision();
|
||||||
if (revisions.contains(revision)) {
|
if (revisions.contains(revision)) {
|
||||||
resolved.add(node);
|
resolved.add(node);
|
||||||
|
|
@ -44,7 +43,7 @@ public class FixedConflictManager extends AbstractConflictManager {
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection getRevs() {
|
public Collection<String> getRevs() {
|
||||||
return revisions;
|
return revisions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,19 +71,20 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
super(name, strategy);
|
super(name, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
|
@Override
|
||||||
|
public Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts) {
|
||||||
if (conflicts.size() < 2) {
|
if (conflicts.size() < 2) {
|
||||||
return conflicts;
|
return conflicts;
|
||||||
}
|
}
|
||||||
VersionMatcher versionMatcher = getSettings().getVersionMatcher();
|
VersionMatcher versionMatcher = getSettings().getVersionMatcher();
|
||||||
|
|
||||||
Iterator iter = conflicts.iterator();
|
Iterator<IvyNode> iter = conflicts.iterator();
|
||||||
IvyNode node = (IvyNode) iter.next();
|
IvyNode node = iter.next();
|
||||||
ModuleRevisionId mrid = node.getResolvedId();
|
ModuleRevisionId mrid = node.getResolvedId();
|
||||||
|
|
||||||
if (versionMatcher.isDynamic(mrid)) {
|
if (versionMatcher.isDynamic(mrid)) {
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IvyNode other = (IvyNode) iter.next();
|
IvyNode other = iter.next();
|
||||||
if (versionMatcher.isDynamic(other.getResolvedId())) {
|
if (versionMatcher.isDynamic(other.getResolvedId())) {
|
||||||
// two dynamic versions in conflict, not enough information yet
|
// two dynamic versions in conflict, not enough information yet
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -98,17 +99,17 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
if (conflicts.size() == 2) {
|
if (conflicts.size() == 2) {
|
||||||
// very common special case of only two modules in conflict,
|
// very common special case of only two modules in conflict,
|
||||||
// let's return the second one (static)
|
// let's return the second one (static)
|
||||||
Iterator it = conflicts.iterator();
|
Iterator<IvyNode> it = conflicts.iterator();
|
||||||
it.next();
|
it.next();
|
||||||
return Collections.singleton(it.next());
|
return Collections.singleton(it.next());
|
||||||
}
|
}
|
||||||
Collection newConflicts = new LinkedHashSet(conflicts);
|
Collection<IvyNode> newConflicts = new LinkedHashSet<IvyNode>(conflicts);
|
||||||
newConflicts.remove(node);
|
newConflicts.remove(node);
|
||||||
return super.resolveConflicts(parent, newConflicts);
|
return super.resolveConflicts(parent, newConflicts);
|
||||||
} else {
|
} else {
|
||||||
// the first node is a static revision, let's see if all other versions match
|
// the first node is a static revision, let's see if all other versions match
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IvyNode other = (IvyNode) iter.next();
|
IvyNode other = iter.next();
|
||||||
if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
|
if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
|
||||||
// incompatibility found
|
// incompatibility found
|
||||||
if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
|
if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
|
||||||
|
|
@ -152,8 +153,8 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
* @return true if the incompatible conflict has been handled, false otherwise (in which case
|
* @return true if the incompatible conflict has been handled, false otherwise (in which case
|
||||||
* resolveConflicts should return null)
|
* resolveConflicts should return null)
|
||||||
*/
|
*/
|
||||||
private boolean handleIncompatibleConflict(IvyNode parent, Collection conflicts, IvyNode node,
|
private boolean handleIncompatibleConflict(IvyNode parent, Collection<IvyNode> conflicts,
|
||||||
IvyNode other) {
|
IvyNode node, IvyNode other) {
|
||||||
// we never actually return anything else than false or throw an exception,
|
// we never actually return anything else than false or throw an exception,
|
||||||
// but returning a boolean make the calling code cleaner
|
// but returning a boolean make the calling code cleaner
|
||||||
try {
|
try {
|
||||||
|
|
@ -184,14 +185,14 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
|
|
||||||
private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
|
private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
|
||||||
IvyNode parent, IvyNode selected, IvyNode evicted) {
|
IvyNode parent, IvyNode selected, IvyNode evicted) {
|
||||||
Stack callerStack = new Stack();
|
Stack<IvyNode> callerStack = new Stack<IvyNode>();
|
||||||
callerStack.push(evicted);
|
callerStack.push(evicted);
|
||||||
final Collection toBlacklist = blackListIncompatibleCaller(settings.getVersionMatcher(),
|
Collection<IvyNodeBlacklist> toBlacklist = blackListIncompatibleCaller(
|
||||||
parent, selected, evicted, callerStack);
|
settings.getVersionMatcher(), parent, selected, evicted, callerStack);
|
||||||
if (toBlacklist != null) {
|
if (toBlacklist != null) {
|
||||||
final StringBuffer blacklisted = new StringBuffer();
|
final StringBuffer blacklisted = new StringBuffer();
|
||||||
for (Iterator iterator = toBlacklist.iterator(); iterator.hasNext();) {
|
for (Iterator<IvyNodeBlacklist> iterator = toBlacklist.iterator(); iterator.hasNext();) {
|
||||||
IvyNodeBlacklist blacklist = (IvyNodeBlacklist) iterator.next();
|
IvyNodeBlacklist blacklist = iterator.next();
|
||||||
blacklist.getBlacklistedNode().blacklist(blacklist);
|
blacklist.getBlacklistedNode().blacklist(blacklist);
|
||||||
blacklisted.append(blacklist.getBlacklistedNode());
|
blacklisted.append(blacklist.getBlacklistedNode());
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
|
|
@ -212,9 +213,9 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleIncompatibleCaller(Stack callerStack, IvyNode node, IvyNode callerNode,
|
private boolean handleIncompatibleCaller(Stack<IvyNode> callerStack, IvyNode node,
|
||||||
IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
|
IvyNode callerNode, IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
|
||||||
Collection blacklisted, VersionMatcher versionMatcher) {
|
Collection<IvyNodeBlacklist> blacklisted, VersionMatcher versionMatcher) {
|
||||||
if (callerStack.subList(0, callerStack.size() - 1).contains(node)) {
|
if (callerStack.subList(0, callerStack.size() - 1).contains(node)) {
|
||||||
// circular dependency found and handled: the current top of the stack (node)
|
// circular dependency found and handled: the current top of the stack (node)
|
||||||
// was already contained in the rest of the stack, the circle is closed, nothing
|
// was already contained in the rest of the stack, the circle is closed, nothing
|
||||||
|
|
@ -222,8 +223,8 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
callerStack.push(callerNode);
|
callerStack.push(callerNode);
|
||||||
Collection sub = blackListIncompatibleCaller(versionMatcher, conflictParent,
|
Collection<IvyNodeBlacklist> sub = blackListIncompatibleCaller(versionMatcher,
|
||||||
selectedNode, evictedNode, callerStack);
|
conflictParent, selectedNode, evictedNode, callerStack);
|
||||||
callerStack.pop();
|
callerStack.pop();
|
||||||
if (sub == null) {
|
if (sub == null) {
|
||||||
// propagate the fact that a path with unblacklistable caller has been found
|
// propagate the fact that a path with unblacklistable caller has been found
|
||||||
|
|
@ -251,11 +252,11 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
* @return the collection of blacklisting to do, null if a blacklist is not possible in at least
|
* @return the collection of blacklisting to do, null if a blacklist is not possible in at least
|
||||||
* one caller path
|
* one caller path
|
||||||
*/
|
*/
|
||||||
private Collection/* <IvyNodeBlacklist> */blackListIncompatibleCaller(
|
private Collection<IvyNodeBlacklist> blackListIncompatibleCaller(VersionMatcher versionMatcher,
|
||||||
VersionMatcher versionMatcher, IvyNode conflictParent, IvyNode selectedNode,
|
IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
|
||||||
IvyNode evictedNode, Stack/* <IvyNode> */callerStack) {
|
Stack<IvyNode> callerStack) {
|
||||||
Collection/* <IvyNodeBlacklist> */blacklisted = new ArrayList/* <IvyNodeBlacklist> */();
|
Collection<IvyNodeBlacklist> blacklisted = new ArrayList<IvyNodeBlacklist>();
|
||||||
IvyNode node = (IvyNode) callerStack.peek();
|
IvyNode node = callerStack.peek();
|
||||||
String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
|
String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
|
||||||
Caller[] callers = node.getCallers(rootModuleConf);
|
Caller[] callers = node.getCallers(rootModuleConf);
|
||||||
for (int i = 0; i < callers.length; i++) {
|
for (int i = 0; i < callers.length; i++) {
|
||||||
|
|
@ -282,30 +283,30 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
|
||||||
return blacklisted;
|
return blacklisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleUnsolvableConflict(IvyNode parent, Collection conflicts, IvyNode node1,
|
protected void handleUnsolvableConflict(IvyNode parent, Collection<IvyNode> conflicts,
|
||||||
IvyNode node2) {
|
IvyNode node1, IvyNode node2) {
|
||||||
throw new StrictConflictException(node1, node2);
|
throw new StrictConflictException(node1, node2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void handleAllBlacklistedRevisions(DependencyDescriptor dd,
|
public void handleAllBlacklistedRevisions(DependencyDescriptor dd,
|
||||||
Collection/* <ModuleRevisionId> */foundBlacklisted) {
|
Collection<ModuleRevisionId> foundBlacklisted) {
|
||||||
ResolveData resolveData = IvyContext.getContext().getResolveData();
|
ResolveData resolveData = IvyContext.getContext().getResolveData();
|
||||||
Collection/* <IvyNode> */blacklisted = new HashSet();
|
Collection<IvyNode> blacklisted = new HashSet<IvyNode>();
|
||||||
for (Iterator iterator = foundBlacklisted.iterator(); iterator.hasNext();) {
|
for (ModuleRevisionId mrid : foundBlacklisted) {
|
||||||
ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
|
|
||||||
blacklisted.add(resolveData.getNode(mrid));
|
blacklisted.add(resolveData.getNode(mrid));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
|
for (IvyNode node : blacklisted) {
|
||||||
IvyNode node = (IvyNode) iterator.next();
|
|
||||||
IvyNodeBlacklist bdata = node.getBlacklistData(resolveData.getReport()
|
IvyNodeBlacklist bdata = node.getBlacklistData(resolveData.getReport()
|
||||||
.getConfiguration());
|
.getConfiguration());
|
||||||
handleUnsolvableConflict(bdata.getConflictParent(),
|
handleUnsolvableConflict(bdata.getConflictParent(),
|
||||||
Arrays.asList(new Object[] {bdata.getEvictedNode(), bdata.getSelectedNode()}),
|
Arrays.asList(bdata.getEvictedNode(), bdata.getSelectedNode()),
|
||||||
bdata.getEvictedNode(), bdata.getSelectedNode());
|
bdata.getEvictedNode(), bdata.getSelectedNode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ package org.apache.ivy.plugins.conflict;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||||
|
|
@ -78,12 +77,11 @@ public class LatestConflictManager extends AbstractConflictManager {
|
||||||
this.strategy = strategy;
|
this.strategy = strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
|
public Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts) {
|
||||||
if (conflicts.size() < 2) {
|
if (conflicts.size() < 2) {
|
||||||
return conflicts;
|
return conflicts;
|
||||||
}
|
}
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
DependencyDescriptor dd = node.getDependencyDescriptor(parent);
|
DependencyDescriptor dd = node.getDependencyDescriptor(parent);
|
||||||
if (dd != null && dd.isForce()
|
if (dd != null && dd.isForce()
|
||||||
&& parent.getResolvedId().equals(dd.getParentRevisionId())) {
|
&& parent.getResolvedId().equals(dd.getParentRevisionId())) {
|
||||||
|
|
@ -95,17 +93,15 @@ public class LatestConflictManager extends AbstractConflictManager {
|
||||||
* If the list of conflicts contains dynamic revisions, delay the conflict calculation until
|
* If the list of conflicts contains dynamic revisions, delay the conflict calculation until
|
||||||
* they are resolved. TODO: we probably could already evict some of the dynamic revisions!
|
* they are resolved. TODO: we probably could already evict some of the dynamic revisions!
|
||||||
*/
|
*/
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
ModuleRevisionId modRev = node.getResolvedId();
|
ModuleRevisionId modRev = node.getResolvedId();
|
||||||
if (getSettings().getVersionMatcher().isDynamic(modRev)) {
|
if (getSettings().getVersionMatcher().isDynamic(modRev)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList unevicted = new ArrayList();
|
ArrayList<IvyNode> unevicted = new ArrayList<IvyNode>();
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
if (!node.isCompletelyEvicted())
|
if (!node.isCompletelyEvicted())
|
||||||
unevicted.add(node);
|
unevicted.add(node);
|
||||||
}
|
}
|
||||||
|
|
@ -128,13 +124,12 @@ public class LatestConflictManager extends AbstractConflictManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArtifactInfo[] toArtifactInfo(Collection conflicts) {
|
protected ArtifactInfo[] toArtifactInfo(Collection<IvyNode> conflicts) {
|
||||||
List artifacts = new ArrayList(conflicts.size());
|
List<ArtifactInfo> artifacts = new ArrayList<ArtifactInfo>(conflicts.size());
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
artifacts.add(new IvyNodeArtifactInfo(node));
|
artifacts.add(new IvyNodeArtifactInfo(node));
|
||||||
}
|
}
|
||||||
return (ArtifactInfo[]) artifacts.toArray(new ArtifactInfo[artifacts.size()]);
|
return artifacts.toArray(new ArtifactInfo[artifacts.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatestStrategy getStrategy() {
|
public LatestStrategy getStrategy() {
|
||||||
|
|
@ -165,6 +160,7 @@ public class LatestConflictManager extends AbstractConflictManager {
|
||||||
this.strategy = strategy;
|
this.strategy = strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return strategy != null ? String.valueOf(strategy) : strategyName;
|
return strategy != null ? String.valueOf(strategy) : strategyName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class NoConflictManager extends AbstractConflictManager {
|
||||||
setName("all");
|
setName("all");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
|
public Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts) {
|
||||||
return conflicts;
|
return conflicts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ package org.apache.ivy.plugins.conflict;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
@ -66,10 +65,9 @@ public class RegexpConflictManager extends AbstractConflictManager {
|
||||||
mIgnoreNonMatching = ignoreNonMatching;
|
mIgnoreNonMatching = ignoreNonMatching;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
|
public Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts) {
|
||||||
IvyNode lastNode = null;
|
IvyNode lastNode = null;
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
|
|
||||||
if (lastNode != null && !matchEquals(node, lastNode)) {
|
if (lastNode != null && !matchEquals(node, lastNode)) {
|
||||||
String msg = lastNode + ":" + getMatch(lastNode) + " (needed by "
|
String msg = lastNode + ":" + getMatch(lastNode) + " (needed by "
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package org.apache.ivy.plugins.conflict;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.apache.ivy.core.resolve.IvyNode;
|
import org.apache.ivy.core.resolve.IvyNode;
|
||||||
import org.apache.ivy.plugins.version.VersionMatcher;
|
import org.apache.ivy.plugins.version.VersionMatcher;
|
||||||
|
|
@ -29,13 +28,11 @@ public class StrictConflictManager extends AbstractConflictManager {
|
||||||
public StrictConflictManager() {
|
public StrictConflictManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
|
public Collection<IvyNode> resolveConflicts(IvyNode parent, Collection<IvyNode> conflicts) {
|
||||||
VersionMatcher versionMatcher = getSettings().getVersionMatcher();
|
VersionMatcher versionMatcher = getSettings().getVersionMatcher();
|
||||||
|
|
||||||
IvyNode lastNode = null;
|
IvyNode lastNode = null;
|
||||||
for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
|
for (IvyNode node : conflicts) {
|
||||||
IvyNode node = (IvyNode) iter.next();
|
|
||||||
|
|
||||||
if (versionMatcher.isDynamic(node.getResolvedId())) {
|
if (versionMatcher.isDynamic(node.getResolvedId())) {
|
||||||
// dynamic revision, not enough information to resolve conflict
|
// dynamic revision, not enough information to resolve conflict
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,18 @@ public abstract class AbstractLatestStrategy implements LatestStrategy {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactInfo findLatest(ArtifactInfo[] infos, Date date) {
|
public ArtifactInfo findLatest(ArtifactInfo[] infos, Date date) {
|
||||||
List l = sort(infos);
|
List<ArtifactInfo> l = sort(infos);
|
||||||
|
|
||||||
// the latest revision comes last, use a ListIterator to iterate the
|
// the latest revision comes last, use a ListIterator to iterate the
|
||||||
// sorted list in the reverse direction.
|
// sorted list in the reverse direction.
|
||||||
for (ListIterator iter = l.listIterator(l.size()); iter.hasPrevious();) {
|
for (ListIterator<ArtifactInfo> iter = l.listIterator(l.size()); iter.hasPrevious();) {
|
||||||
ArtifactInfo info = (ArtifactInfo) iter.previous();
|
ArtifactInfo info = iter.previous();
|
||||||
if (date == null || info.getLastModified() < date.getTime()) {
|
if (date == null || info.getLastModified() < date.getTime()) {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,26 +25,26 @@ import java.util.List;
|
||||||
|
|
||||||
public class ComparatorLatestStrategy extends AbstractLatestStrategy {
|
public class ComparatorLatestStrategy extends AbstractLatestStrategy {
|
||||||
|
|
||||||
private Comparator comparator;
|
private Comparator<ArtifactInfo> comparator;
|
||||||
|
|
||||||
public ComparatorLatestStrategy() {
|
public ComparatorLatestStrategy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComparatorLatestStrategy(Comparator comparator) {
|
public ComparatorLatestStrategy(Comparator<ArtifactInfo> comparator) {
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List sort(ArtifactInfo[] infos) {
|
public List<ArtifactInfo> sort(ArtifactInfo[] infos) {
|
||||||
List ret = new ArrayList(Arrays.asList(infos));
|
List<ArtifactInfo> ret = new ArrayList<ArtifactInfo>(Arrays.asList(infos));
|
||||||
Collections.sort(ret, comparator);
|
Collections.sort(ret, comparator);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Comparator getComparator() {
|
public Comparator<ArtifactInfo> getComparator() {
|
||||||
return comparator;
|
return comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComparator(Comparator comparator) {
|
public void setComparator(Comparator<ArtifactInfo> comparator) {
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ public class LatestLexicographicStrategy extends ComparatorLatestStrategy {
|
||||||
* assumed to be the greater. If a partial latest is found, then it is assumed to be greater
|
* assumed to be the greater. If a partial latest is found, then it is assumed to be greater
|
||||||
* than any matching fixed revision.
|
* than any matching fixed revision.
|
||||||
*/
|
*/
|
||||||
private static final Comparator COMPARATOR = new Comparator() {
|
private static final Comparator<ArtifactInfo> COMPARATOR = new Comparator<ArtifactInfo>() {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(ArtifactInfo o1, ArtifactInfo o2) {
|
||||||
String rev1 = ((ArtifactInfo) o1).getRevision();
|
String rev1 = o1.getRevision();
|
||||||
String rev2 = ((ArtifactInfo) o2).getRevision();
|
String rev2 = o2.getRevision();
|
||||||
if (rev1.startsWith("latest")) {
|
if (rev1.startsWith("latest")) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ public class LatestRevisionStrategy extends ComparatorLatestStrategy {
|
||||||
* Compares two ModuleRevisionId by their revision. Revisions are compared using an algorithm
|
* Compares two ModuleRevisionId by their revision. Revisions are compared using an algorithm
|
||||||
* inspired by PHP version_compare one.
|
* inspired by PHP version_compare one.
|
||||||
*/
|
*/
|
||||||
final class MridComparator implements Comparator {
|
final class MridComparator implements Comparator<ModuleRevisionId> {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(ModuleRevisionId o1, ModuleRevisionId o2) {
|
||||||
String rev1 = ((ModuleRevisionId) o1).getRevision();
|
String rev1 = o1.getRevision();
|
||||||
String rev2 = ((ModuleRevisionId) o2).getRevision();
|
String rev2 = o2.getRevision();
|
||||||
|
|
||||||
rev1 = rev1.replaceAll("([a-zA-Z])(\\d)", "$1.$2");
|
rev1 = rev1.replaceAll("([a-zA-Z])(\\d)", "$1.$2");
|
||||||
rev1 = rev1.replaceAll("(\\d)([a-zA-Z])", "$1.$2");
|
rev1 = rev1.replaceAll("(\\d)([a-zA-Z])", "$1.$2");
|
||||||
|
|
@ -61,9 +61,9 @@ public class LatestRevisionStrategy extends ComparatorLatestStrategy {
|
||||||
return Long.valueOf(parts1[i]).compareTo(Long.valueOf(parts2[i]));
|
return Long.valueOf(parts1[i]).compareTo(Long.valueOf(parts2[i]));
|
||||||
}
|
}
|
||||||
// both are strings, we compare them taking into account special meaning
|
// both are strings, we compare them taking into account special meaning
|
||||||
Map specialMeanings = getSpecialMeanings();
|
Map<String, Integer> specialMeanings = getSpecialMeanings();
|
||||||
Integer sm1 = (Integer) specialMeanings.get(parts1[i].toLowerCase(Locale.US));
|
Integer sm1 = specialMeanings.get(parts1[i].toLowerCase(Locale.US));
|
||||||
Integer sm2 = (Integer) specialMeanings.get(parts2[i].toLowerCase(Locale.US));
|
Integer sm2 = specialMeanings.get(parts2[i].toLowerCase(Locale.US));
|
||||||
if (sm1 != null) {
|
if (sm1 != null) {
|
||||||
sm2 = sm2 == null ? new Integer(0) : sm2;
|
sm2 = sm2 == null ? new Integer(0) : sm2;
|
||||||
return sm1.compareTo(sm2);
|
return sm1.compareTo(sm2);
|
||||||
|
|
@ -92,10 +92,10 @@ public class LatestRevisionStrategy extends ComparatorLatestStrategy {
|
||||||
* inspired by PHP version_compare one, unless a dynamic revision is given, in which case the
|
* inspired by PHP version_compare one, unless a dynamic revision is given, in which case the
|
||||||
* version matcher is used to perform the comparison.
|
* version matcher is used to perform the comparison.
|
||||||
*/
|
*/
|
||||||
final class ArtifactInfoComparator implements Comparator {
|
final class ArtifactInfoComparator implements Comparator<ArtifactInfo> {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(ArtifactInfo o1, ArtifactInfo o2) {
|
||||||
String rev1 = ((ArtifactInfo) o1).getRevision();
|
String rev1 = o1.getRevision();
|
||||||
String rev2 = ((ArtifactInfo) o2).getRevision();
|
String rev2 = o2.getRevision();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The revisions can still be not resolved, so we use the current version matcher to
|
* The revisions can still be not resolved, so we use the current version matcher to
|
||||||
|
|
@ -152,19 +152,19 @@ public class LatestRevisionStrategy extends ComparatorLatestStrategy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map DEFAULT_SPECIAL_MEANINGS;
|
private static final Map<String, Integer> DEFAULT_SPECIAL_MEANINGS;
|
||||||
static {
|
static {
|
||||||
DEFAULT_SPECIAL_MEANINGS = new HashMap();
|
DEFAULT_SPECIAL_MEANINGS = new HashMap<String, Integer>();
|
||||||
DEFAULT_SPECIAL_MEANINGS.put("dev", new Integer(-1));
|
DEFAULT_SPECIAL_MEANINGS.put("dev", new Integer(-1));
|
||||||
DEFAULT_SPECIAL_MEANINGS.put("rc", new Integer(1));
|
DEFAULT_SPECIAL_MEANINGS.put("rc", new Integer(1));
|
||||||
DEFAULT_SPECIAL_MEANINGS.put("final", new Integer(2));
|
DEFAULT_SPECIAL_MEANINGS.put("final", new Integer(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Comparator mridComparator = new MridComparator();
|
private final Comparator<ModuleRevisionId> mridComparator = new MridComparator();
|
||||||
|
|
||||||
private final Comparator artifactInfoComparator = new ArtifactInfoComparator();
|
private final Comparator<ArtifactInfo> artifactInfoComparator = new ArtifactInfoComparator();
|
||||||
|
|
||||||
private Map specialMeanings = null;
|
private Map<String, Integer> specialMeanings = null;
|
||||||
|
|
||||||
private boolean usedefaultspecialmeanings = true;
|
private boolean usedefaultspecialmeanings = true;
|
||||||
|
|
||||||
|
|
@ -178,9 +178,9 @@ public class LatestRevisionStrategy extends ComparatorLatestStrategy {
|
||||||
getSpecialMeanings().put(meaning.getName().toLowerCase(Locale.US), meaning.getValue());
|
getSpecialMeanings().put(meaning.getName().toLowerCase(Locale.US), meaning.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Map getSpecialMeanings() {
|
public synchronized Map<String, Integer> getSpecialMeanings() {
|
||||||
if (specialMeanings == null) {
|
if (specialMeanings == null) {
|
||||||
specialMeanings = new HashMap();
|
specialMeanings = new HashMap<String, Integer>();
|
||||||
if (isUsedefaultspecialmeanings()) {
|
if (isUsedefaultspecialmeanings()) {
|
||||||
specialMeanings.putAll(DEFAULT_SPECIAL_MEANINGS);
|
specialMeanings.putAll(DEFAULT_SPECIAL_MEANINGS);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public interface LatestStrategy {
|
||||||
* @param infos
|
* @param infos
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List sort(ArtifactInfo[] infos);
|
List<ArtifactInfo> sort(ArtifactInfo[] infos);
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ package org.apache.ivy.plugins.latest;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class LatestTimeStrategy extends ComparatorLatestStrategy {
|
public class LatestTimeStrategy extends ComparatorLatestStrategy {
|
||||||
private static final Comparator COMPARATOR = new Comparator() {
|
private static final Comparator<ArtifactInfo> COMPARATOR = new Comparator<ArtifactInfo>() {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(ArtifactInfo o1, ArtifactInfo o2) {
|
||||||
long d1 = ((ArtifactInfo) o1).getLastModified();
|
long d1 = o1.getLastModified();
|
||||||
long d2 = ((ArtifactInfo) o2).getLastModified();
|
long d2 = o2.getLastModified();
|
||||||
return new Long(d1).compareTo(new Long(d2));
|
return new Long(d1).compareTo(new Long(d2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.apache.ivy.plugins.latest;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A strategy which delegate to another strategy, unless for the latest and working revisions which
|
||||||
|
* are considered as superior to any other revision. < br/>
|
||||||
|
* NB : it is for internal usage of Ivy only!
|
||||||
|
*/
|
||||||
|
public class WorkspaceLatestStrategy extends AbstractLatestStrategy {
|
||||||
|
|
||||||
|
private LatestStrategy delegate;
|
||||||
|
|
||||||
|
public WorkspaceLatestStrategy(LatestStrategy delegate) {
|
||||||
|
this.delegate = delegate;
|
||||||
|
setName("workspace-" + delegate.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ArtifactInfo> sort(ArtifactInfo[] infos) {
|
||||||
|
List<ArtifactInfo> sorted = delegate.sort(infos);
|
||||||
|
|
||||||
|
List<ArtifactInfo> head = new ArrayList<ArtifactInfo>();
|
||||||
|
List<ArtifactInfo> tail = new ArrayList<ArtifactInfo>();
|
||||||
|
|
||||||
|
for (ArtifactInfo ai : sorted) {
|
||||||
|
String rev = ai.getRevision();
|
||||||
|
boolean latestRev = rev.startsWith("latest") || rev.startsWith("working");
|
||||||
|
if (latestRev) {
|
||||||
|
head.add(ai);
|
||||||
|
} else {
|
||||||
|
tail.add(ai);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
head.addAll(tail);
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -57,6 +57,7 @@ public abstract class AbstractPatternMatcher implements PatternMatcher {
|
||||||
*/
|
*/
|
||||||
protected abstract/* @NotNull */Matcher newMatcher(/* @NotNull */String expression);
|
protected abstract/* @NotNull */Matcher newMatcher(/* @NotNull */String expression);
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ public/* @Immutable */final class ExactOrRegexpPatternMatcher extends AbstractPa
|
||||||
super(EXACT_OR_REGEXP);
|
super(EXACT_OR_REGEXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Matcher newMatcher(String expression) {
|
protected Matcher newMatcher(String expression) {
|
||||||
return new ExactOrRegexpMatcher(expression);
|
return new ExactOrRegexpMatcher(expression);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public/* @Immutable */final class ExactPatternMatcher extends AbstractPatternMat
|
||||||
super(EXACT);
|
super(EXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Matcher newMatcher(String expression) {
|
protected Matcher newMatcher(String expression) {
|
||||||
return new ExactMatcher(expression);
|
return new ExactMatcher(expression);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ public/* @Immutable */final class GlobPatternMatcher extends AbstractPatternMatc
|
||||||
super(GLOB);
|
super(GLOB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Matcher newMatcher(String expression) {
|
protected Matcher newMatcher(String expression) {
|
||||||
return new GlobMatcher(expression);
|
return new GlobMatcher(expression);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,35 +19,31 @@ package org.apache.ivy.plugins.matcher;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class MapMatcher {
|
public class MapMatcher {
|
||||||
private Map/* <String, Matcher> */matchers = new HashMap();
|
private Map<String, Matcher> matchers = new HashMap<String, Matcher>();
|
||||||
|
|
||||||
private PatternMatcher pm;
|
private PatternMatcher pm;
|
||||||
|
|
||||||
private Map attributes;
|
private Map<String, String> attributes;
|
||||||
|
|
||||||
public MapMatcher(Map attributes, PatternMatcher pm) {
|
public MapMatcher(Map<String, String> attributes, PatternMatcher pm) {
|
||||||
this.attributes = attributes;
|
this.attributes = attributes;
|
||||||
this.pm = pm;
|
this.pm = pm;
|
||||||
for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
|
for (Entry<String, String> entry : attributes.entrySet()) {
|
||||||
Entry entry = (Entry) iter.next();
|
String value = entry.getValue();
|
||||||
String value = (String) entry.getValue();
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
matchers.put(entry.getKey(), pm.getMatcher(value));
|
matchers.put(entry.getKey(), pm.getMatcher(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(Map/* <String,String> */m) {
|
public boolean matches(Map<String, String> m) {
|
||||||
for (Iterator iter = matchers.entrySet().iterator(); iter.hasNext();) {
|
for (Entry<String, Matcher> entry : matchers.entrySet()) {
|
||||||
Entry entry = (Entry) iter.next();
|
Matcher matcher = entry.getValue();
|
||||||
|
String value = m.get(entry.getKey());
|
||||||
Matcher matcher = (Matcher) entry.getValue();
|
|
||||||
String value = (String) m.get(entry.getKey());
|
|
||||||
if ((value == null) || !matcher.matches(value)) {
|
if ((value == null) || !matcher.matches(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -56,11 +52,12 @@ public class MapMatcher {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return attributes + " (" + pm.getName() + ")";
|
return attributes + " (" + pm.getName() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return Collections.unmodifiableMap(attributes);
|
return Collections.unmodifiableMap(attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ public final/* @Immutable */class RegexpPatternMatcher extends AbstractPatternMa
|
||||||
super(REGEXP);
|
super(REGEXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Matcher newMatcher(String expression) {
|
protected Matcher newMatcher(String expression) {
|
||||||
return new RegexpMatcher(expression);
|
return new RegexpMatcher(expression);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue