def compileGwtFacet()

in plugins/gwt/src/org/jetbrains/jps/gwt/GwtModuleBuilder.groovy [34:82]


  def compileGwtFacet(GwtFacet facet, ProjectBuilder projectBuilder, ModuleBuildState state) {
    if (!isIncludedInArtifact(facet, projectBuilder.project)) {
      projectBuilder.info("GWT Facet in module '${facet.module.name}' isn't included in artifacts so GWT compiler won't be called")
      return
    }

    if (facet.tempOutputDir != null) return

    if (!new File(facet.sdkPath).exists()) {
      projectBuilder.error("GWT SDK directory $facet.sdkPath not found")
    }

    List<String> gwtModules = GwtModulesSearcher.findGwtModules(facet.module.sourceRoots)
    if (gwtModules.isEmpty()) {
      projectBuilder.info("No GWT modules found in GWT facet in ${facet.module} module")
      return
    }

    String outputDir = projectBuilder.getTempDirectoryPath("GWT_Output_$facet.module.name")
    facet.tempOutputDir = outputDir

    def ant = projectBuilder.binding.ant
    BuildUtil.deleteDir(projectBuilder, outputDir)
    ant.mkdir(dir: outputDir)

    gwtModules.each {String moduleName ->
      projectBuilder.stage("Compiling GWT Module")
      ant.java(fork: "true", classname: "com.google.gwt.dev.Compiler", failonerror: "true") {
        jvmarg(line: "-Xmx${facet.compilerMaxHeapSize}m")
        if (!facet.additionalCompilerParameters.isEmpty()) {
          jvmarg(line: facet.additionalCompilerParameters)
        }
        classpath {
          pathelement(location: "${facet.sdkPath}/gwt-dev.jar")
          state.sourceRootsFromModuleWithDependencies.each {
            pathelement(location: it)
          }
          state.classpath.each {
            pathelement(location: it)
          }
        }
        arg(value: "-war")
        arg(value: outputDir)
        arg(value: "-style")
        arg(value: facet.scriptOutputStyle)
        arg(value: moduleName)
      }
    }
  }