more futzing with ant crap
This commit is contained in:
parent
0544f8f674
commit
c3a2ffae98
19
build.xml
19
build.xml
@ -1,7 +1,7 @@
|
||||
<project name="LearningFlex" basedir="." default="build">
|
||||
<property environment="env"/>
|
||||
<property name="FLEX_HOME" value="${env.FLEX_HOME}"/>
|
||||
<property name="APP_ROOT" value="${basedir}"/>
|
||||
<property name="FLEXUNIT_HOME" value="${env.FLEXUNIT_HOME}"/>
|
||||
<taskdef resource="flexTasks.tasks" classpath="${env.FLEX_HOME}/ant/lib/flexTasks.jar"/>
|
||||
<target name="build">
|
||||
<mxmlc as3="true" file="./01-flickr/FlickrRIA.mxml"/>
|
||||
@ -55,7 +55,22 @@
|
||||
<mxmlc as3="true" file="./custom-03d3-lists/ListControl.mxml"/>
|
||||
<mxmlc as3="true" file="./custom-03d4-tilelist/TileListExample.mxml"/>
|
||||
<mxmlc as3="true" file="./custom-03g1-debugging/Debugging.mxml"/>
|
||||
<compc output="./custom-03g1-debugging/me/tests/TestSuite.swf"/>
|
||||
<compc output="./custom-03g1-debugging/me/tests/TestSuite.swf" include-classes="me.tests.TestSuite">
|
||||
<sp path-element="./custom-03g1-debugging"/>
|
||||
<l dir="${FLEXUNIT_HOME}" append="yes"/>
|
||||
</compc>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="${basedir}" casesensitive="yes">
|
||||
<patternset id="swf.files">
|
||||
<include name="**/*.swf"/>
|
||||
</patternset>
|
||||
<patternset id="swf.files">
|
||||
<include name="**/*.swc"/>
|
||||
</patternset>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
|
@ -18,35 +18,35 @@ HERE = dirname(abspath(__file__))
|
||||
AUTOGEN_WARNING = ('<!-- ******** AUTOGENERATED by {0} ' +
|
||||
('*' * 20) + '-->').format(basename(sys.argv[0]))
|
||||
|
||||
ROOT = BytesIO(''.join([_line.strip() for _line in """\
|
||||
<project name="LearningFlex" basedir="." default="build">
|
||||
<property environment="env" />
|
||||
<property name="FLEX_HOME" value="${env.FLEX_HOME}" />
|
||||
<property name="APP_ROOT" value="${basedir}" />
|
||||
|
||||
<taskdef resource="flexTasks.tasks" """
|
||||
"""classpath="${env.FLEX_HOME}/ant/lib/flexTasks.jar" />
|
||||
|
||||
<target name="build" />
|
||||
ROOT = ''.join([_line.strip() for _line in """\
|
||||
<project name="{PROJECT_NAME}" basedir="." default="build">
|
||||
<property environment="env" />
|
||||
<property name="FLEX_HOME" value="${{env.FLEX_HOME}}" />
|
||||
<property name="FLEXUNIT_HOME" value="${{env.FLEXUNIT_HOME}}" />
|
||||
<taskdef resource="flexTasks.tasks" """
|
||||
"""classpath="${{env.FLEX_HOME}}/ant/lib/flexTasks.jar" />
|
||||
<target name="build" />
|
||||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="${{basedir}}" casesensitive="yes">
|
||||
<patternset id="swf.files">
|
||||
<include name="**/*.swf" />
|
||||
</patternset>
|
||||
<patternset id="swf.files">
|
||||
<include name="**/*.swc" />
|
||||
</patternset>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
||||
""".splitlines() if _line.strip()]))
|
||||
# TARGET_FMT = '{target}:' + DEP_SEP + '{deps}'
|
||||
# RULE_FMT = '\\\n\t'.join([
|
||||
# '\t$(MXMLC) {primary_dep} ',
|
||||
# '$(MXMLC_FLAGS) ',
|
||||
# '-l+={parent_dir} ',
|
||||
# '-l+={package_base} ',
|
||||
# '-l+={flexunit} ',
|
||||
# '-sp+={package_base} ',
|
||||
# '-sp+={flexunit} ',
|
||||
# '-o {target}',
|
||||
# ])
|
||||
""".splitlines() if _line.strip()])
|
||||
|
||||
|
||||
def main(sysargs=sys.argv[:]):
|
||||
build_xml = pathjoin(HERE, 'build.xml')
|
||||
os.chmod(build_xml, 0600)
|
||||
buildxml_maker = BuildXMLMaker(outstream=open(build_xml, 'wb'))
|
||||
buildxml_maker = \
|
||||
BuildXMLMaker(project_name=sysargs[1], outstream=open(build_xml, 'wb'))
|
||||
buildxml_maker.make()
|
||||
os.chmod(build_xml, 0444)
|
||||
return 0
|
||||
@ -59,10 +59,10 @@ class BuildXMLMaker(object):
|
||||
)
|
||||
_source_fileexts = ('.mxml', '.as', '.css')
|
||||
|
||||
def __init__(self, outstream=sys.stdout):
|
||||
def __init__(self, project_name='%PROJECT%', outstream=sys.stdout):
|
||||
self.outstream = outstream
|
||||
self.targets = {'compc': {}, 'mxmlc': {}}
|
||||
self.tree = ET.parse(ROOT)
|
||||
self.tree = ET.parse(BytesIO(ROOT.format(PROJECT_NAME=project_name)))
|
||||
self.root = self.tree.getroot()
|
||||
self.build = self.tree.xpath('//target[@name="build"]')[0]
|
||||
|
||||
@ -86,7 +86,7 @@ class BuildXMLMaker(object):
|
||||
|
||||
def _add_target_from_test_suite(self, test_suite):
|
||||
rel_class = relpath(test_suite, HERE)
|
||||
self.targets['compc'][rel_class] = dict()
|
||||
self.targets['compc'][rel_class] = {}
|
||||
|
||||
def _add_target_from_mxml(self, mxml):
|
||||
rel_mxml = relpath(mxml, HERE)
|
||||
@ -115,9 +115,17 @@ class BuildXMLMaker(object):
|
||||
for as3 in sorted(self.targets['compc'].iterkeys()):
|
||||
rel_target = './' + as3.lstrip('./')
|
||||
as_swf = re.sub('(.*).as$', '\\1.swf', rel_target)
|
||||
attrs = dict(output=as_swf)
|
||||
as_class = re.sub('(.*).as$', '\\1', rel_target).replace('/', '.')
|
||||
class_parts = as_class.strip('./').split('.')
|
||||
as_class = '.'.join(class_parts[1:])
|
||||
source_path_dir = './' + '/'.join(class_parts[:1])
|
||||
attrs = {'output': as_swf, 'include-classes': as_class}
|
||||
attrs.update(self.targets['compc'][as3])
|
||||
ET.SubElement(self.build, 'compc', **attrs)
|
||||
compc_element = ET.SubElement(self.build, 'compc', **attrs)
|
||||
ET.SubElement(compc_element, 'sp',
|
||||
**{'path-element': source_path_dir})
|
||||
library_path = ET.SubElement(compc_element, 'l',
|
||||
**{'dir': '${FLEXUNIT_HOME}', 'append': 'yes'})
|
||||
|
||||
print(ET.tostring(self.root, pretty_print=True),
|
||||
file=self.outstream)
|
||||
|
Loading…
Reference in New Issue
Block a user