Subversion Repositories gelsvn

Rev

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

Rev 107 Rev 198
Line 156... Line 156...
156
          ## Fill in all the default values
156
          ## Fill in all the default values
157
          $self->generate_defaults();
157
          $self->generate_defaults();
158
 
158
 
159
          ## End of workspace; Have subclass write out the file
159
          ## End of workspace; Have subclass write out the file
160
          ## Generate the project files
160
          ## Generate the project files
161
          my($gstat, $creator) = $self->generate_project_files();
161
          my($gstat, $creator, $err) = $self->generate_project_files();
162
          if ($gstat) {
162
          if ($gstat) {
163
            ($status, $error) = $self->write_workspace($creator, 1);
163
            ($status, $error) = $self->write_workspace($creator, 1);
164
            $self->{'assign'} = {};
164
            $self->{'assign'} = {};
165
          }
165
          }
166
          else {
166
          else {
167
            $error = 'Unable to generate all of the project files';
167
            $error = $err;
168
            $status = 0;
168
            $status = 0;
169
          }
169
          }
170
 
170
 
171
          $self->{'modified_count'} = 0;
171
          $self->{'modified_count'} = 0;
172
          $self->{'workspace_name'} = undef;
172
          $self->{'workspace_name'} = undef;
Line 354... Line 354...
354
 
354
 
355
  if ($name eq 'exclude') {
355
  if ($name eq 'exclude') {
356
    return $self->parse_exclude($fh, $type);
356
    return $self->parse_exclude($fh, $type);
357
  }
357
  }
358
  else {
358
  else {
-
 
359
    ## We need to make a copy of the current assignment hash
-
 
360
    ## to ensure that multiply scoped assignments/additions/subtractions
-
 
361
    ## work and contain the non-scoped assignments/additions/subtractions
-
 
362
    if (!defined $flags) {
-
 
363
      my(%copy) = %{$self->get_assignment_hash()};
-
 
364
      $flags = \%copy;
-
 
365
    }
359
    return $self->SUPER::parse_scope($fh, $name, $type,
366
    return $self->SUPER::parse_scope($fh, $name, $type,
360
                                     $validNames, $flags, $elseflags);
367
                                     $validNames, $flags, $elseflags);
361
  }
368
  }
362
}
369
}
363
 
370
 
Line 951... Line 958...
951
 
958
 
952
  ## Make a copy of these.  We will be modifying them.
959
  ## Make a copy of these.  We will be modifying them.
953
  ## It is necessary to sort the projects to get the correct ordering.
960
  ## It is necessary to sort the projects to get the correct ordering.
954
  ## Projects in the current directory must come before projects in
961
  ## Projects in the current directory must come before projects in
955
  ## other directories.
962
  ## other directories.
956
  my(@projects)  = sort { my($sa) = ($a =~ /\//);
963
  my(@projects)  = sort { return $self->sort_projects_by_directory($a, $b) + 0;
957
                          my($sb) = ($b =~ /\//);
-
 
958
                          if ($sa && !$sb) {
-
 
959
                            return 1;
-
 
960
                          }
-
 
961
                          elsif ($sb && !$sa) {
-
 
962
                            return -1;
-
 
963
                          }
-
 
964
                          return $a cmp $b;
-
 
965
                        } @{$origproj};
964
                        } @{$origproj};
966
  my(%projinfo)  = %{$originfo};
965
  my(%projinfo)  = %{$originfo};
967
 
966
 
968
  foreach my $prj (@projects) {
967
  foreach my $prj (@projects) {
969
    my($top, $rest) = $self->topname($prj);
968
    my($top, $rest) = $self->topname($prj);
Line 1107... Line 1106...
1107
 
1106
 
1108
          ## If any one project file fails, then stop
1107
          ## If any one project file fails, then stop
1109
          ## processing altogether.
1108
          ## processing altogether.
1110
          if (!$status) {
1109
          if (!$status) {
1111
            ## We don't restore the state before we leave,
1110
            ## We don't restore the state before we leave,
1112
            ## but that's ok since we will be exiting soon.
1111
            ## but that's ok since we will be exiting right now.
1113
            return $status, $creator;
1112
            return $status, $creator,
-
 
1113
                   "Unable to process " . ($file eq '' ? " in $dir" : $file);
1114
          }
1114
          }
1115
 
1115
 
1116
          ## Get the individual project information and
1116
          ## Get the individual project information and
1117
          ## generated file name(s)
1117
          ## generated file name(s)
1118
          $files_written = $creator->get_files_written();
1118
          $files_written = $creator->get_files_written();
Line 1132... Line 1132...
1132
      }
1132
      }
1133
      else {
1133
      else {
1134
        ## Unable to change to the directory.
1134
        ## Unable to change to the directory.
1135
        ## We don't restore the state before we leave,
1135
        ## We don't restore the state before we leave,
1136
        ## but that's ok since we will be exiting soon.
1136
        ## but that's ok since we will be exiting soon.
1137
        return 0, $creator;
1137
        return 0, $creator, "Unable to change directory to $dir";
1138
      }
1138
      }
1139
 
1139
 
1140
      ## Return things to the way they were
1140
      ## Return things to the way they were
1141
      if (defined $self->{'scoped_assign'}->{$ofile}) {
1141
      if (defined $self->{'scoped_assign'}->{$ofile}) {
1142
        $impl = $previmpl;
1142
        $impl = $previmpl;
Line 1483... Line 1483...
1483
      }
1483
      }
1484
      $self->warning('Circular dependency detected while processing the ' .
1484
      $self->warning('Circular dependency detected while processing the ' .
1485
                     ($self->{'current_input'} eq '' ?
1485
                     ($self->{'current_input'} eq '' ?
1486
                       'default' : $self->{'current_input'}) .
1486
                       'default' : $self->{'current_input'}) .
1487
                     ' workspace. ' .
1487
                     ' workspace. ' .
1488
                     'The following directories are involved: ' .
1488
                     'The following directories or projects are involved: ' .
1489
                     join(' and ', @dirs));
1489
                     join(' and ', @dirs));
1490
      return;
1490
      return;
1491
    }
1491
    }
1492
 
1492
 
1493
    ## Build up the group dependencies
1493
    ## Build up the group dependencies
Line 1558... Line 1558...
1558
 
1558
 
1559
 
1559
 
1560
sub sort_dependencies {
1560
sub sort_dependencies {
1561
  my($self)     = shift;
1561
  my($self)     = shift;
1562
  my($projects) = shift;
1562
  my($projects) = shift;
-
 
1563
  my(@list)     = sort { return $self->sort_projects_by_directory($a, $b) + 0;
1563
  my(@list)     = sort @$projects;
1564
                       } @$projects;
1564
 
1565
 
1565
  ## Put the projects in the order specified
1566
  ## Put the projects in the order specified
1566
  ## by the project dpendencies.  We only need to do
1567
  ## by the project dpendencies.  We only need to do
1567
  ## this if there is more than one element in the array.
1568
  ## this if there is more than one element in the array.
1568
  if ($#list > 0) {
1569
  if ($#list > 0) {
Line 1577... Line 1578...
1577
      elsif ($previous->[1] ne $dir) {
1578
      elsif ($previous->[1] ne $dir) {
1578
        push(@grindex, [$previous->[0], $li - 1]);
1579
        push(@grindex, [$previous->[0], $li - 1]);
1579
        $previous = [$li, $dir];
1580
        $previous = [$li, $dir];
1580
      }
1581
      }
1581
    }
1582
    }
1582
     push(@grindex, [$previous->[0], $#list]);
1583
    push(@grindex, [$previous->[0], $#list]);
1583
 
1584
 
1584
    ## Next, sort the individual groups
1585
    ## Next, sort the individual groups
1585
    foreach my $gr (@grindex) {
1586
    foreach my $gr (@grindex) {
1586
      if ($$gr[0] != $$gr[1]) {
1587
      if ($$gr[0] != $$gr[1]) {
1587
        $self->sort_within_group(\@list, @$gr);
1588
        $self->sort_within_group(\@list, @$gr);
Line 1641... Line 1642...
1641
  return @list;
1642
  return @list;
1642
}
1643
}
1643
 
1644
 
1644
 
1645
 
1645
sub project_target_translation {
1646
sub project_target_translation {
1646
  my($self)  = shift;
1647
  my($self) = shift;
1647
  my($cased) = shift;
1648
  my($case) = shift;
1648
  my(%map)   = ();
1649
  my(%map)  = ();
1649
 
1650
 
1650
  ## Translate project names to avoid target collision with
1651
  ## Translate project names to avoid target collision with
1651
  ## some versions of make.
1652
  ## some versions of make.
1652
  foreach my $key (keys %{$self->{'project_info'}}) {
1653
  foreach my $key (keys %{$self->{'project_info'}}) {
1653
    my($dir)  = $self->mpc_dirname($key);
1654
    my($dir)  = $self->mpc_dirname($key);
1654
    my($name) = $self->{'project_info'}->{$key}->[0];
1655
    my($name) = $self->{'project_info'}->{$key}->[0];
1655
 
1656
 
-
 
1657
    ## We want to compare to the upper most directory.  This will be the
-
 
1658
    ## one that may conflict with the project name.
-
 
1659
    $dir =~ s/[\/\\].*//;
1656
    if (($cased && $dir eq $name) || (!$cased && lc($dir) eq lc($name))) {
1660
    if (($case && $dir eq $name) || (!$case && lc($dir) eq lc($name))) {
1657
      $map{$key} = "$name-target";
1661
      $map{$key} = "$name-target";
1658
    }
1662
    }
1659
    else {
1663
    else {
1660
      $map{$key} = $name;
1664
      $map{$key} = $name;
1661
    }
1665
    }
Line 1949... Line 1953...
1949
  my($cwd)          = $self->getcwd();
1953
  my($cwd)          = $self->getcwd();
1950
  $self->{'project_file_list'}->{$project_name} = [ $project_file,
1954
  $self->{'project_file_list'}->{$project_name} = [ $project_file,
1951
                                                    $cwd, \@files ];
1955
                                                    $cwd, \@files ];
1952
}
1956
}
1953
 
1957
 
-
 
1958
 
-
 
1959
sub sort_projects_by_directory {
-
 
1960
  my($self)  = shift;
-
 
1961
  my($left)  = shift;
-
 
1962
  my($right) = shift;
-
 
1963
  my($sa)    = ($left =~ /\//);
-
 
1964
  my($sb)    = ($right =~ /\//);
-
 
1965
 
-
 
1966
  if ($sa && !$sb) {
-
 
1967
    return 1;
-
 
1968
  }
-
 
1969
  elsif ($sb && !$sa) {
-
 
1970
    return -1;
-
 
1971
  }
-
 
1972
  return $left cmp $right;
-
 
1973
}
-
 
1974
 
1954
# ************************************************************
1975
# ************************************************************
1955
# Virtual Methods To Be Overridden
1976
# Virtual Methods To Be Overridden
1956
# ************************************************************
1977
# ************************************************************
1957
 
1978
 
1958
sub supports_make_coexistence {
1979
sub supports_make_coexistence {