Subversion Repositories DevTools

Rev

Rev 335 | Rev 347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 335 Rev 343
Line 16... Line 16...
16
#   Global data
16
#   Global data
17
#
17
#
18
my %resource_files;
18
my %resource_files;
19
my $pdb_none;
19
my $pdb_none;
20
 
20
 
-
 
21
my $toolset_name = 'csharp';                           # Toolset name : Error reporting
21
my $toolset_info;
22
my $toolset_info;
22
my $toolset_version = '1.1';
23
my $toolset_version = '1.1';
23
my %ToolsetVersion =
24
my %ToolsetVersion =
24
    (
25
    (
25
    '1.1' => { 'def'      => 'CSHARP.DEF',              # Def file to use
26
    '1.1' => { 'def'      => 'CSHARP.DEF',              # Def file to use
Line 50... Line 51...
50
sub ToolsetInit
51
sub ToolsetInit
51
{
52
{
52
 
53
 
53
    #.. Parse arguments (Toolset arguments)
54
    #.. Parse arguments (Toolset arguments)
54
    #
55
    #
55
    Debug( "csharp(@::ScmToolsetArgs)" );
56
    Debug( "$toolset_name(@::ScmToolsetArgs)" );
56
 
57
 
57
    foreach $_ ( @::ScmToolsetArgs ) {
58
    foreach $_ ( @::ScmToolsetArgs ) {
58
        if (/^--Version=(.*)/) {                # MS SDK Version
59
        if (/^--Version=(.*)/) {                # MS SDK Version
59
            $toolset_version = $1;
60
            $toolset_version = $1;
60
 
61
 
61
        } else {
62
        } else {
62
            Message( "csharp toolset: unknown option $_ -- ignored\n" );
63
            Message( "$toolset_name toolset: unknown option $_ -- ignored\n" );
63
        }
64
        }
64
    }
65
    }
65
 
66
 
66
    #.. Parse arguments (platform arguments)
67
    #.. Parse arguments (platform arguments)
67
    #
68
    #
68
    Debug( "csharp(@::ScmPlatformArgs)" );
69
    Debug( "$toolset_name(@::ScmPlatformArgs)" );
69
 
70
 
70
    foreach $_ ( @::ScmPlatformArgs ) {
71
    foreach $_ ( @::ScmPlatformArgs ) {
71
        if (/^--product=(.*)/) {                # GBE product
72
        if (/^--product=(.*)/) {                # GBE product
72
 
73
 
73
        } elsif (/^--Version=(.*)/) {           # MS SDK Version
74
        } elsif (/^--Version=(.*)/) {           # MS SDK Version
74
            $toolset_version = $1;
75
            $toolset_version = $1;
75
 
76
 
76
        } else {
77
        } else {
77
            Message( "csharp toolset: unknown platform argument $_ -- ignored\n" );
78
            Message( "$toolset_name toolset: unknown platform argument $_ -- ignored\n" );
78
        }
79
        }
79
    }
80
    }
80
 
81
 
81
    #.. Validate SDK version
82
    #.. Validate SDK version
82
    #   Currently supported versions are described in a HASH
83
    #   Currently supported versions are described in a HASH
83
    #
84
    #
84
    $toolset_info = $ToolsetVersion{$toolset_version};
85
    $toolset_info = $ToolsetVersion{$toolset_version};
85
    Error( "csharp toolset: Unknown version: $toolset_version" ) unless ( defined $toolset_info );
86
    Error( "$toolset_name toolset: Unknown version: $toolset_version" ) unless ( defined $toolset_info );
86
    
87
    
87
    #.. Standard.rul requirements
88
    #.. Standard.rul requirements
88
    #
89
    #
89
    $::s    = undef;
90
    $::s    = undef;
90
    $::o    = '';
91
    $::o    = '';
Line 250... Line 251...
250
 
251
 
251
    #
252
    #
252
    #   Ensure that the .cs file also exists
253
    #   Ensure that the .cs file also exists
253
    #
254
    #
254
    (my $csfile = $src) =~ s~\.resx$~.cs~;
255
    (my $csfile = $src) =~ s~\.resx$~.cs~;
255
    Error ("csharp toolset: Resx File without a .cs file",
256
    Error ("$toolset_name toolset: Resx File without a .cs file",
256
           "File: $src") unless ( -f $src );
257
           "File: $src") unless ( -f $src );
257
 
258
 
258
    #
259
    #
259
    #   Scan the .resx file looking for the ThisName element
260
    #   Scan the .resx file looking for the ThisName element
260
    #   A very simple and crude parser
261
    #   A very simple and crude parser
Line 267... Line 268...
267
        {
268
        {
268
            # Next line will contain the needed data item
269
            # Next line will contain the needed data item
269
            my $element = <SCAN>;
270
            my $element = <SCAN>;
270
            $element =~ m~\<.+\>(.+)\</.+\>~;
271
            $element =~ m~\<.+\>(.+)\</.+\>~;
271
            $ThisName = $1;
272
            $ThisName = $1;
272
            Error ("csharp toolset: Resx parsing: Bad this.Name", "File: $src") unless $ThisName;
273
            Error ("$toolset_name toolset: Resx parsing: Bad this.Name", "File: $src") unless $ThisName;
273
            $ThisName =~ s~\s+~~g;
274
            $ThisName =~ s~\s+~~g;
274
            last;
275
            last;
275
        }
276
        }
276
    }
277
    }
277
    close SCAN;
278
    close SCAN;
Line 299... Line 300...
299
            $NameSpace = $1;
300
            $NameSpace = $1;
300
            last;
301
            last;
301
        }
302
        }
302
    }
303
    }
303
    close SCAN;
304
    close SCAN;
304
    Error ("csharp toolset: Resx parsing: NameSpace not found", "File: $csfile") unless $NameSpace;
305
    Error ("$toolset_name toolset: Resx parsing: NameSpace not found", "File: $csfile") unless $NameSpace;
305
 
306
 
306
    #
307
    #
307
    #   Need to create an output file name that is a function of the FQN
308
    #   Need to create an output file name that is a function of the FQN
308
    #
309
    #
309
    my $root = "$NameSpace.$ThisName.resources";
310
    my $root = "$NameSpace.$ThisName.resources";
Line 482... Line 483...
482
 
483
 
483
        } elsif (/^--Dtd=(.+)/) {               # dtd definition
484
        } elsif (/^--Dtd=(.+)/) {               # dtd definition
484
            push @dtd, MakeSrcResolve($1);
485
            push @dtd, MakeSrcResolve($1);
485
            
486
            
486
        } elsif (/^--Icon=(.+)/) {
487
        } elsif (/^--Icon=(.+)/) {
487
            Error ("csharp LD: Only one Icon file allowed") if ( $icon );
488
            Error ("$toolset_name LD: Only one Icon file allowed") if ( $icon );
488
            $icon = MakeSrcResolve($1);
489
            $icon = MakeSrcResolve($1);
489
 
490
 
490
        } elsif (/^--StrongNameKey=(.+)/) {
491
        } elsif (/^--StrongNameKey=(.+)/) {
491
            Error ("csharp LD: Only one SNK file allowed") if ( $snk );
492
            Error ("$toolset_name LD: Only one SNK file allowed") if ( $snk );
492
            $snk = MakeSrcResolve($1);
493
            $snk = MakeSrcResolve($1);
493
 
494
 
494
        } elsif (/^--Entry=(.+)/) {
495
        } elsif (/^--Entry=(.+)/) {
495
            $entry = $1;
496
            $entry = $1;
496
            
497
            
Line 511... Line 512...
511
 
512
 
512
        } elsif ( !/^-/ ) {
513
        } elsif ( !/^-/ ) {
513
            push @csource, MakeSrcResolve($_);
514
            push @csource, MakeSrcResolve($_);
514
 
515
 
515
        } else {
516
        } else {
516
            Message( "csharp LD: unknown option $_ -- ignored\n" );
517
            Message( "$toolset_name LD: unknown option $_ -- ignored\n" );
517
 
518
 
518
        }
519
        }
519
    }
520
    }
520
 
521
 
521
    #
522
    #
Line 706... Line 707...
706
 
707
 
707
        } elsif (/^--Dtd=(.+)/) {               # dtd definition
708
        } elsif (/^--Dtd=(.+)/) {               # dtd definition
708
            push @_dtd, MakeSrcResolve($1);
709
            push @_dtd, MakeSrcResolve($1);
709
 
710
 
710
        } elsif (/^--Icon=(.+)/) {
711
        } elsif (/^--Icon=(.+)/) {
711
            Error ("csharp SHLD: Only one Icon file allowed") if ( $_icon );
712
            Error ("$toolset_name SHLD: Only one Icon file allowed") if ( $_icon );
712
            $_icon = MakeSrcResolve($1);
713
            $_icon = MakeSrcResolve($1);
713
 
714
 
714
        } elsif (/^--StrongNameKey=(.+)/) {
715
        } elsif (/^--StrongNameKey=(.+)/) {
715
            Error ("csharp SHLD: Only one SNK file allowed") if ( $_snk );
716
            Error ("$toolset_name SHLD: Only one SNK file allowed") if ( $_snk );
716
            $_snk = MakeSrcResolve($1);
717
            $_snk = MakeSrcResolve($1);
717
 
718
 
718
        } elsif (/^--Doc/) {
719
        } elsif (/^--Doc/) {
719
            $_docFile = 1;
720
            $_docFile = 1;
720
 
721
 
Line 723... Line 724...
723
 
724
 
724
        } elsif ( !/^-/ ) {
725
        } elsif ( !/^-/ ) {
725
            push @_csource, MakeSrcResolve($_);
726
            push @_csource, MakeSrcResolve($_);
726
 
727
 
727
        } else {
728
        } else {
728
            Message( "csharp SHLD: unknown option $_ -- ignored\n" );
729
            Message( "$toolset_name SHLD: unknown option $_ -- ignored\n" );
729
 
730
 
730
        }
731
        }
731
    }
732
    }
732
 
733
 
733
    #
734
    #
Line 910... Line 911...
910
sub ToolsetPROJECT
911
sub ToolsetPROJECT
911
{
912
{
912
    my( $name, $solution ,$pArgs ) = @_;
913
    my( $name, $solution ,$pArgs ) = @_;
913
    my $buildcmd = 'devenv =DSW= /build =TYPE= /useenv /out =LOG=';
914
    my $buildcmd = 'devenv =DSW= /build =TYPE= /useenv /out =LOG=';
914
    my $cleancmd = 'devenv =DSW= /clean =TYPE= /useenv';
915
    my $cleancmd = 'devenv =DSW= /clean =TYPE= /useenv';
-
 
916
    my $release = 'RELEASE';
-
 
917
    my $debug = 'DEBUG';
915
 
918
 
916
    #
919
    #
917
    #   Process options
920
    #   Process options
918
    #
921
    #
919
    foreach ( @$pArgs ) {
922
    foreach ( @$pArgs ) {
-
 
923
        if ( m/^--TargetProd*=(.+)/ ) {
-
 
924
            $release = $1;
-
 
925
 
-
 
926
        } elsif ( m/^--TargetDebug=(.+)/ ) {
-
 
927
            $debug = $1;
-
 
928
            
-
 
929
        } else {
920
        Message( "csharp PROJECT: unknown option $_ -- ignored\n" );
930
            Message( "$toolset_name PROJECT: unknown option $_ -- ignored\n" );
-
 
931
        }
921
    }
932
    }
922
 
933
 
923
    my ($io) = ToolsetPrinter::New();
934
    my ($io) = ToolsetPrinter::New();
924
 
935
 
925
    #
936
    #
926
    #   Setup toolset pecific difinitions. Once
937
    #   Setup toolset specific difinitions. Once
927
    #
938
    #
928
    unless( $project_defines_done )
939
    unless( $project_defines_done )
929
    {
940
    {
930
        $project_defines_done = 1;
941
        $project_defines_done = 1;
931
        $io->PrtLn( "ifeq \"\$(DEBUG)\" \"1\"");
942
        $io->PrtLn( 'project_target = $(if $(findstring 1,$(DEBUG)),$2,$1)' );
932
        $io->PrtLn( "PROJECT_CMD\t:= DEBUG");
-
 
933
        $io->PrtLn( "else");
-
 
934
        $io->PrtLn( "PROJECT_CMD\t:= RELEASE");
-
 
935
        $io->PrtLn( "endif");
-
 
936
        $io->Newline();
943
        $io->Newline();
937
    }
944
    }
938
 
945
 
939
    #
946
    #
940
    #   Process the build and clean commands
947
    #   Process the build and clean commands
941
    #       Substitute arguments
948
    #       Substitute arguments
942
    #           =TYPE=
949
    #           =TYPE=
943
    #           =LOG=
950
    #           =LOG=
944
    #           =DSW=
951
    #           =DSW=
945
    #
952
    #
946
    $buildcmd =~ s~=TYPE=~\$\(PROJECT_CMD)~g;
953
    $buildcmd =~ s~=TYPE=~"\$(call project_target,$release,$debug)"~g;
947
    $buildcmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
954
    $buildcmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
948
    $buildcmd =~ s~=DSW=~$solution~g;
955
    $buildcmd =~ s~=DSW=~$solution~g;
949
 
956
 
950
    $cleancmd =~ s~=TYPE=~\$\(PROJECT_CMD)~g;
957
    $cleancmd =~ s~=TYPE=~"\$(call project_target,$release,$debug)"~g;
951
    $cleancmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
958
    $cleancmd =~ s~=LOG=~$name\$(GBE_TYPE).log~g;
952
    $cleancmd =~ s~=DSW=~$solution~g;
959
    $cleancmd =~ s~=DSW=~$solution~g;
953
    
960
    
954
    #
961
    #
955
    #   Generate the recipe to create the project
962
    #   Generate the recipe to create the project