Nice.
I also though about it some time ago. Wouldn't it be cleaner to write it
like the following?
<script language="C#" definefunctions="true" namespace="test">
[Function("test-func")]
public string Testfunc( ) {
return "some result !!!!!!!!";
}
</script>
Most parts of the script code are constant, anyway. The parts could be added
automatically by the <script> task.
I also think that we shouldn't require the user to provide "Function"
attributes here. We'd just take all public functions and add them to the
TypeFactory. [Function] could be used to override the default name here.
Jarek
----- Original Message -----
From: "Ian MacLean" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 07, 2004 4:31 PM
Subject: [nant-dev] custom functions with the script task
> I just committed a small change to ScriptTask to allow the definition of
> custom functions inside a <script> task instance - see example below:
> This is quite nice as it means people can easily prototype new functions
> without having to compile and load a dedicated task/function assembly.
> Note that the script still requires a ScriptMain even if its empty.
>
> <script language="C#">
> <code><![CDATA[
> public static void ScriptMain(Project project) {
>
> }
> [FunctionSet("test", "Test")]
> public class TestFunctions : FunctionSetBase {
>
> public TestFunctions(Project project, PropertyDictionary
> propDict) : base(project, propDict) {
> }
> [Function("test-func")]
> public static string Testfunc( ) {
> return "some result !!!!!!!!";
> }
> }
>
> ]]></code>
> </script>
> <echo message="${test::test-func()}" />
> ...
>
> --
> Ian MacLean, Developer,
> ActiveState, a division of Sophos
> http://www.ActiveState.com
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
> Free Linux Tutorials. Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> nant-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-developers
>
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers