ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Lalevée <nicolas.lale...@hibnet.org>
Subject Import and project helpers
Date Fri, 16 Jul 2010 13:25:48 GMT
Hi,

I did some other experiment with the groovy frontend to ant recently. And I 
would like to be able to make a groovy build file import an xml build file 
and vice versa.

As far as I can tell, in order to do this, a simple change would be needed in 
ImportTask. Rather than doing this in importResource:

helper.parse(getProject(), importedResource);

we would do something like:

ProjectHelper subHelper = 
ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(
                    importedResource);

// push current stacks into the sub helper
subHelper.getImportStack().addAll(helper.getImportStack());
subHelper.getExtensionStack().addAll(helper.getExtensionStack());
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, subHelper);

subHelper.parse(getProject(), importedResource);

// push back the stacks from the sub helper to the main one
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
helper.getImportStack().clear();
helper.getImportStack().addAll(subHelper.getImportStack());
helper.getExtensionStack().clear();
helper.getExtensionStack().addAll(subHelper.getExtensionStack());


For the little tests I have done with the groovy frontend, it seems to work 
quite well.

Actually it seems so simple that I am wondering if I might have missed some 
side effect. Did I ?

At least the unit tests showed me that I did nothing that wrong.

Nicolas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message