Thu, 29 Mar 2012 16:43:21 +0200
7163863: Updated projectcreator
Summary: Enable source browsing for all platform dependent code
Reviewed-by: brutisso, coleenp
1.1 --- a/make/windows/makefiles/projectcreator.make Mon Sep 24 17:59:24 2012 -0700 1.2 +++ b/make/windows/makefiles/projectcreator.make Thu Mar 29 16:43:21 2012 +0200 1.3 @@ -29,12 +29,11 @@ 1.4 # HOTSPOTRELEASEBINDEST, or HOTSPOTDEBUGBINDEST environment variables. 1.5 1.6 ProjectCreatorSources=\ 1.7 - $(WorkSpace)\src\share\tools\ProjectCreator\DirectoryTree.java \ 1.8 - $(WorkSpace)\src\share\tools\ProjectCreator\DirectoryTreeNode.java \ 1.9 - $(WorkSpace)\src\share\tools\ProjectCreator\FileFormatException.java \ 1.10 $(WorkSpace)\src\share\tools\ProjectCreator\ProjectCreator.java \ 1.11 + $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreator.java \ 1.12 + $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC7.java \ 1.13 + $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC10.java \ 1.14 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatform.java \ 1.15 - $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC6.java \ 1.16 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC7.java \ 1.17 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC8.java \ 1.18 $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC9.java \ 1.19 @@ -57,10 +56,24 @@ 1.20 -relativeInclude src\os_cpu\windows_$(Platform_arch)\vm \ 1.21 -relativeInclude src\cpu\$(Platform_arch)\vm \ 1.22 -absoluteInclude $(HOTSPOTBUILDSPACE)/%f/generated \ 1.23 - -ignorePath $(HOTSPOTBUILDSPACE)/%f/generated \ 1.24 - -ignorePath src\share\vm\adlc \ 1.25 - -ignorePath src\share\vm\shark \ 1.26 - -ignorePath posix 1.27 + -relativeSrcInclude src \ 1.28 + -absoluteSrcInclude $(HOTSPOTBUILDSPACE) \ 1.29 + -ignorePath $(HOTSPOTBUILDSPACE) \ 1.30 + -ignorePath launcher \ 1.31 + -ignorePath share\vm\adlc \ 1.32 + -ignorePath share\vm\shark \ 1.33 + -ignorePath share\tools \ 1.34 + -ignorePath solaris \ 1.35 + -ignorePath posix \ 1.36 + -ignorePath sparc \ 1.37 + -ignorePath linux \ 1.38 + -ignorePath bsd \ 1.39 + -ignorePath osx \ 1.40 + -ignorePath arm \ 1.41 + -ignorePath ppc \ 1.42 + -ignorePath zero \ 1.43 + -hidePath .hg 1.44 + 1.45 1.46 # This is referenced externally by both the IDE and batch builds 1.47 ProjectCreatorOptions= 1.48 @@ -84,6 +97,7 @@ 1.49 $(ProjectCreatorIDEOptions) \ 1.50 -sourceBase $(HOTSPOTWORKSPACE) \ 1.51 -buildBase $(HOTSPOTBUILDSPACE)\%f\%b \ 1.52 + -buildSpace $(HOTSPOTBUILDSPACE) \ 1.53 -startAt src \ 1.54 -compiler $(VcVersion) \ 1.55 -projectFileName $(HOTSPOTBUILDSPACE)\$(ProjectFile) \ 1.56 @@ -103,6 +117,7 @@ 1.57 -define TARGET_OS_ARCH_windows_x86 \ 1.58 -define TARGET_OS_FAMILY_windows \ 1.59 -define TARGET_COMPILER_visCPP \ 1.60 + -define INCLUDE_TRACE \ 1.61 $(ProjectCreatorIncludesPRIVATE) 1.62 1.63 # Add in build-specific options 1.64 @@ -125,9 +140,13 @@ 1.65 !endif 1.66 1.67 ProjectCreatorIDEOptionsIgnoreCompiler1=\ 1.68 + -ignorePath_TARGET compiler1 \ 1.69 + -ignorePath_TARGET tiered \ 1.70 -ignorePath_TARGET c1_ 1.71 1.72 ProjectCreatorIDEOptionsIgnoreCompiler2=\ 1.73 + -ignorePath_TARGET compiler2 \ 1.74 + -ignorePath_TARGET tiered \ 1.75 -ignorePath_TARGET src/share/vm/opto \ 1.76 -ignorePath_TARGET src/share/vm/libadt \ 1.77 -ignorePath_TARGET adfiles \ 1.78 @@ -209,6 +228,7 @@ 1.79 ################################################## 1.80 ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ 1.81 -define_compiler1 COMPILER1 \ 1.82 + -ignorePath_compiler1 core \ 1.83 $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1) 1.84 1.85 ################################################## 1.86 @@ -217,18 +237,19 @@ 1.87 #NOTE! This list must be kept in sync with GENERATED_NAMES in adlc.make. 1.88 ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ 1.89 -define_compiler2 COMPILER2 \ 1.90 + -ignorePath_compiler2 core \ 1.91 -additionalFile_compiler2 $(Platform_arch_model).ad \ 1.92 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model).cpp \ 1.93 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model).hpp \ 1.94 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_clone.cpp \ 1.95 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_expand.cpp \ 1.96 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_format.cpp \ 1.97 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_gen.cpp \ 1.98 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_misc.cpp \ 1.99 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_peephole.cpp \ 1.100 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles ad_$(Platform_arch_model)_pipeline.cpp \ 1.101 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles adGlobals_$(Platform_arch_model).hpp \ 1.102 - -additionalGeneratedFile_compiler2 $(HOTSPOTBUILDSPACE)/%f/generated/adfiles dfa_$(Platform_arch_model).cpp \ 1.103 + -additionalFile_compiler2 ad_$(Platform_arch_model).cpp \ 1.104 + -additionalFile_compiler2 ad_$(Platform_arch_model).hpp \ 1.105 + -additionalFile_compiler2 ad_$(Platform_arch_model)_clone.cpp \ 1.106 + -additionalFile_compiler2 ad_$(Platform_arch_model)_expand.cpp \ 1.107 + -additionalFile_compiler2 ad_$(Platform_arch_model)_format.cpp \ 1.108 + -additionalFile_compiler2 ad_$(Platform_arch_model)_gen.cpp \ 1.109 + -additionalFile_compiler2 ad_$(Platform_arch_model)_misc.cpp \ 1.110 + -additionalFile_compiler2 ad_$(Platform_arch_model)_peephole.cpp \ 1.111 + -additionalFile_compiler2 ad_$(Platform_arch_model)_pipeline.cpp \ 1.112 + -additionalFile_compiler2 adGlobals_$(Platform_arch_model).hpp \ 1.113 + -additionalFile_compiler2 dfa_$(Platform_arch_model).cpp \ 1.114 $(ProjectCreatorIDEOptionsIgnoreCompiler1:TARGET=compiler2) 1.115 1.116 # Add in the jvmti (JSR-163) options 1.117 @@ -237,8 +258,8 @@ 1.118 # code merge was done correctly (@see jvmti.make and jvmtiEnvFill.java). 1.119 # If so, they would then check it in as a new version of jvmtiEnv.cpp. 1.120 ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ 1.121 - -additionalGeneratedFile $(HOTSPOTBUILDSPACE)/%f/generated/jvmtifiles jvmtiEnv.hpp \ 1.122 - -additionalGeneratedFile $(HOTSPOTBUILDSPACE)/%f/generated/jvmtifiles jvmtiEnter.cpp \ 1.123 - -additionalGeneratedFile $(HOTSPOTBUILDSPACE)/%f/generated/jvmtifiles jvmtiEnterTrace.cpp \ 1.124 - -additionalGeneratedFile $(HOTSPOTBUILDSPACE)/%f/generated/jvmtifiles jvmti.h \ 1.125 - -additionalGeneratedFile $(HOTSPOTBUILDSPACE)/%f/generated/jvmtifiles bytecodeInterpreterWithChecks.cpp 1.126 + -additionalFile jvmtiEnv.hpp \ 1.127 + -additionalFile jvmtiEnter.cpp \ 1.128 + -additionalFile jvmtiEnterTrace.cpp \ 1.129 + -additionalFile jvmti.h \ 1.130 + -additionalFile bytecodeInterpreterWithChecks.cpp
2.1 --- a/src/share/tools/ProjectCreator/BuildConfig.java Mon Sep 24 17:59:24 2012 -0700 2.2 +++ b/src/share/tools/ProjectCreator/BuildConfig.java Thu Mar 29 16:43:21 2012 +0200 2.3 @@ -22,15 +22,14 @@ 2.4 * 2.5 */ 2.6 2.7 -import java.io.File; 2.8 import java.util.Enumeration; 2.9 import java.util.Hashtable; 2.10 -import java.util.Iterator; 2.11 import java.util.Vector; 2.12 2.13 class BuildConfig { 2.14 + @SuppressWarnings("rawtypes") 2.15 Hashtable vars; 2.16 - Vector basicNames, basicPaths; 2.17 + Vector<String> basicNames, basicPaths; 2.18 String[] context; 2.19 2.20 static CompilerInterface ci; 2.21 @@ -47,6 +46,7 @@ 2.22 return ci; 2.23 } 2.24 2.25 + @SuppressWarnings("rawtypes") 2.26 protected void initNames(String flavour, String build, String outDll) { 2.27 if (vars == null) vars = new Hashtable(); 2.28 2.29 @@ -63,26 +63,28 @@ 2.30 // ones mentioned above were needed to expand format 2.31 String buildBase = expandFormat(getFieldString(null, "BuildBase")); 2.32 String sourceBase = getFieldString(null, "SourceBase"); 2.33 + String buildSpace = getFieldString(null, "BuildSpace"); 2.34 String outDir = buildBase; 2.35 2.36 put("Id", flavourBuild); 2.37 put("OutputDir", outDir); 2.38 put("SourceBase", sourceBase); 2.39 put("BuildBase", buildBase); 2.40 + put("BuildSpace", buildSpace); 2.41 put("OutputDll", outDir + Util.sep + outDll); 2.42 2.43 context = new String [] {flavourBuild, flavour, build, null}; 2.44 } 2.45 2.46 - protected void init(Vector includes, Vector defines) { 2.47 + protected void init(Vector<String> includes, Vector<String> defines) { 2.48 initDefaultDefines(defines); 2.49 initDefaultCompilerFlags(includes); 2.50 initDefaultLinkerFlags(); 2.51 - handleDB(); 2.52 + //handleDB(); 2.53 } 2.54 2.55 2.56 - protected void initDefaultCompilerFlags(Vector includes) { 2.57 + protected void initDefaultCompilerFlags(Vector<String> includes) { 2.58 Vector compilerFlags = new Vector(); 2.59 2.60 compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"), 2.61 @@ -100,143 +102,48 @@ 2.62 put("LinkerFlags", linkerFlags); 2.63 } 2.64 2.65 - DirectoryTree getSourceTree(String sourceBase, String startAt) { 2.66 - DirectoryTree tree = new DirectoryTree(); 2.67 - 2.68 - tree.addSubdirToIgnore("Codemgr_wsdata"); 2.69 - tree.addSubdirToIgnore("deleted_files"); 2.70 - tree.addSubdirToIgnore("SCCS"); 2.71 - tree.setVerbose(true); 2.72 - if (startAt != null) { 2.73 - tree.readDirectory(sourceBase + File.separator + startAt); 2.74 - } else { 2.75 - tree.readDirectory(sourceBase); 2.76 - } 2.77 - 2.78 - return tree; 2.79 - } 2.80 - 2.81 - 2.82 - Vector getPreferredPaths() { 2.83 - Vector preferredPaths = new Vector(); 2.84 - 2.85 - // In the case of multiple files with the same name in 2.86 - // different subdirectories, prefer these versions 2.87 - preferredPaths.add("windows"); 2.88 - preferredPaths.add("x86"); 2.89 - preferredPaths.add("closed"); 2.90 - 2.91 - // Also prefer "opto" over "adlc" for adlcVMDeps.hpp 2.92 - preferredPaths.add("opto"); 2.93 - 2.94 - return preferredPaths; 2.95 - } 2.96 - 2.97 - 2.98 - void handleDB() { 2.99 - WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); 2.100 - 2.101 - putSpecificField("AllFilesHash", computeAllFiles(platform)); 2.102 - } 2.103 - 2.104 - 2.105 - private boolean matchesIgnoredPath(String prefixedName) { 2.106 - Vector rv = new Vector(); 2.107 + public boolean matchesIgnoredPath(String path) { 2.108 + Vector<String> rv = new Vector<String>(); 2.109 collectRelevantVectors(rv, "IgnorePath"); 2.110 - for (Iterator i = rv.iterator(); i.hasNext(); ) { 2.111 - String pathPart = (String) i.next(); 2.112 - if (prefixedName.contains(Util.normalize(pathPart))) { 2.113 + for (String pathPart : rv) { 2.114 + if (path.contains(pathPart)) { 2.115 return true; 2.116 } 2.117 } 2.118 return false; 2.119 } 2.120 2.121 - void addAll(Iterator i, Hashtable hash, 2.122 - WinGammaPlatform platform, DirectoryTree tree, 2.123 - Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) { 2.124 - for (; i.hasNext(); ) { 2.125 - String fileName = (String) i.next(); 2.126 - if (lookupHashFieldInContext("IgnoreFile", fileName) == null) { 2.127 - String prefixedName = platform.envVarPrefixedFileName(fileName, 2.128 - 0, /* ignored */ 2.129 - tree, 2.130 - preferredPaths, 2.131 - filesNotFound, 2.132 - filesDuplicate); 2.133 - if (prefixedName != null) { 2.134 - prefixedName = Util.normalize(prefixedName); 2.135 - if (!matchesIgnoredPath(prefixedName)) { 2.136 - addTo(hash, prefixedName, fileName); 2.137 - } 2.138 + public boolean matchesHidePath(String path) { 2.139 + Vector<String> rv = new Vector<String>(); 2.140 + collectRelevantVectors(rv, "HidePath"); 2.141 + for (String pathPart : rv) { 2.142 + if (path.contains(Util.normalize(pathPart))) { 2.143 + return true; 2.144 + } 2.145 + } 2.146 + return false; 2.147 + } 2.148 + 2.149 + public Vector<String> matchesAdditionalGeneratedPath(String fullPath) { 2.150 + Vector<String> rv = new Vector<String>(); 2.151 + Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile"); 2.152 + if (v != null) { 2.153 + for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) { 2.154 + String key = e.nextElement(); 2.155 + String val = v.get(key); 2.156 + 2.157 + if (fullPath.endsWith(expandFormat(key))) { 2.158 + rv.add(expandFormat(val)); 2.159 } 2.160 } 2.161 } 2.162 + return rv; 2.163 } 2.164 2.165 void addTo(Hashtable ht, String key, String value) { 2.166 ht.put(expandFormat(key), expandFormat(value)); 2.167 } 2.168 2.169 - Hashtable computeAllFiles(WinGammaPlatform platform) { 2.170 - Hashtable rv = new Hashtable(); 2.171 - DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); 2.172 - Vector preferredPaths = getPreferredPaths(); 2.173 - 2.174 - // Hold errors until end 2.175 - Vector filesNotFound = new Vector(); 2.176 - Vector filesDuplicate = new Vector(); 2.177 - 2.178 - Vector includedFiles = new Vector(); 2.179 - 2.180 - // find all files 2.181 - Vector dirs = getSourceIncludes(); 2.182 - for (Iterator i = dirs.iterator(); i.hasNext(); ) { 2.183 - String dir = (String)i.next(); 2.184 - DirectoryTree subtree = getSourceTree(dir, null); 2.185 - for (Iterator fi = subtree.getFileIterator(); fi.hasNext(); ) { 2.186 - String name = ((File)fi.next()).getName(); 2.187 - includedFiles.add(name); 2.188 - } 2.189 - } 2.190 - addAll(includedFiles.iterator(), rv, 2.191 - platform, tree, 2.192 - preferredPaths, filesNotFound, filesDuplicate); 2.193 - 2.194 - Vector addFiles = new Vector(); 2.195 - collectRelevantVectors(addFiles, "AdditionalFile"); 2.196 - addAll(addFiles.iterator(), rv, 2.197 - platform, tree, 2.198 - preferredPaths, filesNotFound, filesDuplicate); 2.199 - 2.200 - collectRelevantHashes(rv, "AdditionalGeneratedFile"); 2.201 - 2.202 - if ((filesNotFound.size() != 0) || 2.203 - (filesDuplicate.size() != 0)) { 2.204 - System.err.println("Error: some files were not found or " + 2.205 - "appeared in multiple subdirectories of " + 2.206 - "directory " + get("SourceBase") + " and could not " + 2.207 - "be resolved with os_family and arch."); 2.208 - if (filesNotFound.size() != 0) { 2.209 - System.err.println("Files not found:"); 2.210 - for (Iterator iter = filesNotFound.iterator(); 2.211 - iter.hasNext(); ) { 2.212 - System.err.println(" " + (String) iter.next()); 2.213 - } 2.214 - } 2.215 - if (filesDuplicate.size() != 0) { 2.216 - System.err.println("Duplicate files:"); 2.217 - for (Iterator iter = filesDuplicate.iterator(); 2.218 - iter.hasNext(); ) { 2.219 - System.err.println(" " + (String) iter.next()); 2.220 - } 2.221 - } 2.222 - throw new RuntimeException(); 2.223 - } 2.224 - 2.225 - return rv; 2.226 - } 2.227 - 2.228 void initDefaultDefines(Vector defines) { 2.229 Vector sysDefines = new Vector(); 2.230 sysDefines.add("WIN32"); 2.231 @@ -324,20 +231,19 @@ 2.232 } 2.233 2.234 void collectRelevantVectors(Vector rv, String field) { 2.235 - for (int i = 0; i < context.length; i++) { 2.236 - Vector v = getFieldVector(context[i], field); 2.237 + for (String ctx : context) { 2.238 + Vector<String> v = getFieldVector(ctx, field); 2.239 if (v != null) { 2.240 - for (Iterator j=v.iterator(); j.hasNext(); ) { 2.241 - String val = (String)j.next(); 2.242 - rv.add(expandFormat(val)); 2.243 + for (String val : v) { 2.244 + rv.add(expandFormat(val).replace('/', '\\')); 2.245 } 2.246 } 2.247 } 2.248 } 2.249 2.250 void collectRelevantHashes(Hashtable rv, String field) { 2.251 - for (int i = 0; i < context.length; i++) { 2.252 - Hashtable v = (Hashtable)getField(context[i], field); 2.253 + for (String ctx : context) { 2.254 + Hashtable v = (Hashtable)getField(ctx, field); 2.255 if (v != null) { 2.256 for (Enumeration e=v.keys(); e.hasMoreElements(); ) { 2.257 String key = (String)e.nextElement(); 2.258 @@ -357,21 +263,17 @@ 2.259 2.260 Vector getIncludes() { 2.261 Vector rv = new Vector(); 2.262 - 2.263 collectRelevantVectors(rv, "AbsoluteInclude"); 2.264 - 2.265 rv.addAll(getSourceIncludes()); 2.266 - 2.267 return rv; 2.268 } 2.269 2.270 private Vector getSourceIncludes() { 2.271 - Vector rv = new Vector(); 2.272 - Vector ri = new Vector(); 2.273 + Vector<String> rv = new Vector<String>(); 2.274 + Vector<String> ri = new Vector<String>(); 2.275 String sourceBase = getFieldString(null, "SourceBase"); 2.276 collectRelevantVectors(ri, "RelativeInclude"); 2.277 - for (Iterator i = ri.iterator(); i.hasNext(); ) { 2.278 - String f = (String)i.next(); 2.279 + for (String f : ri) { 2.280 rv.add(sourceBase + Util.sep + f); 2.281 } 2.282 return rv; 2.283 @@ -604,7 +506,6 @@ 2.284 } 2.285 } 2.286 2.287 - 2.288 abstract class ProductConfig extends BuildConfig { 2.289 protected void init(Vector includes, Vector defines) { 2.290 defines.add("NDEBUG"); 2.291 @@ -638,7 +539,6 @@ 2.292 } 2.293 } 2.294 2.295 - 2.296 class CoreDebugConfig extends GenericDebugNonKernelConfig { 2.297 String getOptFlag() { 2.298 return getCI().getNoOptFlag(); 2.299 @@ -650,7 +550,6 @@ 2.300 } 2.301 } 2.302 2.303 - 2.304 class CoreFastDebugConfig extends GenericDebugNonKernelConfig { 2.305 String getOptFlag() { 2.306 return getCI().getOptFlag(); 2.307 @@ -662,7 +561,6 @@ 2.308 } 2.309 } 2.310 2.311 - 2.312 class CoreProductConfig extends ProductConfig { 2.313 CoreProductConfig() { 2.314 initNames("core", "product", "jvm.dll"); 2.315 @@ -700,6 +598,7 @@ 2.316 init(getIncludes(), getDefines()); 2.317 } 2.318 } 2.319 + 2.320 abstract class CompilerInterface { 2.321 abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); 2.322 abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName);
3.1 --- a/src/share/tools/ProjectCreator/DirectoryTree.java Mon Sep 24 17:59:24 2012 -0700 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,287 +0,0 @@ 3.4 -/* 3.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 3.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 - * 3.8 - * This code is free software; you can redistribute it and/or modify it 3.9 - * under the terms of the GNU General Public License version 2 only, as 3.10 - * published by the Free Software Foundation. 3.11 - * 3.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 - * version 2 for more details (a copy is included in the LICENSE file that 3.16 - * accompanied this code). 3.17 - * 3.18 - * You should have received a copy of the GNU General Public License version 3.19 - * 2 along with this work; if not, write to the Free Software Foundation, 3.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 - * 3.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 - * or visit www.oracle.com if you need additional information or have any 3.24 - * questions. 3.25 - * 3.26 - */ 3.27 - 3.28 -/** Encapsulates a notion of a directory tree. Designed to allow fast 3.29 - querying of full paths for unique filenames in the hierarchy. */ 3.30 - 3.31 -import java.io.*; 3.32 -import java.util.*; 3.33 - 3.34 -public class DirectoryTree { 3.35 - 3.36 - /** The root of the read directoryTree */ 3.37 - private Node rootNode; 3.38 - 3.39 - /** Subdirs to ignore; Vector of Strings */ 3.40 - private Vector subdirsToIgnore; 3.41 - 3.42 - /** This maps file names to Lists of nodes. */ 3.43 - private Hashtable nameToNodeListTable; 3.44 - 3.45 - /** Output "."'s as directories are read. Defaults to false. */ 3.46 - private boolean verbose; 3.47 - 3.48 - public DirectoryTree() { 3.49 - subdirsToIgnore = new Vector(); 3.50 - verbose = false; 3.51 - } 3.52 - 3.53 - public void addSubdirToIgnore(String subdir) { 3.54 - subdirsToIgnore.add(subdir); 3.55 - } 3.56 - 3.57 - private class FileIterator implements Iterator { 3.58 - private Vector nodes = new Vector(); 3.59 - 3.60 - public FileIterator(Node rootNode) { 3.61 - if(rootNode == null) { 3.62 - return; 3.63 - } 3.64 - nodes.add(rootNode); 3.65 - prune(); 3.66 - } 3.67 - public boolean hasNext() { 3.68 - return nodes.size() > 0; 3.69 - } 3.70 - public Object next() { 3.71 - Node last = (Node)nodes.remove(nodes.size() - 1); 3.72 - prune(); 3.73 - return new File(last.getName()); 3.74 - } 3.75 - 3.76 - public void remove() { 3.77 - throw new RuntimeException(); 3.78 - } 3.79 - 3.80 - private void prune() { 3.81 - while (nodes.size() > 0) { 3.82 - Node last = (Node)nodes.get(nodes.size() - 1); 3.83 - 3.84 - if (last.isDirectory()) { 3.85 - nodes.remove(nodes.size() - 1); 3.86 - nodes.addAll(last.children); 3.87 - } else { 3.88 - // Is at file 3.89 - return; 3.90 - } 3.91 - } 3.92 - } 3.93 - } 3.94 - 3.95 - public Iterator getFileIterator() { 3.96 - return new FileIterator(rootNode); 3.97 - } 3.98 - 3.99 - /** Output "."'s to System.out as directories are read. Defaults 3.100 - to false. */ 3.101 - public void setVerbose(boolean newValue) { 3.102 - verbose = newValue; 3.103 - } 3.104 - 3.105 - public boolean getVerbose() { 3.106 - return verbose; 3.107 - } 3.108 - 3.109 - public String getRootNodeName() { 3.110 - return rootNode.getName(); 3.111 - } 3.112 - 3.113 - /** Takes an absolute path to the root directory of this 3.114 - DirectoryTree. Throws IllegalArgumentException if the given 3.115 - string represents a plain file or nonexistent directory. */ 3.116 - 3.117 - public void readDirectory(String baseDirectory) 3.118 - throws IllegalArgumentException { 3.119 - File root = new File(Util.normalize(baseDirectory)); 3.120 - if (!root.isDirectory()) { 3.121 - return; 3.122 - } 3.123 - try { 3.124 - root = root.getCanonicalFile(); 3.125 - } 3.126 - catch (IOException e) { 3.127 - throw new RuntimeException(e.toString()); 3.128 - } 3.129 - rootNode = new Node(root); 3.130 - readDirectory(rootNode, root); 3.131 - } 3.132 - 3.133 - /** Queries the DirectoryTree for a file or directory name. Takes 3.134 - only the name of the file or directory itself (i.e., no parent 3.135 - directory information should be in the passed name). Returns a 3.136 - List of DirectoryTreeNodes specifying the full paths of all of 3.137 - the files or directories of this name in the DirectoryTree. 3.138 - Returns null if the directory tree has not been read from disk 3.139 - yet or if the file was not found in the tree. */ 3.140 - public List findFile(String name) { 3.141 - if (rootNode == null) { 3.142 - return null; 3.143 - } 3.144 - 3.145 - if (nameToNodeListTable == null) { 3.146 - nameToNodeListTable = new Hashtable(); 3.147 - try { 3.148 - buildNameToNodeListTable(rootNode); 3.149 - } catch (IOException e) { 3.150 - e.printStackTrace(); 3.151 - return null; 3.152 - } 3.153 - } 3.154 - 3.155 - return (List) nameToNodeListTable.get(name); 3.156 - } 3.157 - 3.158 - private void buildNameToNodeListTable(Node curNode) 3.159 - throws IOException { 3.160 - String fullName = curNode.getName(); 3.161 - String parent = curNode.getParent(); 3.162 - String separator = System.getProperty("file.separator"); 3.163 - 3.164 - if (parent != null) { 3.165 - if (!fullName.startsWith(parent)) { 3.166 - throw new RuntimeException( 3.167 - "Internal error: parent of file name \"" + fullName + 3.168 - "\" does not match file name \"" + parent + "\"" 3.169 - ); 3.170 - } 3.171 - 3.172 - int len = parent.length(); 3.173 - if (!parent.endsWith(separator)) { 3.174 - len += separator.length(); 3.175 - } 3.176 - 3.177 - String fileName = fullName.substring(len); 3.178 - 3.179 - if (fileName == null) { 3.180 - throw new RuntimeException( 3.181 - "Internal error: file name was empty" 3.182 - ); 3.183 - } 3.184 - 3.185 - List nodeList = (List) nameToNodeListTable.get(fileName); 3.186 - if (nodeList == null) { 3.187 - nodeList = new Vector(); 3.188 - nameToNodeListTable.put(fileName, nodeList); 3.189 - } 3.190 - 3.191 - nodeList.add(curNode); 3.192 - } else { 3.193 - if (curNode != rootNode) { 3.194 - throw new RuntimeException( 3.195 - "Internal error: parent of file + \"" + fullName + "\"" + 3.196 - " was null" 3.197 - ); 3.198 - } 3.199 - } 3.200 - 3.201 - if (curNode.isDirectory()) { 3.202 - Iterator iter = curNode.getChildren(); 3.203 - if (iter != null) { 3.204 - while (iter.hasNext()) { 3.205 - buildNameToNodeListTable((Node) iter.next()); 3.206 - } 3.207 - } 3.208 - } 3.209 - } 3.210 - 3.211 - /** Reads all of the files in the given directory and adds them as 3.212 - children of the directory tree node. Requires that the passed 3.213 - node represents a directory. */ 3.214 - 3.215 - private void readDirectory(Node parentNode, File parentDir) { 3.216 - File[] children = parentDir.listFiles(); 3.217 - if (children == null) 3.218 - return; 3.219 - if (verbose) { 3.220 - System.out.print("."); 3.221 - System.out.flush(); 3.222 - } 3.223 - for (int i = 0; i < children.length; i++) { 3.224 - File child = children[i]; 3.225 - children[i] = null; 3.226 - boolean isDir = child.isDirectory(); 3.227 - boolean mustSkip = false; 3.228 - if (isDir) { 3.229 - for (Iterator iter = subdirsToIgnore.iterator(); 3.230 - iter.hasNext(); ) { 3.231 - if (child.getName().equals((String) iter.next())) { 3.232 - mustSkip = true; 3.233 - break; 3.234 - } 3.235 - } 3.236 - } 3.237 - if (!mustSkip) { 3.238 - Node childNode = new Node(child); 3.239 - parentNode.addChild(childNode); 3.240 - if (isDir) { 3.241 - readDirectory(childNode, child); 3.242 - } 3.243 - } 3.244 - } 3.245 - } 3.246 - 3.247 - private class Node implements DirectoryTreeNode { 3.248 - private File file; 3.249 - private Vector children; 3.250 - 3.251 - /** file must be a canonical file */ 3.252 - Node(File file) { 3.253 - this.file = file; 3.254 - children = new Vector(); 3.255 - } 3.256 - 3.257 - public boolean isFile() { 3.258 - return file.isFile(); 3.259 - } 3.260 - 3.261 - public boolean isDirectory() { 3.262 - return file.isDirectory(); 3.263 - } 3.264 - 3.265 - public String getName() { 3.266 - return file.getPath(); 3.267 - } 3.268 - 3.269 - public String getParent() { 3.270 - return file.getParent(); 3.271 - } 3.272 - 3.273 - public void addChild(Node n) { 3.274 - children.add(n); 3.275 - } 3.276 - 3.277 - public Iterator getChildren() throws IllegalArgumentException { 3.278 - return children.iterator(); 3.279 - } 3.280 - 3.281 - public int getNumChildren() throws IllegalArgumentException { 3.282 - return children.size(); 3.283 - } 3.284 - 3.285 - public DirectoryTreeNode getChild(int i) 3.286 - throws IllegalArgumentException, ArrayIndexOutOfBoundsException { 3.287 - return (DirectoryTreeNode) children.get(i); 3.288 - } 3.289 - } 3.290 -}
4.1 --- a/src/share/tools/ProjectCreator/DirectoryTreeNode.java Mon Sep 24 17:59:24 2012 -0700 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,36 +0,0 @@ 4.4 -/* 4.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 4.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 - * 4.8 - * This code is free software; you can redistribute it and/or modify it 4.9 - * under the terms of the GNU General Public License version 2 only, as 4.10 - * published by the Free Software Foundation. 4.11 - * 4.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 - * version 2 for more details (a copy is included in the LICENSE file that 4.16 - * accompanied this code). 4.17 - * 4.18 - * You should have received a copy of the GNU General Public License version 4.19 - * 2 along with this work; if not, write to the Free Software Foundation, 4.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 - * 4.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 - * or visit www.oracle.com if you need additional information or have any 4.24 - * questions. 4.25 - * 4.26 - */ 4.27 - 4.28 -import java.util.*; 4.29 - 4.30 -public interface DirectoryTreeNode { 4.31 - public boolean isFile(); 4.32 - public boolean isDirectory(); 4.33 - public String getName(); 4.34 - public String getParent(); 4.35 - public Iterator getChildren() throws IllegalArgumentException; 4.36 - public int getNumChildren() throws IllegalArgumentException; 4.37 - public DirectoryTreeNode getChild(int i) 4.38 - throws IllegalArgumentException, ArrayIndexOutOfBoundsException; 4.39 -}
5.1 --- a/src/share/tools/ProjectCreator/FileFormatException.java Mon Sep 24 17:59:24 2012 -0700 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,35 +0,0 @@ 5.4 -/* 5.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 5.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 - * 5.8 - * This code is free software; you can redistribute it and/or modify it 5.9 - * under the terms of the GNU General Public License version 2 only, as 5.10 - * published by the Free Software Foundation. 5.11 - * 5.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 - * version 2 for more details (a copy is included in the LICENSE file that 5.16 - * accompanied this code). 5.17 - * 5.18 - * You should have received a copy of the GNU General Public License version 5.19 - * 2 along with this work; if not, write to the Free Software Foundation, 5.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 - * 5.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 - * or visit www.oracle.com if you need additional information or have any 5.24 - * questions. 5.25 - * 5.26 - */ 5.27 - 5.28 -@SuppressWarnings("serial") 5.29 -public class FileFormatException extends Exception { 5.30 - 5.31 - public FileFormatException() { 5.32 - super(); 5.33 - } 5.34 - 5.35 - public FileFormatException(String s) { 5.36 - super(s); 5.37 - } 5.38 -}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/src/share/tools/ProjectCreator/FileTreeCreator.java Thu Mar 29 16:43:21 2012 +0200 6.3 @@ -0,0 +1,72 @@ 6.4 +import java.nio.file.FileSystems; 6.5 +import java.nio.file.Path; 6.6 +import java.nio.file.SimpleFileVisitor; 6.7 +import java.util.HashSet; 6.8 +import java.util.Stack; 6.9 +import java.util.Vector; 6.10 + 6.11 +public class FileTreeCreator extends SimpleFileVisitor<Path> 6.12 +{ 6.13 + Path vcProjLocation; 6.14 + Path startDir; 6.15 + final int startDirLength; 6.16 + Stack<DirAttributes> attributes = new Stack<DirAttributes>(); 6.17 + Vector<BuildConfig> allConfigs; 6.18 + WinGammaPlatformVC10 wg; 6.19 + 6.20 + public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatformVC10 wg) { 6.21 + super(); 6.22 + this.wg = wg; 6.23 + this.allConfigs = allConfigs; 6.24 + this.startDir = startDir; 6.25 + startDirLength = startDir.toAbsolutePath().toString().length(); 6.26 + vcProjLocation = FileSystems.getDefault().getPath(allConfigs.firstElement().get("BuildSpace")); 6.27 + attributes.push(new DirAttributes()); 6.28 + } 6.29 + 6.30 + public class DirAttributes { 6.31 + 6.32 + private HashSet<BuildConfig> ignores; 6.33 + private HashSet<BuildConfig> disablePch; 6.34 + 6.35 + public DirAttributes() { 6.36 + ignores = new HashSet<BuildConfig>(); 6.37 + disablePch = new HashSet<BuildConfig>(); 6.38 + } 6.39 + 6.40 + public DirAttributes(HashSet<BuildConfig> excludes2, HashSet<BuildConfig> disablePch2) { 6.41 + ignores = excludes2; 6.42 + disablePch = disablePch2; 6.43 + } 6.44 + 6.45 + @SuppressWarnings("unchecked") 6.46 + public DirAttributes clone() { 6.47 + return new DirAttributes((HashSet<BuildConfig>)this.ignores.clone(), (HashSet<BuildConfig>)this.disablePch.clone()); 6.48 + } 6.49 + 6.50 + public void setIgnore(BuildConfig conf) { 6.51 + ignores.add(conf); 6.52 + } 6.53 + 6.54 + public boolean hasIgnore(BuildConfig cfg) { 6.55 + return ignores.contains(cfg); 6.56 + } 6.57 + 6.58 + public void removeFromIgnored(BuildConfig cfg) { 6.59 + ignores.remove(cfg); 6.60 + } 6.61 + 6.62 + public void setDisablePch(BuildConfig conf) { 6.63 + disablePch.add(conf); 6.64 + } 6.65 + 6.66 + public boolean hasDisablePch(BuildConfig cfg) { 6.67 + return disablePch.contains(cfg); 6.68 + } 6.69 + 6.70 + public void removeFromDisablePch(BuildConfig cfg) { 6.71 + disablePch.remove(cfg); 6.72 + } 6.73 + 6.74 + } 6.75 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java Thu Mar 29 16:43:21 2012 +0200 7.3 @@ -0,0 +1,142 @@ 7.4 +import static java.nio.file.FileVisitResult.CONTINUE; 7.5 + 7.6 +import java.io.IOException; 7.7 +import java.nio.file.FileSystems; 7.8 +import java.nio.file.FileVisitResult; 7.9 +import java.nio.file.Files; 7.10 +import java.nio.file.Path; 7.11 +import java.nio.file.attribute.BasicFileAttributes; 7.12 +import java.util.Stack; 7.13 +import java.util.Vector; 7.14 + 7.15 +public class FileTreeCreatorVC10 extends FileTreeCreator { 7.16 + 7.17 + public FileTreeCreatorVC10(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatformVC10 wg) { 7.18 + super(startDir, allConfigs, wg); 7.19 + } 7.20 + 7.21 + @Override 7.22 + public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { 7.23 + DirAttributes currentFileAttr = attributes.peek().clone(); 7.24 + boolean usePch = false; 7.25 + boolean disablePch = false; 7.26 + boolean useIgnore = false; 7.27 + String fileName = file.getFileName().toString(); 7.28 + 7.29 + // TODO hideFile 7.30 + 7.31 + // usePch applies to all configs for a file. 7.32 + if (fileName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"))) { 7.33 + usePch = true; 7.34 + } 7.35 + 7.36 + for (BuildConfig cfg : allConfigs) { 7.37 + if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { 7.38 + useIgnore = true; 7.39 + currentFileAttr.setIgnore(cfg); 7.40 + } else if (cfg.matchesIgnoredPath(file.toAbsolutePath().toString())) { 7.41 + useIgnore = true; 7.42 + currentFileAttr.setIgnore(cfg); 7.43 + } 7.44 + 7.45 + if (cfg.lookupHashFieldInContext("DisablePch", fileName) != null) { 7.46 + disablePch = true; 7.47 + currentFileAttr.setDisablePch(cfg); 7.48 + } 7.49 + 7.50 + Vector<String> rv = new Vector<String>(); 7.51 + cfg.collectRelevantVectors(rv, "AdditionalFile"); 7.52 + for(String addFile : rv) { 7.53 + if (addFile.equals(fileName)) { 7.54 + // supress any ignore 7.55 + // TODO - may need some adjustments 7.56 + if (file.toAbsolutePath().toString().contains(cfg.get("Flavour"))) { 7.57 + currentFileAttr.removeFromIgnored(cfg); 7.58 + } 7.59 + } 7.60 + } 7.61 + } 7.62 + 7.63 + String tagName = wg.getFileTagFromSuffix(fileName); 7.64 + String fileLoc = vcProjLocation.relativize(file).toString(); 7.65 + 7.66 + if (!useIgnore && !disablePch && !usePch) { 7.67 + wg.tag(tagName, new String[] { "Include", fileLoc}); 7.68 + } else { 7.69 + wg.startTag( 7.70 + tagName, 7.71 + new String[] { "Include", fileLoc}); 7.72 + 7.73 + for (BuildConfig cfg : allConfigs) { 7.74 + boolean ignore = currentFileAttr.hasIgnore(cfg); 7.75 + if (ignore) { 7.76 + wg.tagData("ExcludedFromBuild", "true", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); 7.77 + } 7.78 + if (usePch) { 7.79 + wg.tagData("PrecompiledHeader", "Create", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); 7.80 + } 7.81 + if (disablePch) { 7.82 + wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); 7.83 + } 7.84 + } 7.85 + wg.endTag(); 7.86 + } 7.87 + 7.88 + String filter = startDir.relativize(file.getParent().toAbsolutePath()).toString(); 7.89 + wg.addFilterDependency(fileLoc, filter); 7.90 + 7.91 + return CONTINUE; 7.92 + } 7.93 + 7.94 + @Override 7.95 + public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) 7.96 + throws IOException { 7.97 + Boolean hide = false; 7.98 + // TODO remove attrs, if path is matched in this dir, then it is too in every subdir. 7.99 + // And we will check anyway 7.100 + DirAttributes newAttr = attributes.peek().clone(); 7.101 + 7.102 + // check per config ignorePaths! 7.103 + for (BuildConfig cfg : allConfigs) { 7.104 + if (cfg.matchesIgnoredPath(path.toAbsolutePath().toString())) { 7.105 + newAttr.setIgnore(cfg); 7.106 + } 7.107 + 7.108 + // Hide is always on all configs. And additional files are never hiddden 7.109 + if (cfg.matchesHidePath(path.toAbsolutePath().toString())) { 7.110 + hide = true; 7.111 + break; 7.112 + } 7.113 + } 7.114 + 7.115 + if (!hide) { 7.116 + String name = startDir.relativize(path.toAbsolutePath()).toString(); 7.117 + if (!"".equals(name)) { 7.118 + wg.addFilter(name); 7.119 + } 7.120 + 7.121 + attributes.push(newAttr); 7.122 + return super.preVisitDirectory(path, attrs); 7.123 + } else { 7.124 + return FileVisitResult.SKIP_SUBTREE; 7.125 + } 7.126 + } 7.127 + 7.128 + @Override 7.129 + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { 7.130 + //end matching attributes set by ignorepath 7.131 + attributes.pop(); 7.132 + return CONTINUE; 7.133 + } 7.134 + 7.135 + @Override 7.136 + public FileVisitResult visitFileFailed(Path file, IOException exc) { 7.137 + return CONTINUE; 7.138 + } 7.139 + 7.140 + public void writeFileTree() throws IOException { 7.141 + Files.walkFileTree(this.startDir, this); 7.142 + } 7.143 + 7.144 + 7.145 + } 7.146 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java Thu Mar 29 16:43:21 2012 +0200 8.3 @@ -0,0 +1,156 @@ 8.4 +import static java.nio.file.FileVisitResult.CONTINUE; 8.5 + 8.6 +import java.io.IOException; 8.7 +import java.nio.file.FileSystems; 8.8 +import java.nio.file.FileVisitResult; 8.9 +import java.nio.file.Files; 8.10 +import java.nio.file.Path; 8.11 +import java.nio.file.attribute.BasicFileAttributes; 8.12 +import java.util.Stack; 8.13 +import java.util.Vector; 8.14 + 8.15 +public class FileTreeCreatorVC7 extends FileTreeCreator { 8.16 + 8.17 + public FileTreeCreatorVC7(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) { 8.18 + super(startDir, allConfigs, null); 8.19 + } 8.20 + 8.21 + @Override 8.22 + public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { 8.23 + DirAttributes currentFileAttr = attributes.peek().clone(); 8.24 + boolean usePch = false; 8.25 + boolean disablePch = false; 8.26 + boolean useIgnore = false; 8.27 + String fileName = file.getFileName().toString(); 8.28 + 8.29 + // usePch applies to all configs for a file. 8.30 + if (fileName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"))) { 8.31 + usePch = true; 8.32 + } 8.33 + 8.34 + for (BuildConfig cfg : allConfigs) { 8.35 + if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { 8.36 + useIgnore = true; 8.37 + currentFileAttr.setIgnore(cfg); 8.38 + } else if (cfg.matchesIgnoredPath(file.toAbsolutePath().toString())) { 8.39 + useIgnore = true; 8.40 + currentFileAttr.setIgnore(cfg); 8.41 + } 8.42 + 8.43 + if (cfg.lookupHashFieldInContext("DisablePch", fileName) != null) { 8.44 + disablePch = true; 8.45 + currentFileAttr.setDisablePch(cfg); 8.46 + } 8.47 + 8.48 + Vector<String> rv = new Vector<String>(); 8.49 + cfg.collectRelevantVectors(rv, "AdditionalFile"); 8.50 + for(String addFile : rv) { 8.51 + if (addFile.equals(fileName)) { 8.52 + // supress any ignore 8.53 + currentFileAttr.removeFromIgnored(cfg); 8.54 + } 8.55 + } 8.56 + } 8.57 + 8.58 + if (!useIgnore && !disablePch && !usePch) { 8.59 + wg.tag("File", new String[] { "RelativePath", vcProjLocation.relativize(file).toString()}); 8.60 + } else { 8.61 + wg.startTag( 8.62 + "File", 8.63 + new String[] { "RelativePath", vcProjLocation.relativize(file).toString()}); 8.64 + 8.65 + for (BuildConfig cfg : allConfigs) { 8.66 + boolean ignore = currentFileAttr.hasIgnore(cfg); 8.67 + String [] fileConfAttr; 8.68 + 8.69 + if (ignore) { 8.70 + fileConfAttr = new String[] {"Name", cfg.get("Name"), "ExcludedFromBuild", "TRUE" }; 8.71 + } else { 8.72 + fileConfAttr = new String[] {"Name", cfg.get("Name")}; 8.73 + } 8.74 + 8.75 + if (!disablePch && !usePch && !ignore) { 8.76 + continue; 8.77 + } else if (!disablePch && !usePch) { 8.78 + wg.tag("FileConfiguration", fileConfAttr); 8.79 + } else { 8.80 + wg.startTag("FileConfiguration", fileConfAttr); 8.81 + if (usePch) { 8.82 + // usePch always applies to all configs, might not always be so. 8.83 + wg.tag("Tool", new String[] { 8.84 + "Name", "VCCLCompilerTool", "UsePrecompiledHeader", 8.85 + "1" }); 8.86 + assert(!disablePch); 8.87 + } 8.88 + if (disablePch) { 8.89 + if (currentFileAttr.hasDisablePch(cfg)) { 8.90 + wg.tag("Tool", new String[] { 8.91 + "Name", "VCCLCompilerTool", "UsePrecompiledHeader", 8.92 + "0" }); 8.93 + } 8.94 + assert(!usePch); 8.95 + } 8.96 + wg.endTag(); 8.97 + } 8.98 + } 8.99 + wg.endTag(); 8.100 + } 8.101 + 8.102 + return CONTINUE; 8.103 + } 8.104 + 8.105 + @Override 8.106 + public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) 8.107 + throws IOException { 8.108 + Boolean hide = false; 8.109 + DirAttributes newAttr = attributes.peek().clone(); 8.110 + 8.111 + String rPath; 8.112 + if (path.toAbsolutePath().toString().equals(this.startDir.toAbsolutePath().toString())){ 8.113 + rPath = startDir.toString(); 8.114 + } else { 8.115 + rPath = path.getFileName().toString(); 8.116 + } 8.117 + 8.118 + // check per config ignorePaths! 8.119 + for (BuildConfig cfg : allConfigs) { 8.120 + if (cfg.matchesIgnoredPath(path.toAbsolutePath().toString())) { 8.121 + newAttr.setIgnore(cfg); 8.122 + } 8.123 + 8.124 + // Hide is always on all configs. And additional files are never hiddden 8.125 + if (cfg.matchesHidePath(path.toAbsolutePath().toString())) { 8.126 + hide = true; 8.127 + break; 8.128 + } 8.129 + } 8.130 + 8.131 + if (!hide) { 8.132 + wg.startTag("Filter", new String[] { 8.133 + "Name", rPath}); 8.134 + 8.135 + attributes.push(newAttr); 8.136 + return super.preVisitDirectory(path, attrs); 8.137 + } else { 8.138 + return FileVisitResult.SKIP_SUBTREE; 8.139 + } 8.140 + } 8.141 + 8.142 + @Override 8.143 + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { 8.144 + //end matching attributes set by ignorepath 8.145 + wg.endTag(); 8.146 + attributes.pop(); 8.147 + 8.148 + return CONTINUE; 8.149 + } 8.150 + 8.151 + @Override 8.152 + public FileVisitResult visitFileFailed(Path file, IOException exc) { 8.153 + return CONTINUE; 8.154 + } 8.155 + 8.156 + public void writeFileTree() throws IOException { 8.157 + Files.walkFileTree(this.startDir, this); 8.158 + } 8.159 + } 8.160 \ No newline at end of file
9.1 --- a/src/share/tools/ProjectCreator/ProjectCreator.java Mon Sep 24 17:59:24 2012 -0700 9.2 +++ b/src/share/tools/ProjectCreator/ProjectCreator.java Thu Mar 29 16:43:21 2012 +0200 9.3 @@ -24,75 +24,76 @@ 9.4 9.5 public class ProjectCreator { 9.6 9.7 - public static void usage() { 9.8 - System.out.println("ProjectCreator options:"); 9.9 - System.err.println("WinGammaPlatform platform-specific options:"); 9.10 - System.err.println(" -sourceBase <path to directory (workspace) " + 9.11 - "containing source files; no trailing slash>"); 9.12 - System.err.println(" -dspFileName <full pathname to which .dsp file " + 9.13 - "will be written; all parent directories must " + 9.14 - "already exist>"); 9.15 - System.err.println(" -envVar <environment variable to be inserted " + 9.16 - "into .dsp file, substituting for path given in " + 9.17 - "-sourceBase. Example: HotSpotWorkSpace>"); 9.18 - System.err.println(" -dllLoc <path to directory in which to put " + 9.19 - "jvm.dll and jvm_g.dll; no trailing slash>"); 9.20 - System.err.println(" If any of the above are specified, "+ 9.21 - "they must all be."); 9.22 - System.err.println(" Additional, optional arguments, which can be " + 9.23 - "specified multiple times:"); 9.24 - System.err.println(" -absoluteInclude <string containing absolute " + 9.25 - "path to include directory>"); 9.26 - System.err.println(" -relativeInclude <string containing include " + 9.27 - "directory relative to -envVar>"); 9.28 - System.err.println(" -define <preprocessor flag to be #defined " + 9.29 - "(note: doesn't yet support " + 9.30 - "#define (flag) (value))>"); 9.31 - System.err.println(" -perFileLine <file> <line>"); 9.32 - System.err.println(" -conditionalPerFileLine <file> <line for " + 9.33 - "release build> <line for debug build>"); 9.34 - System.err.println(" (NOTE: To work around a bug in nmake, where " + 9.35 - "you can't have a '#' character in a quoted " + 9.36 - "string, all of the lines outputted have \"#\"" + 9.37 - "prepended)"); 9.38 - System.err.println(" -startAt <subdir of sourceBase>"); 9.39 - System.err.println(" -ignoreFile <file which won't be able to be " + 9.40 - "found in the sourceBase because it's generated " + 9.41 - "later>"); 9.42 - System.err.println(" -additionalFile <file not in database but " + 9.43 - "which should show up in .dsp file>"); 9.44 - System.err.println(" -additionalGeneratedFile <environment variable of " + 9.45 - "generated file's location> <relative path to " + 9.46 - "directory containing file; no trailing slash> " + 9.47 - "<name of file generated later in the build process>"); 9.48 - System.err.println(" -prelink <build> <desc> <cmds>:"); 9.49 - System.err.println(" Generate a set of prelink commands for the given BUILD"); 9.50 - System.err.println(" (\"Debug\" or \"Release\"). The prelink description and commands"); 9.51 - System.err.println(" are both quoted strings."); 9.52 - System.err.println(" Default includes: \".\""); 9.53 - System.err.println(" Default defines: WIN32, _WINDOWS, \"HOTSPOT_BUILD_USER=$(USERNAME)\""); 9.54 - } 9.55 + public static void usage() { 9.56 + System.out.println("ProjectCreator options:"); 9.57 + System.err.println("WinGammaPlatform platform-specific options:"); 9.58 + System.err.println(" -sourceBase <path to directory (workspace) " 9.59 + + "containing source files; no trailing slash>"); 9.60 + System.err.println(" -dspFileName <full pathname to which .dsp file " 9.61 + + "will be written; all parent directories must " 9.62 + + "already exist>"); 9.63 + System.err.println(" -envVar <environment variable to be inserted " 9.64 + + "into .dsp file, substituting for path given in " 9.65 + + "-sourceBase. Example: HotSpotWorkSpace>"); 9.66 + System.err.println(" -dllLoc <path to directory in which to put " 9.67 + + "jvm.dll and jvm_g.dll; no trailing slash>"); 9.68 + System.err.println(" If any of the above are specified, " 9.69 + + "they must all be."); 9.70 + System.err.println(" Additional, optional arguments, which can be " 9.71 + + "specified multiple times:"); 9.72 + System.err.println(" -absoluteInclude <string containing absolute " 9.73 + + "path to include directory>"); 9.74 + System.err.println(" -relativeInclude <string containing include " 9.75 + + "directory relative to -envVar>"); 9.76 + System.err.println(" -define <preprocessor flag to be #defined " 9.77 + + "(note: doesn't yet support " + "#define (flag) (value))>"); 9.78 + System.err.println(" -perFileLine <file> <line>"); 9.79 + System.err.println(" -conditionalPerFileLine <file> <line for " 9.80 + + "release build> <line for debug build>"); 9.81 + System.err.println(" (NOTE: To work around a bug in nmake, where " 9.82 + + "you can't have a '#' character in a quoted " 9.83 + + "string, all of the lines outputted have \"#\"" + "prepended)"); 9.84 + System.err.println(" -startAt <subdir of sourceBase>"); 9.85 + System.err.println(" -ignoreFile <file which won't be able to be " 9.86 + + "found in the sourceBase because it's generated " + "later>"); 9.87 + System.err.println(" -additionalFile <file not in database but " 9.88 + + "which should show up in .dsp file>"); 9.89 + System.err 9.90 + .println(" -additionalGeneratedFile <environment variable of " 9.91 + + "generated file's location> <relative path to " 9.92 + + "directory containing file; no trailing slash> " 9.93 + + "<name of file generated later in the build process>"); 9.94 + System.err.println(" -prelink <build> <desc> <cmds>:"); 9.95 + System.err 9.96 + .println(" Generate a set of prelink commands for the given BUILD"); 9.97 + System.err 9.98 + .println(" (\"Debug\" or \"Release\"). The prelink description and commands"); 9.99 + System.err.println(" are both quoted strings."); 9.100 + System.err.println(" Default includes: \".\""); 9.101 + System.err 9.102 + .println(" Default defines: WIN32, _WINDOWS, \"HOTSPOT_BUILD_USER=$(USERNAME)\""); 9.103 + } 9.104 9.105 - public static void main(String[] args) { 9.106 - try { 9.107 - if (args.length < 3) { 9.108 - usage(); 9.109 - System.exit(1); 9.110 - } 9.111 + public static void main(String[] args) { 9.112 + try { 9.113 + if (args.length < 3) { 9.114 + usage(); 9.115 + System.exit(1); 9.116 + } 9.117 9.118 - String platformName = args[0]; 9.119 - Class platformClass = Class.forName(platformName); 9.120 - WinGammaPlatform platform = (WinGammaPlatform) platformClass.newInstance(); 9.121 + String platformName = args[0]; 9.122 + Class platformClass = Class.forName(platformName); 9.123 + WinGammaPlatform platform = (WinGammaPlatform) platformClass 9.124 + .newInstance(); 9.125 9.126 - String[] platformArgs = new String[args.length - 1]; 9.127 - System.arraycopy(args, 1, platformArgs, 0, platformArgs.length); 9.128 + String[] platformArgs = new String[args.length - 1]; 9.129 + System.arraycopy(args, 1, platformArgs, 0, platformArgs.length); 9.130 9.131 - // Allow the platform to write platform-specific files 9.132 - platform.createVcproj(platformArgs); 9.133 - } 9.134 - catch (Exception e) { 9.135 - e.printStackTrace(); 9.136 - System.exit(1); 9.137 - } 9.138 - } 9.139 + // Allow the platform to write platform-specific files 9.140 + platform.createVcproj(platformArgs); 9.141 + } catch (Exception e) { 9.142 + e.printStackTrace(); 9.143 + System.exit(1); 9.144 + } 9.145 + } 9.146 }
10.1 --- a/src/share/tools/ProjectCreator/Util.java Mon Sep 24 17:59:24 2012 -0700 10.2 +++ b/src/share/tools/ProjectCreator/Util.java Thu Mar 29 16:43:21 2012 +0200 10.3 @@ -26,18 +26,19 @@ 10.4 import java.io.File; 10.5 10.6 public class Util { 10.7 - static String join(String padder, Vector v) { 10.8 + 10.9 + static String join(String padder, Vector<String> v) { 10.10 return join(padder, v, false); 10.11 } 10.12 10.13 - static String join(String padder, Vector v, boolean quoted) { 10.14 + static String join(String padder, Vector<String> v, boolean quoted) { 10.15 StringBuffer sb = new StringBuffer(); 10.16 10.17 - for (Iterator iter = v.iterator(); iter.hasNext(); ) { 10.18 + for (Iterator<String> iter = v.iterator(); iter.hasNext(); ) { 10.19 if (quoted) { 10.20 sb.append('"'); 10.21 } 10.22 - sb.append((String)iter.next()); 10.23 + sb.append(iter.next()); 10.24 if (quoted) { 10.25 sb.append('"'); 10.26 } 10.27 @@ -48,10 +49,10 @@ 10.28 } 10.29 10.30 10.31 - static String prefixed_join(String padder, Vector v, boolean quoted) { 10.32 + static String prefixed_join(String padder, Vector<String> v, boolean quoted) { 10.33 StringBuffer sb = new StringBuffer(); 10.34 10.35 - for (Iterator iter = v.iterator(); iter.hasNext(); ) { 10.36 + for (Iterator<String> iter = v.iterator(); iter.hasNext(); ) { 10.37 sb.append(padder); 10.38 10.39 if (quoted) {
11.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatform.java Mon Sep 24 17:59:24 2012 -0700 11.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatform.java Thu Mar 29 16:43:21 2012 +0200 11.3 @@ -29,6 +29,7 @@ 11.4 import java.util.Hashtable; 11.5 import java.util.Iterator; 11.6 import java.util.List; 11.7 +import java.util.Stack; 11.8 import java.util.TreeSet; 11.9 import java.util.Vector; 11.10 11.11 @@ -218,69 +219,6 @@ 11.12 return false; 11.13 } 11.14 11.15 - /* This returns a String containing the full path to the passed 11.16 - file name, or null if an error occurred. If the file was not 11.17 - found or was a duplicate and couldn't be resolved using the 11.18 - preferred paths, the file name is added to the appropriate 11.19 - Vector of Strings. */ 11.20 - private String findFileInDirectory(String fileName, 11.21 - DirectoryTree directory, 11.22 - Vector preferredPaths, 11.23 - Vector filesNotFound, 11.24 - Vector filesDuplicate) { 11.25 - List locationsInTree = directory.findFile(fileName); 11.26 - int rootNameLength = directory.getRootNodeName().length(); 11.27 - String name = null; 11.28 - if ((locationsInTree == null) || 11.29 - (locationsInTree.size() == 0)) { 11.30 - filesNotFound.add(fileName); 11.31 - } else if (locationsInTree.size() > 1) { 11.32 - // Iterate through them, trying to find one with a 11.33 - // preferred path 11.34 - search: 11.35 - { 11.36 - for (Iterator locIter = locationsInTree.iterator(); 11.37 - locIter.hasNext(); ) { 11.38 - DirectoryTreeNode node = 11.39 - (DirectoryTreeNode) locIter.next(); 11.40 - String tmpName = node.getName(); 11.41 - for (Iterator prefIter = preferredPaths.iterator(); 11.42 - prefIter.hasNext(); ) { 11.43 - // We need to make sure the preferred path is 11.44 - // found from the file path not including the root node name. 11.45 - if (tmpName.indexOf((String)prefIter.next(), 11.46 - rootNameLength) != -1) { 11.47 - name = tmpName; 11.48 - break search; 11.49 - } 11.50 - } 11.51 - } 11.52 - } 11.53 - 11.54 - if (name == null) { 11.55 - filesDuplicate.add(fileName); 11.56 - } 11.57 - } else { 11.58 - name = ((DirectoryTreeNode) locationsInTree.get(0)).getName(); 11.59 - } 11.60 - 11.61 - return name; 11.62 - } 11.63 - 11.64 - protected String envVarPrefixedFileName(String fileName, 11.65 - int sourceBaseLen, 11.66 - DirectoryTree tree, 11.67 - Vector preferredPaths, 11.68 - Vector filesNotFound, 11.69 - Vector filesDuplicate) { 11.70 - String fullName = findFileInDirectory(fileName, 11.71 - tree, 11.72 - preferredPaths, 11.73 - filesNotFound, 11.74 - filesDuplicate); 11.75 - return fullName; 11.76 - } 11.77 - 11.78 String getProjectName(String fullPath, String extension) 11.79 throws IllegalArgumentException, IOException { 11.80 File file = new File(fullPath).getCanonicalFile(); 11.81 @@ -369,6 +307,12 @@ 11.82 HsArgHandler.STRING 11.83 ), 11.84 11.85 + new HsArgRule("-buildSpace", 11.86 + "BuildSpace", 11.87 + null, 11.88 + HsArgHandler.STRING 11.89 + ), 11.90 + 11.91 new HsArgRule("-platformName", 11.92 "PlatformName", 11.93 null, 11.94 @@ -405,6 +349,18 @@ 11.95 HsArgHandler.VECTOR 11.96 ), 11.97 11.98 + new HsArgRule("-absoluteSrcInclude", 11.99 + "AbsoluteSrcInclude", 11.100 + null, 11.101 + HsArgHandler.VECTOR 11.102 + ), 11.103 + 11.104 + new HsArgRule("-relativeSrcInclude", 11.105 + "RelativeSrcInclude", 11.106 + null, 11.107 + HsArgHandler.VECTOR 11.108 + ), 11.109 + 11.110 new HsArgRule("-define", 11.111 "Define", 11.112 null, 11.113 @@ -494,6 +450,12 @@ 11.114 HsArgHandler.VECTOR 11.115 ), 11.116 11.117 + new HsArgRule("-hidePath", 11.118 + "HidePath", 11.119 + null, 11.120 + HsArgHandler.VECTOR 11.121 + ), 11.122 + 11.123 new HsArgRule("-additionalFile", 11.124 "AdditionalFile", 11.125 null, 11.126 @@ -611,107 +573,101 @@ 11.127 return allConfigs; 11.128 } 11.129 11.130 - class FileAttribute { 11.131 - int numConfigs; 11.132 - Vector configs; 11.133 - String shortName; 11.134 - boolean noPch, pchRoot; 11.135 - 11.136 - FileAttribute(String shortName, BuildConfig cfg, int numConfigs) { 11.137 - this.shortName = shortName; 11.138 - this.noPch = (cfg.lookupHashFieldInContext("DisablePch", shortName) != null); 11.139 - this.pchRoot = shortName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch")); 11.140 - this.numConfigs = numConfigs; 11.141 - 11.142 - configs = new Vector(); 11.143 - add(cfg.get("Name")); 11.144 - } 11.145 - 11.146 - void add(String confName) { 11.147 - configs.add(confName); 11.148 - 11.149 - // if presented in all configs 11.150 - if (configs.size() == numConfigs) { 11.151 - configs = null; 11.152 - } 11.153 - } 11.154 - } 11.155 - 11.156 - class FileInfo implements Comparable { 11.157 - String full; 11.158 - FileAttribute attr; 11.159 - 11.160 - FileInfo(String full, FileAttribute attr) { 11.161 - this.full = full; 11.162 - this.attr = attr; 11.163 - } 11.164 - 11.165 - public int compareTo(Object o) { 11.166 - FileInfo oo = (FileInfo)o; 11.167 - return full.compareTo(oo.full); 11.168 - } 11.169 - 11.170 - boolean isHeader() { 11.171 - return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp"); 11.172 - } 11.173 - 11.174 - boolean isCpp() { 11.175 - return attr.shortName.endsWith(".cpp"); 11.176 - } 11.177 - } 11.178 - 11.179 - 11.180 - TreeSet sortFiles(Hashtable allFiles) { 11.181 - TreeSet rv = new TreeSet(); 11.182 - Enumeration e = allFiles.keys(); 11.183 - while (e.hasMoreElements()) { 11.184 - String fullPath = (String)e.nextElement(); 11.185 - rv.add(new FileInfo(fullPath, (FileAttribute)allFiles.get(fullPath))); 11.186 - } 11.187 - return rv; 11.188 - } 11.189 - 11.190 - Hashtable computeAttributedFiles(Vector allConfigs) { 11.191 - Hashtable ht = new Hashtable(); 11.192 - int numConfigs = allConfigs.size(); 11.193 - 11.194 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 11.195 - BuildConfig bc = (BuildConfig)i.next(); 11.196 - Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash"); 11.197 - String confName = bc.get("Name"); 11.198 - 11.199 - for (Enumeration e=confFiles.keys(); e.hasMoreElements(); ) { 11.200 - String filePath = (String)e.nextElement(); 11.201 - FileAttribute fa = (FileAttribute)ht.get(filePath); 11.202 - 11.203 - if (fa == null) { 11.204 - fa = new FileAttribute((String)confFiles.get(filePath), bc, numConfigs); 11.205 - ht.put(filePath, fa); 11.206 - } else { 11.207 - fa.add(confName); 11.208 - } 11.209 - } 11.210 - } 11.211 - 11.212 - return ht; 11.213 - } 11.214 - 11.215 - Hashtable computeAttributedFiles(BuildConfig bc) { 11.216 - Hashtable ht = new Hashtable(); 11.217 - Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash"); 11.218 - 11.219 - for (Enumeration e = confFiles.keys(); e.hasMoreElements(); ) { 11.220 - String filePath = (String)e.nextElement(); 11.221 - ht.put(filePath, new FileAttribute((String)confFiles.get(filePath), bc, 1)); 11.222 - } 11.223 - 11.224 - return ht; 11.225 - } 11.226 - 11.227 PrintWriter printWriter; 11.228 11.229 public void writeProjectFile(String projectFileName, String projectName, 11.230 Vector<BuildConfig> allConfigs) throws IOException { 11.231 throw new RuntimeException("use compiler version specific version"); 11.232 } 11.233 + 11.234 + int indent; 11.235 + private Stack<String> tagStack = new Stack<String>(); 11.236 + 11.237 + private void startTagPrim(String name, String[] attrs, boolean close) { 11.238 + startTagPrim(name, attrs, close, true); 11.239 + } 11.240 + 11.241 + private void startTagPrim(String name, String[] attrs, boolean close, 11.242 + boolean newline) { 11.243 + doIndent(); 11.244 + printWriter.print("<" + name); 11.245 + indent++; 11.246 + 11.247 + if (attrs != null && attrs.length > 0) { 11.248 + for (int i = 0; i < attrs.length; i += 2) { 11.249 + printWriter.print(" " + attrs[i] + "=\"" + attrs[i + 1] + "\""); 11.250 + if (i < attrs.length - 2) { 11.251 + } 11.252 + } 11.253 + } 11.254 + 11.255 + if (close) { 11.256 + indent--; 11.257 + printWriter.print(" />"); 11.258 + } else { 11.259 + // TODO push tag name, and change endTag to pop and print. 11.260 + tagStack.push(name); 11.261 + printWriter.print(">"); 11.262 + } 11.263 + if (newline) { 11.264 + printWriter.println(); 11.265 + } 11.266 + } 11.267 + 11.268 + void startTag(String name, String... attrs) { 11.269 + startTagPrim(name, attrs, false); 11.270 + } 11.271 + 11.272 + void startTagV(String name, Vector attrs) { 11.273 + String s[] = new String[attrs.size()]; 11.274 + for (int i = 0; i < attrs.size(); i++) { 11.275 + s[i] = (String) attrs.elementAt(i); 11.276 + } 11.277 + startTagPrim(name, s, false); 11.278 + } 11.279 + 11.280 + void endTag() { 11.281 + String name = tagStack.pop(); 11.282 + indent--; 11.283 + doIndent(); 11.284 + printWriter.println("</" + name + ">"); 11.285 + } 11.286 + 11.287 + private void endTagNoIndent() { 11.288 + String name = tagStack.pop(); 11.289 + indent--; 11.290 + printWriter.println("</" + name + ">"); 11.291 + } 11.292 + 11.293 + void tag(String name, String... attrs) { 11.294 + startTagPrim(name, attrs, true); 11.295 + } 11.296 + 11.297 + void tagData(String name, String data) { 11.298 + startTagPrim(name, null, false, false); 11.299 + printWriter.print(data); 11.300 + endTagNoIndent(); 11.301 + } 11.302 + 11.303 + void tagData(String name, String data, String... attrs) { 11.304 + startTagPrim(name, attrs, false, false); 11.305 + printWriter.print(data); 11.306 + endTagNoIndent(); 11.307 + } 11.308 + 11.309 + void tagV(String name, Vector attrs) { 11.310 + String s[] = new String[attrs.size()]; 11.311 + for (int i = 0; i < attrs.size(); i++) { 11.312 + s[i] = (String) attrs.elementAt(i); 11.313 + } 11.314 + startTagPrim(name, s, true); 11.315 + } 11.316 + 11.317 + void doIndent() { 11.318 + for (int i = 0; i < indent; i++) { 11.319 + printWriter.print(" "); 11.320 + } 11.321 + } 11.322 + 11.323 + 11.324 }
12.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Mon Sep 24 17:59:24 2012 -0700 12.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Thu Mar 29 16:43:21 2012 +0200 12.3 @@ -3,14 +3,18 @@ 12.4 import java.io.IOException; 12.5 import java.io.PrintWriter; 12.6 import java.io.UnsupportedEncodingException; 12.7 -import java.util.Hashtable; 12.8 +import java.nio.file.FileSystems; 12.9 import java.util.Iterator; 12.10 -import java.util.TreeSet; 12.11 +import java.util.LinkedList; 12.12 import java.util.UUID; 12.13 import java.util.Vector; 12.14 12.15 public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 { 12.16 12.17 + 12.18 + LinkedList <String>filters = new LinkedList<String>(); 12.19 + LinkedList <String[]>filterDeps = new LinkedList<String[]>(); 12.20 + 12.21 @Override 12.22 protected String getProjectExt() { 12.23 return ".vcxproj"; 12.24 @@ -37,15 +41,15 @@ 12.25 "Include", cfg.get("Name")); 12.26 tagData("Configuration", cfg.get("Id")); 12.27 tagData("Platform", cfg.get("PlatformName")); 12.28 - endTag("ProjectConfiguration"); 12.29 + endTag(); 12.30 } 12.31 - endTag("ItemGroup"); 12.32 + endTag(); 12.33 12.34 startTag("PropertyGroup", "Label", "Globals"); 12.35 tagData("ProjectGuid", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}"); 12.36 tag("SccProjectName"); 12.37 tag("SccLocalPath"); 12.38 - endTag("PropertyGroup"); 12.39 + endTag(); 12.40 12.41 tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); 12.42 12.43 @@ -53,19 +57,19 @@ 12.44 startTag(cfg, "PropertyGroup", "Label", "Configuration"); 12.45 tagData("ConfigurationType", "DynamicLibrary"); 12.46 tagData("UseOfMfc", "false"); 12.47 - endTag("PropertyGroup"); 12.48 + endTag(); 12.49 } 12.50 12.51 tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); 12.52 startTag("ImportGroup", "Label", "ExtensionSettings"); 12.53 - endTag("ImportGroup"); 12.54 + endTag(); 12.55 for (BuildConfig cfg : allConfigs) { 12.56 startTag(cfg, "ImportGroup", "Label", "PropertySheets"); 12.57 tag("Import", 12.58 "Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props", 12.59 "Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')", 12.60 "Label", "LocalAppDataPlatform"); 12.61 - endTag("ImportGroup"); 12.62 + endTag(); 12.63 } 12.64 12.65 tag("PropertyGroup", "Label", "UserMacros"); 12.66 @@ -82,38 +86,38 @@ 12.67 tag(cfg, "CodeAnalysisRules"); 12.68 tag(cfg, "CodeAnalysisRuleAssemblies"); 12.69 } 12.70 - endTag("PropertyGroup"); 12.71 + endTag(); 12.72 12.73 for (BuildConfig cfg : allConfigs) { 12.74 startTag(cfg, "ItemDefinitionGroup"); 12.75 startTag("ClCompile"); 12.76 tagV(cfg.getV("CompilerFlags")); 12.77 - endTag("ClCompile"); 12.78 + endTag(); 12.79 12.80 startTag("Link"); 12.81 tagV(cfg.getV("LinkerFlags")); 12.82 - endTag("Link"); 12.83 + endTag(); 12.84 12.85 startTag("PostBuildEvent"); 12.86 tagData("Message", BuildConfig.getFieldString(null, "PostbuildDescription")); 12.87 tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace("\t", "\r\n"))); 12.88 - endTag("PostBuildEvent"); 12.89 + endTag(); 12.90 12.91 startTag("PreLinkEvent"); 12.92 tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription")); 12.93 tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n"))); 12.94 - endTag("PreLinkEvent"); 12.95 + endTag(); 12.96 12.97 - endTag("ItemDefinitionGroup"); 12.98 + endTag(); 12.99 } 12.100 12.101 writeFiles(allConfigs, projDir); 12.102 12.103 tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); 12.104 startTag("ImportGroup", "Label", "ExtensionTargets"); 12.105 - endTag("ImportGroup"); 12.106 + endTag(); 12.107 12.108 - endTag("Project"); 12.109 + endTag(); 12.110 printWriter.close(); 12.111 System.out.println(" Done."); 12.112 12.113 @@ -138,14 +142,22 @@ 12.114 for (BuildConfig cfg : allConfigs) { 12.115 startTag(cfg, "PropertyGroup"); 12.116 tagData("LocalDebuggerCommand", "$(TargetDir)/hotspot.exe"); 12.117 - endTag("PropertyGroup"); 12.118 + endTag(); 12.119 } 12.120 12.121 - endTag("Project"); 12.122 + endTag(); 12.123 printWriter.close(); 12.124 System.out.println(" Done."); 12.125 } 12.126 12.127 + public void addFilter(String rPath) { 12.128 + filters.add(rPath); 12.129 + } 12.130 + 12.131 + public void addFilterDependency(String fileLoc, String filter) { 12.132 + filterDeps.add(new String[] {fileLoc, filter}); 12.133 + } 12.134 + 12.135 private void writeFilterFile(String projectFileName, String projectName, 12.136 Vector<BuildConfig> allConfigs, String base) throws FileNotFoundException, UnsupportedEncodingException { 12.137 String filterFileName = projectFileName + ".filters"; 12.138 @@ -157,210 +169,92 @@ 12.139 "ToolsVersion", "4.0", 12.140 "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); 12.141 12.142 - Hashtable<String, FileAttribute> allFiles = computeAttributedFiles(allConfigs); 12.143 - TreeSet<FileInfo> sortedFiles = sortFiles(allFiles); 12.144 - Vector<NameFilter> filters = makeFilters(sortedFiles); 12.145 - 12.146 - // first all filters 12.147 startTag("ItemGroup"); 12.148 - for (NameFilter filter : filters) { 12.149 - doWriteFilter(filter, ""); 12.150 + for (String filter : filters) { 12.151 + startTag("Filter", "Include",filter); 12.152 + UUID uuid = UUID.randomUUID(); 12.153 + tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); 12.154 + endTag(); 12.155 } 12.156 startTag("Filter", "Include", "Resource Files"); 12.157 UUID uuid = UUID.randomUUID(); 12.158 tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); 12.159 tagData("Extensions", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"); 12.160 - endTag("Filter"); 12.161 - endTag("ItemGroup"); 12.162 + endTag(); 12.163 + endTag(); 12.164 12.165 - // then all cpp files 12.166 + //TODO - do I need to split cpp and hpp files? 12.167 + 12.168 + // then all files 12.169 startTag("ItemGroup"); 12.170 - for (NameFilter filter : filters) { 12.171 - doWriteFiles(sortedFiles, filter, "", "ClCompile", new Evaluator() { 12.172 - public boolean pick(FileInfo fi) { 12.173 - return fi.isCpp(); 12.174 - } 12.175 - }, base); 12.176 + for (String[] dep : filterDeps) { 12.177 + String tagName = getFileTagFromSuffix(dep[0]); 12.178 + 12.179 + startTag(tagName, "Include", dep[0]); 12.180 + tagData("Filter", dep[1]); 12.181 + endTag(); 12.182 } 12.183 - endTag("ItemGroup"); 12.184 + endTag(); 12.185 12.186 - // then all header files 12.187 - startTag("ItemGroup"); 12.188 - for (NameFilter filter : filters) { 12.189 - doWriteFiles(sortedFiles, filter, "", "ClInclude", new Evaluator() { 12.190 - public boolean pick(FileInfo fi) { 12.191 - return fi.isHeader(); 12.192 - } 12.193 - }, base); 12.194 - } 12.195 - endTag("ItemGroup"); 12.196 - 12.197 - // then all other files 12.198 - startTag("ItemGroup"); 12.199 - for (NameFilter filter : filters) { 12.200 - doWriteFiles(sortedFiles, filter, "", "None", new Evaluator() { 12.201 - public boolean pick(FileInfo fi) { 12.202 - return true; 12.203 - } 12.204 - }, base); 12.205 - } 12.206 - endTag("ItemGroup"); 12.207 - 12.208 - endTag("Project"); 12.209 + endTag(); 12.210 printWriter.close(); 12.211 System.out.println(" Done."); 12.212 } 12.213 12.214 - 12.215 - private void doWriteFilter(NameFilter filter, String start) { 12.216 - startTag("Filter", "Include", start + filter.fname); 12.217 - UUID uuid = UUID.randomUUID(); 12.218 - tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); 12.219 - endTag("Filter"); 12.220 - if (filter instanceof ContainerFilter) { 12.221 - Iterator i = ((ContainerFilter)filter).babies(); 12.222 - while (i.hasNext()) { 12.223 - doWriteFilter((NameFilter)i.next(), start + filter.fname + "\\"); 12.224 - } 12.225 - } 12.226 + public String getFileTagFromSuffix(String fileName) { 12.227 + if (fileName.endsWith(".cpp")) { 12.228 + return"ClCompile"; 12.229 + } else if (fileName.endsWith(".c")) { 12.230 + return "ClCompile"; 12.231 + } else if (fileName.endsWith(".hpp")) { 12.232 + return"ClInclude"; 12.233 + } else if (fileName.endsWith(".h")) { 12.234 + return "ClInclude"; 12.235 + } else { 12.236 + return"None"; 12.237 + } 12.238 } 12.239 12.240 - interface Evaluator { 12.241 - boolean pick(FileInfo fi); 12.242 + void writeFiles(Vector<BuildConfig> allConfigs, String projDir) { 12.243 + // This code assummes there are no config specific includes. 12.244 + startTag("ItemGroup"); 12.245 + 12.246 + String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); 12.247 + 12.248 + // Use first config for all global absolute includes. 12.249 + BuildConfig baseConfig = allConfigs.firstElement(); 12.250 + Vector<String> rv = new Vector<String>(); 12.251 + 12.252 + // Then use first config for all relative includes 12.253 + Vector<String> ri = new Vector<String>(); 12.254 + baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); 12.255 + for (String f : ri) { 12.256 + rv.add(sourceBase + Util.sep + f); 12.257 + } 12.258 + 12.259 + baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); 12.260 + 12.261 + handleIncludes(rv, allConfigs); 12.262 + 12.263 + endTag(); 12.264 } 12.265 12.266 - private void doWriteFiles(TreeSet<FileInfo> allFiles, NameFilter filter, String start, String tool, Evaluator eval, String base) { 12.267 - if (filter instanceof ContainerFilter) { 12.268 - Iterator i = ((ContainerFilter)filter).babies(); 12.269 - while (i.hasNext()) { 12.270 - doWriteFiles(allFiles, (NameFilter)i.next(), start + filter.fname + "\\", tool, eval, base); 12.271 - } 12.272 - } 12.273 - else { 12.274 - Iterator i = allFiles.iterator(); 12.275 - while (i.hasNext()) { 12.276 - FileInfo fi = (FileInfo)i.next(); 12.277 - 12.278 - if (!filter.match(fi)) { 12.279 - continue; 12.280 - } 12.281 - if (eval.pick(fi)) { 12.282 - startTag(tool, "Include", rel(fi.full, base)); 12.283 - tagData("Filter", start + filter.fname); 12.284 - endTag(tool); 12.285 - 12.286 - // we not gonna look at this file anymore (sic!) 12.287 - i.remove(); 12.288 - } 12.289 - } 12.290 - } 12.291 - } 12.292 - 12.293 - 12.294 - void writeFiles(Vector<BuildConfig> allConfigs, String projDir) { 12.295 - Hashtable<String, FileAttribute> allFiles = computeAttributedFiles(allConfigs); 12.296 - TreeSet<FileInfo> sortedFiles = sortFiles(allFiles); 12.297 - 12.298 - // first cpp-files 12.299 - startTag("ItemGroup"); 12.300 - for (FileInfo fi : sortedFiles) { 12.301 - if (!fi.isCpp()) { 12.302 - continue; 12.303 - } 12.304 - writeFile("ClCompile", allConfigs, fi, projDir); 12.305 - } 12.306 - endTag("ItemGroup"); 12.307 - 12.308 - // then header-files 12.309 - startTag("ItemGroup"); 12.310 - for (FileInfo fi : sortedFiles) { 12.311 - if (!fi.isHeader()) { 12.312 - continue; 12.313 - } 12.314 - writeFile("ClInclude", allConfigs, fi, projDir); 12.315 - } 12.316 - endTag("ItemGroup"); 12.317 - 12.318 - // then others 12.319 - startTag("ItemGroup"); 12.320 - for (FileInfo fi : sortedFiles) { 12.321 - if (fi.isHeader() || fi.isCpp()) { 12.322 - continue; 12.323 - } 12.324 - writeFile("None", allConfigs, fi, projDir); 12.325 - } 12.326 - endTag("ItemGroup"); 12.327 - } 12.328 - 12.329 - /** 12.330 - * Make "path" into a relative path using "base" as the base. 12.331 - * 12.332 - * path and base are assumed to be normalized with / as the file separator. 12.333 - * returned path uses "\\" as file separator 12.334 - */ 12.335 - private String rel(String path, String base) 12.336 - { 12.337 - if(!base.endsWith("/")) { 12.338 - base += "/"; 12.339 - } 12.340 - String[] pathTok = path.split("/"); 12.341 - String[] baseTok = base.split("/"); 12.342 - int pi = 0; 12.343 - int bi = 0; 12.344 - StringBuilder newPath = new StringBuilder(); 12.345 - 12.346 - // first step past all path components that are the same 12.347 - while (pi < pathTok.length && 12.348 - bi < baseTok.length && 12.349 - pathTok[pi].equals(baseTok[bi])) { 12.350 - pi++; 12.351 - bi++; 12.352 - } 12.353 - 12.354 - // for each path component left in base, add "../" 12.355 - while (bi < baseTok.length) { 12.356 - bi++; 12.357 - newPath.append("..\\"); 12.358 - } 12.359 - 12.360 - // now add everything left in path 12.361 - while (pi < pathTok.length) { 12.362 - newPath.append(pathTok[pi]); 12.363 - pi++; 12.364 - if (pi != pathTok.length) { 12.365 - newPath.append("\\"); 12.366 - } 12.367 - } 12.368 - return newPath.toString(); 12.369 - } 12.370 - 12.371 - private void writeFile(String tool, Vector<BuildConfig> allConfigs, FileInfo fi, String base) { 12.372 - if (fi.attr.configs == null && fi.attr.pchRoot == false && fi.attr.noPch == false) { 12.373 - tag(tool, "Include", rel(fi.full, base)); 12.374 - } 12.375 - else { 12.376 - startTag(tool, "Include", rel(fi.full, base)); 12.377 - for (BuildConfig cfg : allConfigs) { 12.378 - if (fi.attr.configs != null && !fi.attr.configs.contains(cfg.get("Name"))) { 12.379 - tagData(cfg, "ExcludedFromBuild", "true"); 12.380 - } 12.381 - if (fi.attr.pchRoot) { 12.382 - tagData(cfg, "PrecompiledHeader", "Create"); 12.383 - } 12.384 - if (fi.attr.noPch) { 12.385 - startTag(cfg, "PrecompiledHeader"); 12.386 - endTag("PrecompiledHeader"); 12.387 - } 12.388 - } 12.389 - endTag(tool); 12.390 - } 12.391 + // Will visit file tree for each include 12.392 + private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) { 12.393 + for (String path : includes) { 12.394 + FileTreeCreatorVC10 ftc = new FileTreeCreatorVC10(FileSystems.getDefault().getPath(path) , allConfigs, this); 12.395 + try { 12.396 + ftc.writeFileTree(); 12.397 + } catch (IOException e) { 12.398 + e.printStackTrace(); 12.399 + } 12.400 + } 12.401 } 12.402 12.403 String buildCond(BuildConfig cfg) { 12.404 return "'$(Configuration)|$(Platform)'=='"+cfg.get("Name")+"'"; 12.405 } 12.406 12.407 - 12.408 void tagV(Vector<String> v) { 12.409 Iterator<String> i = v.iterator(); 12.410 while(i.hasNext()) { 12.411 @@ -391,6 +285,7 @@ 12.412 12.413 startTag(name, ss); 12.414 } 12.415 + 12.416 } 12.417 12.418 class CompilerInterfaceVC10 extends CompilerInterface {
13.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC6.java Mon Sep 24 17:59:24 2012 -0700 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,297 +0,0 @@ 13.4 -/* 13.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 13.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 - * 13.8 - * This code is free software; you can redistribute it and/or modify it 13.9 - * under the terms of the GNU General Public License version 2 only, as 13.10 - * published by the Free Software Foundation. 13.11 - * 13.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 - * version 2 for more details (a copy is included in the LICENSE file that 13.16 - * accompanied this code). 13.17 - * 13.18 - * You should have received a copy of the GNU General Public License version 13.19 - * 2 along with this work; if not, write to the Free Software Foundation, 13.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 - * 13.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 - * or visit www.oracle.com if you need additional information or have any 13.24 - * questions. 13.25 - * 13.26 - */ 13.27 - 13.28 -import java.io.*; 13.29 -import java.util.*; 13.30 - 13.31 -public class WinGammaPlatformVC6 extends WinGammaPlatform { 13.32 - public void writeProjectFile(String projectFileName, String projectName, 13.33 - Vector allConfigs) throws IOException { 13.34 - Vector allConfigNames = new Vector(); 13.35 - 13.36 - printWriter = new PrintWriter(new FileWriter(projectFileName)); 13.37 - String cfg = ((BuildConfig)allConfigs.get(0)).get("Name"); 13.38 - 13.39 - printWriter.println("# Microsoft Developer Studio Project File - Name=\"" + projectName + "\" - Package Owner=<4>"); 13.40 - printWriter.println("# Microsoft Developer Studio Generated Build File, Format Version 6.00"); 13.41 - printWriter.println("# ** DO NOT EDIT **"); 13.42 - printWriter.println(""); 13.43 - printWriter.println("# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102"); 13.44 - printWriter.println("CFG=" + cfg); 13.45 - printWriter.println(""); 13.46 - 13.47 - printWriter.println("!MESSAGE This is not a valid makefile. To build this project using NMAKE,"); 13.48 - printWriter.println("!MESSAGE use the Export Makefile command and run"); 13.49 - printWriter.println("!MESSAGE "); 13.50 - printWriter.println("!MESSAGE NMAKE /f \"" + projectName + ".mak\"."); 13.51 - printWriter.println("!MESSAGE "); 13.52 - printWriter.println("!MESSAGE You can specify a configuration when running NMAKE"); 13.53 - printWriter.println("!MESSAGE by defining the macro CFG on the command line. For example:"); 13.54 - printWriter.println("!MESSAGE "); 13.55 - printWriter.println("!MESSAGE NMAKE /f \"" + projectName + ".mak\" CFG=\"" + cfg + "\""); 13.56 - printWriter.println("!MESSAGE "); 13.57 - printWriter.println("!MESSAGE Possible choices for configuration are:"); 13.58 - printWriter.println("!MESSAGE "); 13.59 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 13.60 - String name = ((BuildConfig)i.next()).get("Name"); 13.61 - printWriter.println("!MESSAGE \""+ name + "\" (based on \"Win32 (x86) Dynamic-Link Library\")"); 13.62 - allConfigNames.add(name); 13.63 - } 13.64 - printWriter.println("!MESSAGE "); 13.65 - printWriter.println(""); 13.66 - 13.67 - printWriter.println("# Begin Project"); 13.68 - printWriter.println("# PROP AllowPerConfigDependencies 0"); 13.69 - printWriter.println("# PROP Scc_ProjName \"\""); 13.70 - printWriter.println("# PROP Scc_LocalPath \"\""); 13.71 - printWriter.println("CPP=cl.exe"); 13.72 - printWriter.println("MTL=midl.exe"); 13.73 - printWriter.println("RSC=rc.exe"); 13.74 - 13.75 - 13.76 - String keyword = "!IF"; 13.77 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 13.78 - BuildConfig bcfg = (BuildConfig)i.next(); 13.79 - printWriter.println(keyword + " \"$(CFG)\" == \"" + bcfg.get("Name") + "\""); 13.80 - writeConfigHeader(bcfg); 13.81 - keyword = "!ELSEIF"; 13.82 - if (!i.hasNext()) printWriter.println("!ENDIF"); 13.83 - } 13.84 - 13.85 - 13.86 - TreeSet sortedFiles = sortFiles(computeAttributedFiles(allConfigs)); 13.87 - 13.88 - printWriter.println("# Begin Target"); 13.89 - 13.90 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 13.91 - printWriter.println("# Name \"" + ((BuildConfig)i.next()).get("Name") + "\""); 13.92 - } 13.93 - printWriter.println("# Begin Group \"Header Files\""); 13.94 - printWriter.println("# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\""); 13.95 - 13.96 - Iterator i = sortedFiles.iterator(); 13.97 - 13.98 - while (i.hasNext()) { 13.99 - FileInfo fi = (FileInfo)i.next(); 13.100 - 13.101 - // skip sources 13.102 - if (!fi.isHeader()) { 13.103 - continue; 13.104 - } 13.105 - 13.106 - printFile(fi, allConfigNames); 13.107 - } 13.108 - printWriter.println("# End Group"); 13.109 - printWriter.println(""); 13.110 - 13.111 - printWriter.println("# Begin Group \"Source Files\""); 13.112 - printWriter.println("# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\""); 13.113 - 13.114 - i = sortedFiles.iterator(); 13.115 - while (i.hasNext()) { 13.116 - FileInfo fi = (FileInfo)i.next(); 13.117 - 13.118 - // skip headers 13.119 - if (fi.isHeader()) { 13.120 - continue; 13.121 - } 13.122 - 13.123 - printFile(fi, allConfigNames); 13.124 - } 13.125 - printWriter.println("# End Group"); 13.126 - printWriter.println(""); 13.127 - 13.128 - 13.129 - printWriter.println("# Begin Group \"Resource Files\""); 13.130 - printWriter.println("# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\""); 13.131 - printWriter.println("# End Group"); 13.132 - printWriter.println(""); 13.133 - printWriter.println("# End Target"); 13.134 - 13.135 - printWriter.println("# End Project"); 13.136 - 13.137 - printWriter.close(); 13.138 - } 13.139 - 13.140 - 13.141 - void printFile(FileInfo fi, Vector allConfigNames) { 13.142 - printWriter.println("# Begin Source File"); 13.143 - printWriter.println(""); 13.144 - printWriter.println("SOURCE=\"" + fi.full + "\""); 13.145 - FileAttribute attr = fi.attr; 13.146 - 13.147 - if (attr.noPch) { 13.148 - printWriter.println("# SUBTRACT CPP /YX /Yc /Yu"); 13.149 - } 13.150 - 13.151 - if (attr.pchRoot) { 13.152 - printWriter.println("# ADD CPP /Yc\"incls/_precompiled.incl\""); 13.153 - } 13.154 - if (attr.configs != null) { 13.155 - String keyword = "!IF"; 13.156 - for (Iterator j=allConfigNames.iterator(); j.hasNext();) { 13.157 - String cfg = (String)j.next(); 13.158 - if (!attr.configs.contains(cfg)) { 13.159 - printWriter.println(keyword+" \"$(CFG)\" == \"" + cfg +"\""); 13.160 - printWriter.println("# PROP BASE Exclude_From_Build 1"); 13.161 - printWriter.println("# PROP Exclude_From_Build 1"); 13.162 - keyword = "!ELSEIF"; 13.163 - } 13.164 - } 13.165 - printWriter.println("!ENDIF"); 13.166 - } 13.167 - 13.168 - printWriter.println("# End Source File"); 13.169 - } 13.170 - 13.171 - void writeConfigHeader(BuildConfig cfg) { 13.172 - printWriter.println("# Begin Special Build Tool"); 13.173 - printWriter.println("SOURCE=\"$(InputPath)\""); 13.174 - printWriter.println("PreLink_Desc=" + BuildConfig.getFieldString(null, "PrelinkDescription")); 13.175 - printWriter.println("PreLink_Cmds=" + 13.176 - cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand"))); 13.177 - printWriter.println("# End Special Build Tool"); 13.178 - printWriter.println(""); 13.179 - 13.180 - for (Iterator i = cfg.getV("CompilerFlags").iterator(); i.hasNext(); ) { 13.181 - printWriter.println("# "+(String)i.next()); 13.182 - } 13.183 - 13.184 - 13.185 - printWriter.println("LINK32=link.exe"); 13.186 - 13.187 - for (Iterator i = cfg.getV("LinkerFlags").iterator(); i.hasNext(); ) { 13.188 - printWriter.println("# "+(String)i.next()); 13.189 - } 13.190 - 13.191 - printWriter.println("ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32"); 13.192 - printWriter.println("ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32"); 13.193 - printWriter.println("ADD BASE RSC /l 0x409 /d \"_DEBUG\""); 13.194 - printWriter.println("ADD RSC /l 0x409 /d \"_DEBUG\""); 13.195 - printWriter.println("BSC32=bscmake.exe"); 13.196 - printWriter.println("ADD BASE BSC32 /nologo"); 13.197 - printWriter.println("ADD BSC32 /nologo"); 13.198 - printWriter.println(""); 13.199 - } 13.200 - 13.201 - protected String getProjectExt() { 13.202 - return ".dsp"; 13.203 - } 13.204 -} 13.205 - 13.206 - 13.207 -class CompilerInterfaceVC6 extends CompilerInterface { 13.208 - Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { 13.209 - Vector rv = new Vector(); 13.210 - 13.211 - rv.add("PROP BASE Use_MFC 0"); 13.212 - rv.add("PROP Use_MFC 0"); 13.213 - rv.add("ADD CPP /nologo /MT /W3 /WX /GX /YX /Fr /FD /c"); 13.214 - rv.add("PROP BASE Output_Dir \""+outDir+"\""); 13.215 - rv.add("PROP Output_Dir \""+outDir+"\""); 13.216 - rv.add("PROP BASE Intermediate_Dir \""+outDir+"\""); 13.217 - rv.add("PROP Intermediate_Dir \""+outDir+"\""); 13.218 - rv.add("PROP BASE Target_Dir \"\""); 13.219 - rv.add("PROP Target_Dir \"\""); 13.220 - rv.add("ADD BASE CPP "+Util.prefixed_join(" /I ", includes, true)); 13.221 - rv.add("ADD CPP "+Util.prefixed_join(" /I ", includes, true)); 13.222 - rv.add("ADD BASE CPP "+Util.prefixed_join(" /D ", defines, true)); 13.223 - rv.add("ADD CPP "+Util.prefixed_join(" /D ", defines, true)); 13.224 - rv.add("ADD CPP /Yu\"incls/_precompiled.incl\""); 13.225 - 13.226 - return rv; 13.227 - } 13.228 - 13.229 - Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { 13.230 - Vector rv = new Vector(); 13.231 - 13.232 - rv.add("PROP Ignore_Export_Lib 0"); 13.233 - rv.add("ADD BASE CPP /MD"); 13.234 - rv.add("ADD CPP /MD"); 13.235 - rv.add("ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib " + 13.236 - " advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib"); 13.237 - String machine = "/machine:I386"; 13.238 - if (platformName.equals("x64")) { 13.239 - machine = "/machine:X64"; 13.240 - } 13.241 - rv.add("ADD LINK32 /out:\""+outDll+"\" "+ 13.242 - " /nologo /subsystem:windows /machine:" + machine + 13.243 - " /nologo /base:\"0x8000000\" /subsystem:windows /dll" + 13.244 - " /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM /export:JNI_GetCreatedJavaVMs "+ 13.245 - " /export:jio_snprintf /export:jio_printf /export:jio_fprintf /export:jio_vfprintf "+ 13.246 - " /export:jio_vsnprintf "); 13.247 - rv.add("SUBTRACT LINK32 /pdb:none /map"); 13.248 - 13.249 - return rv; 13.250 - } 13.251 - 13.252 - Vector getDebugCompilerFlags(String opt) { 13.253 - Vector rv = new Vector(); 13.254 - 13.255 - rv.add("ADD BASE CPP /Gm /Zi /O"+opt); 13.256 - 13.257 - return rv; 13.258 - } 13.259 - 13.260 - Vector getDebugLinkerFlags() { 13.261 - Vector rv = new Vector(); 13.262 - 13.263 - rv.add("PROP BASE Use_Debug_Libraries 1"); 13.264 - rv.add("PROP Use_Debug_Libraries 1"); 13.265 - rv.add("ADD LINK32 /debug"); 13.266 - 13.267 - return rv; 13.268 - } 13.269 - 13.270 - void getAdditionalNonKernelLinkerFlags(Vector rv) {} 13.271 - 13.272 - Vector getProductCompilerFlags() { 13.273 - Vector rv = new Vector(); 13.274 - 13.275 - rv.add("ADD CPP /O"+getOptFlag()); 13.276 - 13.277 - return rv; 13.278 - } 13.279 - 13.280 - Vector getProductLinkerFlags() { 13.281 - Vector rv = new Vector(); 13.282 - 13.283 - rv.add("PROP BASE Use_Debug_Libraries 0"); 13.284 - rv.add("PROP Use_Debug_Libraries 0"); 13.285 - 13.286 - return rv; 13.287 - } 13.288 - 13.289 - String getOptFlag() { 13.290 - return "2"; 13.291 - } 13.292 - 13.293 - String getNoOptFlag() { 13.294 - return "d"; 13.295 - } 13.296 - 13.297 - String makeCfgName(String flavourBuild, String platform) { 13.298 - return "vm - "+ platform + " " + flavourBuild; 13.299 - } 13.300 -}
14.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java Mon Sep 24 17:59:24 2012 -0700 14.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java Thu Mar 29 16:43:21 2012 +0200 14.3 @@ -25,758 +25,326 @@ 14.4 import java.io.FileWriter; 14.5 import java.io.IOException; 14.6 import java.io.PrintWriter; 14.7 -import java.util.Hashtable; 14.8 -import java.util.Iterator; 14.9 -import java.util.TreeSet; 14.10 +import java.nio.file.FileSystems; 14.11 import java.util.Vector; 14.12 14.13 public class WinGammaPlatformVC7 extends WinGammaPlatform { 14.14 14.15 - String projectVersion() {return "7.10";}; 14.16 + // TODO How about moving all globals configs to its own BuildConfig? 14.17 14.18 - public void writeProjectFile(String projectFileName, String projectName, 14.19 - Vector<BuildConfig> allConfigs) throws IOException { 14.20 - System.out.println(); 14.21 - System.out.println(" Writing .vcproj file: "+projectFileName); 14.22 - // If we got this far without an error, we're safe to actually 14.23 - // write the .vcproj file 14.24 - printWriter = new PrintWriter(new FileWriter(projectFileName)); 14.25 + String projectVersion() { 14.26 + return "7.10"; 14.27 + }; 14.28 14.29 - printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); 14.30 - startTag( 14.31 - "VisualStudioProject", 14.32 + public void writeProjectFile(String projectFileName, String projectName, 14.33 + Vector<BuildConfig> allConfigs) throws IOException { 14.34 + System.out.println(); 14.35 + System.out.println(" Writing .vcproj file: " + projectFileName); 14.36 + // If we got this far without an error, we're safe to actually 14.37 + // write the .vcproj file 14.38 + printWriter = new PrintWriter(new FileWriter(projectFileName)); 14.39 + 14.40 + printWriter 14.41 + .println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); 14.42 + startTag("VisualStudioProject", new String[] { "ProjectType", 14.43 + "Visual C++", "Version", projectVersion(), "Name", projectName, 14.44 + "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", 14.45 + "SccProjectName", "", "SccLocalPath", "" }); 14.46 + startTag("Platforms"); 14.47 + tag("Platform", 14.48 + new String[] { "Name", 14.49 + (String) BuildConfig.getField(null, "PlatformName") }); 14.50 + endTag(); 14.51 + 14.52 + startTag("Configurations"); 14.53 + 14.54 + for (BuildConfig cfg : allConfigs) { 14.55 + writeConfiguration(cfg); 14.56 + } 14.57 + 14.58 + endTag(); 14.59 + 14.60 + tag("References"); 14.61 + 14.62 + writeFiles(allConfigs); 14.63 + 14.64 + tag("Globals"); 14.65 + 14.66 + endTag(); 14.67 + printWriter.close(); 14.68 + 14.69 + System.out.println(" Done."); 14.70 + } 14.71 + 14.72 + void writeCustomToolConfig(Vector<BuildConfig> configs, String[] customToolAttrs) { 14.73 + for (BuildConfig cfg : configs) { 14.74 + startTag("FileConfiguration", 14.75 + new String[] { "Name", (String) cfg.get("Name") }); 14.76 + tag("Tool", customToolAttrs); 14.77 + 14.78 + endTag(); 14.79 + } 14.80 + } 14.81 + 14.82 + void writeFiles(Vector<BuildConfig> allConfigs) { 14.83 + 14.84 + // This code assummes there are no config specific includes. 14.85 + startTag("Files"); 14.86 + String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); 14.87 + 14.88 + // Use first config for all global absolute includes. 14.89 + BuildConfig baseConfig = allConfigs.firstElement(); 14.90 + Vector<String> rv = new Vector<String>(); 14.91 + 14.92 + // Then use first config for all relative includes 14.93 + Vector<String> ri = new Vector<String>(); 14.94 + baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); 14.95 + for (String f : ri) { 14.96 + rv.add(sourceBase + Util.sep + f); 14.97 + } 14.98 + 14.99 + baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); 14.100 + 14.101 + handleIncludes(rv, allConfigs); 14.102 + 14.103 + startTag("Filter", new String[] { "Name", "Resource Files", "Filter", 14.104 + "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" }); 14.105 + endTag(); 14.106 + 14.107 + endTag(); 14.108 + } 14.109 + 14.110 + // Will visit file tree for each include 14.111 + private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) { 14.112 + for (String path : includes) { 14.113 + FileTreeCreatorVC7 ftc = new FileTreeCreatorVC7(FileSystems.getDefault().getPath(path) , allConfigs, this); 14.114 + try { 14.115 + ftc.writeFileTree(); 14.116 + } catch (IOException e) { 14.117 + e.printStackTrace(); 14.118 + } 14.119 + } 14.120 + } 14.121 + 14.122 + void writeConfiguration(BuildConfig cfg) { 14.123 + startTag("Configuration", new String[] { "Name", cfg.get("Name"), 14.124 + "OutputDirectory", cfg.get("OutputDir"), 14.125 + "IntermediateDirectory", cfg.get("OutputDir"), 14.126 + "ConfigurationType", "2", "UseOfMFC", "0", 14.127 + "ATLMinimizesCRunTimeLibraryUsage", "FALSE" }); 14.128 + 14.129 + tagV("Tool", cfg.getV("CompilerFlags")); 14.130 + 14.131 + tag("Tool", new String[] { "Name", "VCCustomBuildTool" }); 14.132 + 14.133 + tagV("Tool", cfg.getV("LinkerFlags")); 14.134 + 14.135 + tag("Tool", 14.136 new String[] { 14.137 - "ProjectType", "Visual C++", 14.138 - "Version", projectVersion(), 14.139 - "Name", projectName, 14.140 - "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", 14.141 - "SccProjectName", "", 14.142 - "SccLocalPath", "" 14.143 - } 14.144 - ); 14.145 - startTag("Platforms"); 14.146 - tag("Platform", new String[] {"Name", (String) BuildConfig.getField(null, "PlatformName")}); 14.147 - endTag("Platforms"); 14.148 + "Name", 14.149 + "VCPostBuildEventTool", 14.150 + "Description", 14.151 + BuildConfig 14.152 + .getFieldString(null, "PostbuildDescription"), 14.153 + // Caution: String.replace(String,String) is available 14.154 + // from JDK5 onwards only 14.155 + "CommandLine", 14.156 + cfg.expandFormat(BuildConfig.getFieldString(null, 14.157 + "PostbuildCommand").replace("\t", 14.158 + "
")) }); 14.159 14.160 - startTag("Configurations"); 14.161 + tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); 14.162 14.163 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 14.164 - writeConfiguration((BuildConfig)i.next()); 14.165 - } 14.166 + tag("Tool", 14.167 + new String[] { 14.168 + "Name", 14.169 + "VCPreLinkEventTool", 14.170 + "Description", 14.171 + BuildConfig.getFieldString(null, "PrelinkDescription"), 14.172 + // Caution: String.replace(String,String) is available 14.173 + // from JDK5 onwards only 14.174 + "CommandLine", 14.175 + cfg.expandFormat(BuildConfig.getFieldString(null, 14.176 + "PrelinkCommand").replace("\t", "
")) }); 14.177 14.178 - endTag("Configurations"); 14.179 + tag("Tool", new String[] { "Name", "VCResourceCompilerTool", 14.180 + "PreprocessorDefinitions", "NDEBUG", "Culture", "1033" }); 14.181 14.182 - tag("References"); 14.183 + tag("Tool", new String[] { "Name", "VCMIDLTool", 14.184 + "PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible", 14.185 + "TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment", 14.186 + "1", "TypeLibraryName", 14.187 + cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName", 14.188 + "" }); 14.189 14.190 - writeFiles(allConfigs); 14.191 + endTag(); 14.192 + } 14.193 14.194 - tag("Globals"); 14.195 14.196 - endTag("VisualStudioProject"); 14.197 - printWriter.close(); 14.198 14.199 - System.out.println(" Done."); 14.200 - } 14.201 - 14.202 - 14.203 - abstract class NameFilter { 14.204 - protected String fname; 14.205 - 14.206 - abstract boolean match(FileInfo fi); 14.207 - 14.208 - String filterString() { return ""; } 14.209 - String name() { return this.fname;} 14.210 - 14.211 - @Override 14.212 - // eclipse auto-generated 14.213 - public int hashCode() { 14.214 - final int prime = 31; 14.215 - int result = 1; 14.216 - result = prime * result + getOuterType().hashCode(); 14.217 - result = prime * result + ((fname == null) ? 0 : fname.hashCode()); 14.218 - return result; 14.219 - } 14.220 - 14.221 - @Override 14.222 - // eclipse auto-generated 14.223 - public boolean equals(Object obj) { 14.224 - if (this == obj) 14.225 - return true; 14.226 - if (obj == null) 14.227 - return false; 14.228 - if (getClass() != obj.getClass()) 14.229 - return false; 14.230 - NameFilter other = (NameFilter) obj; 14.231 - if (!getOuterType().equals(other.getOuterType())) 14.232 - return false; 14.233 - if (fname == null) { 14.234 - if (other.fname != null) 14.235 - return false; 14.236 - } else if (!fname.equals(other.fname)) 14.237 - return false; 14.238 - return true; 14.239 - } 14.240 - 14.241 - // eclipse auto-generated 14.242 - private WinGammaPlatformVC7 getOuterType() { 14.243 - return WinGammaPlatformVC7.this; 14.244 - } 14.245 - } 14.246 - 14.247 - class DirectoryFilter extends NameFilter { 14.248 - String dir; 14.249 - int baseLen, dirLen; 14.250 - 14.251 - DirectoryFilter(String dir, String sbase) { 14.252 - this.dir = dir; 14.253 - this.baseLen = sbase.length(); 14.254 - this.dirLen = dir.length(); 14.255 - this.fname = dir; 14.256 - } 14.257 - 14.258 - DirectoryFilter(String fname, String dir, String sbase) { 14.259 - this.dir = dir; 14.260 - this.baseLen = sbase.length(); 14.261 - this.dirLen = dir.length(); 14.262 - this.fname = fname; 14.263 - } 14.264 - 14.265 - 14.266 - boolean match(FileInfo fi) { 14.267 - int lastSlashIndex = fi.full.lastIndexOf('/'); 14.268 - String fullDir = fi.full.substring(0, lastSlashIndex); 14.269 - return fullDir.endsWith(dir); 14.270 - } 14.271 - 14.272 - @Override 14.273 - // eclipse auto-generated 14.274 - public int hashCode() { 14.275 - final int prime = 31; 14.276 - int result = super.hashCode(); 14.277 - result = prime * result + getOuterType().hashCode(); 14.278 - result = prime * result + baseLen; 14.279 - result = prime * result + ((dir == null) ? 0 : dir.hashCode()); 14.280 - result = prime * result + dirLen; 14.281 - return result; 14.282 - } 14.283 - 14.284 - @Override 14.285 - // eclipse auto-generated 14.286 - public boolean equals(Object obj) { 14.287 - if (this == obj) 14.288 - return true; 14.289 - if (!super.equals(obj)) 14.290 - return false; 14.291 - if (getClass() != obj.getClass()) 14.292 - return false; 14.293 - DirectoryFilter other = (DirectoryFilter) obj; 14.294 - if (!getOuterType().equals(other.getOuterType())) 14.295 - return false; 14.296 - if (baseLen != other.baseLen) 14.297 - return false; 14.298 - if (dir == null) { 14.299 - if (other.dir != null) 14.300 - return false; 14.301 - } else if (!dir.equals(other.dir)) 14.302 - return false; 14.303 - if (dirLen != other.dirLen) 14.304 - return false; 14.305 - return true; 14.306 - } 14.307 - 14.308 - // eclipse auto-generated 14.309 - private WinGammaPlatformVC7 getOuterType() { 14.310 - return WinGammaPlatformVC7.this; 14.311 - } 14.312 - } 14.313 - 14.314 - class TerminatorFilter extends NameFilter { 14.315 - TerminatorFilter(String fname) { 14.316 - this.fname = fname; 14.317 - 14.318 - } 14.319 - boolean match(FileInfo fi) { 14.320 - return true; 14.321 - } 14.322 - 14.323 - } 14.324 - 14.325 - class SpecificNameFilter extends NameFilter { 14.326 - String pats[]; 14.327 - 14.328 - SpecificNameFilter(String fname, String[] pats) { 14.329 - this.fname = fname; 14.330 - this.pats = pats; 14.331 - } 14.332 - 14.333 - boolean match(FileInfo fi) { 14.334 - for (int i=0; i<pats.length; i++) { 14.335 - if (fi.attr.shortName.matches(pats[i])) { 14.336 - return true; 14.337 - } 14.338 - } 14.339 - return false; 14.340 - } 14.341 - 14.342 - } 14.343 - 14.344 - class SpecificPathFilter extends NameFilter { 14.345 - String pats[]; 14.346 - 14.347 - SpecificPathFilter(String fname, String[] pats) { 14.348 - this.fname = fname; 14.349 - this.pats = pats; 14.350 - } 14.351 - 14.352 - boolean match(FileInfo fi) { 14.353 - for (int i=0; i<pats.length; i++) { 14.354 - if (fi.full.matches(pats[i])) { 14.355 - return true; 14.356 - } 14.357 - } 14.358 - return false; 14.359 - } 14.360 - 14.361 - } 14.362 - 14.363 - class ContainerFilter extends NameFilter { 14.364 - Vector children; 14.365 - 14.366 - ContainerFilter(String fname) { 14.367 - this.fname = fname; 14.368 - children = new Vector(); 14.369 - 14.370 - } 14.371 - boolean match(FileInfo fi) { 14.372 - return false; 14.373 - } 14.374 - 14.375 - Iterator babies() { return children.iterator(); } 14.376 - 14.377 - void add(NameFilter f) { 14.378 - children.add(f); 14.379 - } 14.380 - } 14.381 - 14.382 - 14.383 - void writeCustomToolConfig(Vector configs, String[] customToolAttrs) { 14.384 - for (Iterator i = configs.iterator(); i.hasNext(); ) { 14.385 - startTag("FileConfiguration", 14.386 - new String[] { 14.387 - "Name", (String)i.next() 14.388 - } 14.389 - ); 14.390 - tag("Tool", customToolAttrs); 14.391 - 14.392 - endTag("FileConfiguration"); 14.393 - } 14.394 - } 14.395 - 14.396 - // here we define filters, which define layout of what can be seen in 'Solution View' of MSVC 14.397 - // Basically there are two types of entities - container filters and real filters 14.398 - // - container filter just provides a container to group together real filters 14.399 - // - real filter can select elements from the set according to some rule, put it into XML 14.400 - // and remove from the list 14.401 - Vector<NameFilter> makeFilters(TreeSet<FileInfo> files) { 14.402 - Vector<NameFilter> rv = new Vector<NameFilter>(); 14.403 - String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/"); 14.404 - 14.405 - String currentDir = ""; 14.406 - DirectoryFilter container = null; 14.407 - for(FileInfo fileInfo : files) { 14.408 - 14.409 - if (!fileInfo.full.startsWith(sbase)) { 14.410 - continue; 14.411 - } 14.412 - 14.413 - int lastSlash = fileInfo.full.lastIndexOf('/'); 14.414 - String dir = fileInfo.full.substring(sbase.length(), lastSlash); 14.415 - if(dir.equals("share/vm")) { 14.416 - // skip files directly in share/vm - should only be precompiled.hpp which is handled below 14.417 - continue; 14.418 - } 14.419 - if (!dir.equals(currentDir)) { 14.420 - currentDir = dir; 14.421 - if (container != null && !rv.contains(container)) { 14.422 - rv.add(container); 14.423 - } 14.424 - 14.425 - // remove "share/vm/" from names 14.426 - String name = dir; 14.427 - if (dir.startsWith("share/vm/")) { 14.428 - name = dir.substring("share/vm/".length(), dir.length()); 14.429 - } 14.430 - DirectoryFilter newfilter = new DirectoryFilter(name, dir, sbase); 14.431 - int i = rv.indexOf(newfilter); 14.432 - if(i == -1) { 14.433 - container = newfilter; 14.434 - } else { 14.435 - // if the filter already exists, reuse it 14.436 - container = (DirectoryFilter) rv.get(i); 14.437 - } 14.438 - } 14.439 - } 14.440 - if (container != null && !rv.contains(container)) { 14.441 - rv.add(container); 14.442 - } 14.443 - 14.444 - ContainerFilter generated = new ContainerFilter("Generated"); 14.445 - ContainerFilter c1Generated = new ContainerFilter("C1"); 14.446 - c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 14.447 - c1Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler1/generated/jvmtifiles/.*"})); 14.448 - generated.add(c1Generated); 14.449 - ContainerFilter c2Generated = new ContainerFilter("C2"); 14.450 - c2Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler2/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 14.451 - c2Generated.add(new SpecificPathFilter("adfiles", new String[] {".*compiler2/generated/adfiles/.*"})); 14.452 - c2Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler2/generated/jvmtifiles/.*"})); 14.453 - generated.add(c2Generated); 14.454 - ContainerFilter coreGenerated = new ContainerFilter("Core"); 14.455 - coreGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*core/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 14.456 - coreGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*core/generated/jvmtifiles/.*"})); 14.457 - generated.add(coreGenerated); 14.458 - ContainerFilter tieredGenerated = new ContainerFilter("Tiered"); 14.459 - tieredGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*tiered/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 14.460 - tieredGenerated.add(new SpecificPathFilter("adfiles", new String[] {".*tiered/generated/adfiles/.*"})); 14.461 - tieredGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*tiered/generated/jvmtifiles/.*"})); 14.462 - generated.add(tieredGenerated); 14.463 - ContainerFilter kernelGenerated = new ContainerFilter("Kernel"); 14.464 - kernelGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*kernel/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 14.465 - kernelGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*kernel/generated/jvmtifiles/.*"})); 14.466 - generated.add(kernelGenerated); 14.467 - rv.add(generated); 14.468 - 14.469 - rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"})); 14.470 - 14.471 - // this one is to catch files not caught by other filters 14.472 - rv.add(new TerminatorFilter("Source Files")); 14.473 - 14.474 - return rv; 14.475 - } 14.476 - 14.477 - void writeFiles(Vector<BuildConfig> allConfigs) { 14.478 - 14.479 - Hashtable allFiles = computeAttributedFiles(allConfigs); 14.480 - 14.481 - Vector allConfigNames = new Vector(); 14.482 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 14.483 - allConfigNames.add(((BuildConfig)i.next()).get("Name")); 14.484 - } 14.485 - 14.486 - TreeSet sortedFiles = sortFiles(allFiles); 14.487 - 14.488 - startTag("Files"); 14.489 - 14.490 - for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) { 14.491 - doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next()); 14.492 - } 14.493 - 14.494 - 14.495 - startTag("Filter", 14.496 - new String[] { 14.497 - "Name", "Resource Files", 14.498 - "Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" 14.499 - } 14.500 - ); 14.501 - endTag("Filter"); 14.502 - 14.503 - endTag("Files"); 14.504 - } 14.505 - 14.506 - void doWriteFiles(TreeSet allFiles, Vector allConfigNames, NameFilter filter) { 14.507 - startTag("Filter", 14.508 - new String[] { 14.509 - "Name", filter.name(), 14.510 - "Filter", filter.filterString() 14.511 - } 14.512 - ); 14.513 - 14.514 - if (filter instanceof ContainerFilter) { 14.515 - 14.516 - Iterator i = ((ContainerFilter)filter).babies(); 14.517 - while (i.hasNext()) { 14.518 - doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next()); 14.519 - } 14.520 - 14.521 - } else { 14.522 - 14.523 - Iterator i = allFiles.iterator(); 14.524 - while (i.hasNext()) { 14.525 - FileInfo fi = (FileInfo)i.next(); 14.526 - 14.527 - if (!filter.match(fi)) { 14.528 - continue; 14.529 - } 14.530 - 14.531 - startTag("File", 14.532 - new String[] { 14.533 - "RelativePath", fi.full.replace('/', '\\') 14.534 - } 14.535 - ); 14.536 - 14.537 - FileAttribute a = fi.attr; 14.538 - if (a.pchRoot) { 14.539 - writeCustomToolConfig(allConfigNames, 14.540 - new String[] { 14.541 - "Name", "VCCLCompilerTool", 14.542 - "UsePrecompiledHeader", "1" 14.543 - }); 14.544 - } 14.545 - 14.546 - if (a.noPch) { 14.547 - writeCustomToolConfig(allConfigNames, 14.548 - new String[] { 14.549 - "Name", "VCCLCompilerTool", 14.550 - "UsePrecompiledHeader", "0" 14.551 - }); 14.552 - } 14.553 - 14.554 - if (a.configs != null) { 14.555 - for (Iterator j=allConfigNames.iterator(); j.hasNext();) { 14.556 - String cfg = (String)j.next(); 14.557 - if (!a.configs.contains(cfg)) { 14.558 - startTag("FileConfiguration", 14.559 - new String[] { 14.560 - "Name", cfg, 14.561 - "ExcludedFromBuild", "TRUE" 14.562 - }); 14.563 - endTag("FileConfiguration"); 14.564 - 14.565 - } 14.566 - } 14.567 - } 14.568 - 14.569 - endTag("File"); 14.570 - 14.571 - // we not gonna look at this file anymore 14.572 - i.remove(); 14.573 - } 14.574 - } 14.575 - 14.576 - endTag("Filter"); 14.577 - } 14.578 - 14.579 - 14.580 - void writeConfiguration(BuildConfig cfg) { 14.581 - startTag("Configuration", 14.582 - new String[] { 14.583 - "Name", cfg.get("Name"), 14.584 - "OutputDirectory", cfg.get("OutputDir"), 14.585 - "IntermediateDirectory", cfg.get("OutputDir"), 14.586 - "ConfigurationType", "2", 14.587 - "UseOfMFC", "0", 14.588 - "ATLMinimizesCRunTimeLibraryUsage", "FALSE" 14.589 - } 14.590 - ); 14.591 - 14.592 - 14.593 - 14.594 - tagV("Tool", cfg.getV("CompilerFlags")); 14.595 - 14.596 - tag("Tool", 14.597 - new String[] { 14.598 - "Name", "VCCustomBuildTool" 14.599 - } 14.600 - ); 14.601 - 14.602 - tagV("Tool", cfg.getV("LinkerFlags")); 14.603 - 14.604 - tag("Tool", 14.605 - new String[] { 14.606 - "Name", "VCPostBuildEventTool", 14.607 - "Description", BuildConfig.getFieldString(null, "PostbuildDescription"), 14.608 - //Caution: String.replace(String,String) is available from JDK5 onwards only 14.609 - "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace 14.610 - ("\t", "
")) 14.611 - } 14.612 - ); 14.613 - 14.614 - tag("Tool", 14.615 - new String[] { 14.616 - "Name", "VCPreBuildEventTool" 14.617 - } 14.618 - ); 14.619 - 14.620 - tag("Tool", 14.621 - new String[] { 14.622 - "Name", "VCPreLinkEventTool", 14.623 - "Description", BuildConfig.getFieldString(null, "PrelinkDescription"), 14.624 - //Caution: String.replace(String,String) is available from JDK5 onwards only 14.625 - "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace 14.626 - ("\t", "
")) 14.627 - } 14.628 - ); 14.629 - 14.630 - tag("Tool", 14.631 - new String[] { 14.632 - "Name", "VCResourceCompilerTool", 14.633 - // XXX??? 14.634 - "PreprocessorDefinitions", "NDEBUG", 14.635 - "Culture", "1033" 14.636 - } 14.637 - ); 14.638 - 14.639 - tag("Tool", 14.640 - new String[] { 14.641 - "Name", "VCMIDLTool", 14.642 - "PreprocessorDefinitions", "NDEBUG", 14.643 - "MkTypLibCompatible", "TRUE", 14.644 - "SuppressStartupBanner", "TRUE", 14.645 - "TargetEnvironment", "1", 14.646 - "TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb", 14.647 - "HeaderFileName", "" 14.648 - } 14.649 - ); 14.650 - 14.651 - endTag("Configuration"); 14.652 - } 14.653 - 14.654 - int indent; 14.655 - 14.656 - private void startTagPrim(String name, 14.657 - String[] attrs, 14.658 - boolean close) { 14.659 - startTagPrim(name, attrs, close, true); 14.660 - } 14.661 - 14.662 - private void startTagPrim(String name, 14.663 - String[] attrs, 14.664 - boolean close, 14.665 - boolean newline) { 14.666 - doIndent(); 14.667 - printWriter.print("<"+name); 14.668 - indent++; 14.669 - 14.670 - if (attrs != null && attrs.length > 0) { 14.671 - for (int i=0; i<attrs.length; i+=2) { 14.672 - printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\""); 14.673 - if (i < attrs.length - 2) { 14.674 - } 14.675 - } 14.676 - } 14.677 - 14.678 - if (close) { 14.679 - indent--; 14.680 - printWriter.print(" />"); 14.681 - } else { 14.682 - printWriter.print(">"); 14.683 - } 14.684 - if(newline) { 14.685 - printWriter.println(); 14.686 - } 14.687 - } 14.688 - 14.689 - void startTag(String name, String... attrs) { 14.690 - startTagPrim(name, attrs, false); 14.691 - } 14.692 - 14.693 - void startTagV(String name, Vector attrs) { 14.694 - String s[] = new String [attrs.size()]; 14.695 - for (int i=0; i<attrs.size(); i++) { 14.696 - s[i] = (String)attrs.elementAt(i); 14.697 - } 14.698 - startTagPrim(name, s, false); 14.699 - } 14.700 - 14.701 - void endTag(String name) { 14.702 - indent--; 14.703 - doIndent(); 14.704 - printWriter.println("</"+name+">"); 14.705 - } 14.706 - 14.707 - void tag(String name, String... attrs) { 14.708 - startTagPrim(name, attrs, true); 14.709 - } 14.710 - 14.711 - void tagData(String name, String data) { 14.712 - doIndent(); 14.713 - printWriter.print("<"+name+">"); 14.714 - printWriter.print(data); 14.715 - printWriter.println("</"+name+">"); 14.716 - } 14.717 - 14.718 - void tagData(String name, String data, String... attrs) { 14.719 - startTagPrim(name, attrs, false, false); 14.720 - printWriter.print(data); 14.721 - printWriter.println("</"+name+">"); 14.722 - indent--; 14.723 - } 14.724 - 14.725 - void tagV(String name, Vector attrs) { 14.726 - String s[] = new String [attrs.size()]; 14.727 - for (int i=0; i<attrs.size(); i++) { 14.728 - s[i] = (String)attrs.elementAt(i); 14.729 - } 14.730 - startTagPrim(name, s, true); 14.731 - } 14.732 - 14.733 - 14.734 - void doIndent() { 14.735 - for (int i=0; i<indent; i++) { 14.736 - printWriter.print(" "); 14.737 - } 14.738 - } 14.739 - 14.740 - protected String getProjectExt() { 14.741 - return ".vcproj"; 14.742 - } 14.743 + protected String getProjectExt() { 14.744 + return ".vcproj"; 14.745 + } 14.746 } 14.747 14.748 class CompilerInterfaceVC7 extends CompilerInterface { 14.749 - void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) { 14.750 + void getBaseCompilerFlags_common(Vector defines, Vector includes, 14.751 + String outDir, Vector rv) { 14.752 14.753 - // advanced M$ IDE (2003) can only recognize name if it's first or 14.754 - // second attribute in the tag - go guess 14.755 - addAttr(rv, "Name", "VCCLCompilerTool"); 14.756 - addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); 14.757 - addAttr(rv, "PreprocessorDefinitions", 14.758 - Util.join(";", defines).replace("\"",""")); 14.759 - addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); 14.760 - addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch"); 14.761 - addAttr(rv, "AssemblerListingLocation", outDir); 14.762 - addAttr(rv, "ObjectFile", outDir+Util.sep); 14.763 - addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); 14.764 - // Set /nologo optin 14.765 - addAttr(rv, "SuppressStartupBanner", "TRUE"); 14.766 - // Surpass the default /Tc or /Tp. 0 is compileAsDefault 14.767 - addAttr(rv, "CompileAs", "0"); 14.768 - // Set /W3 option. 3 is warningLevel_3 14.769 - addAttr(rv, "WarningLevel", "3"); 14.770 - // Set /WX option, 14.771 - addAttr(rv, "WarnAsError", "TRUE"); 14.772 - // Set /GS option 14.773 - addAttr(rv, "BufferSecurityCheck", "FALSE"); 14.774 - // Set /Zi option. 3 is debugEnabled 14.775 - addAttr(rv, "DebugInformationFormat", "3"); 14.776 - } 14.777 - Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { 14.778 - Vector rv = new Vector(); 14.779 + // advanced M$ IDE (2003) can only recognize name if it's first or 14.780 + // second attribute in the tag - go guess 14.781 + addAttr(rv, "Name", "VCCLCompilerTool"); 14.782 + addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); 14.783 + addAttr(rv, "PreprocessorDefinitions", 14.784 + Util.join(";", defines).replace("\"", """)); 14.785 + addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); 14.786 + addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch"); 14.787 + addAttr(rv, "AssemblerListingLocation", outDir); 14.788 + addAttr(rv, "ObjectFile", outDir + Util.sep); 14.789 + addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb"); 14.790 + // Set /nologo optin 14.791 + addAttr(rv, "SuppressStartupBanner", "TRUE"); 14.792 + // Surpass the default /Tc or /Tp. 0 is compileAsDefault 14.793 + addAttr(rv, "CompileAs", "0"); 14.794 + // Set /W3 option. 3 is warningLevel_3 14.795 + addAttr(rv, "WarningLevel", "3"); 14.796 + // Set /WX option, 14.797 + addAttr(rv, "WarnAsError", "TRUE"); 14.798 + // Set /GS option 14.799 + addAttr(rv, "BufferSecurityCheck", "FALSE"); 14.800 + // Set /Zi option. 3 is debugEnabled 14.801 + addAttr(rv, "DebugInformationFormat", "3"); 14.802 + } 14.803 14.804 - getBaseCompilerFlags_common(defines,includes, outDir, rv); 14.805 - // Set /Yu option. 3 is pchUseUsingSpecific 14.806 - // Note: Starting VC8 pchUseUsingSpecific is 2 !!! 14.807 - addAttr(rv, "UsePrecompiledHeader", "3"); 14.808 - // Set /EHsc- option 14.809 - addAttr(rv, "ExceptionHandling", "FALSE"); 14.810 + Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { 14.811 + Vector rv = new Vector(); 14.812 14.813 - return rv; 14.814 - } 14.815 + getBaseCompilerFlags_common(defines, includes, outDir, rv); 14.816 + // Set /Yu option. 3 is pchUseUsingSpecific 14.817 + // Note: Starting VC8 pchUseUsingSpecific is 2 !!! 14.818 + addAttr(rv, "UsePrecompiledHeader", "3"); 14.819 + // Set /EHsc- option 14.820 + addAttr(rv, "ExceptionHandling", "FALSE"); 14.821 14.822 - Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { 14.823 - Vector rv = new Vector(); 14.824 + return rv; 14.825 + } 14.826 14.827 - addAttr(rv, "Name", "VCLinkerTool"); 14.828 - addAttr(rv, "AdditionalOptions", 14.829 - "/export:JNI_GetDefaultJavaVMInitArgs " + 14.830 - "/export:JNI_CreateJavaVM " + 14.831 - "/export:JVM_FindClassFromBootLoader "+ 14.832 - "/export:JNI_GetCreatedJavaVMs "+ 14.833 - "/export:jio_snprintf /export:jio_printf "+ 14.834 - "/export:jio_fprintf /export:jio_vfprintf "+ 14.835 - "/export:jio_vsnprintf "+ 14.836 - "/export:JVM_GetVersionInfo "+ 14.837 - "/export:JVM_GetThreadStateNames "+ 14.838 - "/export:JVM_GetThreadStateValues "+ 14.839 - "/export:JVM_InitAgentProperties "); 14.840 - addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); 14.841 - addAttr(rv, "OutputFile", outDll); 14.842 - // Set /INCREMENTAL option. 1 is linkIncrementalNo 14.843 - addAttr(rv, "LinkIncremental", "1"); 14.844 - addAttr(rv, "SuppressStartupBanner", "TRUE"); 14.845 - addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); 14.846 - addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); 14.847 - // Set /SUBSYSTEM option. 2 is subSystemWindows 14.848 - addAttr(rv, "SubSystem", "2"); 14.849 - addAttr(rv, "BaseAddress", "0x8000000"); 14.850 - addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); 14.851 - if(platformName.equals("Win32")) { 14.852 - // Set /MACHINE option. 1 is X86 14.853 - addAttr(rv, "TargetMachine", "1"); 14.854 - } else { 14.855 - // Set /MACHINE option. 17 is X64 14.856 - addAttr(rv, "TargetMachine", "17"); 14.857 - } 14.858 + Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { 14.859 + Vector rv = new Vector(); 14.860 14.861 - return rv; 14.862 - } 14.863 + addAttr(rv, "Name", "VCLinkerTool"); 14.864 + addAttr(rv, "AdditionalOptions", 14.865 + "/export:JNI_GetDefaultJavaVMInitArgs " 14.866 + + "/export:JNI_CreateJavaVM " 14.867 + + "/export:JVM_FindClassFromBootLoader " 14.868 + + "/export:JNI_GetCreatedJavaVMs " 14.869 + + "/export:jio_snprintf /export:jio_printf " 14.870 + + "/export:jio_fprintf /export:jio_vfprintf " 14.871 + + "/export:jio_vsnprintf " 14.872 + + "/export:JVM_GetVersionInfo " 14.873 + + "/export:JVM_GetThreadStateNames " 14.874 + + "/export:JVM_GetThreadStateValues " 14.875 + + "/export:JVM_InitAgentProperties "); 14.876 + addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); 14.877 + addAttr(rv, "OutputFile", outDll); 14.878 + // Set /INCREMENTAL option. 1 is linkIncrementalNo 14.879 + addAttr(rv, "LinkIncremental", "1"); 14.880 + addAttr(rv, "SuppressStartupBanner", "TRUE"); 14.881 + addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def"); 14.882 + addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb"); 14.883 + // Set /SUBSYSTEM option. 2 is subSystemWindows 14.884 + addAttr(rv, "SubSystem", "2"); 14.885 + addAttr(rv, "BaseAddress", "0x8000000"); 14.886 + addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib"); 14.887 + if (platformName.equals("Win32")) { 14.888 + // Set /MACHINE option. 1 is X86 14.889 + addAttr(rv, "TargetMachine", "1"); 14.890 + } else { 14.891 + // Set /MACHINE option. 17 is X64 14.892 + addAttr(rv, "TargetMachine", "17"); 14.893 + } 14.894 14.895 - void getDebugCompilerFlags_common(String opt,Vector rv) { 14.896 + return rv; 14.897 + } 14.898 14.899 - // Set /On option 14.900 - addAttr(rv, "Optimization", opt); 14.901 - // Set /FR option. 1 is brAllInfo 14.902 - addAttr(rv, "BrowseInformation", "1"); 14.903 - addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); 14.904 - // Set /MD option. 2 is rtMultiThreadedDLL 14.905 - addAttr(rv, "RuntimeLibrary", "2"); 14.906 - // Set /Oy- option 14.907 - addAttr(rv, "OmitFramePointers", "FALSE"); 14.908 + void getDebugCompilerFlags_common(String opt, Vector rv) { 14.909 14.910 - } 14.911 + // Set /On option 14.912 + addAttr(rv, "Optimization", opt); 14.913 + // Set /FR option. 1 is brAllInfo 14.914 + addAttr(rv, "BrowseInformation", "1"); 14.915 + addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); 14.916 + // Set /MD option. 2 is rtMultiThreadedDLL 14.917 + addAttr(rv, "RuntimeLibrary", "2"); 14.918 + // Set /Oy- option 14.919 + addAttr(rv, "OmitFramePointers", "FALSE"); 14.920 14.921 - Vector getDebugCompilerFlags(String opt) { 14.922 - Vector rv = new Vector(); 14.923 + } 14.924 14.925 - getDebugCompilerFlags_common(opt,rv); 14.926 + Vector getDebugCompilerFlags(String opt) { 14.927 + Vector rv = new Vector(); 14.928 14.929 - return rv; 14.930 - } 14.931 + getDebugCompilerFlags_common(opt, rv); 14.932 14.933 - Vector getDebugLinkerFlags() { 14.934 - Vector rv = new Vector(); 14.935 + return rv; 14.936 + } 14.937 14.938 - addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option 14.939 + Vector getDebugLinkerFlags() { 14.940 + Vector rv = new Vector(); 14.941 14.942 - return rv; 14.943 - } 14.944 + addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option 14.945 14.946 - void getAdditionalNonKernelLinkerFlags(Vector rv) { 14.947 - extAttr(rv, "AdditionalOptions", 14.948 - "/export:AsyncGetCallTrace "); 14.949 - } 14.950 + return rv; 14.951 + } 14.952 14.953 - void getProductCompilerFlags_common(Vector rv) { 14.954 - // Set /O2 option. 2 is optimizeMaxSpeed 14.955 - addAttr(rv, "Optimization", "2"); 14.956 - // Set /Oy- option 14.957 - addAttr(rv, "OmitFramePointers", "FALSE"); 14.958 - // Set /Ob option. 1 is expandOnlyInline 14.959 - addAttr(rv, "InlineFunctionExpansion", "1"); 14.960 - // Set /GF option. 14.961 - addAttr(rv, "StringPooling", "TRUE"); 14.962 - // Set /MD option. 2 is rtMultiThreadedDLL 14.963 - addAttr(rv, "RuntimeLibrary", "2"); 14.964 - // Set /Gy option 14.965 - addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); 14.966 - } 14.967 + void getAdditionalNonKernelLinkerFlags(Vector rv) { 14.968 + extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace "); 14.969 + } 14.970 14.971 - Vector getProductCompilerFlags() { 14.972 - Vector rv = new Vector(); 14.973 + void getProductCompilerFlags_common(Vector rv) { 14.974 + // Set /O2 option. 2 is optimizeMaxSpeed 14.975 + addAttr(rv, "Optimization", "2"); 14.976 + // Set /Oy- option 14.977 + addAttr(rv, "OmitFramePointers", "FALSE"); 14.978 + // Set /Ob option. 1 is expandOnlyInline 14.979 + addAttr(rv, "InlineFunctionExpansion", "1"); 14.980 + // Set /GF option. 14.981 + addAttr(rv, "StringPooling", "TRUE"); 14.982 + // Set /MD option. 2 is rtMultiThreadedDLL 14.983 + addAttr(rv, "RuntimeLibrary", "2"); 14.984 + // Set /Gy option 14.985 + addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); 14.986 + } 14.987 14.988 - getProductCompilerFlags_common(rv); 14.989 + Vector getProductCompilerFlags() { 14.990 + Vector rv = new Vector(); 14.991 14.992 - return rv; 14.993 - } 14.994 + getProductCompilerFlags_common(rv); 14.995 14.996 - Vector getProductLinkerFlags() { 14.997 - Vector rv = new Vector(); 14.998 + return rv; 14.999 + } 14.1000 14.1001 - // Set /OPT:REF option. 2 is optReferences 14.1002 - addAttr(rv, "OptimizeReferences", "2"); 14.1003 - // Set /OPT:optFolding option. 2 is optFolding 14.1004 - addAttr(rv, "EnableCOMDATFolding", "2"); 14.1005 + Vector getProductLinkerFlags() { 14.1006 + Vector rv = new Vector(); 14.1007 14.1008 - return rv; 14.1009 - } 14.1010 + // Set /OPT:REF option. 2 is optReferences 14.1011 + addAttr(rv, "OptimizeReferences", "2"); 14.1012 + // Set /OPT:optFolding option. 2 is optFolding 14.1013 + addAttr(rv, "EnableCOMDATFolding", "2"); 14.1014 14.1015 - String getOptFlag() { 14.1016 - return "2"; 14.1017 - } 14.1018 + return rv; 14.1019 + } 14.1020 14.1021 - String getNoOptFlag() { 14.1022 - return "0"; 14.1023 - } 14.1024 + String getOptFlag() { 14.1025 + return "2"; 14.1026 + } 14.1027 14.1028 - String makeCfgName(String flavourBuild, String platform) { 14.1029 - return flavourBuild + "|" + platform; 14.1030 - } 14.1031 + String getNoOptFlag() { 14.1032 + return "0"; 14.1033 + } 14.1034 + 14.1035 + String makeCfgName(String flavourBuild, String platform) { 14.1036 + return flavourBuild + "|" + platform; 14.1037 + } 14.1038 + 14.1039 }