lib/qx/tool/compiler/makers/AppMaker.js
function() {
      var analyser = this.getAnalyser();
      
      // merge all environment settings for the analyser
      const compileEnv = qx.tool.compiler.utils.Values.merge({}, 
          qx.tool.compiler.ClassFile.ENVIRONMENT_CONSTANTS,
          {
            "qx.compilerVersion": qx.tool.compiler.Version.VERSION
          },
          this.getEnvironment(),
          this.getTarget().getEnvironment());
      
      // Application env settings must be removed from the global and bumped into the application's
      //  environment settings (to avoid code elimination)
      const allAppEnv = {};
      this.getApplications().forEach(app => {
        let appEnv = app.getEnvironment();
        if (appEnv) {
          for (let key in appEnv) {
            allAppEnv[key] = true;
          }
        }
      });
      this.getApplications().forEach(app => {
        let appEnv = app.getEnvironment();
        if (appEnv) {
          for (let key in allAppEnv) {
            if (compileEnv[key] !== undefined && appEnv[key] === undefined) {
              appEnv[key] = compileEnv[key];
            }
          }
        }
      });
      for (let key in allAppEnv) {
        delete compileEnv[key];
      }
      
      return this.checkCompileVersion()
        .then(() => this.writeCompileVersion())
        .then(() => {
          analyser.setEnvironment(compileEnv);

          this.getTarget().setAnalyser(analyser);
          this.__applications.forEach(app => app.setAnalyser(analyser));
          
          return this.getTarget().open();
        })
        .then(() => analyser.open())
        .then(() => {
          if (this.isOutputTypescript()) {
            analyser.getLibraries().forEach(library => {
              var symbols = library.getKnownSymbols();
              for (var name in symbols) {
                var type = symbols[name];
                if (type === "class" && name !== "q" && name !== "qxWeb") {
                  analyser.addClass(name); 
                }
              }
            });
          }
          
          this.__applications.forEach(function(app) {
            app.getRequiredClasses().forEach(function(className) {
              analyser.addClass(className);
            });
            if (app.getTheme()) {
              analyser.addClass(app.getTheme());
            }
          });
          return qx.tool.compiler.utils.Promisify.call(cb => analyser.analyseClasses(cb));
        })
        .then(() => {
          var target = this.getTarget();
          this.fireEvent("writingApplications");

          // Detect which applications need to be recompiled by looking for classes recently compiled
          //  which is on the application's dependency list.  The first time `.make()` is called there
          //  will be no dependencies so we just compile anyway, but `qx compile --watch` will call it
          //  multiple times
          let compiledClasses = this.getRecentlyCompiledClasses(true);
          var appsThisTime = this.__applications.filter(app => {
            let loadDeps = app.getDependencies();
            if (!loadDeps || !loadDeps.length)
              return true;
            return loadDeps.some(name => !!compiledClasses[name]);
          });
          
          var promises = appsThisTime.map(application => {
            var appEnv = qx.tool.compiler.utils.Values.merge({}, compileEnv, application.getEnvironment());
            application.calcDependencies();
            if (application.getFatalCompileErrors()) {
              qx.tool.compiler.Console.print("qx.tool.compiler.maker.appFatalError", application.getName());
              return undefined;
            }
            
            this.fireDataEvent("writingApplication", application);
            return target.generateApplication(application, appEnv)
              .then(() => this.fireDataEvent("writtenApplication", application));
          });
          
          return qx.Promise.all(promises)
            .then(() => {
              this.fireEvent("writtenApplications");
              if (this.isOutputTypescript()) {
                return new qx.tool.compiler.targets.TypeScriptWriter(target)
                  .set({ outputTo: this.getOutputTypescriptTo() })
                  .run();
              }
              return undefined;
            });
        })
        .then(() => analyser.saveDatabase());
    }
function() {
      var analyser = this.getAnalyser();
      
      // merge all environment settings for the analyser
      const compileEnv = qx.tool.compiler.utils.Values.merge({}, 
          qx.tool.compiler.ClassFile.ENVIRONMENT_CONSTANTS,
          {
            "qx.compilerVersion": qx.tool.compiler.Version.VERSION
          },
          this.getEnvironment(),
          this.getTarget().getEnvironment());
      
      // Application env settings must be removed from the global and bumped into the application's
      //  environment settings (to avoid code elimination)
      const allAppEnv = {};
      this.getApplications().forEach(app => {
        let appEnv = app.getEnvironment();
        if (appEnv) {
          for (let key in appEnv) {
            allAppEnv[key] = true;
          }
        }
      });
      this.getApplications().forEach(app => {
        let appEnv = app.getEnvironment();
        if (appEnv) {
          for (let key in allAppEnv) {
            if (compileEnv[key] !== undefined && appEnv[key] === undefined) {
              appEnv[key] = compileEnv[key];
            }
          }
        }
      });
      for (let key in allAppEnv) {
        delete compileEnv[key];
      }
      
      return this.checkCompileVersion()
        .then(() => this.writeCompileVersion())
        .then(() => {
          analyser.setEnvironment(compileEnv);

          this.getTarget().setAnalyser(analyser);
          this.__applications.forEach(app => app.setAnalyser(analyser));
          
          return this.getTarget().open();
        })
        .then(() => analyser.open())
        .then(() => {
          if (this.isOutputTypescript()) {
            analyser.getLibraries().forEach(library => {
              var symbols = library.getKnownSymbols();
              for (var name in symbols) {
                var type = symbols[name];
                if (type === "class" && name !== "q" && name !== "qxWeb") {
                  analyser.addClass(name); 
                }
              }
            });
          }
          
          this.__applications.forEach(function(app) {
            app.getRequiredClasses().forEach(function(className) {
              analyser.addClass(className);
            });
            if (app.getTheme()) {
              analyser.addClass(app.getTheme());
            }
          });
          return qx.tool.compiler.utils.Promisify.call(cb => analyser.analyseClasses(cb));
        })
        .then(() => {
          var target = this.getTarget();
          this.fireEvent("writingApplications");

          // Detect which applications need to be recompiled by looking for classes recently compiled
          //  which is on the application's dependency list.  The first time `.make()` is called there
          //  will be no dependencies so we just compile anyway, but `qx compile --watch` will call it
          //  multiple times
          let compiledClasses = this.getRecentlyCompiledClasses(true);
          var appsThisTime = this.__applications.filter(app => {
            let loadDeps = app.getDependencies();
            if (!loadDeps || !loadDeps.length)
              return true;
            return loadDeps.some(name => !!compiledClasses[name]);
          });
          
          var promises = appsThisTime.map(application => {
            var appEnv = qx.tool.compiler.utils.Values.merge({}, compileEnv, application.getEnvironment());
            application.calcDependencies();
            if (application.getFatalCompileErrors()) {
              qx.tool.compiler.Console.print("qx.tool.compiler.maker.appFatalError", application.getName());
              return undefined;
            }
            
            this.fireDataEvent("writingApplication", application);
            return target.generateApplication(application, appEnv)
              .then(() => this.fireDataEvent("writtenApplication", application));
          });
          
          return qx.Promise.all(promises)
            .then(() => {
              this.fireEvent("writtenApplications");
              if (this.isOutputTypescript()) {
                return new qx.tool.compiler.targets.TypeScriptWriter(target)
                  .set({ outputTo: this.getOutputTypescriptTo() })
                  .run();
              }
              return undefined;
            });
        })
        .then(() => analyser.saveDatabase());
    }
function ( ) { var analyser = this . getAnalyser ( ) ; // merge all environment settings for the analyser const compileEnv = qx . tool . compiler . utils . Values . merge ( { } , qx . tool . compiler . ClassFile . ENVIRONMENT_CONSTANTS , { "qx.compilerVersion" : qx . tool . compiler . Version . VERSION } , this . getEnvironment ( ) , this . getTarget ( ) . getEnvironment ( ) ) ; // Application env settings must be removed from the global and bumped into the application's //  environment settings (to avoid code elimination) const allAppEnv = { } ; this . getApplications ( ) . forEach ( app => { let appEnv = app . getEnvironment ( ) ; if ( appEnv ) { for ( let key in appEnv ) { allAppEnv [ key ] = true ; } } } ) ; this . getApplications ( ) . forEach ( app => { let appEnv = app . getEnvironment ( ) ; if ( appEnv ) { for ( let key in allAppEnv ) { if ( compileEnv [ key ] !== undefined && appEnv [ key ] === undefined ) { appEnv [ key ] = compileEnv [ key ] ; } } } } ) ; for ( let key in allAppEnv ) { delete compileEnv [ key ] ; } return this . checkCompileVersion ( ) . then ( ( ) => this . writeCompileVersion ( ) ) . then ( ( ) => { analyser . setEnvironment ( compileEnv ) ; this . getTarget ( ) . setAnalyser ( analyser ) ; this . __applications . forEach ( app => app . setAnalyser ( analyser ) ) ; return this . getTarget ( ) . open ( ) ; } ) . then ( ( ) => analyser . open ( ) ) . then ( ( ) => { if ( this . isOutputTypescript ( ) ) { analyser . getLibraries ( ) . forEach ( library => { var symbols = library . getKnownSymbols ( ) ; for ( var name in symbols ) { var type = symbols [ name ] ; if ( type === "class" && name !== "q" && name !== "qxWeb" ) { analyser . addClass ( name ) ; } } } ) ; } this . __applications . forEach ( function ( app ) { app . getRequiredClasses ( ) . forEach ( function ( className ) { analyser . addClass ( className ) ; } ) ; if ( app . getTheme ( ) ) { analyser . addClass ( app . getTheme ( ) ) ; } } ) ; return qx . tool . compiler . utils . Promisify . call ( cb => analyser . analyseClasses ( cb ) ) ; } ) . then ( ( ) => { var target = this . getTarget ( ) ; this . fireEvent ( "writingApplications" ) ; // Detect which applications need to be recompiled by looking for classes recently compiled //  which is on the application's dependency list.  The first time `.make()` is called there //  will be no dependencies so we just compile anyway, but `qx compile --watch` will call it //  multiple times let compiledClasses = this . getRecentlyCompiledClasses ( true ) ; var appsThisTime = this . __applications . filter ( app => { let loadDeps = app . getDependencies ( ) ; if ( ! loadDeps || ! loadDeps . length ) return true ; return loadDeps . some ( name => ! ! compiledClasses [ name ] ) ; } ) ; var promises = appsThisTime . map ( application => { var appEnv = qx . tool . compiler . utils . Values . merge ( { } , compileEnv , application . getEnvironment ( ) ) ; application . calcDependencies ( ) ; if ( application . getFatalCompileErrors ( ) ) { qx . tool . compiler . Console . print ( "qx.tool.compiler.maker.appFatalError" , application . getName ( ) ) ; return undefined ; } this . fireDataEvent ( "writingApplication" , application ) ; return target . generateApplication ( application , appEnv ) . then ( ( ) => this . fireDataEvent ( "writtenApplication" , application ) ) ; } ) ; return qx . Promise . all ( promises ) . then ( ( ) => { this . fireEvent ( "writtenApplications" ) ; if ( this . isOutputTypescript ( ) ) { return new qx . tool . compiler . targets . TypeScriptWriter ( target ) . set ( { outputTo : this . getOutputTypescriptTo ( ) } ) . run ( ) ; } return undefined ; } ) ; } ) . then ( ( ) => analyser . saveDatabase ( ) ) ; }
/*
@Override
/ *