Subversion Repositories gelsvn

Rev

Rev 107 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 107 Rev 217
Line 55... Line 55...
55
  my($fh)   = shift;
55
  my($fh)   = shift;
56
  my($crlf) = $self->crlf();
56
  my($crlf) = $self->crlf();
57
 
57
 
58
  print $fh 'Microsoft Visual Studio Solution File, Format Version 7.00', $crlf,
58
  print $fh 'Microsoft Visual Studio Solution File, Format Version 7.00', $crlf,
59
            '#', $crlf,
59
            '#', $crlf,
60
            '# $Id: VC7WorkspaceCreator.pm 107 2005-09-02 16:42:23Z bj $', $crlf,
60
            '# $Id: VC7WorkspaceCreator.pm 217 2006-05-05 09:35:48Z bj $', $crlf,
61
            '#', $crlf,
61
            '#', $crlf,
62
            '# This file was generated by MPC.  Any changes made directly to', $crlf,
62
            '# This file was generated by MPC.  Any changes made directly to', $crlf,
63
            '# this file will be lost the next time it is generated.', $crlf,
63
            '# this file will be lost the next time it is generated.', $crlf,
64
            '#', $crlf,
64
            '#', $crlf,
65
            '# MPC Command:', $crlf,
65
            '# MPC Command:', $crlf,
Line 110... Line 110...
110
  ## Project Dependencies
110
  ## Project Dependencies
111
  print $fh "\tGlobalSection(ProjectDependencies) = postSolution$crlf";
111
  print $fh "\tGlobalSection(ProjectDependencies) = postSolution$crlf";
112
  foreach my $project (@$list) {
112
  foreach my $project (@$list) {
113
    my($name, $rawdeps, $project_guid) = @{$$pjs{$project}};
113
    my($name, $rawdeps, $project_guid) = @{$$pjs{$project}};
114
    my($deps) = $self->get_validated_ordering($project);
114
    my($deps) = $self->get_validated_ordering($project);
115
    if (defined $deps && $deps ne '') {
115
    if (defined $$deps[0]) {
116
      my($darr) = $self->create_array($deps);
-
 
117
      my($i)    = 0;
116
      my($i) = 0;
118
      foreach my $dep (@$darr) {
117
      foreach my $dep (@$deps) {
119
        my($guid) = $name_to_guid_map{$dep};
118
        my($guid) = $name_to_guid_map{$dep};
120
        if (defined $guid && $guid ne $project_guid) {
119
        if (defined $guid) {
121
          print $fh "\t\t{$project_guid}.$i = {$guid}$crlf";
120
          print $fh "\t\t{$project_guid}.$i = {$guid}$crlf";
122
          $i++;
121
          $i++;
123
        }
122
        }
124
      }
123
      }
125
    }
124
    }
Line 131... Line 130...
131
sub write_comps {
130
sub write_comps {
132
  my($self)     = shift;
131
  my($self)     = shift;
133
  my($fh)       = shift;
132
  my($fh)       = shift;
134
  my($gen)      = shift;
133
  my($gen)      = shift;
135
  my($projects) = $self->get_projects();
134
  my($projects) = $self->get_projects();
136
  my($language) = $self->get_language();
-
 
137
  my($vc7guid)  = $guids{$language};
-
 
138
  my($pjs)      = $self->get_project_info();
135
  my($pjs)      = $self->get_project_info();
139
  my(@list)     = sort @$projects;
136
  my(@list)     = sort @$projects;
140
  my($crlf)     = $self->crlf();
137
  my($crlf)     = $self->crlf();
141
 
138
 
142
  ## I hate to add yet another loop through all the projects, but
139
  ## I hate to add yet another loop through all the projects, but
Line 147... Line 144...
147
    $name_to_guid_map{$name} = $guid;
144
    $name_to_guid_map{$name} = $guid;
148
  }
145
  }
149
 
146
 
150
  ## Project Information
147
  ## Project Information
151
  foreach my $project (@list) {
148
  foreach my $project (@list) {
152
    my($name, $rawdeps, $guid) = @{$$pjs{$project}};
149
    my($name, $rawdeps, $guid, $language) = @{$$pjs{$project}};
-
 
150
    my($pguid) = $guids{$language};
153
    my($deps) = $self->get_validated_ordering($project);
151
    my($deps) = $self->get_validated_ordering($project);
154
    ## Convert all /'s to \
152
    ## Convert all /'s to \
155
    my($cpy) = $self->slash_to_backslash($project);
153
    my($cpy) = $project;
-
 
154
    $cpy =~ s/\//\\/g;
156
    print $fh "Project(\"{$vc7guid}\") = \"$name\", \"$cpy\", \"{$guid}\"$crlf";
155
    print $fh "Project(\"{$pguid}\") = \"$name\", \"$cpy\", \"{$guid}\"$crlf";
157
    $self->print_inner_project($fh, $gen, $guid, $deps, $name, \%name_to_guid_map);
156
    $self->print_inner_project($fh, $gen, $guid, $deps, $name, \%name_to_guid_map);
158
    print $fh "EndProject$crlf";
157
    print $fh "EndProject$crlf";
159
 
-
 
160
    if ($deps ne '' &&
-
 
161
        ($language eq 'csharp' || $language eq 'vb')) {
-
 
162
      $self->add_references($project, $vc7guid, $deps, \%name_to_guid_map);
-
 
163
    }
-
 
164
  }
158
  }
165
 
159
 
166
  print $fh "Global$crlf",
160
  print $fh "Global$crlf",
167
            "\tGlobalSection(",
161
            "\tGlobalSection(",
168
            $self->get_solution_config_section_name(),
162
            $self->get_solution_config_section_name(),
169
            ") = preSolution$crlf";
163
            ") = preSolution$crlf";
170
 
164
 
171
  my(%configs) = ();
165
  my(%configs) = ();
172
  foreach my $project (@list) {
166
  foreach my $project (@list) {
173
    my($name, $deps, $pguid, @cfgs) = @{$$pjs{$project}};
167
    my($name, $deps, $pguid, $lang, @cfgs) = @{$$pjs{$project}};
174
    foreach my $cfg (@cfgs) {
168
    foreach my $cfg (@cfgs) {
175
      $cfg = $self->get_short_config_name($cfg);
169
      $cfg = $self->get_short_config_name($cfg);
176
      $configs{$cfg} = 1;
170
      $configs{$cfg} = 1;
177
    }
171
    }
178
  }
172
  }
Line 186... Line 180...
186
  print $fh "\tGlobalSection(",
180
  print $fh "\tGlobalSection(",
187
            $self->get_project_config_section_name(),
181
            $self->get_project_config_section_name(),
188
            ") = postSolution$crlf";
182
            ") = postSolution$crlf";
189
 
183
 
190
  foreach my $project (@list) {
184
  foreach my $project (@list) {
191
    my($name, $deps, $pguid, @cfgs) = @{$$pjs{$project}};
185
    my($name, $deps, $pguid, $lang, @cfgs) = @{$$pjs{$project}};
192
    foreach my $cfg (sort @cfgs) {
186
    foreach my $cfg (sort @cfgs) {
193
      my($c) = $self->get_short_config_name($cfg);
187
      my($c) = $self->get_short_config_name($cfg);
194
      print $fh "\t\t{$pguid}.$c.ActiveCfg = $cfg$crlf" .
188
      print $fh "\t\t{$pguid}.$c.ActiveCfg = $cfg$crlf" .
195
                "\t\t{$pguid}.$c.Build.0 = $cfg$crlf";
189
                "\t\t{$pguid}.$c.Build.0 = $cfg$crlf";
196
    }
190
    }
Line 233... Line 227...
233
            "\tGlobalSection(ExtensibilityAddIns) = postSolution$crlf",
227
            "\tGlobalSection(ExtensibilityAddIns) = postSolution$crlf",
234
            "\tEndGlobalSection$crlf";
228
            "\tEndGlobalSection$crlf";
235
}
229
}
236
 
230
 
237
 
231
 
238
sub add_references {
-
 
239
  my($self)   = shift;
-
 
240
  my($proj)   = shift;
-
 
241
  my($pguid)  = shift;
-
 
242
  my($deps)   = shift;
-
 
243
  my($gmap)   = shift;
-
 
244
  my($crlf)   = $self->crlf();
-
 
245
  my($fh)     = new FileHandle();
-
 
246
  my($outdir) = $self->get_outdir();
-
 
247
 
-
 
248
  if (open($fh, "$outdir/$proj")) {
-
 
249
    my($write) = 0;
-
 
250
    my(@read)  = ();
-
 
251
    while(<$fh>) {
-
 
252
      if (/MPC\s+ADD\s+REFERENCES/) {
-
 
253
        $write = 1;
-
 
254
        my($darr) = $self->create_array($deps);
-
 
255
        foreach my $dep (@$darr) {
-
 
256
          push(@read, "                <Reference$crlf",
-
 
257
                      "                    Name = \"$dep\"$crlf",
-
 
258
                      "                    Project = \"{$$gmap{$dep}}\"$crlf",
-
 
259
                      "                    Package = \"{$pguid}\"$crlf",
-
 
260
                      "                />$crlf");
-
 
261
        }
-
 
262
      }
-
 
263
      else {
-
 
264
        push(@read, $_);
-
 
265
      }
-
 
266
    }
-
 
267
    close($fh);
-
 
268
 
-
 
269
    if ($write && open($fh, ">$outdir/$proj")) {
-
 
270
      foreach my $line (@read) {
-
 
271
        print $fh $line;
-
 
272
      }
-
 
273
      close($fh);
-
 
274
    }
-
 
275
  }
-
 
276
}
-
 
277
 
-
 
278
 
-
 
279
1;
232
1;