Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Peter B West
Build problems: icu4j for windows only?
August 18, 2012 8:40 PM
Answer

Peter B West

Rank: Junior Member

Posts: 57

Join Date: March 23, 2009

Recent Posts

There are a few places in the build where only windows systems are catered for. Here's one. It is in the 6.1.x branch from github.

In portal/portal-impl/build.xml is this fragment:
 1
 2    <target name="build-icu4j">
 3        <tstamp>
 4            <format property="tstamp.value" pattern="yyyyMMddkkmmssSSS" />
 5        </tstamp>
 6
 7        <unzip src="${project.dir}/tools/icu4j-4_0_1-src.jar" dest="${tstamp.value}" />
 8
 9        <move file="${tstamp.value}/src/com/ibm" todir="${tstamp.value}/src/com/liferay" />
10
11        <replace dir="${tstamp.value}" includes="build.xml,**/*.java,**/*.properties">
12            <replacefilter token="com.ibm" value="com.liferay.ibm" />
13            <replacefilter token="com/ibm" value="com/liferay/ibm" />
14        </replace>
15
16        <replace file="${tstamp.value}/build.xml">
17            <replacetoken><![CDATA[<unjar src="${icudatajar.file}" dest="${build.dir}" />]]></replacetoken>
18            <replacevalue><![CDATA[<unjar src="${icudatajar.file}" dest="${build.dir}" />
19    <move file="classes/com/ibm" todir="classes/com/liferay" />]]></replacevalue>
20        </replace>
21
22        <!--
23        Use exec because of a bug with com.liferay.ibm.icu.dev.tool.index.IndexGenerator
24        not picking up the correct base directory.
25
26        <ant dir="${tstamp.value}" target="core" inheritAll="false" />
27        <ant dir="${tstamp.value}" target="jar" inheritAll="false" />-->
28
29        <exec dir="${tstamp.value}" executable="cmd.exe" os="${os.windows}">
30            <arg line="/c ant core jar" />
31        </exec>
32
33        <move file="${tstamp.value}/icu4j.jar" tofile="${project.dir}/lib/portal/liferay-icu4j.jar.new" />
34
35        <delete dir="${tstamp.value}" />
36    </target>


Three things stand out here.

1) Why the windows-only exec? There is a section of the ant manual call "Running Ant in Java" which describes how to "exec" ant from within ant using the <java/> task. That is, how to perform the above windows-only action in an os-independent manner.

2) Why the changes to the package definition of icu4j? There are only a couple of places in the code where packages beginning com.liferay.ibm are used. So why not just bundle icu4j and be done with it?

3) The distribution packages, and then hacks, the icu4j sources for version 4.0.1. The current version is 49.1 (equivalent to 4.9.1 - the numbering system has been modified.) The hack above no longer works with the current icu4j build files. That seems like another reason to just bundle iuc4j.

So, why is it being done this way?
James Falkner
RE: Build problems: icu4j for windows only?
August 21, 2012 8:29 AM
Answer

James Falkner

Community Moderator

Rank: Liferay Legend

Posts: 1406

Join Date: September 17, 2010

Recent Posts

Peter B West:
There are a few places in the build where only windows systems are catered for. Here's one. It is in the 6.1.x branch from github.

In portal/portal-impl/build.xml is this fragment:

...

Three things stand out here.

1) Why the windows-only exec? There is a section of the ant manual call "Running Ant in Java" which describes how to "exec" ant from within ant using the <java/> task. That is, how to perform the above windows-only action in an os-independent manner.

2) Why the changes to the package definition of icu4j? There are only a couple of places in the code where packages beginning com.liferay.ibm are used. So why not just bundle icu4j and be done with it?

3) The distribution packages, and then hacks, the icu4j sources for version 4.0.1. The current version is 49.1 (equivalent to 4.9.1 - the numbering system has been modified.) The hack above no longer works with the current icu4j build files. That seems like another reason to just bundle iuc4j.

So, why is it being done this way?


I think this is old, dead ant code that is no longer used (as far as I can tell - I don't see anywhere where that task is called) - the source base now has an already-namespace-hacked version. The namespace hack is due to LPS-1907. I totally agree that windows-only hacks are bad and should only be used as a last resort. It was probably someone who was quickly trying to workaround the problem without thinking things through, and the code should be removed.