Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

794 righe
23 KiB

2 anni fa
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="build-common-ivy" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant">
<basename property="basedir.name" file="${basedir}" />
<propertyregex
input="${basedir.name}"
property="ivy.module.name"
regexp="(.*)\-(.*)$"
select="com.liferay.\1"
/>
<propertyregex
input="${ivy.module.name}"
override="true"
property="ivy.module.name"
regexp="\-"
replace="\."
/>
<path id="classpath.com.liferay.ant.mirrors.get">
<fileset dir="${sdk.dir}/dependencies/com.liferay.ant.mirrors.get/lib" erroronmissingdir="false" includes="*.jar" />
</path>
<taskdef classname="com.liferay.ant.mirrors.get.MirrorsGetTask" classpathref="classpath.com.liferay.ant.mirrors.get" name="mirrors-get" onerror="ignore" />
<if>
<not>
<available file="${ivy.home}/ivy-${ivy.version}.jar" />
</not>
<then>
<mkdir dir="${ivy.home}" />
<if>
<typefound name="mirrors-get" />
<then>
<mirrors-get
dest="${ivy.home}/ivy-${ivy.version}.jar"
src="${ivy.jar.url}"
/>
</then>
<else>
<get
dest="${ivy.home}/ivy-${ivy.version}.jar"
src="${ivy.jar.url}"
/>
</else>
</if>
</then>
</if>
<path id="ivy.lib.path">
<fileset
dir="${ivy.home}"
includes="ivy-${ivy.version}.jar"
/>
<fileset
dir="${sdk.dir}/lib"
includes="bcpg-jdk16.jar,bcprov-jdk16.jar"
/>
</path>
<taskdef classpathref="ivy.lib.path" resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" />
<pathconvert property="sdk.dependencies.dir" targetos="unix">
<path location="${sdk.dir}/dependencies" />
</pathconvert>
<path id="sdk.dependencies.path">
<dirset dir="${sdk.dir}" includes="dependencies/*" />
</path>
<pathconvert pathsep="," property="sdk.dependencies.path" refid="sdk.dependencies.path" targetos="unix" />
<macrodef name="process-ivy">
<attribute default="${basedir}" name="module.dir" />
<sequential>
<for list="@{module.dir},${sdk.dir},${sdk.dependencies.path}" param="ivy.xml.dir">
<sequential>
<if>
<available file="@{ivy.xml.dir}/ivy.xml" />
<then>
<fixcrlf eol="lf" file="@{ivy.xml.dir}/ivy.xml" fixlast="false" />
<checksum file="@{ivy.xml.dir}/ivy.xml" verifyproperty="ivy.xml.unmodified" />
<if>
<isfalse value="${ivy.xml.unmodified}" />
<then>
<var name="plugin.ivy.resolve.transitive.dependencies" unset="true" />
<if>
<and>
<available file="@{ivy.xml.dir}/bnd.bnd" />
<available file="@{ivy.xml.dir}/build.xml" />
</and>
<then>
<set-module-properties
module.dir="@{ivy.xml.dir}"
/>
</then>
<else>
<var name="plugin.ivy.resolve.transitive.dependencies" value="${ivy.resolve.transitive.dependencies}" />
</else>
</if>
<ivy:settings file="${ivy.custom.settings.file}" />
<if>
<antelope:endswith string="@{module.dir}" with="solr4-shared" />
<then>
<var name="ivy.checksums" value="" />
</then>
</if>
<ivy:resolve
conf="default,internal,provided"
file="@{ivy.xml.dir}/ivy.xml"
log="${ivy.log.level}"
transitive="${plugin.ivy.resolve.transitive.dependencies}"
/>
<var name="ivy.checksums" unset="true" />
<if>
<not>
<available file="@{ivy.xml.dir}/docroot" />
</not>
<then>
<ivy:retrieve
log="${ivy.log.level}"
overwriteMode="always"
pattern="@{ivy.xml.dir}/lib/[artifact].[ext]"
type="bundle,eclipse-plugin,jar,maven-plugin,orbit"
/>
<ivy:retrieve
log="${ivy.log.level}"
overwriteMode="always"
pattern="@{ivy.xml.dir}/lib/[artifact]-[type]s.[ext]"
type="source"
/>
</then>
<else>
<ivy:retrieve
log="${ivy.log.level}"
overwriteMode="always"
pattern="@{ivy.xml.dir}/docroot/WEB-INF/lib/[artifact].[ext]"
type="bundle,eclipse-plugin,jar,maven-plugin,orbit"
/>
<ivy:retrieve
log="${ivy.log.level}"
overwriteMode="always"
pattern="@{ivy.xml.dir}/docroot/WEB-INF/lib/[artifact]-[type]s.[ext]"
type="source"
/>
</else>
</if>
<checksum file="@{ivy.xml.dir}/ivy.xml" forceoverwrite="true" />
</then>
</if>
<var name="ivy.xml.unmodified" unset="true" />
</then>
</if>
</sequential>
</for>
</sequential>
</macrodef>
<macrodef name="record-git-commit-snapshot">
<sequential>
<loadfile srcfile="maven.deploy.log" property="maven.deploy.log.content" />
<propertyregex
input="${maven.deploy.log.content}"
override="true"
property="snapshot.tstamp"
regexp="${plugin.name}-${plugin.full.version}-([\d.-]+)\.jar"
select="\1"
/>
<property file="bnd.bnd" prefix="bnd." />
<exec executable="git" outputproperty="git.commit.module.log">
<arg value="log" />
<arg value="-1" />
<arg value="--pretty=format:%H" />
<arg value="--" />
<arg value="." />
<arg value=":!snapshot.properties" />
</exec>
<propertyregex
input="${sonatype.url}"
property="cdn.sonatype.url"
regexp="https://"
replace="http://cdn."
/>
<echo file="snapshot.properties">
module.snapshot.git.id=${git.commit.module.log}
module.snapshot.url=${cdn.sonatype.url}/com/liferay/${bnd.Bundle-SymbolicName}/${bnd.Bundle-Version}-SNAPSHOT/${bnd.Bundle-SymbolicName}-${bnd.Bundle-Version}-${snapshot.tstamp}.jar
</echo>
<var name="git.commit.module.log" unset="true" />
<var name="maven.deploy.log.content" unset="true" />
<var name="snapshot.tstamp" unset="true" />
</sequential>
</macrodef>
<macrodef name="set-build-xml-var">
<attribute name="bnd.property.key" default="" />
<attribute name="build.xml.var.name" />
<attribute name="module.dir" />
<sequential>
<if>
<and>
<available file="@{module.dir}/bnd.bnd" />
<not>
<equals arg1="@{bnd.property.key}" arg2="" />
</not>
</and>
<then>
<var name="module.bnd.@{bnd.property.key}" unset="true" />
<loadproperties prefix="module.bnd.">
<file file="@{module.dir}/bnd.bnd" />
</loadproperties>
<propertycopy
from="module.bnd.@{bnd.property.key}"
name="module.bnd.property.value"
override="true"
silent="true"
/>
<if>
<isset property="module.bnd.property.value" />
<then>
<var name="set-build-xml-var.return" value="${module.bnd.property.value}" />
</then>
<else>
<set-build-xml-var-from-build-xml
build.xml.var.name="@{build.xml.var.name}"
module.dir="@{module.dir}"
/>
</else>
</if>
</then>
<else>
<set-build-xml-var-from-build-xml
build.xml.var.name="@{build.xml.var.name}"
module.dir="@{module.dir}"
/>
</else>
</if>
</sequential>
</macrodef>
<macrodef name="set-build-xml-var-from-build-xml">
<attribute name="build.xml.var.name" />
<attribute name="module.dir" />
<sequential>
<loadfile property="set-build-xml-var.build.xml.content" srcFile="@{module.dir}/build.xml" />
<antelope:stringutil string="${set-build-xml-var.build.xml.content}" property="set-build-xml-var.value.beginindex">
<antelope:indexof string="property name=&quot;@{build.xml.var.name}&quot; value=&quot;" fromindex="0" />
</antelope:stringutil>
<if>
<equals arg1="${set-build-xml-var.value.beginindex}" arg2="-1" />
<then>
<var name="set-build-xml-var.return" unset="true" />
</then>
<else>
<antelope:stringutil string="${set-build-xml-var.build.xml.content}" property="set-build-xml-var.value.beginindex">
<antelope:indexof string="value=&quot;" fromindex="${set-build-xml-var.value.beginindex}" />
</antelope:stringutil>
<antelope:math
datatype="int"
operand1="${set-build-xml-var.value.beginindex}"
operand2="7"
operation="+"
result="set-build-xml-var.value.beginindex"
/>
<antelope:stringutil string="${set-build-xml-var.build.xml.content}" property="set-build-xml-var.value.endindex">
<antelope:indexof string="&quot;" fromindex="${set-build-xml-var.value.beginindex}" />
</antelope:stringutil>
<antelope:stringutil string="${set-build-xml-var.build.xml.content}" property="set-build-xml-var.return">
<antelope:substring beginindex="${set-build-xml-var.value.beginindex}" endindex="${set-build-xml-var.value.endindex}" />
</antelope:stringutil>
</else>
</if>
<var name="set-build-xml-var.build.xml.content" unset="true" />
</sequential>
</macrodef>
<macrodef name="set-module-properties">
<attribute name="module.dir" />
<sequential>
<var name="module.dir.unix" unset="true" />
<pathconvert property="module.dir.unix" targetos="unix">
<path location="@{module.dir}" />
</pathconvert>
<var name="module.auto.deploy.dir" unset="true" />
<var name="original.lib.name" unset="true" />
<var name="original.lib.version" unset="true" />
<var name="original.lib.url" unset="true" />
<var name="plugin.full.version" unset="true" />
<var name="plugin.jars" unset="true" />
<var name="plugin.required.contexts" unset="true" />
<var name="plugin.tlds" unset="true" />
<var name="plugin.version" unset="true" />
<set-build-xml-var
build.xml.var.name="auto.deploy.dir"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="module.auto.deploy.dir" value="${set-build-xml-var.return}" />
</then>
<else>
<var name="module.auto.deploy.dir" value="${auto.deploy.dir}" />
</else>
</if>
<set-build-xml-var
build.xml.var.name="original.lib.name"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="original.lib.name" value="${set-build-xml-var.return}" />
</then>
</if>
<set-build-xml-var
build.xml.var.name="original.lib.version"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="original.lib.version" value="${set-build-xml-var.return}" />
</then>
</if>
<set-build-xml-var
build.xml.var.name="original.lib.url"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="original.lib.url" value="${set-build-xml-var.return}" />
</then>
</if>
<if>
<available file="@{module.dir}/docroot/WEB-INF/liferay-plugin-package.properties" />
<then>
<var name="plugin-package.module-incremental-version" unset="true" />
<var name="plugin-package.portal-dependency-jars" unset="true" />
<var name="plugin-package.portal-dependency-tlds" unset="true" />
<var name="plugin-package.required-deployment-contexts" unset="true" />
<property file="@{module.dir}/docroot/WEB-INF/liferay-plugin-package.properties" prefix="plugin-package" />
<if>
<isset property="plugin-package.module-full-version" />
<then>
<var name="plugin.full.version" value="${plugin-package.module-full-version}" />
</then>
</if>
<var name="plugin.jars" value="${plugin-package.portal-dependency-jars}" />
<var name="plugin.required.contexts" value="${plugin-package.required-deployment-contexts}" />
<var name="plugin.tlds" value="${plugin-package.portal-dependency-tlds}" />
<var name="plugin.version" value="${plugin-package.module-incremental-version}" />
</then>
<else>
<set-build-xml-var
build.xml.var.name="plugin.version"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="plugin.version" value="${set-build-xml-var.return}" />
</then>
<else>
<var name="plugin.version" value="1" />
</else>
</if>
<set-build-xml-var
bnd.property.key="Bundle-Version"
build.xml.var.name="plugin.full.version"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="plugin.full.version" value="${set-build-xml-var.return}" />
</then>
</if>
</else>
</if>
<if>
<not>
<isset property="plugin.full.version" />
</not>
<then>
<var name="plugin.full.version" value="${lp.version}.${plugin.version}${lp.version.file.suffix}" />
</then>
</if>
<set-build-xml-var
bnd.property.key="Bundle-SymbolicName"
build.xml.var.name="plugin.name"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="plugin.name" value="${set-build-xml-var.return}" />
</then>
<else>
<if>
<equals arg1="@{module.dir}" arg2="." />
<then>
<var name="plugin.name" value="${ant.project.name}" />
</then>
<else>
<antelope:grep
group="1"
in="@{module.dir}"
property="plugin.name"
regex="(?:.*[/\\])(.*)"
/>
</else>
</if>
</else>
</if>
<set-build-xml-var
build.xml.var.name="theme.parent"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="theme.parent" value="${set-build-xml-var.return}" />
</then>
<else>
<var name="theme.parent" unset="true" />
</else>
</if>
<set-build-xml-var
build.xml.var.name="theme.type"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="theme.type" value="${set-build-xml-var.return}" />
</then>
<else>
<var name="theme.type" unset="true" />
</else>
</if>
<if>
<and>
<or>
<antelope:endswith string="${plugin.name}" with="-ext" />
<antelope:endswith string="${plugin.name}" with="-hook" />
<antelope:endswith string="${plugin.name}" with="-layouttpl" />
<antelope:endswith string="${plugin.name}" with="-portlet" />
<antelope:endswith string="${plugin.name}" with="-theme" />
<antelope:endswith string="${plugin.name}" with="-web" />
</or>
<not>
<resourcecontains
resource="${module.dir.unix}/build.xml"
substring="/build-common-osgi-plugin.xml&quot;"
/>
</not>
</and>
<then>
<var name="plugin.packaging" value="war" />
</then>
<else>
<var name="plugin.packaging" value="jar" />
</else>
</if>
<var name="plugin.file" value="${sdk.dir}/dist/${plugin.name}-${plugin.full.version}.${plugin.packaging}" />
<var name="plugin.javadoc.file" value="${sdk.dir}/dist/${plugin.name}-${plugin.full.version}-javadoc.zip" />
<var name="plugin.pom.file" value="${sdk.dir}/dist/${plugin.name}-${plugin.full.version}.pom" />
<var name="plugin.sources.file" value="${sdk.dir}/dist/${plugin.name}-${plugin.full.version}-sources.${plugin.packaging}" />
<var name="plugin.src.file" value="${sdk.dir}/dist/${plugin.name}-src-${plugin.full.version}.zip" />
<var name="plugin.wsdd.file" value="${sdk.dir}/dist/${plugin.name}-wsdd-${plugin.full.version}.jar" />
<if>
<available file="@{module.dir}/src" />
<then>
<var name="plugin.classes.dir" value="@{module.dir}/classes" />
<var name="plugin.lib.dir" value="@{module.dir}/lib" />
<var name="plugin.source.dir" value="@{module.dir}/src" />
<if>
<available file="@{module.dir}/lib" />
<then>
<path id="plugin-lib.classpath">
<fileset dir="@{module.dir}/lib" includes="*.jar" />
<pathelement location="@{module.dir}/classes" />
</path>
</then>
<else>
<path id="plugin-lib.classpath">
<pathelement location="@{module.dir}/classes" />
</path>
</else>
</if>
</then>
<else>
<var name="plugin.classes.dir" value="@{module.dir}/docroot/WEB-INF/classes" />
<var name="plugin.lib.dir" value="@{module.dir}/docroot/WEB-INF/lib" />
<var name="plugin.source.dir" value="@{module.dir}/docroot/WEB-INF/src" />
<if>
<available file="@{module.dir}/tmp" />
<then>
<path id="plugin-lib.classpath">
<fileset dir="@{module.dir}/docroot/WEB-INF/lib" erroronmissingdir="false" includes="*.jar" />
<fileset dir="@{module.dir}/tmp/WEB-INF/lib" erroronmissingdir="false" includes="*.jar" />
<pathelement location="@{module.dir}/docroot/WEB-INF/classes" />
<pathelement location="@{module.dir}/tmp/WEB-INF/classes" />
</path>
</then>
<else>
<path id="plugin-lib.classpath">
<fileset dir="@{module.dir}/docroot/WEB-INF/lib" erroronmissingdir="false" includes="*.jar" />
<pathelement location="@{module.dir}/docroot/WEB-INF/classes" />
</path>
</else>
</if>
</else>
</if>
<if>
<resourcecontains
resource="${module.dir.unix}/build.xml"
substring="/build-common-osgi-plugin.xml&quot;"
/>
<then>
<property name="plugin-lib.classpath.path" refid="plugin-lib.classpath" />
<set-build-xml-var
build.xml.var.name="ignore.osgi.portal.classpath"
module.dir="@{module.dir}"
/>
<path id="plugin-lib.classpath">
<fileset dir="@{module.dir}/lib" erroronmissingdir="false" includes="*.jar" />
<pathelement path="${plugin-lib.classpath.path}" />
<path refid="portal.classpath" />
</path>
<var name="plugin-lib.classpath.path" unset="true" />
</then>
</if>
<set-build-xml-var
build.xml.var.name="plugin-lib.additional.dir"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<property name="plugin-lib.classpath.path" refid="plugin-lib.classpath" />
<path id="plugin-lib.classpath">
<fileset dir="@{module.dir}/${set-build-xml-var.return}" includes="*.jar" />
<pathelement path="${plugin-lib.classpath.path}" />
</path>
<var name="plugin-lib.classpath.path" unset="true" />
</then>
</if>
<set-build-xml-var
build.xml.var.name="ivy.resolve.transitive.dependencies"
module.dir="@{module.dir}"
/>
<if>
<isset property="set-build-xml-var.return" />
<then>
<var name="plugin.ivy.resolve.transitive.dependencies" value="${set-build-xml-var.return}" />
</then>
<else>
<var name="plugin.ivy.resolve.transitive.dependencies" value="${ivy.resolve.transitive.dependencies}" />
</else>
</if>
</sequential>
</macrodef>
<process-ivy />
<target name="publish">
<ivy:settings file="${sdk.dir}/ivy-settings-publisher.xml" />
<ivy:resolve
conf="default,provided"
log="${ivy.log.level}"
transitive="${ivy.resolve.transitive.dependencies}"
/>
<property name="ivy.pom.description" value="${plugin.name}" />
<property name="ivy.pom.name" value="${plugin.name}" />
<property name="plugin.release.qualifier" value="" />
<if>
<equals arg1="${plugin.release.qualifier}" arg2="-SNAPSHOT" />
<then>
<property name="sonatype.password" value="${sonatype.snapshot.password}" />
<property name="sonatype.url" value="${sonatype.snapshot.url}" />
<property name="sonatype.username" value="${sonatype.snapshot.username}" />
</then>
<else>
<property name="sonatype.password" value="${sonatype.release.password}" />
<property name="sonatype.url" value="${sonatype.release.url}" />
<property name="sonatype.username" value="${sonatype.release.username}" />
</else>
</if>
<property name="ivy.pom.version" value="${plugin.full.version}${plugin.release.qualifier}" />
<ivy:makepom
description="${ivy.pom.description}"
ivyfile="ivy.xml"
pomfile="${plugin.pom.file}"
templatefile="${sdk.dir}/tools/templates/pom_tmpl/template.pom"
>
<mapping conf="default" scope="compile" />
<mapping conf="provided" scope="provided" />
<mapping conf="runtime" scope="runtime" />
</ivy:makepom>
<artifact:pom file="${plugin.pom.file}" id="${plugin.name}" />
<if>
<equals arg1="${publish.target}" arg2="local" />
<then>
<if>
<and>
<available file="${plugin.javadoc.file}" />
<available file="${plugin.source.file}" />
</and>
<then>
<artifact:install file="${plugin.file}">
<attach classifier="javadoc" file="${plugin.javadoc.file}" />
<attach classifier="sources" file="${plugin.source.file}" />
<pom refid="${plugin.name}" />
</artifact:install>
</then>
<elseif>
<available file="${plugin.javadoc.file}" />
<then>
<artifact:install file="${plugin.file}">
<attach classifier="javadoc" file="${plugin.javadoc.file}" />
<pom refid="${plugin.name}" />
</artifact:install>
</then>
</elseif>
<elseif>
<available file="${plugin.source.file}" />
<then>
<artifact:install file="${plugin.file}">
<attach classifier="sources" file="${plugin.source.file}" />
<pom refid="${plugin.name}" />
</artifact:install>
</then>
</elseif>
<else>
<artifact:install file="${plugin.file}">
<pom refid="${plugin.name}" />
</artifact:install>
</else>
</if>
</then>
<else>
<if>
<equals arg1="${plugin.release.qualifier}" arg2="-SNAPSHOT" />
<then>
<record action="start" name="${basedir}/maven.deploy.log" />
</then>
</if>
<if>
<and>
<available file="${plugin.javadoc.file}" />
<available file="${plugin.source.file}" />
</and>
<then>
<artifact:deploy file="${plugin.file}">
<attach classifier="javadoc" file="${plugin.javadoc.file}" />
<attach classifier="sources" file="${plugin.source.file}" />
<pom refid="${plugin.name}" />
<remoteRepository url="${sonatype.url}">
<authentication password="${sonatype.password}" username="${sonatype.username}" />
</remoteRepository>
</artifact:deploy>
</then>
<elseif>
<available file="${plugin.javadoc.file}" />
<then>
<artifact:deploy file="${plugin.file}">
<attach classifier="javadoc" file="${plugin.javadoc.file}" />
<pom refid="${plugin.name}" />
<remoteRepository url="${sonatype.url}">
<authentication password="${sonatype.password}" username="${sonatype.username}" />
</remoteRepository>
</artifact:deploy>
</then>
</elseif>
<elseif>
<available file="${plugin.source.file}" />
<then>
<artifact:deploy file="${plugin.file}">
<attach classifier="sources" file="${plugin.source.file}" />
<pom refid="${plugin.name}" />
<remoteRepository url="${sonatype.url}">
<authentication password="${sonatype.password}" username="${sonatype.username}" />
</remoteRepository>
</artifact:deploy>
</then>
</elseif>
<else>
<artifact:deploy file="${plugin.file}">
<pom refid="${plugin.name}" />
<remoteRepository url="${sonatype.url}">
<authentication password="${sonatype.password}" username="${sonatype.username}" />
</remoteRepository>
</artifact:deploy>
</else>
</if>
<if>
<equals arg1="${plugin.release.qualifier}" arg2="-SNAPSHOT" />
<then>
<record action="stop" name="${basedir}/maven.deploy.log" />
<record-git-commit-snapshot />
<delete file="maven.deploy.log" />
</then>
</if>
</else>
</if>
</target>
</project>