Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
3691 lines (3073 sloc) 116 KB
<?xml version="1.0"?>
<project basedir="." default="dist" name="portal-dist" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build.xml" />
<if>
<isset property="java.security" />
<then>
<property name="java.security.manager.option" value="-Djava.security.manager" />
</then>
<else>
<property name="java.security.manager.option" value="" />
</else>
</if>
<macrodef name="build-dist-tomcat-bare" >
<sequential>
<if>
<equals arg1="${tomcat.keep.app.server.properties}" arg2="true" />
<then>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall inheritAll="false" target="unzip-tomcat" />
</then>
<else>
<app-server-properties-update>
app.server.type=tomcat
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall target="unzip-tomcat" />
</else>
</if>
<delete dir="${project.dir}/portal-web/classes" />
</sequential>
</macrodef>
<macrodef name="download-dynamic-jars">
<attribute name="app.server.lib.portal.dir" />
<sequential>
<property file="${project.dir}/portal-impl/src/portal.properties" prefix="portal" />
<mirrors-get
dest="@{app.server.lib.portal.dir}/${portal.setup.liferay.pool.provider.jar.name[hikaricp]}"
src="${portal.setup.liferay.pool.provider.jar.url[hikaricp]}"
/>
</sequential>
</macrodef>
<macrodef name="update-jboss-java-opts">
<sequential>
<replace
dir="${app.server.jboss.dir}/bin"
includes="*.bat,*.conf"
token="-Xmx512m"
value="-Xmx1024m"
/>
</sequential>
</macrodef>
<macrodef name="update-plugins-includes-plugin">
<attribute name="plugins.includes.plugin.bundle" />
<attribute name="plugins.includes.plugin.dependent-apps" />
<attribute name="plugins.includes.plugin.marketplace" />
<attribute name="plugins.includes.plugin.name" />
<attribute name="plugins.includes.plugin.public" />
<sequential>
<if>
<and>
<or>
<and>
<equals arg1="${lp.release.type}" arg2="CE" />
<equals arg1="@{plugins.includes.plugin.public}" arg2="true" />
</and>
<equals arg1="${lp.release.type}" arg2="EE" />
</or>
<or>
<and>
<equals arg1="${plugins.includes.bundle.required}" arg2="true" />
<equals arg1="@{plugins.includes.plugin.bundle}" arg2="true" />
</and>
<and>
<equals arg1="${plugins.includes.marketplace.required}" arg2="true" />
<equals arg1="@{plugins.includes.plugin.marketplace}" arg2="true" />
</and>
</or>
</and>
<then>
<echo append="true" file="${lp.plugins.dir}/build.${user.name}.properties">@{plugins.includes.plugin.dependent-apps},@{plugins.includes.plugin.name},</echo>
</then>
</if>
</sequential>
</macrodef>
<target name="build-dist-glassfish">
<app-server-properties-update>
app.server.type=glassfish
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall target="unzip-glassfish" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.glassfish.deploy.dir}" />
<param name="deployer.app.server.type" value="glassfish" />
<param name="deployer.app.server.lib.portal.dir" value="lib/portal" />
</antcall>
</target>
<target name="build-dist-jboss">
<app-server-properties-update>
app.server.type=jboss
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall inheritAll="false" target="unzip-jboss" />
<update-jboss-java-opts />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.jboss.deploy.dir}" />
<param name="deployer.app.server.type" value="jboss" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.jboss.portal.dir}/WEB-INF/lib" />
</antcall>
</target>
<target name="build-dist-jetty">
<app-server-properties-update>
app.server.type=jetty
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall target="unzip-jetty" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.jetty.deploy.dir}" />
<param name="deployer.app.server.type" value="jetty" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.jetty.lib.portal.dir}" />
</antcall>
</target>
<target name="build-dist-jonas">
<antcall target="unzip-jonas" />
<app-server-properties-update>
app.server.type=jonas
</app-server-properties-update>
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.jonas.deploy.dir}" />
<param name="deployer.app.server.type" value="jonas" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.jonas.lib.portal.dir}" />
</antcall>
</target>
<target name="build-dist-language-hook">
<if>
<available file="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook" />
<then>
<delete dir="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook" />
</then>
</if>
<exec dir="${lp.plugins.dir}/hooks" executable="cmd.exe">
<arg line="/c create.bat liferay-language-${locale.current} &quot;Liferay Portal Language Pack ${locale.current}&quot;" />
</exec>
<echo file="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook/docroot/WEB-INF/liferay-hook.xml"><![CDATA[<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_1_0.dtd">
<hook>
<language-properties>content/Language-ext_${locale.current}.properties</language-properties>
</hook>]]></echo>
<copy file="portal-impl/src/content/Language_${locale.current}.properties" tofile="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook/docroot/WEB-INF/src/content/Language-ext_${locale.current}.properties" />
<if>
<not>
<equals arg1="${lp.plugins.minor.version}" arg2="1" />
</not>
<then>
<replace file="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook/docroot/WEB-INF/liferay-plugin-package.properties">
<replacefilter token="module-incremental-version=1" value="module-incremental-version=${lp.plugins.minor.version}" />
</replace>
</then>
</if>
<ant dir="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook" inheritAll="false" target="war" />
</target>
<target name="build-dist-language-hooks">
<exec executable="cmd">
<arg line="/c dir /b ${project.dir}\portal-impl\src\content\ > ${project.dir}\output.txt" />
</exec>
<loadfile property="output.txt.content" srcFile="${project.dir}\output.txt" />
<delete file="output.txt" />
<beanshell>
String outputTxtContent = project.getProperty("output.txt.content");
if (outputTxtContent.contains("File Not Found")) {
outputTxtContent = "";
}
String locales = outputTxtContent.replaceAll("\r\n", ",");
locales = locales.replaceAll("Language.properties,", "");
locales = locales.replaceAll("Language_", "");
locales = locales.replaceAll(".properties", "");
if (locales.endsWith(",")) {
locales = locales.substring(0, locales.length() - 1);
}
project.setProperty("locale.list", locales);
</beanshell>
<for list="${locale.list}" param="locale.current">
<sequential>
<antcall target="build-dist-language-hook">
<param name="locale.current" value="@{locale.current}" />
</antcall>
</sequential>
</for>
</target>
<target name="build-dist-plugins">
<antcall inheritAll="false" target="update-plugins-includes">
<param name="plugins.includes.bundle.required" value="true" />
</antcall>
<ant dir="${lp.plugins.dir}" inheritAll="false" target="all" />
</target>
<target name="build-dist-resin">
<app-server-properties-update>
app.server.type=resin
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall target="unzip-resin" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.resin.deploy.dir}" />
<param name="deployer.app.server.type" value="resin" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.resin.lib.portal.dir}" />
</antcall>
</target>
<target name="build-dist-sql-oracle">
<ant dir="sql" inheritAll="false" target="rebuild-oracle" />
<ant dir="sql" inheritAll="false" target="export-oracle" />
<move file="sql/lportal.dmp" tofile="dist/liferay-portal-sql-oracle-${lp.version}.dmp" />
</target>
<target name="build-dist-tcat">
<app-server-properties-update>
app.server.type=tomcat
app.server.tomcat.version=7.0.39
app.server.tomcat.zip.url=http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.39/bin/apache-tomcat-7.0.39.zip
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall inheritAll="false" target="build-dist-tomcat">
<param name="tomcat.keep.app.server.properties" value="true" />
</antcall>
<beanshell>
String lpVersion = project.getProperty("lp.version");
String lpVersionTcat = lpVersion.replace(".", "_");
project.setProperty("lp.version.tcat", lpVersionTcat);
</beanshell>
<echo append="true" file="release.${user.name}.properties">
lp.version.tcat=${lp.version.tcat}
</echo>
<delete dir="${app.server.tcat.dir}" />
<antcall inheritAll="false" target="build-dist-tcat-profile">
<param name="app.server.tcat.dir" value="${app.server.tcat.dir}" />
</antcall>
<antcall inheritAll="false" target="build-dist-tcat-tomcat">
<param name="app.server.tcat.dir" value="${app.server.tcat.dir}" />
</antcall>
<if>
<not>
<available file="${app.server.parent.dir}/${app.server.tcat.zip.name}" />
</not>
<then>
<mkdir dir="${app.server.parent.dir}" />
<mirrors-get
dest="${app.server.parent.dir}/${app.server.tcat.zip.name}"
src="${app.server.tcat.zip.url}"
verbose="true"
/>
</then>
</if>
<antcall inheritAll="false" target="build-dist-tcat-admin">
<param name="app.server.tcat.dir" value="${app.server.tcat.dir}" />
<param name="app.server.tcat.zip.name" value="${app.server.tcat.zip.name}" />
</antcall>
<antcall inheritAll="false" target="build-dist-tcat-agent">
<param name="app.server.tcat.dir" value="${app.server.tcat.dir}" />
<param name="app.server.tcat.zip.name" value="${app.server.tcat.zip.name}" />
</antcall>
<app-server-properties-reset />
</target>
<target name="build-dist-tcat-admin">
<copy file="tools/servers/tcat/tcat-init.groovy" todir="${app.server.tcat.dir}/admin" />
<unzip
dest="${app.server.tcat.dir}/admin/webapps"
src="${app.server.parent.dir}/${app.server.tcat.zip.name}"
>
<patternset
includes="**/console.war"
/>
<flattenmapper />
</unzip>
<replace file="${app.server.tcat.dir}/admin/conf/server.xml">
<replacefilter token="8005" value="8105" />
<replacefilter token="8009" value="8109" />
<replacefilter token="8080" value="8180" />
<replacefilter token="8443" value="81443" />
</replace>
<mkdir dir="${app.server.tcat.dir}/admin/tcat_init/profiles" />
<copy file="dist/liferay-portal-tcat-profile-${lp.version}.zip" todir="${app.server.tcat.dir}/admin/tcat_init/profiles" />
<mkdir dir="${app.server.tcat.dir}/admin/tcat_init/scripts" />
<copy file="tools/servers/tcat/LiferayDeployerFactory.groovy" todir="${app.server.tcat.dir}/admin/tcat_init/scripts" />
<antcall target="build-dist-tcat-admin-webapps-plugins">
<param name="app.server.tcat.dir" value="${app.server.tcat.dir}" />
</antcall>
<antcall target="build-dist-tcat-admin-webapps-portal">
<param name="app.server.tcat.dir" value="${app.server.tcat.dir}" />
</antcall>
</target>
<target name="build-dist-tcat-admin-webapps-plugins">
<echo append="true" file="${lp.plugins.dir}/build.${user.name}.properties">
plugins.war.excludes=**/WEB-INF/service/**,**/WEB-INF/src/**
</echo>
<ant dir="${lp.plugins.dir}" inheritAll="false" target="all" />
<copy todir="${app.server.tcat.dir}/admin/tcat_init/webapps/${lp.version.tcat}">
<fileset dir="${lp.plugins.dir}/dist" includes="*.war" />
</copy>
</target>
<target name="build-dist-tcat-admin-webapps-portal">
<tstamp>
<format pattern="yyyyMMddkkmmssSSS" property="tstamp.value" />
</tstamp>
<mkdir dir="${tstamp.value}/META-INF" />
<echo file="${tstamp.value}/META-INF/context.xml"><![CDATA[<?xml version="1.0"?>
<Context crossContext="true" path="">
<Realm
className="org.apache.catalina.realm.JAASRealm"
appName="PortalRealm"
userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
/>
</Context>]]>
</echo>
<mkdir dir="${app.server.tcat.dir}/admin/tcat_init/webapps/${lp.version.tcat}" />
<copy file="dist/liferay-portal-${lp.version}.war" tofile="${app.server.tcat.dir}/admin/tcat_init/webapps/${lp.version.tcat}/ROOT.war" />
<zip
basedir="${tstamp.value}"
destfile="${app.server.tcat.dir}/admin/tcat_init/webapps/${lp.version.tcat}/ROOT.war"
update="yes"
/>
<delete dir="${tstamp.value}" />
</target>
<target name="build-dist-tcat-agent">
<echo file="${app.server.tcat.dir}/agent/conf/Catalina/localhost/agent.xml"><![CDATA[<?xml version="1.0"?>
<Context privileged="true" />]]>
</echo>
<unzip
dest="${app.server.tcat.dir}/agent/webapps"
src="${app.server.parent.dir}/${app.server.tcat.zip.name}"
>
<patternset
includes="**/agent.war"
/>
<flattenmapper />
</unzip>
</target>
<target name="build-dist-tcat-profile">
<mkdir dir="${app.server.tcat.dir}/profile/files/lib/ext" />
<copy file="tools/servers/tcat/profile.xml" todir="${app.server.tcat.dir}/profile">
<filterset>
<filter token="lp.version" value="${lp.version}" />
</filterset>
</copy>
<copy todir="${app.server.tcat.dir}/profile/files/lib/ext">
<fileset dir="${app.server.tomcat.dir}/lib/ext" />
</copy>
<echo file="${app.server.tcat.dir}/profile/files/lib/ext/portal-bundle.properties">auto.deploy.deploy.dir=${catalina.base}/deploy</echo>
<delete failonerror="false" file="dist/liferay-portal-tcat-profile-${lp.version}.zip" />
<zip destfile="dist/liferay-portal-tcat-profile-${lp.version}.zip">
<zipfileset
dir="${app.server.tcat.dir}/profile"
/>
</zip>
</target>
<target name="build-dist-tcat-tomcat">
<mkdir dir="${app.server.tcat.dir}/tomcat" />
<copy todir="${app.server.tcat.dir}/tomcat">
<fileset
dir="${app.server.tomcat.dir}"
excludes="**/ROOT.xml,logs/**,temp/**,webapps/**,work/**"
/>
</copy>
<mkdir dir="${app.server.tcat.dir}/tomcat/temp" />
<replace file="${app.server.tcat.dir}/tomcat/conf/server.xml">
<replacetoken><![CDATA[xmlValidation="false" deployXML="false" xmlNamespaceAware="false">]]></replacetoken>
<replacevalue><![CDATA[xmlValidation="false" xmlNamespaceAware="false">]]></replacevalue>
</replace>
<move file="${app.server.tcat.dir}/tomcat" tofile="${app.server.tcat.dir}/admin" />
<copy todir="${app.server.tcat.dir}/agent">
<fileset dir="${app.server.tcat.dir}/admin" />
</copy>
</target>
<target name="build-dist-tcserver">
<app-server-properties-update>
app.server.type=tcserver
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall target="unzip-tcserver" />
<delete dir="${project.dir}/portal-web/classes" />
<antcall inheritAll="false" target="all" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.tcserver.deploy.dir}" />
<param name="deployer.app.server.type" value="tomcat" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.tcserver.lib.portal.dir}" />
</antcall>
</target>
<target name="build-dist-tomcat">
<build-dist-tomcat-bare />
<ant inheritAll="false" target="deploy" />
<if>
<not>
<equals arg1="${tomcat.keep.app.server.properties}" arg2="true" />
</not>
<then>
<app-server-properties-reset />
</then>
</if>
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.parent.dir}/tomcat-${app.server.tomcat.version}/webapps" />
<param name="deployer.app.server.type" value="tomcat" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.parent.dir}/tomcat-${app.server.tomcat.version}/webapps/ROOT/WEB-INF/lib" />
</antcall>
</target>
<target name="build-dist-tomcat-bare">
<build-dist-tomcat-bare />
</target>
<target name="build-dist-weblogic">
<app-server-properties-update>
app.server.type=weblogic
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<if>
<equals arg1="${app.server.weblogic.version}" arg2="12.2.1" />
<then>
<antcall target="unzip-weblogic-custom" />
</then>
<else>
<antcall target="unzip-weblogic" />
</else>
</if>
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.weblogic.deploy.dir}" />
<param name="deployer.app.server.type" value="weblogic" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.weblogic.lib.portal.dir}" />
</antcall>
</target>
<target name="build-dist-websphere">
<app-server-properties-update>
app.server.type=websphere
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall inheritAll="false" target="unzip-websphere" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.websphere.deploy.dir}" />
<param name="deployer.app.server.type" value="websphere" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.websphere.portal.dir}/WEB-INF/lib" />
</antcall>
</target>
<target name="build-dist-wildfly">
<app-server-properties-update>
app.server.type=wildfly
</app-server-properties-update>
<antcall inheritAll="false" target="update-sdk-properties" />
<antcall target="unzip-wildfly" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<antcall inheritAll="false" target="resolve-dynamic-jars" />
<app-server-properties-reset />
<antcall target="deploy-plugins">
<param name="deployer.dest.dir" value="${app.server.parent.dir}/wildfly-${app.server.wildfly.version}/standalone/deployments" />
<param name="deployer.app.server.type" value="wildfly" />
<param name="deployer.app.server.lib.portal.dir" value="${app.server.parent.dir}/wildfly-${app.server.wildfly.version}/standalone/deployments/ROOT.war/WEB-INF/lib" />
</antcall>
</target>
<target name="deploy-plugins">
<delete failonerror="false" includeemptydirs="true">
<fileset
dir="${deployer.dest.dir}"
includes="*-ext/**,*-hook/**,*-layouttpl/**,*-portlet/**,*-theme/**"
/>
</delete>
<java
classname="com.liferay.portal.tools.deploy.ExtDeployer"
classpathref="project.classpath"
fork="true"