1.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java Mon Sep 24 17:59:24 2012 -0700 1.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java Thu Mar 29 16:43:21 2012 +0200 1.3 @@ -25,758 +25,326 @@ 1.4 import java.io.FileWriter; 1.5 import java.io.IOException; 1.6 import java.io.PrintWriter; 1.7 -import java.util.Hashtable; 1.8 -import java.util.Iterator; 1.9 -import java.util.TreeSet; 1.10 +import java.nio.file.FileSystems; 1.11 import java.util.Vector; 1.12 1.13 public class WinGammaPlatformVC7 extends WinGammaPlatform { 1.14 1.15 - String projectVersion() {return "7.10";}; 1.16 + // TODO How about moving all globals configs to its own BuildConfig? 1.17 1.18 - public void writeProjectFile(String projectFileName, String projectName, 1.19 - Vector<BuildConfig> allConfigs) throws IOException { 1.20 - System.out.println(); 1.21 - System.out.println(" Writing .vcproj file: "+projectFileName); 1.22 - // If we got this far without an error, we're safe to actually 1.23 - // write the .vcproj file 1.24 - printWriter = new PrintWriter(new FileWriter(projectFileName)); 1.25 + String projectVersion() { 1.26 + return "7.10"; 1.27 + }; 1.28 1.29 - printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); 1.30 - startTag( 1.31 - "VisualStudioProject", 1.32 + public void writeProjectFile(String projectFileName, String projectName, 1.33 + Vector<BuildConfig> allConfigs) throws IOException { 1.34 + System.out.println(); 1.35 + System.out.println(" Writing .vcproj file: " + projectFileName); 1.36 + // If we got this far without an error, we're safe to actually 1.37 + // write the .vcproj file 1.38 + printWriter = new PrintWriter(new FileWriter(projectFileName)); 1.39 + 1.40 + printWriter 1.41 + .println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); 1.42 + startTag("VisualStudioProject", new String[] { "ProjectType", 1.43 + "Visual C++", "Version", projectVersion(), "Name", projectName, 1.44 + "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", 1.45 + "SccProjectName", "", "SccLocalPath", "" }); 1.46 + startTag("Platforms"); 1.47 + tag("Platform", 1.48 + new String[] { "Name", 1.49 + (String) BuildConfig.getField(null, "PlatformName") }); 1.50 + endTag(); 1.51 + 1.52 + startTag("Configurations"); 1.53 + 1.54 + for (BuildConfig cfg : allConfigs) { 1.55 + writeConfiguration(cfg); 1.56 + } 1.57 + 1.58 + endTag(); 1.59 + 1.60 + tag("References"); 1.61 + 1.62 + writeFiles(allConfigs); 1.63 + 1.64 + tag("Globals"); 1.65 + 1.66 + endTag(); 1.67 + printWriter.close(); 1.68 + 1.69 + System.out.println(" Done."); 1.70 + } 1.71 + 1.72 + void writeCustomToolConfig(Vector<BuildConfig> configs, String[] customToolAttrs) { 1.73 + for (BuildConfig cfg : configs) { 1.74 + startTag("FileConfiguration", 1.75 + new String[] { "Name", (String) cfg.get("Name") }); 1.76 + tag("Tool", customToolAttrs); 1.77 + 1.78 + endTag(); 1.79 + } 1.80 + } 1.81 + 1.82 + void writeFiles(Vector<BuildConfig> allConfigs) { 1.83 + 1.84 + // This code assummes there are no config specific includes. 1.85 + startTag("Files"); 1.86 + String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); 1.87 + 1.88 + // Use first config for all global absolute includes. 1.89 + BuildConfig baseConfig = allConfigs.firstElement(); 1.90 + Vector<String> rv = new Vector<String>(); 1.91 + 1.92 + // Then use first config for all relative includes 1.93 + Vector<String> ri = new Vector<String>(); 1.94 + baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); 1.95 + for (String f : ri) { 1.96 + rv.add(sourceBase + Util.sep + f); 1.97 + } 1.98 + 1.99 + baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); 1.100 + 1.101 + handleIncludes(rv, allConfigs); 1.102 + 1.103 + startTag("Filter", new String[] { "Name", "Resource Files", "Filter", 1.104 + "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" }); 1.105 + endTag(); 1.106 + 1.107 + endTag(); 1.108 + } 1.109 + 1.110 + // Will visit file tree for each include 1.111 + private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) { 1.112 + for (String path : includes) { 1.113 + FileTreeCreatorVC7 ftc = new FileTreeCreatorVC7(FileSystems.getDefault().getPath(path) , allConfigs, this); 1.114 + try { 1.115 + ftc.writeFileTree(); 1.116 + } catch (IOException e) { 1.117 + e.printStackTrace(); 1.118 + } 1.119 + } 1.120 + } 1.121 + 1.122 + void writeConfiguration(BuildConfig cfg) { 1.123 + startTag("Configuration", new String[] { "Name", cfg.get("Name"), 1.124 + "OutputDirectory", cfg.get("OutputDir"), 1.125 + "IntermediateDirectory", cfg.get("OutputDir"), 1.126 + "ConfigurationType", "2", "UseOfMFC", "0", 1.127 + "ATLMinimizesCRunTimeLibraryUsage", "FALSE" }); 1.128 + 1.129 + tagV("Tool", cfg.getV("CompilerFlags")); 1.130 + 1.131 + tag("Tool", new String[] { "Name", "VCCustomBuildTool" }); 1.132 + 1.133 + tagV("Tool", cfg.getV("LinkerFlags")); 1.134 + 1.135 + tag("Tool", 1.136 new String[] { 1.137 - "ProjectType", "Visual C++", 1.138 - "Version", projectVersion(), 1.139 - "Name", projectName, 1.140 - "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", 1.141 - "SccProjectName", "", 1.142 - "SccLocalPath", "" 1.143 - } 1.144 - ); 1.145 - startTag("Platforms"); 1.146 - tag("Platform", new String[] {"Name", (String) BuildConfig.getField(null, "PlatformName")}); 1.147 - endTag("Platforms"); 1.148 + "Name", 1.149 + "VCPostBuildEventTool", 1.150 + "Description", 1.151 + BuildConfig 1.152 + .getFieldString(null, "PostbuildDescription"), 1.153 + // Caution: String.replace(String,String) is available 1.154 + // from JDK5 onwards only 1.155 + "CommandLine", 1.156 + cfg.expandFormat(BuildConfig.getFieldString(null, 1.157 + "PostbuildCommand").replace("\t", 1.158 + "
")) }); 1.159 1.160 - startTag("Configurations"); 1.161 + tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); 1.162 1.163 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 1.164 - writeConfiguration((BuildConfig)i.next()); 1.165 - } 1.166 + tag("Tool", 1.167 + new String[] { 1.168 + "Name", 1.169 + "VCPreLinkEventTool", 1.170 + "Description", 1.171 + BuildConfig.getFieldString(null, "PrelinkDescription"), 1.172 + // Caution: String.replace(String,String) is available 1.173 + // from JDK5 onwards only 1.174 + "CommandLine", 1.175 + cfg.expandFormat(BuildConfig.getFieldString(null, 1.176 + "PrelinkCommand").replace("\t", "
")) }); 1.177 1.178 - endTag("Configurations"); 1.179 + tag("Tool", new String[] { "Name", "VCResourceCompilerTool", 1.180 + "PreprocessorDefinitions", "NDEBUG", "Culture", "1033" }); 1.181 1.182 - tag("References"); 1.183 + tag("Tool", new String[] { "Name", "VCMIDLTool", 1.184 + "PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible", 1.185 + "TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment", 1.186 + "1", "TypeLibraryName", 1.187 + cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName", 1.188 + "" }); 1.189 1.190 - writeFiles(allConfigs); 1.191 + endTag(); 1.192 + } 1.193 1.194 - tag("Globals"); 1.195 1.196 - endTag("VisualStudioProject"); 1.197 - printWriter.close(); 1.198 1.199 - System.out.println(" Done."); 1.200 - } 1.201 - 1.202 - 1.203 - abstract class NameFilter { 1.204 - protected String fname; 1.205 - 1.206 - abstract boolean match(FileInfo fi); 1.207 - 1.208 - String filterString() { return ""; } 1.209 - String name() { return this.fname;} 1.210 - 1.211 - @Override 1.212 - // eclipse auto-generated 1.213 - public int hashCode() { 1.214 - final int prime = 31; 1.215 - int result = 1; 1.216 - result = prime * result + getOuterType().hashCode(); 1.217 - result = prime * result + ((fname == null) ? 0 : fname.hashCode()); 1.218 - return result; 1.219 - } 1.220 - 1.221 - @Override 1.222 - // eclipse auto-generated 1.223 - public boolean equals(Object obj) { 1.224 - if (this == obj) 1.225 - return true; 1.226 - if (obj == null) 1.227 - return false; 1.228 - if (getClass() != obj.getClass()) 1.229 - return false; 1.230 - NameFilter other = (NameFilter) obj; 1.231 - if (!getOuterType().equals(other.getOuterType())) 1.232 - return false; 1.233 - if (fname == null) { 1.234 - if (other.fname != null) 1.235 - return false; 1.236 - } else if (!fname.equals(other.fname)) 1.237 - return false; 1.238 - return true; 1.239 - } 1.240 - 1.241 - // eclipse auto-generated 1.242 - private WinGammaPlatformVC7 getOuterType() { 1.243 - return WinGammaPlatformVC7.this; 1.244 - } 1.245 - } 1.246 - 1.247 - class DirectoryFilter extends NameFilter { 1.248 - String dir; 1.249 - int baseLen, dirLen; 1.250 - 1.251 - DirectoryFilter(String dir, String sbase) { 1.252 - this.dir = dir; 1.253 - this.baseLen = sbase.length(); 1.254 - this.dirLen = dir.length(); 1.255 - this.fname = dir; 1.256 - } 1.257 - 1.258 - DirectoryFilter(String fname, String dir, String sbase) { 1.259 - this.dir = dir; 1.260 - this.baseLen = sbase.length(); 1.261 - this.dirLen = dir.length(); 1.262 - this.fname = fname; 1.263 - } 1.264 - 1.265 - 1.266 - boolean match(FileInfo fi) { 1.267 - int lastSlashIndex = fi.full.lastIndexOf('/'); 1.268 - String fullDir = fi.full.substring(0, lastSlashIndex); 1.269 - return fullDir.endsWith(dir); 1.270 - } 1.271 - 1.272 - @Override 1.273 - // eclipse auto-generated 1.274 - public int hashCode() { 1.275 - final int prime = 31; 1.276 - int result = super.hashCode(); 1.277 - result = prime * result + getOuterType().hashCode(); 1.278 - result = prime * result + baseLen; 1.279 - result = prime * result + ((dir == null) ? 0 : dir.hashCode()); 1.280 - result = prime * result + dirLen; 1.281 - return result; 1.282 - } 1.283 - 1.284 - @Override 1.285 - // eclipse auto-generated 1.286 - public boolean equals(Object obj) { 1.287 - if (this == obj) 1.288 - return true; 1.289 - if (!super.equals(obj)) 1.290 - return false; 1.291 - if (getClass() != obj.getClass()) 1.292 - return false; 1.293 - DirectoryFilter other = (DirectoryFilter) obj; 1.294 - if (!getOuterType().equals(other.getOuterType())) 1.295 - return false; 1.296 - if (baseLen != other.baseLen) 1.297 - return false; 1.298 - if (dir == null) { 1.299 - if (other.dir != null) 1.300 - return false; 1.301 - } else if (!dir.equals(other.dir)) 1.302 - return false; 1.303 - if (dirLen != other.dirLen) 1.304 - return false; 1.305 - return true; 1.306 - } 1.307 - 1.308 - // eclipse auto-generated 1.309 - private WinGammaPlatformVC7 getOuterType() { 1.310 - return WinGammaPlatformVC7.this; 1.311 - } 1.312 - } 1.313 - 1.314 - class TerminatorFilter extends NameFilter { 1.315 - TerminatorFilter(String fname) { 1.316 - this.fname = fname; 1.317 - 1.318 - } 1.319 - boolean match(FileInfo fi) { 1.320 - return true; 1.321 - } 1.322 - 1.323 - } 1.324 - 1.325 - class SpecificNameFilter extends NameFilter { 1.326 - String pats[]; 1.327 - 1.328 - SpecificNameFilter(String fname, String[] pats) { 1.329 - this.fname = fname; 1.330 - this.pats = pats; 1.331 - } 1.332 - 1.333 - boolean match(FileInfo fi) { 1.334 - for (int i=0; i<pats.length; i++) { 1.335 - if (fi.attr.shortName.matches(pats[i])) { 1.336 - return true; 1.337 - } 1.338 - } 1.339 - return false; 1.340 - } 1.341 - 1.342 - } 1.343 - 1.344 - class SpecificPathFilter extends NameFilter { 1.345 - String pats[]; 1.346 - 1.347 - SpecificPathFilter(String fname, String[] pats) { 1.348 - this.fname = fname; 1.349 - this.pats = pats; 1.350 - } 1.351 - 1.352 - boolean match(FileInfo fi) { 1.353 - for (int i=0; i<pats.length; i++) { 1.354 - if (fi.full.matches(pats[i])) { 1.355 - return true; 1.356 - } 1.357 - } 1.358 - return false; 1.359 - } 1.360 - 1.361 - } 1.362 - 1.363 - class ContainerFilter extends NameFilter { 1.364 - Vector children; 1.365 - 1.366 - ContainerFilter(String fname) { 1.367 - this.fname = fname; 1.368 - children = new Vector(); 1.369 - 1.370 - } 1.371 - boolean match(FileInfo fi) { 1.372 - return false; 1.373 - } 1.374 - 1.375 - Iterator babies() { return children.iterator(); } 1.376 - 1.377 - void add(NameFilter f) { 1.378 - children.add(f); 1.379 - } 1.380 - } 1.381 - 1.382 - 1.383 - void writeCustomToolConfig(Vector configs, String[] customToolAttrs) { 1.384 - for (Iterator i = configs.iterator(); i.hasNext(); ) { 1.385 - startTag("FileConfiguration", 1.386 - new String[] { 1.387 - "Name", (String)i.next() 1.388 - } 1.389 - ); 1.390 - tag("Tool", customToolAttrs); 1.391 - 1.392 - endTag("FileConfiguration"); 1.393 - } 1.394 - } 1.395 - 1.396 - // here we define filters, which define layout of what can be seen in 'Solution View' of MSVC 1.397 - // Basically there are two types of entities - container filters and real filters 1.398 - // - container filter just provides a container to group together real filters 1.399 - // - real filter can select elements from the set according to some rule, put it into XML 1.400 - // and remove from the list 1.401 - Vector<NameFilter> makeFilters(TreeSet<FileInfo> files) { 1.402 - Vector<NameFilter> rv = new Vector<NameFilter>(); 1.403 - String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/"); 1.404 - 1.405 - String currentDir = ""; 1.406 - DirectoryFilter container = null; 1.407 - for(FileInfo fileInfo : files) { 1.408 - 1.409 - if (!fileInfo.full.startsWith(sbase)) { 1.410 - continue; 1.411 - } 1.412 - 1.413 - int lastSlash = fileInfo.full.lastIndexOf('/'); 1.414 - String dir = fileInfo.full.substring(sbase.length(), lastSlash); 1.415 - if(dir.equals("share/vm")) { 1.416 - // skip files directly in share/vm - should only be precompiled.hpp which is handled below 1.417 - continue; 1.418 - } 1.419 - if (!dir.equals(currentDir)) { 1.420 - currentDir = dir; 1.421 - if (container != null && !rv.contains(container)) { 1.422 - rv.add(container); 1.423 - } 1.424 - 1.425 - // remove "share/vm/" from names 1.426 - String name = dir; 1.427 - if (dir.startsWith("share/vm/")) { 1.428 - name = dir.substring("share/vm/".length(), dir.length()); 1.429 - } 1.430 - DirectoryFilter newfilter = new DirectoryFilter(name, dir, sbase); 1.431 - int i = rv.indexOf(newfilter); 1.432 - if(i == -1) { 1.433 - container = newfilter; 1.434 - } else { 1.435 - // if the filter already exists, reuse it 1.436 - container = (DirectoryFilter) rv.get(i); 1.437 - } 1.438 - } 1.439 - } 1.440 - if (container != null && !rv.contains(container)) { 1.441 - rv.add(container); 1.442 - } 1.443 - 1.444 - ContainerFilter generated = new ContainerFilter("Generated"); 1.445 - ContainerFilter c1Generated = new ContainerFilter("C1"); 1.446 - c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 1.447 - c1Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler1/generated/jvmtifiles/.*"})); 1.448 - generated.add(c1Generated); 1.449 - ContainerFilter c2Generated = new ContainerFilter("C2"); 1.450 - c2Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler2/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 1.451 - c2Generated.add(new SpecificPathFilter("adfiles", new String[] {".*compiler2/generated/adfiles/.*"})); 1.452 - c2Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler2/generated/jvmtifiles/.*"})); 1.453 - generated.add(c2Generated); 1.454 - ContainerFilter coreGenerated = new ContainerFilter("Core"); 1.455 - coreGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*core/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 1.456 - coreGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*core/generated/jvmtifiles/.*"})); 1.457 - generated.add(coreGenerated); 1.458 - ContainerFilter tieredGenerated = new ContainerFilter("Tiered"); 1.459 - tieredGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*tiered/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 1.460 - tieredGenerated.add(new SpecificPathFilter("adfiles", new String[] {".*tiered/generated/adfiles/.*"})); 1.461 - tieredGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*tiered/generated/jvmtifiles/.*"})); 1.462 - generated.add(tieredGenerated); 1.463 - ContainerFilter kernelGenerated = new ContainerFilter("Kernel"); 1.464 - kernelGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*kernel/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"})); 1.465 - kernelGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*kernel/generated/jvmtifiles/.*"})); 1.466 - generated.add(kernelGenerated); 1.467 - rv.add(generated); 1.468 - 1.469 - rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"})); 1.470 - 1.471 - // this one is to catch files not caught by other filters 1.472 - rv.add(new TerminatorFilter("Source Files")); 1.473 - 1.474 - return rv; 1.475 - } 1.476 - 1.477 - void writeFiles(Vector<BuildConfig> allConfigs) { 1.478 - 1.479 - Hashtable allFiles = computeAttributedFiles(allConfigs); 1.480 - 1.481 - Vector allConfigNames = new Vector(); 1.482 - for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { 1.483 - allConfigNames.add(((BuildConfig)i.next()).get("Name")); 1.484 - } 1.485 - 1.486 - TreeSet sortedFiles = sortFiles(allFiles); 1.487 - 1.488 - startTag("Files"); 1.489 - 1.490 - for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) { 1.491 - doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next()); 1.492 - } 1.493 - 1.494 - 1.495 - startTag("Filter", 1.496 - new String[] { 1.497 - "Name", "Resource Files", 1.498 - "Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" 1.499 - } 1.500 - ); 1.501 - endTag("Filter"); 1.502 - 1.503 - endTag("Files"); 1.504 - } 1.505 - 1.506 - void doWriteFiles(TreeSet allFiles, Vector allConfigNames, NameFilter filter) { 1.507 - startTag("Filter", 1.508 - new String[] { 1.509 - "Name", filter.name(), 1.510 - "Filter", filter.filterString() 1.511 - } 1.512 - ); 1.513 - 1.514 - if (filter instanceof ContainerFilter) { 1.515 - 1.516 - Iterator i = ((ContainerFilter)filter).babies(); 1.517 - while (i.hasNext()) { 1.518 - doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next()); 1.519 - } 1.520 - 1.521 - } else { 1.522 - 1.523 - Iterator i = allFiles.iterator(); 1.524 - while (i.hasNext()) { 1.525 - FileInfo fi = (FileInfo)i.next(); 1.526 - 1.527 - if (!filter.match(fi)) { 1.528 - continue; 1.529 - } 1.530 - 1.531 - startTag("File", 1.532 - new String[] { 1.533 - "RelativePath", fi.full.replace('/', '\\') 1.534 - } 1.535 - ); 1.536 - 1.537 - FileAttribute a = fi.attr; 1.538 - if (a.pchRoot) { 1.539 - writeCustomToolConfig(allConfigNames, 1.540 - new String[] { 1.541 - "Name", "VCCLCompilerTool", 1.542 - "UsePrecompiledHeader", "1" 1.543 - }); 1.544 - } 1.545 - 1.546 - if (a.noPch) { 1.547 - writeCustomToolConfig(allConfigNames, 1.548 - new String[] { 1.549 - "Name", "VCCLCompilerTool", 1.550 - "UsePrecompiledHeader", "0" 1.551 - }); 1.552 - } 1.553 - 1.554 - if (a.configs != null) { 1.555 - for (Iterator j=allConfigNames.iterator(); j.hasNext();) { 1.556 - String cfg = (String)j.next(); 1.557 - if (!a.configs.contains(cfg)) { 1.558 - startTag("FileConfiguration", 1.559 - new String[] { 1.560 - "Name", cfg, 1.561 - "ExcludedFromBuild", "TRUE" 1.562 - }); 1.563 - endTag("FileConfiguration"); 1.564 - 1.565 - } 1.566 - } 1.567 - } 1.568 - 1.569 - endTag("File"); 1.570 - 1.571 - // we not gonna look at this file anymore 1.572 - i.remove(); 1.573 - } 1.574 - } 1.575 - 1.576 - endTag("Filter"); 1.577 - } 1.578 - 1.579 - 1.580 - void writeConfiguration(BuildConfig cfg) { 1.581 - startTag("Configuration", 1.582 - new String[] { 1.583 - "Name", cfg.get("Name"), 1.584 - "OutputDirectory", cfg.get("OutputDir"), 1.585 - "IntermediateDirectory", cfg.get("OutputDir"), 1.586 - "ConfigurationType", "2", 1.587 - "UseOfMFC", "0", 1.588 - "ATLMinimizesCRunTimeLibraryUsage", "FALSE" 1.589 - } 1.590 - ); 1.591 - 1.592 - 1.593 - 1.594 - tagV("Tool", cfg.getV("CompilerFlags")); 1.595 - 1.596 - tag("Tool", 1.597 - new String[] { 1.598 - "Name", "VCCustomBuildTool" 1.599 - } 1.600 - ); 1.601 - 1.602 - tagV("Tool", cfg.getV("LinkerFlags")); 1.603 - 1.604 - tag("Tool", 1.605 - new String[] { 1.606 - "Name", "VCPostBuildEventTool", 1.607 - "Description", BuildConfig.getFieldString(null, "PostbuildDescription"), 1.608 - //Caution: String.replace(String,String) is available from JDK5 onwards only 1.609 - "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace 1.610 - ("\t", "
")) 1.611 - } 1.612 - ); 1.613 - 1.614 - tag("Tool", 1.615 - new String[] { 1.616 - "Name", "VCPreBuildEventTool" 1.617 - } 1.618 - ); 1.619 - 1.620 - tag("Tool", 1.621 - new String[] { 1.622 - "Name", "VCPreLinkEventTool", 1.623 - "Description", BuildConfig.getFieldString(null, "PrelinkDescription"), 1.624 - //Caution: String.replace(String,String) is available from JDK5 onwards only 1.625 - "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace 1.626 - ("\t", "
")) 1.627 - } 1.628 - ); 1.629 - 1.630 - tag("Tool", 1.631 - new String[] { 1.632 - "Name", "VCResourceCompilerTool", 1.633 - // XXX??? 1.634 - "PreprocessorDefinitions", "NDEBUG", 1.635 - "Culture", "1033" 1.636 - } 1.637 - ); 1.638 - 1.639 - tag("Tool", 1.640 - new String[] { 1.641 - "Name", "VCMIDLTool", 1.642 - "PreprocessorDefinitions", "NDEBUG", 1.643 - "MkTypLibCompatible", "TRUE", 1.644 - "SuppressStartupBanner", "TRUE", 1.645 - "TargetEnvironment", "1", 1.646 - "TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb", 1.647 - "HeaderFileName", "" 1.648 - } 1.649 - ); 1.650 - 1.651 - endTag("Configuration"); 1.652 - } 1.653 - 1.654 - int indent; 1.655 - 1.656 - private void startTagPrim(String name, 1.657 - String[] attrs, 1.658 - boolean close) { 1.659 - startTagPrim(name, attrs, close, true); 1.660 - } 1.661 - 1.662 - private void startTagPrim(String name, 1.663 - String[] attrs, 1.664 - boolean close, 1.665 - boolean newline) { 1.666 - doIndent(); 1.667 - printWriter.print("<"+name); 1.668 - indent++; 1.669 - 1.670 - if (attrs != null && attrs.length > 0) { 1.671 - for (int i=0; i<attrs.length; i+=2) { 1.672 - printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\""); 1.673 - if (i < attrs.length - 2) { 1.674 - } 1.675 - } 1.676 - } 1.677 - 1.678 - if (close) { 1.679 - indent--; 1.680 - printWriter.print(" />"); 1.681 - } else { 1.682 - printWriter.print(">"); 1.683 - } 1.684 - if(newline) { 1.685 - printWriter.println(); 1.686 - } 1.687 - } 1.688 - 1.689 - void startTag(String name, String... attrs) { 1.690 - startTagPrim(name, attrs, false); 1.691 - } 1.692 - 1.693 - void startTagV(String name, Vector attrs) { 1.694 - String s[] = new String [attrs.size()]; 1.695 - for (int i=0; i<attrs.size(); i++) { 1.696 - s[i] = (String)attrs.elementAt(i); 1.697 - } 1.698 - startTagPrim(name, s, false); 1.699 - } 1.700 - 1.701 - void endTag(String name) { 1.702 - indent--; 1.703 - doIndent(); 1.704 - printWriter.println("</"+name+">"); 1.705 - } 1.706 - 1.707 - void tag(String name, String... attrs) { 1.708 - startTagPrim(name, attrs, true); 1.709 - } 1.710 - 1.711 - void tagData(String name, String data) { 1.712 - doIndent(); 1.713 - printWriter.print("<"+name+">"); 1.714 - printWriter.print(data); 1.715 - printWriter.println("</"+name+">"); 1.716 - } 1.717 - 1.718 - void tagData(String name, String data, String... attrs) { 1.719 - startTagPrim(name, attrs, false, false); 1.720 - printWriter.print(data); 1.721 - printWriter.println("</"+name+">"); 1.722 - indent--; 1.723 - } 1.724 - 1.725 - void tagV(String name, Vector attrs) { 1.726 - String s[] = new String [attrs.size()]; 1.727 - for (int i=0; i<attrs.size(); i++) { 1.728 - s[i] = (String)attrs.elementAt(i); 1.729 - } 1.730 - startTagPrim(name, s, true); 1.731 - } 1.732 - 1.733 - 1.734 - void doIndent() { 1.735 - for (int i=0; i<indent; i++) { 1.736 - printWriter.print(" "); 1.737 - } 1.738 - } 1.739 - 1.740 - protected String getProjectExt() { 1.741 - return ".vcproj"; 1.742 - } 1.743 + protected String getProjectExt() { 1.744 + return ".vcproj"; 1.745 + } 1.746 } 1.747 1.748 class CompilerInterfaceVC7 extends CompilerInterface { 1.749 - void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) { 1.750 + void getBaseCompilerFlags_common(Vector defines, Vector includes, 1.751 + String outDir, Vector rv) { 1.752 1.753 - // advanced M$ IDE (2003) can only recognize name if it's first or 1.754 - // second attribute in the tag - go guess 1.755 - addAttr(rv, "Name", "VCCLCompilerTool"); 1.756 - addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); 1.757 - addAttr(rv, "PreprocessorDefinitions", 1.758 - Util.join(";", defines).replace("\"",""")); 1.759 - addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); 1.760 - addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch"); 1.761 - addAttr(rv, "AssemblerListingLocation", outDir); 1.762 - addAttr(rv, "ObjectFile", outDir+Util.sep); 1.763 - addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); 1.764 - // Set /nologo optin 1.765 - addAttr(rv, "SuppressStartupBanner", "TRUE"); 1.766 - // Surpass the default /Tc or /Tp. 0 is compileAsDefault 1.767 - addAttr(rv, "CompileAs", "0"); 1.768 - // Set /W3 option. 3 is warningLevel_3 1.769 - addAttr(rv, "WarningLevel", "3"); 1.770 - // Set /WX option, 1.771 - addAttr(rv, "WarnAsError", "TRUE"); 1.772 - // Set /GS option 1.773 - addAttr(rv, "BufferSecurityCheck", "FALSE"); 1.774 - // Set /Zi option. 3 is debugEnabled 1.775 - addAttr(rv, "DebugInformationFormat", "3"); 1.776 - } 1.777 - Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { 1.778 - Vector rv = new Vector(); 1.779 + // advanced M$ IDE (2003) can only recognize name if it's first or 1.780 + // second attribute in the tag - go guess 1.781 + addAttr(rv, "Name", "VCCLCompilerTool"); 1.782 + addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); 1.783 + addAttr(rv, "PreprocessorDefinitions", 1.784 + Util.join(";", defines).replace("\"", """)); 1.785 + addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); 1.786 + addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch"); 1.787 + addAttr(rv, "AssemblerListingLocation", outDir); 1.788 + addAttr(rv, "ObjectFile", outDir + Util.sep); 1.789 + addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb"); 1.790 + // Set /nologo optin 1.791 + addAttr(rv, "SuppressStartupBanner", "TRUE"); 1.792 + // Surpass the default /Tc or /Tp. 0 is compileAsDefault 1.793 + addAttr(rv, "CompileAs", "0"); 1.794 + // Set /W3 option. 3 is warningLevel_3 1.795 + addAttr(rv, "WarningLevel", "3"); 1.796 + // Set /WX option, 1.797 + addAttr(rv, "WarnAsError", "TRUE"); 1.798 + // Set /GS option 1.799 + addAttr(rv, "BufferSecurityCheck", "FALSE"); 1.800 + // Set /Zi option. 3 is debugEnabled 1.801 + addAttr(rv, "DebugInformationFormat", "3"); 1.802 + } 1.803 1.804 - getBaseCompilerFlags_common(defines,includes, outDir, rv); 1.805 - // Set /Yu option. 3 is pchUseUsingSpecific 1.806 - // Note: Starting VC8 pchUseUsingSpecific is 2 !!! 1.807 - addAttr(rv, "UsePrecompiledHeader", "3"); 1.808 - // Set /EHsc- option 1.809 - addAttr(rv, "ExceptionHandling", "FALSE"); 1.810 + Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { 1.811 + Vector rv = new Vector(); 1.812 1.813 - return rv; 1.814 - } 1.815 + getBaseCompilerFlags_common(defines, includes, outDir, rv); 1.816 + // Set /Yu option. 3 is pchUseUsingSpecific 1.817 + // Note: Starting VC8 pchUseUsingSpecific is 2 !!! 1.818 + addAttr(rv, "UsePrecompiledHeader", "3"); 1.819 + // Set /EHsc- option 1.820 + addAttr(rv, "ExceptionHandling", "FALSE"); 1.821 1.822 - Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { 1.823 - Vector rv = new Vector(); 1.824 + return rv; 1.825 + } 1.826 1.827 - addAttr(rv, "Name", "VCLinkerTool"); 1.828 - addAttr(rv, "AdditionalOptions", 1.829 - "/export:JNI_GetDefaultJavaVMInitArgs " + 1.830 - "/export:JNI_CreateJavaVM " + 1.831 - "/export:JVM_FindClassFromBootLoader "+ 1.832 - "/export:JNI_GetCreatedJavaVMs "+ 1.833 - "/export:jio_snprintf /export:jio_printf "+ 1.834 - "/export:jio_fprintf /export:jio_vfprintf "+ 1.835 - "/export:jio_vsnprintf "+ 1.836 - "/export:JVM_GetVersionInfo "+ 1.837 - "/export:JVM_GetThreadStateNames "+ 1.838 - "/export:JVM_GetThreadStateValues "+ 1.839 - "/export:JVM_InitAgentProperties "); 1.840 - addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); 1.841 - addAttr(rv, "OutputFile", outDll); 1.842 - // Set /INCREMENTAL option. 1 is linkIncrementalNo 1.843 - addAttr(rv, "LinkIncremental", "1"); 1.844 - addAttr(rv, "SuppressStartupBanner", "TRUE"); 1.845 - addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); 1.846 - addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); 1.847 - // Set /SUBSYSTEM option. 2 is subSystemWindows 1.848 - addAttr(rv, "SubSystem", "2"); 1.849 - addAttr(rv, "BaseAddress", "0x8000000"); 1.850 - addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); 1.851 - if(platformName.equals("Win32")) { 1.852 - // Set /MACHINE option. 1 is X86 1.853 - addAttr(rv, "TargetMachine", "1"); 1.854 - } else { 1.855 - // Set /MACHINE option. 17 is X64 1.856 - addAttr(rv, "TargetMachine", "17"); 1.857 - } 1.858 + Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { 1.859 + Vector rv = new Vector(); 1.860 1.861 - return rv; 1.862 - } 1.863 + addAttr(rv, "Name", "VCLinkerTool"); 1.864 + addAttr(rv, "AdditionalOptions", 1.865 + "/export:JNI_GetDefaultJavaVMInitArgs " 1.866 + + "/export:JNI_CreateJavaVM " 1.867 + + "/export:JVM_FindClassFromBootLoader " 1.868 + + "/export:JNI_GetCreatedJavaVMs " 1.869 + + "/export:jio_snprintf /export:jio_printf " 1.870 + + "/export:jio_fprintf /export:jio_vfprintf " 1.871 + + "/export:jio_vsnprintf " 1.872 + + "/export:JVM_GetVersionInfo " 1.873 + + "/export:JVM_GetThreadStateNames " 1.874 + + "/export:JVM_GetThreadStateValues " 1.875 + + "/export:JVM_InitAgentProperties "); 1.876 + addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); 1.877 + addAttr(rv, "OutputFile", outDll); 1.878 + // Set /INCREMENTAL option. 1 is linkIncrementalNo 1.879 + addAttr(rv, "LinkIncremental", "1"); 1.880 + addAttr(rv, "SuppressStartupBanner", "TRUE"); 1.881 + addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def"); 1.882 + addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb"); 1.883 + // Set /SUBSYSTEM option. 2 is subSystemWindows 1.884 + addAttr(rv, "SubSystem", "2"); 1.885 + addAttr(rv, "BaseAddress", "0x8000000"); 1.886 + addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib"); 1.887 + if (platformName.equals("Win32")) { 1.888 + // Set /MACHINE option. 1 is X86 1.889 + addAttr(rv, "TargetMachine", "1"); 1.890 + } else { 1.891 + // Set /MACHINE option. 17 is X64 1.892 + addAttr(rv, "TargetMachine", "17"); 1.893 + } 1.894 1.895 - void getDebugCompilerFlags_common(String opt,Vector rv) { 1.896 + return rv; 1.897 + } 1.898 1.899 - // Set /On option 1.900 - addAttr(rv, "Optimization", opt); 1.901 - // Set /FR option. 1 is brAllInfo 1.902 - addAttr(rv, "BrowseInformation", "1"); 1.903 - addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); 1.904 - // Set /MD option. 2 is rtMultiThreadedDLL 1.905 - addAttr(rv, "RuntimeLibrary", "2"); 1.906 - // Set /Oy- option 1.907 - addAttr(rv, "OmitFramePointers", "FALSE"); 1.908 + void getDebugCompilerFlags_common(String opt, Vector rv) { 1.909 1.910 - } 1.911 + // Set /On option 1.912 + addAttr(rv, "Optimization", opt); 1.913 + // Set /FR option. 1 is brAllInfo 1.914 + addAttr(rv, "BrowseInformation", "1"); 1.915 + addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); 1.916 + // Set /MD option. 2 is rtMultiThreadedDLL 1.917 + addAttr(rv, "RuntimeLibrary", "2"); 1.918 + // Set /Oy- option 1.919 + addAttr(rv, "OmitFramePointers", "FALSE"); 1.920 1.921 - Vector getDebugCompilerFlags(String opt) { 1.922 - Vector rv = new Vector(); 1.923 + } 1.924 1.925 - getDebugCompilerFlags_common(opt,rv); 1.926 + Vector getDebugCompilerFlags(String opt) { 1.927 + Vector rv = new Vector(); 1.928 1.929 - return rv; 1.930 - } 1.931 + getDebugCompilerFlags_common(opt, rv); 1.932 1.933 - Vector getDebugLinkerFlags() { 1.934 - Vector rv = new Vector(); 1.935 + return rv; 1.936 + } 1.937 1.938 - addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option 1.939 + Vector getDebugLinkerFlags() { 1.940 + Vector rv = new Vector(); 1.941 1.942 - return rv; 1.943 - } 1.944 + addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option 1.945 1.946 - void getAdditionalNonKernelLinkerFlags(Vector rv) { 1.947 - extAttr(rv, "AdditionalOptions", 1.948 - "/export:AsyncGetCallTrace "); 1.949 - } 1.950 + return rv; 1.951 + } 1.952 1.953 - void getProductCompilerFlags_common(Vector rv) { 1.954 - // Set /O2 option. 2 is optimizeMaxSpeed 1.955 - addAttr(rv, "Optimization", "2"); 1.956 - // Set /Oy- option 1.957 - addAttr(rv, "OmitFramePointers", "FALSE"); 1.958 - // Set /Ob option. 1 is expandOnlyInline 1.959 - addAttr(rv, "InlineFunctionExpansion", "1"); 1.960 - // Set /GF option. 1.961 - addAttr(rv, "StringPooling", "TRUE"); 1.962 - // Set /MD option. 2 is rtMultiThreadedDLL 1.963 - addAttr(rv, "RuntimeLibrary", "2"); 1.964 - // Set /Gy option 1.965 - addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); 1.966 - } 1.967 + void getAdditionalNonKernelLinkerFlags(Vector rv) { 1.968 + extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace "); 1.969 + } 1.970 1.971 - Vector getProductCompilerFlags() { 1.972 - Vector rv = new Vector(); 1.973 + void getProductCompilerFlags_common(Vector rv) { 1.974 + // Set /O2 option. 2 is optimizeMaxSpeed 1.975 + addAttr(rv, "Optimization", "2"); 1.976 + // Set /Oy- option 1.977 + addAttr(rv, "OmitFramePointers", "FALSE"); 1.978 + // Set /Ob option. 1 is expandOnlyInline 1.979 + addAttr(rv, "InlineFunctionExpansion", "1"); 1.980 + // Set /GF option. 1.981 + addAttr(rv, "StringPooling", "TRUE"); 1.982 + // Set /MD option. 2 is rtMultiThreadedDLL 1.983 + addAttr(rv, "RuntimeLibrary", "2"); 1.984 + // Set /Gy option 1.985 + addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); 1.986 + } 1.987 1.988 - getProductCompilerFlags_common(rv); 1.989 + Vector getProductCompilerFlags() { 1.990 + Vector rv = new Vector(); 1.991 1.992 - return rv; 1.993 - } 1.994 + getProductCompilerFlags_common(rv); 1.995 1.996 - Vector getProductLinkerFlags() { 1.997 - Vector rv = new Vector(); 1.998 + return rv; 1.999 + } 1.1000 1.1001 - // Set /OPT:REF option. 2 is optReferences 1.1002 - addAttr(rv, "OptimizeReferences", "2"); 1.1003 - // Set /OPT:optFolding option. 2 is optFolding 1.1004 - addAttr(rv, "EnableCOMDATFolding", "2"); 1.1005 + Vector getProductLinkerFlags() { 1.1006 + Vector rv = new Vector(); 1.1007 1.1008 - return rv; 1.1009 - } 1.1010 + // Set /OPT:REF option. 2 is optReferences 1.1011 + addAttr(rv, "OptimizeReferences", "2"); 1.1012 + // Set /OPT:optFolding option. 2 is optFolding 1.1013 + addAttr(rv, "EnableCOMDATFolding", "2"); 1.1014 1.1015 - String getOptFlag() { 1.1016 - return "2"; 1.1017 - } 1.1018 + return rv; 1.1019 + } 1.1020 1.1021 - String getNoOptFlag() { 1.1022 - return "0"; 1.1023 - } 1.1024 + String getOptFlag() { 1.1025 + return "2"; 1.1026 + } 1.1027 1.1028 - String makeCfgName(String flavourBuild, String platform) { 1.1029 - return flavourBuild + "|" + platform; 1.1030 - } 1.1031 + String getNoOptFlag() { 1.1032 + return "0"; 1.1033 + } 1.1034 + 1.1035 + String makeCfgName(String flavourBuild, String platform) { 1.1036 + return flavourBuild + "|" + platform; 1.1037 + } 1.1038 + 1.1039 }