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

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


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  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.*;







  29 import java.net.URI;
  30 import java.util.ArrayList;
  31 import java.util.Collections;
  32 import java.util.List;
  33 import java.util.Set;
  34 import java.util.HashSet;

  35 import java.util.Map;
  36 import java.util.Properties;

  37 
  38 import com.sun.tools.sjavac.options.Options;

  39 import com.sun.tools.sjavac.server.Sjavac;
  40 
  41 /**
  42  * The clean properties transform should not be necessary.
  43  * Eventually we will cleanup the property file sources in the OpenJDK instead.
  44  *
  45  *  <p><b>This is NOT part of any supported API.
  46  *  If you write code that depends on this, you do so at your own risk.
  47  *  This code and its internal interfaces are subject to change or
  48  *  deletion without notice.</b>
  49  */
  50 public class CleanProperties implements Transformer {
  51     public void setExtra(String e) {
  52         // Any extra information is ignored for clean properties.
  53     }
  54 
  55     public void setExtra(Options a) {
  56         // Any extra information is ignored for clean properties.
  57     }
  58 
  59     public boolean transform(Sjavac sjavac,
  60                              Map<String,Set<URI>> pkgSrcs,
  61                              Set<URI>             visibleSrcs,
  62                              Map<URI,Set<String>> visibleClasses,
  63                              Map<String,Set<String>> oldPackageDependencies,
  64                              URI destRoot,
  65                              Map<String,Set<URI>>    packageArtifacts,
  66                              Map<String,Set<String>> packageDependencies,
  67                              Map<String,String>      packagePublicApis,


  68                              int debugLevel,
  69                              boolean incremental,
  70                              int numCores,
  71                              PrintStream out,
  72                              PrintStream err) {
  73         boolean rc = true;
  74         for (String pkgName : pkgSrcs.keySet()) {
  75             String pkgNameF = pkgName.replace('.',File.separatorChar);
  76             for (URI u : pkgSrcs.get(pkgName)) {
  77                 File src = new File(u);
  78                 boolean r = clean(pkgName, pkgNameF, src, new File(destRoot), debugLevel,
  79                                   packageArtifacts);
  80                 if (r == false) {
  81                     rc = false;
  82                 }
  83             }
  84         }
  85         return rc;
  86     }
  87 




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  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.BufferedWriter;
  29 import java.io.File;
  30 import java.io.FileInputStream;
  31 import java.io.FileOutputStream;
  32 import java.io.IOException;
  33 import java.io.OutputStreamWriter;
  34 import java.io.PrintStream;
  35 import java.io.Writer;
  36 import java.net.URI;
  37 import java.util.ArrayList;
  38 import java.util.Collections;


  39 import java.util.HashSet;
  40 import java.util.List;
  41 import java.util.Map;
  42 import java.util.Properties;
  43 import java.util.Set;
  44 
  45 import com.sun.tools.sjavac.options.Options;
  46 import com.sun.tools.sjavac.pubapi.PubApi;
  47 import com.sun.tools.sjavac.server.Sjavac;
  48 
  49 /**
  50  * The clean properties transform should not be necessary.
  51  * Eventually we will cleanup the property file sources in the OpenJDK instead.
  52  *
  53  *  <p><b>This is NOT part of any supported API.
  54  *  If you write code that depends on this, you do so at your own risk.
  55  *  This code and its internal interfaces are subject to change or
  56  *  deletion without notice.</b>
  57  */
  58 public class CleanProperties implements Transformer {
  59     public void setExtra(String e) {
  60         // Any extra information is ignored for clean properties.
  61     }
  62 
  63     public void setExtra(Options a) {
  64         // Any extra information is ignored for clean properties.
  65     }
  66 
  67     public boolean transform(Sjavac sjavac,
  68                              Map<String,Set<URI>> pkgSrcs,
  69                              Set<URI>             visibleSrcs,
  70                              Map<URI,Set<String>> visibleClasses,
  71                              Map<String,Set<String>> oldPackageDependencies,
  72                              URI destRoot,
  73                              Map<String,Set<URI>>    packageArtifacts,
  74                              Map<String, Map<String, Set<String>>> packageDependencies,
  75                              Map<String, Map<String, Set<String>>> packageCpDependencies,
  76                              Map<String, PubApi> packagePublicApis,
  77                              Map<String, PubApi> dependencyPublicApis,
  78                              int debugLevel,
  79                              boolean incremental,
  80                              int numCores,
  81                              PrintStream out,
  82                              PrintStream err) {
  83         boolean rc = true;
  84         for (String pkgName : pkgSrcs.keySet()) {
  85             String pkgNameF = pkgName.replace('.',File.separatorChar);
  86             for (URI u : pkgSrcs.get(pkgName)) {
  87                 File src = new File(u);
  88                 boolean r = clean(pkgName, pkgNameF, src, new File(destRoot), debugLevel,
  89                                   packageArtifacts);
  90                 if (r == false) {
  91                     rc = false;
  92                 }
  93             }
  94         }
  95         return rc;
  96     }
  97