def processModule()

in src/org/jetbrains/jps/builders/StandardBuilders.groovy [146:191]


  def processModule(ModuleBuildState state, ModuleChunk moduleChunk, ProjectBuilder projectBuilder) {
    if (!resourcePatternInitialized) {
      CompilerConfiguration configuration = projectBuilder.project.compilerConfiguration
      projectBuilder.binding.ant.patternset(id: "compiler.resources") {
        configuration.resourceIncludePatterns.each { include(name: it)}
        configuration.resourceExcludePatterns.each { exclude(name: it)}
      }
      resourcePatternInitialized = true
    }

    if (state.iterated) return;

    state.iterated = true

    if (state.sourceRoots.isEmpty()) return;

    def ant = projectBuilder.binding.ant

    state.sourceRoots.each {String root ->
      if (new File(root).exists()) {
        def target = state.targetFolder
        def prefix = moduleChunk.modules.collect { it.sourceRootPrefixes[root] }.find {it != null}
        if (prefix != null) {
          if (!(target.endsWith("/") || target.endsWith("\\"))) {
            target += "/"
          }
          target += prefix
        }

        ant.copy(todir: target) {
          fileset(dir: root) {
            patternset(refid: "compiler.resources")
            type(type: "file")
            state.excludes.each { String excludedRoot ->
              if (excludedRoot.startsWith("${root}/")) {
                exclude(name: "${excludedRoot.substring(root.length() + 1)}/**")
              }
            }
          }
        }
      }
      else {
        projectBuilder.warning("$root doesn't exist")
      }
    }
  }