I noticed with version 2.0B3 that a recursive options on the makefile and nant builds would not work since files had to be specifically included in the build. Attached is a build script to help update a nant build file from sources listed in the *.csprojs. It'll probably need to be updated with current build options, but at least it accomplishes the tedious part.

This is based on a nant build file found at http://fepy.svn.sourceforge.net/viewvc/fepy/trunk/patches/latest/patch-nant-build?revision=588&view=markup

I hope this script at least helps to build under Mono.

# build.build.py: Outputs to stdout a nant build file
# 
# uasge:
# $ cd IronPython 2.0B4/Src
# $ python build.build.py >IronPython.build
# $ nant -f:IronPython.build
#

import xml.dom.minidom

def SilverLightCondition(node):
    if not node.hasAttribute('Condition'):
        return False
    c = node.attributes['Condition'].value
    return c.find("$(SilverlightBuild)") >= 0 and c.find("==") >= 0 and c.find("true") >= 0

def extractsources(csproj):
    s=''
    doc=xml.dom.minidom.parse(csproj)
    for x in doc.getElementsByTagName('Compile'):
        if SilverLightCondition(x):
            continue
        s+='<include name="' + x.attributes['Include'].value + '" />\n'
	return s


NantXML='''
<project name="IronPython">
    <property name="warn" value="4"/>
    <resgen input="Microsoft.Scripting.Core/Microsoft.Scripting.txt"
        output="Microsoft.Scripting.Core/Microsoft.Scripting.Core.resources"/>
    <csc target="library" output="Microsoft.Scripting.Core.dll"
        warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("Microsoft.Scripting.Core/Microsoft.Scripting.Core.csproj")
NantXML+='''
        </sources>
        <resources dynamicprefix="true" basedir="Microsoft.Scripting.Core">
            <include name="Microsoft.Scripting.Core.resources"/>
        </resources>
        <references>
            <include name="System.Configuration.dll"/>
        </references>
    </csc>
    <csc target="library" output="Microsoft.Scripting.dll"
        warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("Microsoft.Scripting/Microsoft.Scripting.csproj")
NantXML+='''
        </sources>
        <resources dynamicprefix="true">
            <include name="Microsoft.Scripting/**/*.resx"/>
        </resources>
        <references>
            <include name="System.Configuration.dll"/>
            <include name="Microsoft.Scripting.Core.dll"/>
        </references>
    </csc>
    <csc target="library" output="IronPython.dll"
        warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("IronPython/IronPython.csproj")
NantXML+='''
        </sources>
        <resources dynamicprefix="true">
            <include name="IronPython/**/*.resx"/>
        </resources>
        <references>
            <include name="Microsoft.Scripting.dll"/>
            <include name="Microsoft.Scripting.Core.dll"/>
        </references>
    </csc>
    <csc target="library" output="IronPython.Modules.dll"
        warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("IronPython.Modules/IronPython.Modules.csproj")
NantXML+='''
        </sources>
        <references>
            <include name="Microsoft.Scripting.dll"/>
            <include name="Microsoft.Scripting.Core.dll"/>
            <include name="IronPython.dll"/>
        </references>
    </csc>
    <csc target="library" output="IronPythonTest.dll"
        noconfig="true" warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("IronPythonTest/IronPythonTest.csproj")
NantXML+='''
        </sources>
        <references>
            <include name="System.dll"/>
            <include name="System.Xml.dll"/>
            <include name="Microsoft.Scripting.dll"/>
            <include name="Microsoft.Scripting.Core.dll"/>
            <include name="IronPython.dll"/>
        </references>
    </csc>
    <csc target="exe" output="ipy.exe"
        warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("IronPythonConsole/IronPythonConsole.csproj")
NantXML+='''
        </sources>
        <references>
            <include name="Microsoft.Scripting.dll"/>
            <include name="Microsoft.Scripting.Core.dll"/>
            <include name="IronPython.dll"/>
        </references>
    </csc>
    <csc target="winexe" output="ipyw.exe" define="IRONPYTHON_WINDOW"
        warninglevel="${warn}">
        <sources>
'''
NantXML+=extractsources("IronPythonConsole/IronPythonConsole.csproj")
NantXML+='''
        </sources>
        <references>
            <include name="Microsoft.Scripting.dll"/>
            <include name="Microsoft.Scripting.Core.dll"/>
            <include name="IronPython.dll"/>
        </references>
    </csc>
</project>
'''

print NantXML
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to