src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java

Print this page
rev 2819 : imported patch my-classpath-deps-00


  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.sjavac;
  27 
  28 import java.io.PrintStream;
  29 import java.net.URI;
  30 import java.util.Set;
  31 import java.util.Map;

  32 
  33 import com.sun.tools.sjavac.options.Options;

  34 import com.sun.tools.sjavac.server.Sjavac;
  35 
  36 /**
  37  * The transform interface is used to transform content inside a package, from one form to another.
  38  * Usually the output form is an unpredictable number of output files. (eg class files)
  39  * but can also be an unpredictable number of generated source files (eg idl2java)
  40  * or a single predictable output file (eg when copying,cleaning or compiling a properties file).
  41  *
  42  *  <p><b>This is NOT part of any supported API.
  43  *  If you write code that depends on this, you do so at your own risk.
  44  *  This code and its internal interfaces are subject to change or
  45  *  deletion without notice.</b>
  46  */
  47 public interface Transformer {
  48     /**
  49      * The transform method takes a set of package names, mapped to their source files and to the
  50      * pubapis of the packages.
  51      *
  52      * The transform implementation must:
  53      *    store the names of the generated artifacts for each package into package_artifacts


  72      * and it must always update package_artifacts, package_dependencies, and package_pubapis correctly.
  73      * This means that at least for Java source, it will always have to recompile the sources.
  74      *
  75      * The transformer is allowed to put files anywhere in the dest_root.
  76      * An example of this is, can be the META-INF transformer that copy files
  77      * below META-INF directories to the single META-INF directory below dest_root.
  78      *
  79      * False is returned if there was an error that prevented the transform.
  80      * I.e. something was printed on stderr.
  81      *
  82      * If num_cores is set to a non-zero value. The transform should attempt to use no more than these
  83      * number of threads for heavy work.
  84      */
  85     boolean transform(Sjavac sjavac,
  86                       Map<String,Set<URI>> pkgSrcs,
  87                       Set<URI>             visibleSources,
  88                       Map<URI,Set<String>> visibleClasses,
  89                       Map<String,Set<String>> oldPackageDependencies,
  90                       URI destRoot,
  91                       Map<String,Set<URI>>    packageArtifacts,
  92                       Map<String,Set<String>> packageDependencies,
  93                       Map<String,String>      packagePublicApis,


  94                       int debugLevel,
  95                       boolean incremental,
  96                       int numCores,
  97                       PrintStream out,
  98                       PrintStream err);
  99 
 100     void setExtra(String e);
 101     void setExtra(Options args);
 102 }


  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.sjavac;
  27 
  28 import java.io.PrintStream;
  29 import java.net.URI;

  30 import java.util.Map;
  31 import java.util.Set;
  32 
  33 import com.sun.tools.sjavac.options.Options;
  34 import com.sun.tools.sjavac.pubapi.PubApi;
  35 import com.sun.tools.sjavac.server.Sjavac;
  36 
  37 /**
  38  * The transform interface is used to transform content inside a package, from one form to another.
  39  * Usually the output form is an unpredictable number of output files. (eg class files)
  40  * but can also be an unpredictable number of generated source files (eg idl2java)
  41  * or a single predictable output file (eg when copying,cleaning or compiling a properties file).
  42  *
  43  *  <p><b>This is NOT part of any supported API.
  44  *  If you write code that depends on this, you do so at your own risk.
  45  *  This code and its internal interfaces are subject to change or
  46  *  deletion without notice.</b>
  47  */
  48 public interface Transformer {
  49     /**
  50      * The transform method takes a set of package names, mapped to their source files and to the
  51      * pubapis of the packages.
  52      *
  53      * The transform implementation must:
  54      *    store the names of the generated artifacts for each package into package_artifacts


  73      * and it must always update package_artifacts, package_dependencies, and package_pubapis correctly.
  74      * This means that at least for Java source, it will always have to recompile the sources.
  75      *
  76      * The transformer is allowed to put files anywhere in the dest_root.
  77      * An example of this is, can be the META-INF transformer that copy files
  78      * below META-INF directories to the single META-INF directory below dest_root.
  79      *
  80      * False is returned if there was an error that prevented the transform.
  81      * I.e. something was printed on stderr.
  82      *
  83      * If num_cores is set to a non-zero value. The transform should attempt to use no more than these
  84      * number of threads for heavy work.
  85      */
  86     boolean transform(Sjavac sjavac,
  87                       Map<String,Set<URI>> pkgSrcs,
  88                       Set<URI>             visibleSources,
  89                       Map<URI,Set<String>> visibleClasses,
  90                       Map<String,Set<String>> oldPackageDependencies,
  91                       URI destRoot,
  92                       Map<String,Set<URI>>    packageArtifacts,
  93                       Map<String, Map<String, Set<String>>> packageDependencies,   // Package name -> Fully Qualified Type [from] -> Set of fully qualified type [to]
  94                       Map<String, Map<String, Set<String>>> packageCpDependencies, // Package name -> Fully Qualified Type [from] -> Set of fully qualified type [to]
  95                       Map<String, PubApi>     packagePublicApis,
  96                       Map<String, PubApi>     dependencyApis,
  97                       int debugLevel,
  98                       boolean incremental,
  99                       int numCores,
 100                       PrintStream out,
 101                       PrintStream err);
 102 
 103     void setExtra(String e);
 104     void setExtra(Options args);
 105 }