system/src/sc/layer/LayeredSystem.java
public boolean buildSystem(List<String> includeFiles, boolean newLayersOnly, boolean separateLayersOnly) {
      setCurrent(this);

      if (buildStartTime == -1) {
         // Reset the time just before we make a pass through all of the layers so we pick up any subsequent changes
         lastRefreshTime = System.currentTimeMillis();
         buildStartTime = lastRefreshTime;
      }
      // Reset this before the build because we will refresh all files.  Any changes after this time, should trigger a refresh.
      if (lastChangedModelTime == -1)
         lastChangedModelTime = buildStartTime;

      try {
         buildingSystem = true;
         if (buildLayer == null) {
            if (options.verbose)
               System.out.println("No compiled layers");
         }
         else {
            if (!buildLayersIfNecessary(layers.size(), includeFiles, newLayersOnly, separateLayersOnly))
               return false;

            if (anyErrors)
               return false;

            if (getCurrent() != this)
               System.out.println("*** Error mismatching layered systems");

            GenerateCodeStatus stat;
            boolean firstCompile = !buildLayer.compiled;
            if (generateAndCompileLayer(buildLayer, includeFiles, newLayersOnly, separateLayersOnly) != GenerateCodeStatus.Error) {
               if (!separateLayersOnly || buildLayer.buildSeparate) {
                  if (firstCompile) {
                     /* Once we are done generating and compiling, add the buildDir to the class path */
                     initSysClassLoader(buildLayer, ClassLoaderMode.BUILD);
                  }

                  /*
                  * This is necessary both to free up resources and also because the transformed models no longer
                  * obey all of the StrataCode contracts.  For example, we transform bindings to method calls and can't detect
                  * cycles on the transformed model.  We do lose the ability to cache models across the compile to
                  * runtime phases which is a loss... maybe the transformed models should try to preserve all of the
                  * behavior of the original?  It would just require cloning some nodes at key spots such as the
                  * data binding initializer and likely other places.
                  *
                  * Must be done after we have set the sys class loader because of the refreshBoundType process.  That
                  * requires replacing transformed models with their runtime types.
                  */
                  flushTypeCache();

                  /* And init the build dir index */
                  initBuildDirIndex();

                  // These object references also need to get reloaded into the new class loader scheme
                  buildInfo.reload();

                  if (options.info && !options.testVerifyMode)
                     System.out.println("Build of the " + getRuntimeName() + " runtime completed in: " + StringUtil.formatFloat((System.currentTimeMillis() - buildStartTime)/1000.0));
                  if (options.verbose && Parser.ENABLE_STATS) {
                     System.out.println("Parser stats: tested: " + Parser.testedNodes + " matched: " + Parser.matchedNodes);
                     System.out.println("Generated: " + GenerateContext.generateCount + " false starts: " + GenerateContext.generateError);
                     System.out.println("Num classes cached: " + PTypeUtil.numClassesCached + " numFields: " + PTypeUtil.numFieldsCached + " numMethods: " + PTypeUtil.numMethodsCached + " numInterfacesPropsCached: " + PTypeUtil.numInterfacePropsCached + " numPropsInherited: " + PTypeUtil.numPropsInherited);
                  }

                  buildStartTime = -1;
               }
            }
            else {
               if (options.verbose) {
                  // Dump errors again because otherwise they are mixed into the verbose messages and harder to find
                  if (viewedErrors.size() > 0) {
                     System.err.println("Summary of errors compiling " + getRuntimeName() + " runtime");
                     System.err.println(LayerUtil.errorsToString(viewedErrors));
                  }
                  if (peerSystems != null) {
                     for (LayeredSystem peer:peerSystems) {
                        boolean anyForPeer = false;
                        for (String peerError:peer.viewedErrors) {
                           if (!viewedErrors.contains(peerError)) {
                              if (!anyForPeer) {
                                 System.err.println(peer.getRuntimeName() + " runtime errors: ");
                                 anyForPeer = true;
                              }
                              System.err.println(peerError);
                           }
                        }
                     }
                  }

                  System.err.println("Failed build took: " + StringUtil.formatFloat((System.currentTimeMillis() - buildStartTime)/1000.0));
               }
               return false;
            }
         }

      }
      finally {
         if (!separateLayersOnly)
            buildingSystem = false;
      }

      for (int i = 0; i < layers.size(); i++)
         if (layers.get(i).buildSrcIndexNeedsSave)
            System.out.println("*** Exiting build with unsaved buildSrcIndexes");

      return true;
   }
/**
    * Builds the system.  The newLayersOnly option looks for changed files only.  separateLayersOnly will only build layers with the buildSeparate=true option.  That mode is typically run first - to build all
    * separate layers, so their compiled results can be used for building the normal layers.
    * You can specify the list of includeFiles to build a subset of files if you know exactly what needs to be processed and transformed but that mode is really only used for testing purposes and may not
    * generate an accurate build.
    */
Builds the system.  The newLayersOnly option looks for changed files only.  separateLayersOnly will only build layers with the buildSeparate=true option.  That mode is typically run first - to build all
separate layers, so their compiled results can be used for building the normal layers.
You can specify the list of includeFiles to build a subset of files if you know exactly what needs to be processed and transformed but that mode is really only used for testing purposes and may not
generate an accurate build.
Builds the system . The newLayersOnly option looks for changed files only . separateLayersOnly will only build layers with the buildSeparate = true option . That mode is typically run first - to build all separate layers so their compiled results can be used for building the normal layers . You can specify the list of includeFiles to build a subset of files if you know exactly what needs to be processed and transformed but that mode is really only used for testing purposes and may not generate an accurate build .
public boolean buildSystem(List<String> includeFiles, boolean newLayersOnly, boolean separateLayersOnly) {
      setCurrent(this);
      if (buildStartTime == -1) {
         lastRefreshTime = System.currentTimeMillis();
         buildStartTime = lastRefreshTime;
      }
      if (lastChangedModelTime == -1)
         lastChangedModelTime = buildStartTime;
      try {
         buildingSystem = true;
         if (buildLayer == null) {
            if (options.verbose)
               System.out.println("No compiled layers");
         }
         else {
            if (!buildLayersIfNecessary(layers.size(), includeFiles, newLayersOnly, separateLayersOnly))
               return false;
            if (anyErrors)
               return false;
            if (getCurrent() != this)
               System.out.println("*** Error mismatching layered systems");
            GenerateCodeStatus stat;
            boolean firstCompile = !buildLayer.compiled;
            if (generateAndCompileLayer(buildLayer, includeFiles, newLayersOnly, separateLayersOnly) != GenerateCodeStatus.Error) {
               if (!separateLayersOnly || buildLayer.buildSeparate) {
                  if (firstCompile) {
                     /* Once we are done generating and compiling, add the buildDir to the class path */
                     initSysClassLoader(buildLayer, ClassLoaderMode.BUILD);
                  }
                  /*
                  * This is necessary both to free up resources and also because the transformed models no longer
                  * obey all of the StrataCode contracts.  For example, we transform bindings to method calls and can't detect
                  * cycles on the transformed model.  We do lose the ability to cache models across the compile to
                  * runtime phases which is a loss... maybe the transformed models should try to preserve all of the
                  * behavior of the original?  It would just require cloning some nodes at key spots such as the
                  * data binding initializer and likely other places.
                  *
                  * Must be done after we have set the sys class loader because of the refreshBoundType process.  That
                  * requires replacing transformed models with their runtime types.
                  */
                  flushTypeCache();
                  /* And init the build dir index */
                  initBuildDirIndex();
                  buildInfo.reload();
                  if (options.info && !options.testVerifyMode)
                     System.out.println("Build of the " + getRuntimeName() + " runtime completed in: " + StringUtil.formatFloat((System.currentTimeMillis() - buildStartTime)/1000.0));
                  if (options.verbose && Parser.ENABLE_STATS) {
                     System.out.println("Parser stats: tested: " + Parser.testedNodes + " matched: " + Parser.matchedNodes);
                     System.out.println("Generated: " + GenerateContext.generateCount + " false starts: " + GenerateContext.generateError);
                     System.out.println("Num classes cached: " + PTypeUtil.numClassesCached + " numFields: " + PTypeUtil.numFieldsCached + " numMethods: " + PTypeUtil.numMethodsCached + " numInterfacesPropsCached: " + PTypeUtil.numInterfacePropsCached + " numPropsInherited: " + PTypeUtil.numPropsInherited);
                  }
                  buildStartTime = -1;
               }
            }
            else {
               if (options.verbose) {
                  if (viewedErrors.size() > 0) {
                     System.err.println("Summary of errors compiling " + getRuntimeName() + " runtime");
                     System.err.println(LayerUtil.errorsToString(viewedErrors));
                  }
                  if (peerSystems != null) {
                     for (LayeredSystem peer:peerSystems) {
                        boolean anyForPeer = false;
                        for (String peerError:peer.viewedErrors) {
                           if (!viewedErrors.contains(peerError)) {
                              if (!anyForPeer) {
                                 System.err.println(peer.getRuntimeName() + " runtime errors: ");
                                 anyForPeer = true;
                              }
                              System.err.println(peerError);
                           }
                        }
                     }
                  }
                  System.err.println("Failed build took: " + StringUtil.formatFloat((System.currentTimeMillis() - buildStartTime)/1000.0));
               }
               return false;
            }
         }
      }
      finally {
         if (!separateLayersOnly)
            buildingSystem = false;
      }
      for (int i = 0; i < layers.size(); i++)
         if (layers.get(i).buildSrcIndexNeedsSave)
            System.out.println("*** Exiting build with unsaved buildSrcIndexes");
      return true;
   }
public boolean buildSystem ( List < String > includeFiles , boolean newLayersOnly , boolean separateLayersOnly ) { setCurrent ( this ) ; if ( buildStartTime == - 1 ) { lastRefreshTime = System . currentTimeMillis ( ) ; buildStartTime = lastRefreshTime ; } if ( lastChangedModelTime == - 1 ) lastChangedModelTime = buildStartTime ; try { buildingSystem = true ; if ( buildLayer == null ) { if ( options . verbose ) System . out . println ( "No compiled layers" ) ; } else { if ( ! buildLayersIfNecessary ( layers . size ( ) , includeFiles , newLayersOnly , separateLayersOnly ) ) return false ; if ( anyErrors ) return false ; if ( getCurrent ( ) != this ) System . out . println ( "*** Error mismatching layered systems" ) ; GenerateCodeStatus stat ; boolean firstCompile = ! buildLayer . compiled ; if ( generateAndCompileLayer ( buildLayer , includeFiles , newLayersOnly , separateLayersOnly ) != GenerateCodeStatus . Error ) { if ( ! separateLayersOnly || buildLayer . buildSeparate ) { if ( firstCompile ) { /* Once we are done generating and compiling, add the buildDir to the class path */ initSysClassLoader ( buildLayer , ClassLoaderMode . BUILD ) ; } /*
                  * This is necessary both to free up resources and also because the transformed models no longer
                  * obey all of the StrataCode contracts.  For example, we transform bindings to method calls and can't detect
                  * cycles on the transformed model.  We do lose the ability to cache models across the compile to
                  * runtime phases which is a loss... maybe the transformed models should try to preserve all of the
                  * behavior of the original?  It would just require cloning some nodes at key spots such as the
                  * data binding initializer and likely other places.
                  *
                  * Must be done after we have set the sys class loader because of the refreshBoundType process.  That
                  * requires replacing transformed models with their runtime types.
                  */ flushTypeCache ( ) ; /* And init the build dir index */ initBuildDirIndex ( ) ; buildInfo . reload ( ) ; if ( options . info && ! options . testVerifyMode ) System . out . println ( "Build of the " + getRuntimeName ( ) + " runtime completed in: " + StringUtil . formatFloat ( ( System . currentTimeMillis ( ) - buildStartTime ) / 1000.0 ) ) ; if ( options . verbose && Parser . ENABLE_STATS ) { System . out . println ( "Parser stats: tested: " + Parser . testedNodes + " matched: " + Parser . matchedNodes ) ; System . out . println ( "Generated: " + GenerateContext . generateCount + " false starts: " + GenerateContext . generateError ) ; System . out . println ( "Num classes cached: " + PTypeUtil . numClassesCached + " numFields: " + PTypeUtil . numFieldsCached + " numMethods: " + PTypeUtil . numMethodsCached + " numInterfacesPropsCached: " + PTypeUtil . numInterfacePropsCached + " numPropsInherited: " + PTypeUtil . numPropsInherited ) ; } buildStartTime = - 1 ; } } else { if ( options . verbose ) { if ( viewedErrors . size ( ) > 0 ) { System . err . println ( "Summary of errors compiling " + getRuntimeName ( ) + " runtime" ) ; System . err . println ( LayerUtil . errorsToString ( viewedErrors ) ) ; } if ( peerSystems != null ) { for ( LayeredSystem peer : peerSystems ) { boolean anyForPeer = false ; for ( String peerError : peer . viewedErrors ) { if ( ! viewedErrors . contains ( peerError ) ) { if ( ! anyForPeer ) { System . err . println ( peer . getRuntimeName ( ) + " runtime errors: " ) ; anyForPeer = true ; } System . err . println ( peerError ) ; } } } } System . err . println ( "Failed build took: " + StringUtil . formatFloat ( ( System . currentTimeMillis ( ) - buildStartTime ) / 1000.0 ) ) ; } return false ; } } } finally { if ( ! separateLayersOnly ) buildingSystem = false ; } for ( int i = 0 ; i < layers . size ( ) ; i ++ ) if ( layers . get ( i ) . buildSrcIndexNeedsSave ) System . out . println ( "*** Exiting build with unsaved buildSrcIndexes" ) ; return true ; }
Builds the system.
Builds the system .
// Reset the time just before we make a pass through all of the layers so we pick up any subsequent changes // Reset this before the build because we will refresh all files.  Any changes after this time, should trigger a refresh. // These object references also need to get reloaded into the new class loader scheme // Dump errors again because otherwise they are mixed into the verbose messages and harder to find