Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1006 closed defect (fixed)

Dojo cannot build the intern-strings target as an Ant subproject

Reported by: kindsol@… Owned by: jkuhnert
Priority: high Milestone:
Component: BuildTools Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

If someone tries to build dojo as a <subant> or <ant> task of a parent Ant project, the "intern-string" target will fail due to file-not-found exceptions.

For example:

<!-- dojo build task -->
<target name="dojo" description="builds the dojo profile">
  <subant buildpath="${dojo_scripts}" target="release">
     <property name="profile" value="${dojo_profile}" />
     <property name="docless" value="true" />
  </subant>
  <subant buildpath="${dojo_scripts}" target="intern-strings" >
     <property name="profile" value="${dojo_profile}" />
  </subant>
</target>
<!-- end dojo task -->

Turns out that in Ant setting the buildpath does not actually 'cwd' to the buildpath directory. What changes is the project's basedir property (based on the various attributes that <ant> accepts).

What a change in basedir means for Jython scripts (whis is what the intern-strings target runs) is that all relative paths get broken and thus trying to build Dojo as a sub-project to a larger project fails.

The solution that I found is to use the project.resolveFile("./relative/path/").getPath() method on all relative paths within the <script> tasks.

My modified "intern-strings" target (from the 0.2.2 version of [dojo]/buildscripts/build.xml) follows:

 <!-- intern-strings task -->
    <target name="intern-strings" depends="-fix-config"
        description="pulls template paths specified in prototypes into templateStrings which can be used to speed up widget construction">
        <script language="jython"><![CDATA[
import sys
# make the python standard library avialable            
            
sys.path.append(project.resolveFile("lib/pyLib.zip").getPath())
sys.path.append(project.resolveFile(".").getPath())

# import re
import os
from buildUtil import *

packageFile=project.resolveFile("../release/dojo/dojo.js").getPath()             
srcRoot=project.resolveFile("../").getPath() + "\"
            
internTemplateStrings(packageFile, srcRoot)
]]></script>
    </target>
    <!-- end intern-strings task -->

-Sol

Change History (3)

comment:1 Changed 13 years ago by dylan

Milestone: 0.4
Owner: changed from anonymous to jkuhnert

comment:2 Changed 13 years ago by jkuhnert

Resolution: fixed
Status: newclosed

Resolved in current trunk.

comment:3 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.