system/src/sc/layer/BuildInfo.java
void cleanStaleEntries(HashSet<String> changedTypes, Set<String> processedModels, boolean removeEntries) {
      if (modelJarFiles != null) {
         for (int i = 0; i < modelJarFiles.size(); i++) {
            ModelJar mj = modelJarFiles.get(i);
            if (mj == null || (changedTypes.contains(mj.typeName) && !processedModels.contains(mj.typeName))) {
               modelJarFiles.remove(i);
               i--;
            }
         }
      }
      if (mainMethods != null) {
         for (int i = 0; i < mainMethods.size(); i++) {
            MainMethod mm = mainMethods.get(i);
            if (changedTypes.contains(mm.typeName) && !processedModels.contains(mm.typeName)) {
               mainMethods.remove(i);
               i--;
            }
         }
      }
      if (testInstances != null) {
         for (int i = 0; i < testInstances.size(); i++) {
            TestInstance ti = testInstances.get(i);
            if (changedTypes.contains(ti.typeName) && !processedModels.contains(ti.typeName)) {
               testInstances.remove(i);
               i--;
            }
         }
      }
      if (typeGroupMembers != null) {
         for (Iterator<TypeGroupMember> it = typeGroupMembers.iterator(); it.hasNext(); ) {
            TypeGroupMember ti = it.next();
            // Wait till the buildLayer till we remove entries.  We can't find types in layers which have not
            // been started and once they are removed when building a base layer we don't get them back again.
            if (removeEntries && !system.hasAnyTypeDeclaration(ti.typeName)) {
               it.remove();
               changed = true;
            }
            if (changedTypes.contains(ti.typeName) && !processedModels.contains(ti.typeName)) {
               // We call this multiple times on the same build info when building successive layers.  Some of these
               // guys may have already changed on this build and won't be processed in the next set of files 
               if (!ti.changed) {
                  it.remove();
                  changed = true;
               }
            }
         }
      }
      /*
       * If we have mappings of external types, to do incremental builds we go and remove any bindings or dynamic
       * dependencies for changed models.  They'll get added back again if they are still required.
       *
       * Only do this for the buildLayer though, since the classpath etc. won't be set up until then.
       */
      if (extDynTypes != null && removeEntries) {
         for (ExternalDynType edt:extDynTypes) {
            if (edt.reverseDeps != null) {
               // Remove any type references from types which are in the changedTypes set but did not get added to the
               // registry since being restored.
               edt.reverseDeps.cleanStaleEntries(changedTypes);
               if (edt.reverseDeps.hasChanged() || externalTypeClassStale(edt.className)) {
                  ReverseDependencies.saveReverseDeps(edt.reverseDeps, FileUtil.addExtension(getExternalDynTypeFileName(edt.className), ReverseDependencies.REVERSE_DEPENDENCIES_EXTENSION));
                  if (toCompile == null)
                     toCompile = new ArrayList<SrcEntry>();
                  toCompile.add(generateExternalType(edt.className, edt.reverseDeps));
               }
            }
         }
      }
   }
/**
    * For incremental builds, we keep track of the set of changed models.  For global data structures
    * like modelJarFiles, mainMethods, etc. here we go through and remove the entry for any changed models.
    * The model should add it back again during the process phase.  This gets run after the validate phase.
    * We also must track the set of models that have already been processed in a previous build layer.  If the model
    * is changed but also processed, we can't remove it because we won't be adding it back in again.
    */
For incremental builds, we keep track of the set of changed models.  For global data structures
like modelJarFiles, mainMethods, etc. here we go through and remove the entry for any changed models.
The model should add it back again during the process phase.  This gets run after the validate phase.
We also must track the set of models that have already been processed in a previous build layer.  If the model
is changed but also processed, we can't remove it because we won't be adding it back in again.
For incremental builds we keep track of the set of changed models . For global data structures like modelJarFiles mainMethods etc . here we go through and remove the entry for any changed models . The model should add it back again during the process phase . This gets run after the validate phase . We also must track the set of models that have already been processed in a previous build layer . If the model is changed but also processed we can ' t remove it because we won ' t be adding it back in again .
void cleanStaleEntries(HashSet<String> changedTypes, Set<String> processedModels, boolean removeEntries) {
      if (modelJarFiles != null) {
         for (int i = 0; i < modelJarFiles.size(); i++) {
            ModelJar mj = modelJarFiles.get(i);
            if (mj == null || (changedTypes.contains(mj.typeName) && !processedModels.contains(mj.typeName))) {
               modelJarFiles.remove(i);
               i--;
            }
         }
      }
      if (mainMethods != null) {
         for (int i = 0; i < mainMethods.size(); i++) {
            MainMethod mm = mainMethods.get(i);
            if (changedTypes.contains(mm.typeName) && !processedModels.contains(mm.typeName)) {
               mainMethods.remove(i);
               i--;
            }
         }
      }
      if (testInstances != null) {
         for (int i = 0; i < testInstances.size(); i++) {
            TestInstance ti = testInstances.get(i);
            if (changedTypes.contains(ti.typeName) && !processedModels.contains(ti.typeName)) {
               testInstances.remove(i);
               i--;
            }
         }
      }
      if (typeGroupMembers != null) {
         for (Iterator<TypeGroupMember> it = typeGroupMembers.iterator(); it.hasNext(); ) {
            TypeGroupMember ti = it.next();
            if (removeEntries && !system.hasAnyTypeDeclaration(ti.typeName)) {
               it.remove();
               changed = true;
            }
            if (changedTypes.contains(ti.typeName) && !processedModels.contains(ti.typeName)) {
               if (!ti.changed) {
                  it.remove();
                  changed = true;
               }
            }
         }
      }
      /*
       * If we have mappings of external types, to do incremental builds we go and remove any bindings or dynamic
       * dependencies for changed models.  They'll get added back again if they are still required.
       *
       * Only do this for the buildLayer though, since the classpath etc. won't be set up until then.
       */
      if (extDynTypes != null && removeEntries) {
         for (ExternalDynType edt:extDynTypes) {
            if (edt.reverseDeps != null) {
               edt.reverseDeps.cleanStaleEntries(changedTypes);
               if (edt.reverseDeps.hasChanged() || externalTypeClassStale(edt.className)) {
                  ReverseDependencies.saveReverseDeps(edt.reverseDeps, FileUtil.addExtension(getExternalDynTypeFileName(edt.className), ReverseDependencies.REVERSE_DEPENDENCIES_EXTENSION));
                  if (toCompile == null)
                     toCompile = new ArrayList<SrcEntry>();
                  toCompile.add(generateExternalType(edt.className, edt.reverseDeps));
               }
            }
         }
      }
   }
void cleanStaleEntries ( HashSet < String > changedTypes , Set < String > processedModels , boolean removeEntries ) { if ( modelJarFiles != null ) { for ( int i = 0 ; i < modelJarFiles . size ( ) ; i ++ ) { ModelJar mj = modelJarFiles . get ( i ) ; if ( mj == null || ( changedTypes . contains ( mj . typeName ) && ! processedModels . contains ( mj . typeName ) ) ) { modelJarFiles . remove ( i ) ; i -- ; } } } if ( mainMethods != null ) { for ( int i = 0 ; i < mainMethods . size ( ) ; i ++ ) { MainMethod mm = mainMethods . get ( i ) ; if ( changedTypes . contains ( mm . typeName ) && ! processedModels . contains ( mm . typeName ) ) { mainMethods . remove ( i ) ; i -- ; } } } if ( testInstances != null ) { for ( int i = 0 ; i < testInstances . size ( ) ; i ++ ) { TestInstance ti = testInstances . get ( i ) ; if ( changedTypes . contains ( ti . typeName ) && ! processedModels . contains ( ti . typeName ) ) { testInstances . remove ( i ) ; i -- ; } } } if ( typeGroupMembers != null ) { for ( Iterator < TypeGroupMember > it = typeGroupMembers . iterator ( ) ; it . hasNext ( ) ; ) { TypeGroupMember ti = it . next ( ) ; if ( removeEntries && ! system . hasAnyTypeDeclaration ( ti . typeName ) ) { it . remove ( ) ; changed = true ; } if ( changedTypes . contains ( ti . typeName ) && ! processedModels . contains ( ti . typeName ) ) { if ( ! ti . changed ) { it . remove ( ) ; changed = true ; } } } } /*
       * If we have mappings of external types, to do incremental builds we go and remove any bindings or dynamic
       * dependencies for changed models.  They'll get added back again if they are still required.
       *
       * Only do this for the buildLayer though, since the classpath etc. won't be set up until then.
       */ if ( extDynTypes != null && removeEntries ) { for ( ExternalDynType edt : extDynTypes ) { if ( edt . reverseDeps != null ) { edt . reverseDeps . cleanStaleEntries ( changedTypes ) ; if ( edt . reverseDeps . hasChanged ( ) || externalTypeClassStale ( edt . className ) ) { ReverseDependencies . saveReverseDeps ( edt . reverseDeps , FileUtil . addExtension ( getExternalDynTypeFileName ( edt . className ) , ReverseDependencies . REVERSE_DEPENDENCIES_EXTENSION ) ) ; if ( toCompile == null ) toCompile = new ArrayList < SrcEntry > ( ) ; toCompile . add ( generateExternalType ( edt . className , edt . reverseDeps ) ) ; } } } } }
For incremental builds, we keep track of the set of changed models.
For incremental builds we keep track of the set of changed models .
// Wait till the buildLayer till we remove entries.  We can't find types in layers which have not // been started and once they are removed when building a base layer we don't get them back again. // We call this multiple times on the same build info when building successive layers.  Some of these // guys may have already changed on this build and won't be processed in the next set of files  // Remove any type references from types which are in the changedTypes set but did not get added to the // registry since being restored.