mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 20:44:41 +02:00
6989984: Use standard include model for Hospot
Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
This commit is contained in:
parent
01f78952da
commit
8006fe8f75
1587 changed files with 18714 additions and 14420 deletions
85
hotspot/src/share/tools/ProjectCreator/ArgsParser.java
Normal file
85
hotspot/src/share/tools/ProjectCreator/ArgsParser.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
class ArgIterator {
|
||||
String[] args;
|
||||
int i;
|
||||
ArgIterator(String[] args) {
|
||||
this.args = args;
|
||||
this.i = 0;
|
||||
}
|
||||
String get() { return args[i]; }
|
||||
boolean hasMore() { return args != null && i < args.length; }
|
||||
boolean next() { return ++i < args.length; }
|
||||
}
|
||||
|
||||
abstract class ArgHandler {
|
||||
public abstract void handle(ArgIterator it);
|
||||
|
||||
}
|
||||
|
||||
class ArgRule {
|
||||
String arg;
|
||||
ArgHandler handler;
|
||||
ArgRule(String arg, ArgHandler handler) {
|
||||
this.arg = arg;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
boolean process(ArgIterator it) {
|
||||
if (match(it.get(), arg)) {
|
||||
handler.handle(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
boolean match(String rule_pattern, String arg) {
|
||||
return arg.equals(rule_pattern);
|
||||
}
|
||||
}
|
||||
|
||||
class ArgsParser {
|
||||
ArgsParser(String[] args,
|
||||
ArgRule[] rules,
|
||||
ArgHandler defaulter) {
|
||||
ArgIterator ai = new ArgIterator(args);
|
||||
while (ai.hasMore()) {
|
||||
boolean processed = false;
|
||||
for (int i=0; i<rules.length; i++) {
|
||||
processed |= rules[i].process(ai);
|
||||
if (processed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!processed) {
|
||||
if (defaulter != null) {
|
||||
defaulter.handle(ai);
|
||||
} else {
|
||||
System.err.println("ERROR: unparsed \""+ai.get()+"\"");
|
||||
ai.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
716
hotspot/src/share/tools/ProjectCreator/BuildConfig.java
Normal file
716
hotspot/src/share/tools/ProjectCreator/BuildConfig.java
Normal file
|
@ -0,0 +1,716 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
|
||||
class BuildConfig {
|
||||
Hashtable vars;
|
||||
Vector basicNames, basicPaths;
|
||||
String[] context;
|
||||
|
||||
static CompilerInterface ci;
|
||||
static CompilerInterface getCI() {
|
||||
if (ci == null) {
|
||||
String comp = (String)getField(null, "CompilerVersion");
|
||||
try {
|
||||
ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
|
||||
} catch (Exception cnfe) {
|
||||
System.err.println("Cannot find support for compiler " + comp);
|
||||
throw new RuntimeException(cnfe.toString());
|
||||
}
|
||||
}
|
||||
return ci;
|
||||
}
|
||||
|
||||
protected void initNames(String flavour, String build, String outDll) {
|
||||
if (vars == null) vars = new Hashtable();
|
||||
|
||||
String flavourBuild = flavour + "_" + build;
|
||||
System.out.println();
|
||||
System.out.println(flavourBuild);
|
||||
|
||||
put("Name", getCI().makeCfgName(flavourBuild));
|
||||
put("Flavour", flavour);
|
||||
put("Build", build);
|
||||
|
||||
// ones mentioned above were needed to expand format
|
||||
String buildBase = expandFormat(getFieldString(null, "BuildBase"));
|
||||
String jdkDir = getFieldString(null, "JdkTargetRoot");
|
||||
String sourceBase = getFieldString(null, "SourceBase");
|
||||
String outDir = buildBase;
|
||||
|
||||
put("Id", flavourBuild);
|
||||
put("OutputDir", outDir);
|
||||
put("SourceBase", sourceBase);
|
||||
put("BuildBase", buildBase);
|
||||
put("OutputDll", jdkDir + Util.sep + outDll);
|
||||
|
||||
context = new String [] {flavourBuild, flavour, build, null};
|
||||
}
|
||||
|
||||
protected void init(Vector includes, Vector defines) {
|
||||
initDefaultDefines(defines);
|
||||
initDefaultCompilerFlags(includes);
|
||||
initDefaultLinkerFlags();
|
||||
handleDB();
|
||||
}
|
||||
|
||||
|
||||
protected void initDefaultCompilerFlags(Vector includes) {
|
||||
Vector compilerFlags = new Vector();
|
||||
|
||||
compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
|
||||
includes,
|
||||
get("OutputDir")));
|
||||
|
||||
put("CompilerFlags", compilerFlags);
|
||||
}
|
||||
|
||||
protected void initDefaultLinkerFlags() {
|
||||
Vector linkerFlags = new Vector();
|
||||
|
||||
linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll")));
|
||||
|
||||
put("LinkerFlags", linkerFlags);
|
||||
}
|
||||
|
||||
DirectoryTree getSourceTree(String sourceBase, String startAt) {
|
||||
DirectoryTree tree = new DirectoryTree();
|
||||
|
||||
tree.addSubdirToIgnore("Codemgr_wsdata");
|
||||
tree.addSubdirToIgnore("deleted_files");
|
||||
tree.addSubdirToIgnore("SCCS");
|
||||
tree.setVerbose(true);
|
||||
if (startAt != null) {
|
||||
tree.readDirectory(sourceBase + File.separator + startAt);
|
||||
} else {
|
||||
tree.readDirectory(sourceBase);
|
||||
}
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
Vector getPreferredPaths(MacroDefinitions macros) {
|
||||
Vector preferredPaths = new Vector();
|
||||
// In the case of multiple files with the same name in
|
||||
// different subdirectories, prefer the versions specified in
|
||||
// the platform file as the "os_family" and "arch" macros.
|
||||
for (Iterator iter = macros.getMacros(); iter.hasNext(); ) {
|
||||
Macro macro = (Macro) iter.next();
|
||||
if (macro.name.equals("os_family") ||
|
||||
macro.name.equals("arch")) {
|
||||
preferredPaths.add(macro.contents);
|
||||
}
|
||||
}
|
||||
// Also prefer "opto" over "adlc" for adlcVMDeps.hpp
|
||||
preferredPaths.add("opto");
|
||||
|
||||
return preferredPaths;
|
||||
}
|
||||
|
||||
|
||||
void handleDB() {
|
||||
WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject");
|
||||
|
||||
File incls = new File(get("OutputDir")+Util.sep+"incls");
|
||||
|
||||
incls.mkdirs();
|
||||
|
||||
MacroDefinitions macros = new MacroDefinitions();
|
||||
try {
|
||||
macros.readFrom(getFieldString(null, "Platform"), false);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
putSpecificField("AllFilesHash", computeAllFiles(platform, macros));
|
||||
}
|
||||
|
||||
|
||||
private boolean matchesIgnoredPath(String prefixedName) {
|
||||
Vector rv = new Vector();
|
||||
collectRelevantVectors(rv, "IgnorePath");
|
||||
for (Iterator i = rv.iterator(); i.hasNext(); ) {
|
||||
String pathPart = (String) i.next();
|
||||
if (prefixedName.contains(Util.normalize(pathPart))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void addAll(Iterator i, Hashtable hash,
|
||||
WinGammaPlatform platform, DirectoryTree tree,
|
||||
Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) {
|
||||
for (; i.hasNext(); ) {
|
||||
String fileName = (String) i.next();
|
||||
if (lookupHashFieldInContext("IgnoreFile", fileName) == null) {
|
||||
String prefixedName = platform.envVarPrefixedFileName(fileName,
|
||||
0, /* ignored */
|
||||
tree,
|
||||
preferredPaths,
|
||||
filesNotFound,
|
||||
filesDuplicate);
|
||||
if (prefixedName != null) {
|
||||
prefixedName = Util.normalize(prefixedName);
|
||||
if (!matchesIgnoredPath(prefixedName)) {
|
||||
addTo(hash, prefixedName, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addTo(Hashtable ht, String key, String value) {
|
||||
ht.put(expandFormat(key), expandFormat(value));
|
||||
}
|
||||
|
||||
Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) {
|
||||
Hashtable rv = new Hashtable();
|
||||
DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt"));
|
||||
Vector preferredPaths = getPreferredPaths(macros);
|
||||
|
||||
// Hold errors until end
|
||||
Vector filesNotFound = new Vector();
|
||||
Vector filesDuplicate = new Vector();
|
||||
|
||||
Vector includedFiles = new Vector();
|
||||
|
||||
// find all files
|
||||
Vector dirs = getSourceIncludes();
|
||||
for (Iterator i = dirs.iterator(); i.hasNext(); ) {
|
||||
String dir = (String)i.next();
|
||||
DirectoryTree subtree = getSourceTree(dir, null);
|
||||
for (Iterator fi = subtree.getFileIterator(); fi.hasNext(); ) {
|
||||
String name = ((File)fi.next()).getName();
|
||||
includedFiles.add(name);
|
||||
}
|
||||
}
|
||||
addAll(includedFiles.iterator(), rv,
|
||||
platform, tree,
|
||||
preferredPaths, filesNotFound, filesDuplicate);
|
||||
|
||||
Vector addFiles = new Vector();
|
||||
collectRelevantVectors(addFiles, "AdditionalFile");
|
||||
addAll(addFiles.iterator(), rv,
|
||||
platform, tree,
|
||||
preferredPaths, filesNotFound, filesDuplicate);
|
||||
|
||||
collectRelevantHashes(rv, "AdditionalGeneratedFile");
|
||||
|
||||
if ((filesNotFound.size() != 0) ||
|
||||
(filesDuplicate.size() != 0)) {
|
||||
System.err.println("Error: some files were not found or " +
|
||||
"appeared in multiple subdirectories of " +
|
||||
"directory " + get("SourceBase") + " and could not " +
|
||||
"be resolved with the os_family and arch " +
|
||||
"macros in the platform file.");
|
||||
if (filesNotFound.size() != 0) {
|
||||
System.err.println("Files not found:");
|
||||
for (Iterator iter = filesNotFound.iterator();
|
||||
iter.hasNext(); ) {
|
||||
System.err.println(" " + (String) iter.next());
|
||||
}
|
||||
}
|
||||
if (filesDuplicate.size() != 0) {
|
||||
System.err.println("Duplicate files:");
|
||||
for (Iterator iter = filesDuplicate.iterator();
|
||||
iter.hasNext(); ) {
|
||||
System.err.println(" " + (String) iter.next());
|
||||
}
|
||||
}
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void initDefaultDefines(Vector defines) {
|
||||
Vector sysDefines = new Vector();
|
||||
sysDefines.add("WIN32");
|
||||
sysDefines.add("_WINDOWS");
|
||||
sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name"));
|
||||
sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
|
||||
sysDefines.add("_JNI_IMPLEMENTATION_");
|
||||
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
|
||||
|
||||
sysDefines.addAll(defines);
|
||||
|
||||
put("Define", sysDefines);
|
||||
}
|
||||
|
||||
String get(String key) {
|
||||
return (String)vars.get(key);
|
||||
}
|
||||
|
||||
Vector getV(String key) {
|
||||
return (Vector)vars.get(key);
|
||||
}
|
||||
|
||||
Object getO(String key) {
|
||||
return vars.get(key);
|
||||
}
|
||||
|
||||
Hashtable getH(String key) {
|
||||
return (Hashtable)vars.get(key);
|
||||
}
|
||||
|
||||
Object getFieldInContext(String field) {
|
||||
for (int i=0; i<context.length; i++) {
|
||||
Object rv = getField(context[i], field);
|
||||
if (rv != null) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Object lookupHashFieldInContext(String field, String key) {
|
||||
for (int i=0; i<context.length; i++) {
|
||||
Hashtable ht = (Hashtable)getField(context[i], field);
|
||||
if (ht != null) {
|
||||
Object rv = ht.get(key);
|
||||
if (rv != null) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void put(String key, String value) {
|
||||
vars.put(key, value);
|
||||
}
|
||||
|
||||
void put(String key, Vector vvalue) {
|
||||
vars.put(key, vvalue);
|
||||
}
|
||||
|
||||
void add(String key, Vector vvalue) {
|
||||
getV(key).addAll(vvalue);
|
||||
}
|
||||
|
||||
String flavour() {
|
||||
return get("Flavour");
|
||||
}
|
||||
|
||||
String build() {
|
||||
return get("Build");
|
||||
}
|
||||
|
||||
Object getSpecificField(String field) {
|
||||
return getField(get("Id"), field);
|
||||
}
|
||||
|
||||
void putSpecificField(String field, Object value) {
|
||||
putField(get("Id"), field, value);
|
||||
}
|
||||
|
||||
void collectRelevantVectors(Vector rv, String field) {
|
||||
for (int i = 0; i < context.length; i++) {
|
||||
Vector v = getFieldVector(context[i], field);
|
||||
if (v != null) {
|
||||
for (Iterator j=v.iterator(); j.hasNext(); ) {
|
||||
String val = (String)j.next();
|
||||
rv.add(expandFormat(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void collectRelevantHashes(Hashtable rv, String field) {
|
||||
for (int i = 0; i < context.length; i++) {
|
||||
Hashtable v = (Hashtable)getField(context[i], field);
|
||||
if (v != null) {
|
||||
for (Enumeration e=v.keys(); e.hasMoreElements(); ) {
|
||||
String key = (String)e.nextElement();
|
||||
String val = (String)v.get(key);
|
||||
addTo(rv, key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vector getDefines() {
|
||||
Vector rv = new Vector();
|
||||
collectRelevantVectors(rv, "Define");
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getIncludes() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
collectRelevantVectors(rv, "AbsoluteInclude");
|
||||
|
||||
rv.addAll(getSourceIncludes());
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
private Vector getSourceIncludes() {
|
||||
Vector rv = new Vector();
|
||||
Vector ri = new Vector();
|
||||
String sourceBase = getFieldString(null, "SourceBase");
|
||||
collectRelevantVectors(ri, "RelativeInclude");
|
||||
for (Iterator i = ri.iterator(); i.hasNext(); ) {
|
||||
String f = (String)i.next();
|
||||
rv.add(sourceBase + Util.sep + f);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static Hashtable cfgData = new Hashtable();
|
||||
static Hashtable globalData = new Hashtable();
|
||||
|
||||
static boolean appliesToTieredBuild(String cfg) {
|
||||
return (cfg != null &&
|
||||
(cfg.startsWith("compiler1") ||
|
||||
cfg.startsWith("compiler2")));
|
||||
}
|
||||
|
||||
// Filters out the IgnoreFile and IgnorePaths since they are
|
||||
// handled specially for tiered builds.
|
||||
static boolean appliesToTieredBuild(String cfg, String key) {
|
||||
return (appliesToTieredBuild(cfg))&& (key != null && !key.startsWith("Ignore"));
|
||||
}
|
||||
|
||||
static String getTieredBuildCfg(String cfg) {
|
||||
assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg;
|
||||
return "tiered" + cfg.substring(9);
|
||||
}
|
||||
|
||||
static Object getField(String cfg, String field) {
|
||||
if (cfg == null) {
|
||||
return globalData.get(field);
|
||||
}
|
||||
|
||||
Hashtable ht = (Hashtable)cfgData.get(cfg);
|
||||
return ht == null ? null : ht.get(field);
|
||||
}
|
||||
|
||||
static String getFieldString(String cfg, String field) {
|
||||
return (String)getField(cfg, field);
|
||||
}
|
||||
|
||||
static Vector getFieldVector(String cfg, String field) {
|
||||
return (Vector)getField(cfg, field);
|
||||
}
|
||||
|
||||
static void putField(String cfg, String field, Object value) {
|
||||
putFieldImpl(cfg, field, value);
|
||||
if (appliesToTieredBuild(cfg, field)) {
|
||||
putFieldImpl(getTieredBuildCfg(cfg), field, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void putFieldImpl(String cfg, String field, Object value) {
|
||||
if (cfg == null) {
|
||||
globalData.put(field, value);
|
||||
return;
|
||||
}
|
||||
|
||||
Hashtable ht = (Hashtable)cfgData.get(cfg);
|
||||
if (ht == null) {
|
||||
ht = new Hashtable();
|
||||
cfgData.put(cfg, ht);
|
||||
}
|
||||
|
||||
ht.put(field, value);
|
||||
}
|
||||
|
||||
static Object getFieldHash(String cfg, String field, String name) {
|
||||
Hashtable ht = (Hashtable)getField(cfg, field);
|
||||
|
||||
return ht == null ? null : ht.get(name);
|
||||
}
|
||||
|
||||
static void putFieldHash(String cfg, String field, String name, Object val) {
|
||||
putFieldHashImpl(cfg, field, name, val);
|
||||
if (appliesToTieredBuild(cfg, field)) {
|
||||
putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val);
|
||||
}
|
||||
}
|
||||
|
||||
private static void putFieldHashImpl(String cfg, String field, String name, Object val) {
|
||||
Hashtable ht = (Hashtable)getField(cfg, field);
|
||||
|
||||
if (ht == null) {
|
||||
ht = new Hashtable();
|
||||
putFieldImpl(cfg, field, ht);
|
||||
}
|
||||
|
||||
ht.put(name, val);
|
||||
}
|
||||
|
||||
static void addFieldVector(String cfg, String field, String element) {
|
||||
addFieldVectorImpl(cfg, field, element);
|
||||
if (appliesToTieredBuild(cfg, field)) {
|
||||
addFieldVectorImpl(getTieredBuildCfg(cfg), field, element);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFieldVectorImpl(String cfg, String field, String element) {
|
||||
Vector v = (Vector)getField(cfg, field);
|
||||
|
||||
if (v == null) {
|
||||
v = new Vector();
|
||||
putFieldImpl(cfg, field, v);
|
||||
}
|
||||
|
||||
v.add(element);
|
||||
}
|
||||
|
||||
String expandFormat(String format) {
|
||||
if (format == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (format.indexOf('%') == -1) {
|
||||
return format;
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
int len = format.length();
|
||||
for (int i=0; i<len; i++) {
|
||||
char ch = format.charAt(i);
|
||||
if (ch == '%') {
|
||||
char ch1 = format.charAt(i+1);
|
||||
switch (ch1) {
|
||||
case '%':
|
||||
sb.append(ch1);
|
||||
break;
|
||||
case 'b':
|
||||
sb.append(build());
|
||||
break;
|
||||
case 'f':
|
||||
sb.append(flavour());
|
||||
break;
|
||||
default:
|
||||
sb.append(ch);
|
||||
sb.append(ch1);
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
sb.append(ch);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class GenericDebugConfig extends BuildConfig {
|
||||
abstract String getOptFlag();
|
||||
|
||||
protected void init(Vector includes, Vector defines) {
|
||||
defines.add("_DEBUG");
|
||||
defines.add("ASSERT");
|
||||
|
||||
super.init(includes, defines);
|
||||
|
||||
getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag()));
|
||||
getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags());
|
||||
}
|
||||
}
|
||||
|
||||
class C1DebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getNoOptFlag();
|
||||
}
|
||||
|
||||
C1DebugConfig() {
|
||||
initNames("compiler1", "debug", "fastdebug\\jre\\bin\\client\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class C1FastDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getOptFlag();
|
||||
}
|
||||
|
||||
C1FastDebugConfig() {
|
||||
initNames("compiler1", "fastdebug", "fastdebug\\jre\\bin\\client\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class C2DebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getNoOptFlag();
|
||||
}
|
||||
|
||||
C2DebugConfig() {
|
||||
initNames("compiler2", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class C2FastDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getOptFlag();
|
||||
}
|
||||
|
||||
C2FastDebugConfig() {
|
||||
initNames("compiler2", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class TieredDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getNoOptFlag();
|
||||
}
|
||||
|
||||
TieredDebugConfig() {
|
||||
initNames("tiered", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class TieredFastDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getOptFlag();
|
||||
}
|
||||
|
||||
TieredFastDebugConfig() {
|
||||
initNames("tiered", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
abstract class ProductConfig extends BuildConfig {
|
||||
protected void init(Vector includes, Vector defines) {
|
||||
defines.add("NDEBUG");
|
||||
defines.add("PRODUCT");
|
||||
|
||||
super.init(includes, defines);
|
||||
|
||||
getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
|
||||
getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
|
||||
}
|
||||
}
|
||||
|
||||
class C1ProductConfig extends ProductConfig {
|
||||
C1ProductConfig() {
|
||||
initNames("compiler1", "product", "jre\\bin\\client\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class C2ProductConfig extends ProductConfig {
|
||||
C2ProductConfig() {
|
||||
initNames("compiler2", "product", "jre\\bin\\server\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class TieredProductConfig extends ProductConfig {
|
||||
TieredProductConfig() {
|
||||
initNames("tiered", "product", "jre\\bin\\server\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CoreDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getNoOptFlag();
|
||||
}
|
||||
|
||||
CoreDebugConfig() {
|
||||
initNames("core", "debug", "fastdebug\\jre\\bin\\core\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CoreFastDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getOptFlag();
|
||||
}
|
||||
|
||||
CoreFastDebugConfig() {
|
||||
initNames("core", "fastdebug", "fastdebug\\jre\\bin\\core\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CoreProductConfig extends ProductConfig {
|
||||
CoreProductConfig() {
|
||||
initNames("core", "product", "jre\\bin\\core\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
class KernelDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getNoOptFlag();
|
||||
}
|
||||
|
||||
KernelDebugConfig() {
|
||||
initNames("kernel", "debug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class KernelFastDebugConfig extends GenericDebugConfig {
|
||||
String getOptFlag() {
|
||||
return getCI().getOptFlag();
|
||||
}
|
||||
|
||||
KernelFastDebugConfig() {
|
||||
initNames("kernel", "fastdebug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class KernelProductConfig extends ProductConfig {
|
||||
KernelProductConfig() {
|
||||
initNames("kernel", "product", "jre\\bin\\kernel\\jvm.dll");
|
||||
init(getIncludes(), getDefines());
|
||||
}
|
||||
}
|
||||
abstract class CompilerInterface {
|
||||
abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
|
||||
abstract Vector getBaseLinkerFlags(String outDir, String outDll);
|
||||
abstract Vector getDebugCompilerFlags(String opt);
|
||||
abstract Vector getDebugLinkerFlags();
|
||||
abstract Vector getProductCompilerFlags();
|
||||
abstract Vector getProductLinkerFlags();
|
||||
abstract String getOptFlag();
|
||||
abstract String getNoOptFlag();
|
||||
abstract String makeCfgName(String flavourBuild);
|
||||
|
||||
void addAttr(Vector receiver, String attr, String value) {
|
||||
receiver.add(attr); receiver.add(value);
|
||||
}
|
||||
}
|
287
hotspot/src/share/tools/ProjectCreator/DirectoryTree.java
Normal file
287
hotspot/src/share/tools/ProjectCreator/DirectoryTree.java
Normal file
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/** Encapsulates a notion of a directory tree. Designed to allow fast
|
||||
querying of full paths for unique filenames in the hierarchy. */
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class DirectoryTree {
|
||||
|
||||
/** The root of the read directoryTree */
|
||||
private Node rootNode;
|
||||
|
||||
/** Subdirs to ignore; Vector of Strings */
|
||||
private Vector subdirsToIgnore;
|
||||
|
||||
/** This maps file names to Lists of nodes. */
|
||||
private Hashtable nameToNodeListTable;
|
||||
|
||||
/** Output "."'s as directories are read. Defaults to false. */
|
||||
private boolean verbose;
|
||||
|
||||
public DirectoryTree() {
|
||||
subdirsToIgnore = new Vector();
|
||||
verbose = false;
|
||||
}
|
||||
|
||||
public void addSubdirToIgnore(String subdir) {
|
||||
subdirsToIgnore.add(subdir);
|
||||
}
|
||||
|
||||
private class FileIterator implements Iterator {
|
||||
private Vector nodes = new Vector();
|
||||
|
||||
public FileIterator(Node rootNode) {
|
||||
nodes.add(rootNode);
|
||||
prune();
|
||||
}
|
||||
public boolean hasNext() {
|
||||
return nodes.size() > 0;
|
||||
}
|
||||
public Object next() {
|
||||
Node last = (Node)nodes.remove(nodes.size() - 1);
|
||||
prune();
|
||||
return new File(last.getName());
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
private void prune() {
|
||||
while (nodes.size() > 0) {
|
||||
Node last = (Node)nodes.get(nodes.size() - 1);
|
||||
|
||||
if (last.isDirectory()) {
|
||||
nodes.remove(nodes.size() - 1);
|
||||
nodes.addAll(last.children);
|
||||
} else {
|
||||
// Is at file
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator getFileIterator() {
|
||||
return new FileIterator(rootNode);
|
||||
}
|
||||
|
||||
/** Output "."'s to System.out as directories are read. Defaults
|
||||
to false. */
|
||||
public void setVerbose(boolean newValue) {
|
||||
verbose = newValue;
|
||||
}
|
||||
|
||||
public boolean getVerbose() {
|
||||
return verbose;
|
||||
}
|
||||
|
||||
public String getRootNodeName() {
|
||||
return rootNode.getName();
|
||||
}
|
||||
|
||||
/** Takes an absolute path to the root directory of this
|
||||
DirectoryTree. Throws IllegalArgumentException if the given
|
||||
string represents a plain file or nonexistent directory. */
|
||||
|
||||
public void readDirectory(String baseDirectory)
|
||||
throws IllegalArgumentException {
|
||||
File root = new File(Util.normalize(baseDirectory));
|
||||
if (!root.isDirectory()) {
|
||||
throw new IllegalArgumentException("baseDirectory \"" +
|
||||
baseDirectory +
|
||||
"\" does not exist or " +
|
||||
"is not a directory");
|
||||
}
|
||||
try {
|
||||
root = root.getCanonicalFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e.toString());
|
||||
}
|
||||
rootNode = new Node(root);
|
||||
readDirectory(rootNode, root);
|
||||
}
|
||||
|
||||
/** Queries the DirectoryTree for a file or directory name. Takes
|
||||
only the name of the file or directory itself (i.e., no parent
|
||||
directory information should be in the passed name). Returns a
|
||||
List of DirectoryTreeNodes specifying the full paths of all of
|
||||
the files or directories of this name in the DirectoryTree.
|
||||
Returns null if the directory tree has not been read from disk
|
||||
yet or if the file was not found in the tree. */
|
||||
public List findFile(String name) {
|
||||
if (rootNode == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nameToNodeListTable == null) {
|
||||
nameToNodeListTable = new Hashtable();
|
||||
try {
|
||||
buildNameToNodeListTable(rootNode);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (List) nameToNodeListTable.get(name);
|
||||
}
|
||||
|
||||
private void buildNameToNodeListTable(Node curNode)
|
||||
throws IOException {
|
||||
String fullName = curNode.getName();
|
||||
String parent = curNode.getParent();
|
||||
String separator = System.getProperty("file.separator");
|
||||
|
||||
if (parent != null) {
|
||||
if (!fullName.startsWith(parent)) {
|
||||
throw new RuntimeException(
|
||||
"Internal error: parent of file name \"" + fullName +
|
||||
"\" does not match file name \"" + parent + "\""
|
||||
);
|
||||
}
|
||||
|
||||
int len = parent.length();
|
||||
if (!parent.endsWith(separator)) {
|
||||
len += separator.length();
|
||||
}
|
||||
|
||||
String fileName = fullName.substring(len);
|
||||
|
||||
if (fileName == null) {
|
||||
throw new RuntimeException(
|
||||
"Internal error: file name was empty"
|
||||
);
|
||||
}
|
||||
|
||||
List nodeList = (List) nameToNodeListTable.get(fileName);
|
||||
if (nodeList == null) {
|
||||
nodeList = new Vector();
|
||||
nameToNodeListTable.put(fileName, nodeList);
|
||||
}
|
||||
|
||||
nodeList.add(curNode);
|
||||
} else {
|
||||
if (curNode != rootNode) {
|
||||
throw new RuntimeException(
|
||||
"Internal error: parent of file + \"" + fullName + "\"" +
|
||||
" was null"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (curNode.isDirectory()) {
|
||||
Iterator iter = curNode.getChildren();
|
||||
if (iter != null) {
|
||||
while (iter.hasNext()) {
|
||||
buildNameToNodeListTable((Node) iter.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads all of the files in the given directory and adds them as
|
||||
children of the directory tree node. Requires that the passed
|
||||
node represents a directory. */
|
||||
|
||||
private void readDirectory(Node parentNode, File parentDir) {
|
||||
File[] children = parentDir.listFiles();
|
||||
if (children == null)
|
||||
return;
|
||||
if (verbose) {
|
||||
System.out.print(".");
|
||||
System.out.flush();
|
||||
}
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
File child = children[i];
|
||||
children[i] = null;
|
||||
boolean isDir = child.isDirectory();
|
||||
boolean mustSkip = false;
|
||||
if (isDir) {
|
||||
for (Iterator iter = subdirsToIgnore.iterator();
|
||||
iter.hasNext(); ) {
|
||||
if (child.getName().equals((String) iter.next())) {
|
||||
mustSkip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mustSkip) {
|
||||
Node childNode = new Node(child);
|
||||
parentNode.addChild(childNode);
|
||||
if (isDir) {
|
||||
readDirectory(childNode, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Node implements DirectoryTreeNode {
|
||||
private File file;
|
||||
private Vector children;
|
||||
|
||||
/** file must be a canonical file */
|
||||
Node(File file) {
|
||||
this.file = file;
|
||||
children = new Vector();
|
||||
}
|
||||
|
||||
public boolean isFile() {
|
||||
return file.isFile();
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return file.isDirectory();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return file.getPath();
|
||||
}
|
||||
|
||||
public String getParent() {
|
||||
return file.getParent();
|
||||
}
|
||||
|
||||
public void addChild(Node n) {
|
||||
children.add(n);
|
||||
}
|
||||
|
||||
public Iterator getChildren() throws IllegalArgumentException {
|
||||
return children.iterator();
|
||||
}
|
||||
|
||||
public int getNumChildren() throws IllegalArgumentException {
|
||||
return children.size();
|
||||
}
|
||||
|
||||
public DirectoryTreeNode getChild(int i)
|
||||
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
|
||||
return (DirectoryTreeNode) children.get(i);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public interface DirectoryTreeNode {
|
||||
public boolean isFile();
|
||||
public boolean isDirectory();
|
||||
public String getName();
|
||||
public String getParent();
|
||||
public Iterator getChildren() throws IllegalArgumentException;
|
||||
public int getNumChildren() throws IllegalArgumentException;
|
||||
public DirectoryTreeNode getChild(int i)
|
||||
throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
public class FileFormatException extends Exception {
|
||||
public FileFormatException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FileFormatException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
28
hotspot/src/share/tools/ProjectCreator/Macro.java
Normal file
28
hotspot/src/share/tools/ProjectCreator/Macro.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
public class Macro {
|
||||
public String name;
|
||||
public String contents;
|
||||
}
|
154
hotspot/src/share/tools/ProjectCreator/MacroDefinitions.java
Normal file
154
hotspot/src/share/tools/ProjectCreator/MacroDefinitions.java
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class MacroDefinitions {
|
||||
private Vector macros;
|
||||
|
||||
public MacroDefinitions() {
|
||||
macros = new Vector();
|
||||
}
|
||||
|
||||
public void addMacro(String name, String contents) {
|
||||
Macro macro = new Macro();
|
||||
macro.name = name;
|
||||
macro.contents = contents;
|
||||
macros.add(macro);
|
||||
}
|
||||
|
||||
private boolean lineIsEmpty(String s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
if (!Character.isWhitespace(s.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void readFrom(String fileName, boolean missingOk)
|
||||
throws FileNotFoundException, FileFormatException, IOException {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(fileName));
|
||||
} catch (FileNotFoundException e) {
|
||||
if (missingOk) {
|
||||
return;
|
||||
} else {
|
||||
throw(e);
|
||||
}
|
||||
}
|
||||
String line;
|
||||
do {
|
||||
line = reader.readLine();
|
||||
if (line != null) {
|
||||
// This had to be rewritten (compare to Database.java)
|
||||
// because the Solaris platform file has been
|
||||
// repurposed and now contains "macros" with spaces in
|
||||
// them.
|
||||
|
||||
if ((!line.startsWith("//")) &&
|
||||
(!lineIsEmpty(line))) {
|
||||
int nameBegin = -1;
|
||||
int nameEnd = -1;
|
||||
boolean gotEquals = false;
|
||||
int contentsBegin = -1;
|
||||
int contentsEnd = -1;
|
||||
|
||||
int i = 0;
|
||||
// Scan forward for beginning of name
|
||||
while (i < line.length()) {
|
||||
if (!Character.isWhitespace(line.charAt(i))) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
nameBegin = i;
|
||||
|
||||
// Scan forward for end of name
|
||||
while (i < line.length()) {
|
||||
if (Character.isWhitespace(line.charAt(i))) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
nameEnd = i;
|
||||
|
||||
// Scan forward for equals sign
|
||||
while (i < line.length()) {
|
||||
if (line.charAt(i) == '=') {
|
||||
gotEquals = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// Scan forward for start of contents
|
||||
i++;
|
||||
while (i < line.length()) {
|
||||
if (!Character.isWhitespace(line.charAt(i))) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
contentsBegin = i;
|
||||
|
||||
// Scan *backward* for end of contents
|
||||
i = line.length() - 1;
|
||||
while (i >= 0) {
|
||||
if (!Character.isWhitespace(line.charAt(i))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
contentsEnd = i+1;
|
||||
|
||||
// Now do consistency check
|
||||
if (!((nameBegin < nameEnd) &&
|
||||
(nameEnd < contentsBegin) &&
|
||||
(contentsBegin < contentsEnd) &&
|
||||
(gotEquals == true))) {
|
||||
throw new FileFormatException(
|
||||
"Expected \"macroname = value\", " +
|
||||
"but found: " + line
|
||||
);
|
||||
}
|
||||
|
||||
String name = line.substring(nameBegin, nameEnd);
|
||||
String contents = line.substring(contentsBegin,
|
||||
contentsEnd);
|
||||
addMacro(name, contents);
|
||||
}
|
||||
}
|
||||
} while (line != null);
|
||||
reader.close();
|
||||
}
|
||||
|
||||
/** This returns an Iterator of Macros. You should not mutate the
|
||||
returned Macro objects or use the Iterator to remove
|
||||
macros. */
|
||||
public Iterator getMacros() {
|
||||
return macros.iterator();
|
||||
}
|
||||
}
|
98
hotspot/src/share/tools/ProjectCreator/ProjectCreator.java
Normal file
98
hotspot/src/share/tools/ProjectCreator/ProjectCreator.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
public class ProjectCreator {
|
||||
|
||||
public static void usage() {
|
||||
System.out.println("ProjectCreator options:");
|
||||
System.err.println("WinGammaPlatform platform-specific options:");
|
||||
System.err.println(" -sourceBase <path to directory (workspace) " +
|
||||
"containing source files; no trailing slash>");
|
||||
System.err.println(" -dspFileName <full pathname to which .dsp file " +
|
||||
"will be written; all parent directories must " +
|
||||
"already exist>");
|
||||
System.err.println(" -envVar <environment variable to be inserted " +
|
||||
"into .dsp file, substituting for path given in " +
|
||||
"-sourceBase. Example: HotSpotWorkSpace>");
|
||||
System.err.println(" -dllLoc <path to directory in which to put " +
|
||||
"jvm.dll and jvm_g.dll; no trailing slash>");
|
||||
System.err.println(" If any of the above are specified, "+
|
||||
"they must all be.");
|
||||
System.err.println(" Additional, optional arguments, which can be " +
|
||||
"specified multiple times:");
|
||||
System.err.println(" -absoluteInclude <string containing absolute " +
|
||||
"path to include directory>");
|
||||
System.err.println(" -relativeInclude <string containing include " +
|
||||
"directory relative to -envVar>");
|
||||
System.err.println(" -define <preprocessor flag to be #defined " +
|
||||
"(note: doesn't yet support " +
|
||||
"#define (flag) (value))>");
|
||||
System.err.println(" -perFileLine <file> <line>");
|
||||
System.err.println(" -conditionalPerFileLine <file> <line for " +
|
||||
"release build> <line for debug build>");
|
||||
System.err.println(" (NOTE: To work around a bug in nmake, where " +
|
||||
"you can't have a '#' character in a quoted " +
|
||||
"string, all of the lines outputted have \"#\"" +
|
||||
"prepended)");
|
||||
System.err.println(" -startAt <subdir of sourceBase>");
|
||||
System.err.println(" -ignoreFile <file which won't be able to be " +
|
||||
"found in the sourceBase because it's generated " +
|
||||
"later>");
|
||||
System.err.println(" -additionalFile <file not in database but " +
|
||||
"which should show up in .dsp file>");
|
||||
System.err.println(" -additionalGeneratedFile <environment variable of " +
|
||||
"generated file's location> <relative path to " +
|
||||
"directory containing file; no trailing slash> " +
|
||||
"<name of file generated later in the build process>");
|
||||
System.err.println(" -prelink <build> <desc> <cmds>:");
|
||||
System.err.println(" Generate a set of prelink commands for the given BUILD");
|
||||
System.err.println(" (\"Debug\" or \"Release\"). The prelink description and commands");
|
||||
System.err.println(" are both quoted strings.");
|
||||
System.err.println(" Default includes: \".\"");
|
||||
System.err.println(" Default defines: WIN32, _WINDOWS, \"HOTSPOT_BUILD_USER=$(USERNAME)\"");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
if (args.length < 3) {
|
||||
usage();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
String platformName = args[0];
|
||||
Class platformClass = Class.forName(platformName);
|
||||
WinGammaPlatform platform = (WinGammaPlatform) platformClass.newInstance();
|
||||
|
||||
String[] platformArgs = new String[args.length - 1];
|
||||
System.arraycopy(args, 1, platformArgs, 0, platformArgs.length);
|
||||
|
||||
// Allow the platform to write platform-specific files
|
||||
platform.createVcproj(platformArgs);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
88
hotspot/src/share/tools/ProjectCreator/Util.java
Normal file
88
hotspot/src/share/tools/ProjectCreator/Util.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
|
||||
public class Util {
|
||||
static String join(String padder, Vector v) {
|
||||
return join(padder, v, false);
|
||||
}
|
||||
|
||||
static String join(String padder, Vector v, boolean quoted) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
for (Iterator iter = v.iterator(); iter.hasNext(); ) {
|
||||
if (quoted) {
|
||||
sb.append('"');
|
||||
}
|
||||
sb.append((String)iter.next());
|
||||
if (quoted) {
|
||||
sb.append('"');
|
||||
}
|
||||
if (iter.hasNext()) sb.append(padder);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
static String join(String padder, String v[]) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
for (int i=0; i<v.length; i++) {
|
||||
sb.append(v[i]);
|
||||
if (i < (v.length - 1)) sb.append(padder);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static String prefixed_join(String padder, Vector v, boolean quoted) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
for (Iterator iter = v.iterator(); iter.hasNext(); ) {
|
||||
sb.append(padder);
|
||||
|
||||
if (quoted) {
|
||||
sb.append('"');
|
||||
}
|
||||
sb.append((String)iter.next());
|
||||
if (quoted) {
|
||||
sb.append('"');
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
static String normalize(String file) {
|
||||
return file.replace('\\', '/');
|
||||
}
|
||||
|
||||
static String sep = File.separator;
|
||||
static String os = "Win32"; //System.getProperty("os.name");
|
||||
}
|
687
hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java
Normal file
687
hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java
Normal file
|
@ -0,0 +1,687 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
abstract class HsArgHandler extends ArgHandler {
|
||||
static final int STRING = 1;
|
||||
static final int VECTOR = 2;
|
||||
static final int HASH = 3;
|
||||
|
||||
boolean nextNotKey(ArgIterator it) {
|
||||
if (it.next()) {
|
||||
String s = it.get();
|
||||
return (s.length() == 0) || (s.charAt(0) != '-');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void empty(String key, String message) {
|
||||
if (key != null) {
|
||||
System.err.println("** Error: empty " + key);
|
||||
}
|
||||
if (message != null) {
|
||||
System.err.println(message);
|
||||
}
|
||||
WinGammaPlatform.usage();
|
||||
}
|
||||
|
||||
static String getCfg(String val) {
|
||||
int under = val.indexOf('_');
|
||||
int len = val.length();
|
||||
if (under != -1 && under < len - 1) {
|
||||
return val.substring(under+1, len);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ArgRuleSpecific extends ArgRule {
|
||||
ArgRuleSpecific(String arg, ArgHandler handler) {
|
||||
super(arg, handler);
|
||||
}
|
||||
|
||||
boolean match(String rulePattern, String arg) {
|
||||
return rulePattern.startsWith(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SpecificHsArgHandler extends HsArgHandler {
|
||||
|
||||
String message, argKey, valKey;
|
||||
int type;
|
||||
|
||||
public void handle(ArgIterator it) {
|
||||
String cfg = getCfg(it.get());
|
||||
if (nextNotKey(it)) {
|
||||
String val = it.get();
|
||||
switch (type) {
|
||||
case VECTOR:
|
||||
BuildConfig.addFieldVector(cfg, valKey, val);
|
||||
break;
|
||||
case HASH:
|
||||
BuildConfig.putFieldHash(cfg, valKey, val, "1");
|
||||
break;
|
||||
case STRING:
|
||||
BuildConfig.putField(cfg, valKey, val);
|
||||
break;
|
||||
default:
|
||||
empty(valKey, "Unknown type: "+type);
|
||||
}
|
||||
it.next();
|
||||
|
||||
} else {
|
||||
empty(argKey, message);
|
||||
}
|
||||
}
|
||||
|
||||
SpecificHsArgHandler(String argKey, String valKey, String message, int type) {
|
||||
this.argKey = argKey;
|
||||
this.valKey = valKey;
|
||||
this.message = message;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HsArgRule extends ArgRuleSpecific {
|
||||
|
||||
HsArgRule(String argKey, String valKey, String message, int type) {
|
||||
super(argKey, new SpecificHsArgHandler(argKey, valKey, message, type));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class WinGammaPlatform {
|
||||
|
||||
public boolean fileNameStringEquality(String s1, String s2) {
|
||||
return s1.equalsIgnoreCase(s2);
|
||||
}
|
||||
|
||||
static void usage() throws IllegalArgumentException {
|
||||
System.err.println("WinGammaPlatform platform-specific options:");
|
||||
System.err.println(" -sourceBase <path to directory (workspace) " +
|
||||
"containing source files; no trailing slash>");
|
||||
System.err.println(" -projectFileName <full pathname to which project file " +
|
||||
"will be written; all parent directories must " +
|
||||
"already exist>");
|
||||
System.err.println(" If any of the above are specified, "+
|
||||
"they must all be.");
|
||||
System.err.println(" Additional, optional arguments, which can be " +
|
||||
"specified multiple times:");
|
||||
System.err.println(" -absoluteInclude <string containing absolute " +
|
||||
"path to include directory>");
|
||||
System.err.println(" -relativeInclude <string containing include " +
|
||||
"directory relative to -sourceBase>");
|
||||
System.err.println(" -define <preprocessor flag to be #defined " +
|
||||
"(note: doesn't yet support " +
|
||||
"#define (flag) (value))>");
|
||||
System.err.println(" -startAt <subdir of sourceBase>");
|
||||
System.err.println(" -additionalFile <file not in database but " +
|
||||
"which should show up in project file>");
|
||||
System.err.println(" -additionalGeneratedFile <absolute path to " +
|
||||
"directory containing file; no trailing slash> " +
|
||||
"<name of file generated later in the build process>");
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
||||
public void addPerFileLine(Hashtable table,
|
||||
String fileName,
|
||||
String line) {
|
||||
Vector v = (Vector) table.get(fileName);
|
||||
if (v != null) {
|
||||
v.add(line);
|
||||
} else {
|
||||
v = new Vector();
|
||||
v.add(line);
|
||||
table.put(fileName, v);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class PerFileCondData {
|
||||
public String releaseString;
|
||||
public String debugString;
|
||||
}
|
||||
|
||||
protected void addConditionalPerFileLine(Hashtable table,
|
||||
String fileName,
|
||||
String releaseLine,
|
||||
String debugLine) {
|
||||
PerFileCondData data = new PerFileCondData();
|
||||
data.releaseString = releaseLine;
|
||||
data.debugString = debugLine;
|
||||
Vector v = (Vector) table.get(fileName);
|
||||
if (v != null) {
|
||||
v.add(data);
|
||||
} else {
|
||||
v = new Vector();
|
||||
v.add(data);
|
||||
table.put(fileName, v);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class PrelinkCommandData {
|
||||
String description;
|
||||
String commands;
|
||||
}
|
||||
|
||||
protected void addPrelinkCommand(Hashtable table,
|
||||
String build,
|
||||
String description,
|
||||
String commands) {
|
||||
PrelinkCommandData data = new PrelinkCommandData();
|
||||
data.description = description;
|
||||
data.commands = commands;
|
||||
table.put(build, data);
|
||||
}
|
||||
|
||||
public boolean findString(Vector v, String s) {
|
||||
for (Iterator iter = v.iterator(); iter.hasNext(); ) {
|
||||
if (((String) iter.next()).equals(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This returns a String containing the full path to the passed
|
||||
file name, or null if an error occurred. If the file was not
|
||||
found or was a duplicate and couldn't be resolved using the
|
||||
preferred paths, the file name is added to the appropriate
|
||||
Vector of Strings. */
|
||||
private String findFileInDirectory(String fileName,
|
||||
DirectoryTree directory,
|
||||
Vector preferredPaths,
|
||||
Vector filesNotFound,
|
||||
Vector filesDuplicate) {
|
||||
List locationsInTree = directory.findFile(fileName);
|
||||
int rootNameLength = directory.getRootNodeName().length();
|
||||
String name = null;
|
||||
if ((locationsInTree == null) ||
|
||||
(locationsInTree.size() == 0)) {
|
||||
filesNotFound.add(fileName);
|
||||
} else if (locationsInTree.size() > 1) {
|
||||
// We shouldn't have duplicate file names in our workspace.
|
||||
System.err.println();
|
||||
System.err.println("There are multiple files named as: " + fileName);
|
||||
System.exit(-1);
|
||||
// The following code could be safely removed if we don't need duplicate
|
||||
// file names.
|
||||
|
||||
// Iterate through them, trying to find one with a
|
||||
// preferred path
|
||||
search:
|
||||
{
|
||||
for (Iterator locIter = locationsInTree.iterator();
|
||||
locIter.hasNext(); ) {
|
||||
DirectoryTreeNode node =
|
||||
(DirectoryTreeNode) locIter.next();
|
||||
String tmpName = node.getName();
|
||||
for (Iterator prefIter = preferredPaths.iterator();
|
||||
prefIter.hasNext(); ) {
|
||||
// We need to make sure the preferred path is
|
||||
// found from the file path not including the root node name.
|
||||
if (tmpName.indexOf((String)prefIter.next(),
|
||||
rootNameLength) != -1) {
|
||||
name = tmpName;
|
||||
break search;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
filesDuplicate.add(fileName);
|
||||
}
|
||||
} else {
|
||||
name = ((DirectoryTreeNode) locationsInTree.get(0)).getName();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
protected String envVarPrefixedFileName(String fileName,
|
||||
int sourceBaseLen,
|
||||
DirectoryTree tree,
|
||||
Vector preferredPaths,
|
||||
Vector filesNotFound,
|
||||
Vector filesDuplicate) {
|
||||
String fullName = findFileInDirectory(fileName,
|
||||
tree,
|
||||
preferredPaths,
|
||||
filesNotFound,
|
||||
filesDuplicate);
|
||||
return fullName;
|
||||
}
|
||||
|
||||
String getProjectName(String fullPath, String extension)
|
||||
throws IllegalArgumentException, IOException {
|
||||
File file = new File(fullPath).getCanonicalFile();
|
||||
fullPath = file.getCanonicalPath();
|
||||
String parent = file.getParent();
|
||||
|
||||
if (!fullPath.endsWith(extension)) {
|
||||
throw new IllegalArgumentException("project file name \"" +
|
||||
fullPath +
|
||||
"\" does not end in "+extension);
|
||||
}
|
||||
|
||||
if ((parent != null) &&
|
||||
(!fullPath.startsWith(parent))) {
|
||||
throw new RuntimeException(
|
||||
"Internal error: parent of file name \"" + parent +
|
||||
"\" does not match file name \"" + fullPath + "\""
|
||||
);
|
||||
}
|
||||
|
||||
int len = parent.length();
|
||||
if (!parent.endsWith(Util.sep)) {
|
||||
len += Util.sep.length();
|
||||
}
|
||||
|
||||
int end = fullPath.length() - extension.length();
|
||||
|
||||
if (len == end) {
|
||||
throw new RuntimeException(
|
||||
"Internal error: file name was empty"
|
||||
);
|
||||
}
|
||||
|
||||
return fullPath.substring(len, end);
|
||||
}
|
||||
|
||||
protected abstract String getProjectExt();
|
||||
|
||||
public void createVcproj(String[] args)
|
||||
throws IllegalArgumentException, IOException {
|
||||
|
||||
parseArguments(args);
|
||||
|
||||
String projectFileName = BuildConfig.getFieldString(null, "ProjectFileName");
|
||||
String ext = getProjectExt();
|
||||
|
||||
String projectName = getProjectName(projectFileName, ext);
|
||||
|
||||
writeProjectFile(projectFileName, projectName, createAllConfigs());
|
||||
}
|
||||
|
||||
protected void writePrologue(String[] args) {
|
||||
System.err.println("WinGammaPlatform platform-specific arguments:");
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.err.print(args[i] + " ");
|
||||
}
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
|
||||
void parseArguments(String[] args) {
|
||||
new ArgsParser(args,
|
||||
new ArgRule[]
|
||||
{
|
||||
new HsArgRule("-sourceBase",
|
||||
"SourceBase",
|
||||
" (Did you set the HotSpotWorkSpace environment variable?)",
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new HsArgRule("-buildBase",
|
||||
"BuildBase",
|
||||
" (Did you set the HotSpotBuildSpace environment variable?)",
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new HsArgRule("-projectFileName",
|
||||
"ProjectFileName",
|
||||
null,
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new HsArgRule("-jdkTargetRoot",
|
||||
"JdkTargetRoot",
|
||||
" (Did you set the HotSpotJDKDist environment variable?)",
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new HsArgRule("-compiler",
|
||||
"CompilerVersion",
|
||||
" (Did you set the VcVersion correctly?)",
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new HsArgRule("-platform",
|
||||
"Platform",
|
||||
null,
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new HsArgRule("-absoluteInclude",
|
||||
"AbsoluteInclude",
|
||||
null,
|
||||
HsArgHandler.VECTOR
|
||||
),
|
||||
|
||||
new HsArgRule("-relativeInclude",
|
||||
"RelativeInclude",
|
||||
null,
|
||||
HsArgHandler.VECTOR
|
||||
),
|
||||
|
||||
new HsArgRule("-define",
|
||||
"Define",
|
||||
null,
|
||||
HsArgHandler.VECTOR
|
||||
),
|
||||
|
||||
new HsArgRule("-useToGeneratePch",
|
||||
"UseToGeneratePch",
|
||||
null,
|
||||
HsArgHandler.STRING
|
||||
),
|
||||
|
||||
new ArgRuleSpecific("-perFileLine",
|
||||
new HsArgHandler() {
|
||||
public void handle(ArgIterator it) {
|
||||
String cfg = getCfg(it.get());
|
||||
if (nextNotKey(it)) {
|
||||
String fileName = it.get();
|
||||
if (nextNotKey(it)) {
|
||||
String line = it.get();
|
||||
BuildConfig.putFieldHash(cfg, "PerFileLine", fileName, line);
|
||||
it.next();
|
||||
return;
|
||||
}
|
||||
}
|
||||
empty(null, "** Error: wrong number of args to -perFileLine");
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
new ArgRuleSpecific("-conditionalPerFileLine",
|
||||
new HsArgHandler() {
|
||||
public void handle(ArgIterator it) {
|
||||
String cfg = getCfg(it.get());
|
||||
if (nextNotKey(it)) {
|
||||
String fileName = it.get();
|
||||
if (nextNotKey(it)) {
|
||||
String productLine = it.get();
|
||||
if (nextNotKey(it)) {
|
||||
String debugLine = it.get();
|
||||
BuildConfig.putFieldHash(cfg+"_debug", "CondPerFileLine",
|
||||
fileName, debugLine);
|
||||
BuildConfig.putFieldHash(cfg+"_product", "CondPerFileLine",
|
||||
fileName, productLine);
|
||||
it.next();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
empty(null, "** Error: wrong number of args to -conditionalPerFileLine");
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
new HsArgRule("-disablePch",
|
||||
"DisablePch",
|
||||
null,
|
||||
HsArgHandler.HASH
|
||||
),
|
||||
|
||||
new ArgRule("-startAt",
|
||||
new HsArgHandler() {
|
||||
public void handle(ArgIterator it) {
|
||||
if (BuildConfig.getField(null, "StartAt") != null) {
|
||||
empty(null, "** Error: multiple -startAt");
|
||||
}
|
||||
if (nextNotKey(it)) {
|
||||
BuildConfig.putField(null, "StartAt", it.get());
|
||||
it.next();
|
||||
} else {
|
||||
empty("-startAt", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
new HsArgRule("-ignoreFile",
|
||||
"IgnoreFile",
|
||||
null,
|
||||
HsArgHandler.HASH
|
||||
),
|
||||
|
||||
new HsArgRule("-ignorePath",
|
||||
"IgnorePath",
|
||||
null,
|
||||
HsArgHandler.VECTOR
|
||||
),
|
||||
|
||||
new HsArgRule("-additionalFile",
|
||||
"AdditionalFile",
|
||||
null,
|
||||
HsArgHandler.VECTOR
|
||||
),
|
||||
|
||||
new ArgRuleSpecific("-additionalGeneratedFile",
|
||||
new HsArgHandler() {
|
||||
public void handle(ArgIterator it) {
|
||||
String cfg = getCfg(it.get());
|
||||
if (nextNotKey(it)) {
|
||||
String dir = it.get();
|
||||
if (nextNotKey(it)) {
|
||||
String fileName = it.get();
|
||||
BuildConfig.putFieldHash(cfg, "AdditionalGeneratedFile",
|
||||
Util.normalize(dir + Util.sep + fileName),
|
||||
fileName);
|
||||
it.next();
|
||||
return;
|
||||
}
|
||||
}
|
||||
empty(null, "** Error: wrong number of args to -additionalGeneratedFile");
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
new ArgRule("-prelink",
|
||||
new HsArgHandler() {
|
||||
public void handle(ArgIterator it) {
|
||||
if (nextNotKey(it)) {
|
||||
String build = it.get();
|
||||
if (nextNotKey(it)) {
|
||||
String description = it.get();
|
||||
if (nextNotKey(it)) {
|
||||
String command = it.get();
|
||||
BuildConfig.putField(null, "PrelinkDescription", description);
|
||||
BuildConfig.putField(null, "PrelinkCommand", command);
|
||||
it.next();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
empty(null, "** Error: wrong number of args to -prelink");
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
new ArgHandler() {
|
||||
public void handle(ArgIterator it) {
|
||||
|
||||
throw new RuntimeException("Arg Parser: unrecognized option "+it.get());
|
||||
}
|
||||
}
|
||||
);
|
||||
if (BuildConfig.getField(null, "SourceBase") == null ||
|
||||
BuildConfig.getField(null, "BuildBase") == null ||
|
||||
BuildConfig.getField(null, "ProjectFileName") == null ||
|
||||
BuildConfig.getField(null, "CompilerVersion") == null) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if (BuildConfig.getField(null, "UseToGeneratePch") == null) {
|
||||
throw new RuntimeException("ERROR: need to specify one file to compute PCH, with -useToGeneratePch flag");
|
||||
}
|
||||
|
||||
BuildConfig.putField(null, "PlatformObject", this);
|
||||
}
|
||||
|
||||
Vector createAllConfigs() {
|
||||
Vector allConfigs = new Vector();
|
||||
|
||||
allConfigs.add(new C1DebugConfig());
|
||||
|
||||
boolean b = true;
|
||||
if (b) {
|
||||
allConfigs.add(new C1FastDebugConfig());
|
||||
allConfigs.add(new C1ProductConfig());
|
||||
|
||||
allConfigs.add(new C2DebugConfig());
|
||||
allConfigs.add(new C2FastDebugConfig());
|
||||
allConfigs.add(new C2ProductConfig());
|
||||
|
||||
allConfigs.add(new TieredDebugConfig());
|
||||
allConfigs.add(new TieredFastDebugConfig());
|
||||
allConfigs.add(new TieredProductConfig());
|
||||
|
||||
allConfigs.add(new CoreDebugConfig());
|
||||
allConfigs.add(new CoreFastDebugConfig());
|
||||
allConfigs.add(new CoreProductConfig());
|
||||
|
||||
allConfigs.add(new KernelDebugConfig());
|
||||
allConfigs.add(new KernelFastDebugConfig());
|
||||
allConfigs.add(new KernelProductConfig());
|
||||
}
|
||||
|
||||
return allConfigs;
|
||||
}
|
||||
|
||||
class FileAttribute {
|
||||
int numConfigs;
|
||||
Vector configs;
|
||||
String shortName;
|
||||
boolean noPch, pchRoot;
|
||||
|
||||
FileAttribute(String shortName, BuildConfig cfg, int numConfigs) {
|
||||
this.shortName = shortName;
|
||||
this.noPch = (cfg.lookupHashFieldInContext("DisablePch", shortName) != null);
|
||||
this.pchRoot = shortName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"));
|
||||
this.numConfigs = numConfigs;
|
||||
|
||||
configs = new Vector();
|
||||
add(cfg.get("Name"));
|
||||
}
|
||||
|
||||
void add(String confName) {
|
||||
configs.add(confName);
|
||||
|
||||
// if presented in all configs
|
||||
if (configs.size() == numConfigs) {
|
||||
configs = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FileInfo implements Comparable {
|
||||
String full;
|
||||
FileAttribute attr;
|
||||
|
||||
FileInfo(String full, FileAttribute attr) {
|
||||
this.full = full;
|
||||
this.attr = attr;
|
||||
}
|
||||
|
||||
public int compareTo(Object o) {
|
||||
FileInfo oo = (FileInfo)o;
|
||||
// Don't squelch identical short file names where the full
|
||||
// paths are different
|
||||
if (!attr.shortName.equals(oo.attr.shortName))
|
||||
return attr.shortName.compareTo(oo.attr.shortName);
|
||||
return full.compareTo(oo.full);
|
||||
}
|
||||
|
||||
boolean isHeader() {
|
||||
return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TreeSet sortFiles(Hashtable allFiles) {
|
||||
TreeSet rv = new TreeSet();
|
||||
Enumeration e = allFiles.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
String fullPath = (String)e.nextElement();
|
||||
rv.add(new FileInfo(fullPath, (FileAttribute)allFiles.get(fullPath)));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
Hashtable computeAttributedFiles(Vector allConfigs) {
|
||||
Hashtable ht = new Hashtable();
|
||||
int numConfigs = allConfigs.size();
|
||||
|
||||
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
|
||||
BuildConfig bc = (BuildConfig)i.next();
|
||||
Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
|
||||
String confName = bc.get("Name");
|
||||
|
||||
for (Enumeration e=confFiles.keys(); e.hasMoreElements(); ) {
|
||||
String filePath = (String)e.nextElement();
|
||||
FileAttribute fa = (FileAttribute)ht.get(filePath);
|
||||
|
||||
if (fa == null) {
|
||||
fa = new FileAttribute((String)confFiles.get(filePath), bc, numConfigs);
|
||||
ht.put(filePath, fa);
|
||||
} else {
|
||||
fa.add(confName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ht;
|
||||
}
|
||||
|
||||
Hashtable computeAttributedFiles(BuildConfig bc) {
|
||||
Hashtable ht = new Hashtable();
|
||||
Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
|
||||
|
||||
for (Enumeration e = confFiles.keys(); e.hasMoreElements(); ) {
|
||||
String filePath = (String)e.nextElement();
|
||||
ht.put(filePath, new FileAttribute((String)confFiles.get(filePath), bc, 1));
|
||||
}
|
||||
|
||||
return ht;
|
||||
}
|
||||
|
||||
PrintWriter printWriter;
|
||||
|
||||
public void writeProjectFile(String projectFileName, String projectName,
|
||||
Vector allConfigs) throws IOException {
|
||||
throw new RuntimeException("use compiler version specific version");
|
||||
}
|
||||
}
|
291
hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC6.java
Normal file
291
hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC6.java
Normal file
|
@ -0,0 +1,291 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class WinGammaPlatformVC6 extends WinGammaPlatform {
|
||||
public void writeProjectFile(String projectFileName, String projectName,
|
||||
Vector allConfigs) throws IOException {
|
||||
Vector allConfigNames = new Vector();
|
||||
|
||||
printWriter = new PrintWriter(new FileWriter(projectFileName));
|
||||
String cfg = ((BuildConfig)allConfigs.get(0)).get("Name");
|
||||
|
||||
printWriter.println("# Microsoft Developer Studio Project File - Name=\"" + projectName + "\" - Package Owner=<4>");
|
||||
printWriter.println("# Microsoft Developer Studio Generated Build File, Format Version 6.00");
|
||||
printWriter.println("# ** DO NOT EDIT **");
|
||||
printWriter.println("");
|
||||
printWriter.println("# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102");
|
||||
printWriter.println("CFG=" + cfg);
|
||||
printWriter.println("");
|
||||
|
||||
printWriter.println("!MESSAGE This is not a valid makefile. To build this project using NMAKE,");
|
||||
printWriter.println("!MESSAGE use the Export Makefile command and run");
|
||||
printWriter.println("!MESSAGE ");
|
||||
printWriter.println("!MESSAGE NMAKE /f \"" + projectName + ".mak\".");
|
||||
printWriter.println("!MESSAGE ");
|
||||
printWriter.println("!MESSAGE You can specify a configuration when running NMAKE");
|
||||
printWriter.println("!MESSAGE by defining the macro CFG on the command line. For example:");
|
||||
printWriter.println("!MESSAGE ");
|
||||
printWriter.println("!MESSAGE NMAKE /f \"" + projectName + ".mak\" CFG=\"" + cfg + "\"");
|
||||
printWriter.println("!MESSAGE ");
|
||||
printWriter.println("!MESSAGE Possible choices for configuration are:");
|
||||
printWriter.println("!MESSAGE ");
|
||||
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
|
||||
String name = ((BuildConfig)i.next()).get("Name");
|
||||
printWriter.println("!MESSAGE \""+ name + "\" (based on \"Win32 (x86) Dynamic-Link Library\")");
|
||||
allConfigNames.add(name);
|
||||
}
|
||||
printWriter.println("!MESSAGE ");
|
||||
printWriter.println("");
|
||||
|
||||
printWriter.println("# Begin Project");
|
||||
printWriter.println("# PROP AllowPerConfigDependencies 0");
|
||||
printWriter.println("# PROP Scc_ProjName \"\"");
|
||||
printWriter.println("# PROP Scc_LocalPath \"\"");
|
||||
printWriter.println("CPP=cl.exe");
|
||||
printWriter.println("MTL=midl.exe");
|
||||
printWriter.println("RSC=rc.exe");
|
||||
|
||||
|
||||
String keyword = "!IF";
|
||||
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
|
||||
BuildConfig bcfg = (BuildConfig)i.next();
|
||||
printWriter.println(keyword + " \"$(CFG)\" == \"" + bcfg.get("Name") + "\"");
|
||||
writeConfigHeader(bcfg);
|
||||
keyword = "!ELSEIF";
|
||||
if (!i.hasNext()) printWriter.println("!ENDIF");
|
||||
}
|
||||
|
||||
|
||||
TreeSet sortedFiles = sortFiles(computeAttributedFiles(allConfigs));
|
||||
|
||||
printWriter.println("# Begin Target");
|
||||
|
||||
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
|
||||
printWriter.println("# Name \"" + ((BuildConfig)i.next()).get("Name") + "\"");
|
||||
}
|
||||
printWriter.println("# Begin Group \"Header Files\"");
|
||||
printWriter.println("# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"");
|
||||
|
||||
Iterator i = sortedFiles.iterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
FileInfo fi = (FileInfo)i.next();
|
||||
|
||||
// skip sources
|
||||
if (!fi.isHeader()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
printFile(fi, allConfigNames);
|
||||
}
|
||||
printWriter.println("# End Group");
|
||||
printWriter.println("");
|
||||
|
||||
printWriter.println("# Begin Group \"Source Files\"");
|
||||
printWriter.println("# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\"");
|
||||
|
||||
i = sortedFiles.iterator();
|
||||
while (i.hasNext()) {
|
||||
FileInfo fi = (FileInfo)i.next();
|
||||
|
||||
// skip headers
|
||||
if (fi.isHeader()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
printFile(fi, allConfigNames);
|
||||
}
|
||||
printWriter.println("# End Group");
|
||||
printWriter.println("");
|
||||
|
||||
|
||||
printWriter.println("# Begin Group \"Resource Files\"");
|
||||
printWriter.println("# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"");
|
||||
printWriter.println("# End Group");
|
||||
printWriter.println("");
|
||||
printWriter.println("# End Target");
|
||||
|
||||
printWriter.println("# End Project");
|
||||
|
||||
printWriter.close();
|
||||
}
|
||||
|
||||
|
||||
void printFile(FileInfo fi, Vector allConfigNames) {
|
||||
printWriter.println("# Begin Source File");
|
||||
printWriter.println("");
|
||||
printWriter.println("SOURCE=\"" + fi.full + "\"");
|
||||
FileAttribute attr = fi.attr;
|
||||
|
||||
if (attr.noPch) {
|
||||
printWriter.println("# SUBTRACT CPP /YX /Yc /Yu");
|
||||
}
|
||||
|
||||
if (attr.pchRoot) {
|
||||
printWriter.println("# ADD CPP /Yc\"incls/_precompiled.incl\"");
|
||||
}
|
||||
if (attr.configs != null) {
|
||||
String keyword = "!IF";
|
||||
for (Iterator j=allConfigNames.iterator(); j.hasNext();) {
|
||||
String cfg = (String)j.next();
|
||||
if (!attr.configs.contains(cfg)) {
|
||||
printWriter.println(keyword+" \"$(CFG)\" == \"" + cfg +"\"");
|
||||
printWriter.println("# PROP BASE Exclude_From_Build 1");
|
||||
printWriter.println("# PROP Exclude_From_Build 1");
|
||||
keyword = "!ELSEIF";
|
||||
}
|
||||
}
|
||||
printWriter.println("!ENDIF");
|
||||
}
|
||||
|
||||
printWriter.println("# End Source File");
|
||||
}
|
||||
|
||||
void writeConfigHeader(BuildConfig cfg) {
|
||||
printWriter.println("# Begin Special Build Tool");
|
||||
printWriter.println("SOURCE=\"$(InputPath)\"");
|
||||
printWriter.println("PreLink_Desc=" + BuildConfig.getFieldString(null, "PrelinkDescription"));
|
||||
printWriter.println("PreLink_Cmds=" +
|
||||
cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand")));
|
||||
printWriter.println("# End Special Build Tool");
|
||||
printWriter.println("");
|
||||
|
||||
for (Iterator i = cfg.getV("CompilerFlags").iterator(); i.hasNext(); ) {
|
||||
printWriter.println("# "+(String)i.next());
|
||||
}
|
||||
|
||||
|
||||
printWriter.println("LINK32=link.exe");
|
||||
|
||||
for (Iterator i = cfg.getV("LinkerFlags").iterator(); i.hasNext(); ) {
|
||||
printWriter.println("# "+(String)i.next());
|
||||
}
|
||||
|
||||
printWriter.println("ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32");
|
||||
printWriter.println("ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32");
|
||||
printWriter.println("ADD BASE RSC /l 0x409 /d \"_DEBUG\"");
|
||||
printWriter.println("ADD RSC /l 0x409 /d \"_DEBUG\"");
|
||||
printWriter.println("BSC32=bscmake.exe");
|
||||
printWriter.println("ADD BASE BSC32 /nologo");
|
||||
printWriter.println("ADD BSC32 /nologo");
|
||||
printWriter.println("");
|
||||
}
|
||||
|
||||
protected String getProjectExt() {
|
||||
return ".dsp";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CompilerInterfaceVC6 extends CompilerInterface {
|
||||
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
rv.add("PROP BASE Use_MFC 0");
|
||||
rv.add("PROP Use_MFC 0");
|
||||
rv.add("ADD CPP /nologo /MT /W3 /WX /GX /YX /Fr /FD /c");
|
||||
rv.add("PROP BASE Output_Dir \""+outDir+"\"");
|
||||
rv.add("PROP Output_Dir \""+outDir+"\"");
|
||||
rv.add("PROP BASE Intermediate_Dir \""+outDir+"\"");
|
||||
rv.add("PROP Intermediate_Dir \""+outDir+"\"");
|
||||
rv.add("PROP BASE Target_Dir \"\"");
|
||||
rv.add("PROP Target_Dir \"\"");
|
||||
rv.add("ADD BASE CPP "+Util.prefixed_join(" /I ", includes, true));
|
||||
rv.add("ADD CPP "+Util.prefixed_join(" /I ", includes, true));
|
||||
rv.add("ADD BASE CPP "+Util.prefixed_join(" /D ", defines, true));
|
||||
rv.add("ADD CPP "+Util.prefixed_join(" /D ", defines, true));
|
||||
rv.add("ADD CPP /Yu\"incls/_precompiled.incl\"");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getBaseLinkerFlags(String outDir, String outDll) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
rv.add("PROP Ignore_Export_Lib 0");
|
||||
rv.add("ADD BASE CPP /MD");
|
||||
rv.add("ADD CPP /MD");
|
||||
rv.add("ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib " +
|
||||
" advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib");
|
||||
rv.add("ADD LINK32 /out:\""+outDll+"\" "+
|
||||
" /nologo /subsystem:windows /machine:I386" +
|
||||
" /nologo /base:\"0x8000000\" /subsystem:windows /dll" +
|
||||
" /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM /export:JNI_GetCreatedJavaVMs "+
|
||||
" /export:jio_snprintf /export:jio_printf /export:jio_fprintf /export:jio_vfprintf "+
|
||||
" /export:jio_vsnprintf ");
|
||||
rv.add("SUBTRACT LINK32 /pdb:none /map");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getDebugCompilerFlags(String opt) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
rv.add("ADD BASE CPP /Gm /Zi /O"+opt);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getDebugLinkerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
rv.add("PROP BASE Use_Debug_Libraries 1");
|
||||
rv.add("PROP Use_Debug_Libraries 1");
|
||||
rv.add("ADD LINK32 /debug");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getProductCompilerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
rv.add("ADD CPP /O"+getOptFlag());
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getProductLinkerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
rv.add("PROP BASE Use_Debug_Libraries 0");
|
||||
rv.add("PROP Use_Debug_Libraries 0");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
String getOptFlag() {
|
||||
return "2";
|
||||
}
|
||||
|
||||
String getNoOptFlag() {
|
||||
return "d";
|
||||
}
|
||||
|
||||
String makeCfgName(String flavourBuild) {
|
||||
return "vm - "+ Util.os + " " + flavourBuild;
|
||||
}
|
||||
}
|
730
hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
Normal file
730
hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
Normal file
|
@ -0,0 +1,730 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class WinGammaPlatformVC7 extends WinGammaPlatform {
|
||||
|
||||
String projectVersion() {return "7.10";};
|
||||
|
||||
public void writeProjectFile(String projectFileName, String projectName,
|
||||
Vector allConfigs) throws IOException {
|
||||
System.out.println();
|
||||
System.out.println(" Writing .vcproj file...");
|
||||
// If we got this far without an error, we're safe to actually
|
||||
// write the .vcproj file
|
||||
printWriter = new PrintWriter(new FileWriter(projectFileName));
|
||||
|
||||
printWriter.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>");
|
||||
startTag(
|
||||
"VisualStudioProject",
|
||||
new String[] {
|
||||
"ProjectType", "Visual C++",
|
||||
"Version", projectVersion(),
|
||||
"Name", projectName,
|
||||
"ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}",
|
||||
"SccProjectName", "",
|
||||
"SccLocalPath", ""
|
||||
}
|
||||
);
|
||||
|
||||
startTag("Platforms", null);
|
||||
tag("Platform", new String[] {"Name", Util.os});
|
||||
endTag("Platforms");
|
||||
|
||||
startTag("Configurations", null);
|
||||
|
||||
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
|
||||
writeConfiguration((BuildConfig)i.next());
|
||||
}
|
||||
|
||||
endTag("Configurations");
|
||||
|
||||
tag("References", null);
|
||||
|
||||
writeFiles(allConfigs);
|
||||
|
||||
tag("Globals", null);
|
||||
|
||||
endTag("VisualStudioProject");
|
||||
printWriter.close();
|
||||
|
||||
System.out.println(" Done.");
|
||||
}
|
||||
|
||||
|
||||
abstract class NameFilter {
|
||||
protected String fname;
|
||||
|
||||
abstract boolean match(FileInfo fi);
|
||||
|
||||
String filterString() { return ""; }
|
||||
String name() { return this.fname;}
|
||||
}
|
||||
|
||||
class DirectoryFilter extends NameFilter {
|
||||
String dir;
|
||||
int baseLen, dirLen;
|
||||
|
||||
DirectoryFilter(String dir, String sbase) {
|
||||
this.dir = dir;
|
||||
this.baseLen = sbase.length();
|
||||
this.dirLen = dir.length();
|
||||
this.fname = dir;
|
||||
}
|
||||
|
||||
DirectoryFilter(String fname, String dir, String sbase) {
|
||||
this.dir = dir;
|
||||
this.baseLen = sbase.length();
|
||||
this.dirLen = dir.length();
|
||||
this.fname = fname;
|
||||
}
|
||||
|
||||
|
||||
boolean match(FileInfo fi) {
|
||||
return fi.full.regionMatches(true, baseLen, dir, 0, dirLen);
|
||||
}
|
||||
}
|
||||
|
||||
class TypeFilter extends NameFilter {
|
||||
String[] exts;
|
||||
|
||||
TypeFilter(String fname, String[] exts) {
|
||||
this.fname = fname;
|
||||
this.exts = exts;
|
||||
}
|
||||
|
||||
boolean match(FileInfo fi) {
|
||||
for (int i=0; i<exts.length; i++) {
|
||||
if (fi.full.endsWith(exts[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
String filterString() {
|
||||
return Util.join(";", exts);
|
||||
}
|
||||
}
|
||||
|
||||
class TerminatorFilter extends NameFilter {
|
||||
TerminatorFilter(String fname) {
|
||||
this.fname = fname;
|
||||
|
||||
}
|
||||
boolean match(FileInfo fi) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SpecificNameFilter extends NameFilter {
|
||||
String pats[];
|
||||
|
||||
SpecificNameFilter(String fname, String[] pats) {
|
||||
this.fname = fname;
|
||||
this.pats = pats;
|
||||
}
|
||||
|
||||
boolean match(FileInfo fi) {
|
||||
for (int i=0; i<pats.length; i++) {
|
||||
if (fi.attr.shortName.matches(pats[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SpecificPathFilter extends NameFilter {
|
||||
String pats[];
|
||||
|
||||
SpecificPathFilter(String fname, String[] pats) {
|
||||
this.fname = fname;
|
||||
this.pats = pats;
|
||||
}
|
||||
|
||||
boolean match(FileInfo fi) {
|
||||
for (int i=0; i<pats.length; i++) {
|
||||
if (fi.full.matches(pats[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ContainerFilter extends NameFilter {
|
||||
Vector children;
|
||||
|
||||
ContainerFilter(String fname) {
|
||||
this.fname = fname;
|
||||
children = new Vector();
|
||||
|
||||
}
|
||||
boolean match(FileInfo fi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Iterator babies() { return children.iterator(); }
|
||||
|
||||
void add(NameFilter f) {
|
||||
children.add(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void writeCustomToolConfig(Vector configs, String[] customToolAttrs) {
|
||||
for (Iterator i = configs.iterator(); i.hasNext(); ) {
|
||||
startTag("FileConfiguration",
|
||||
new String[] {
|
||||
"Name", (String)i.next()
|
||||
}
|
||||
);
|
||||
tag("Tool", customToolAttrs);
|
||||
|
||||
endTag("FileConfiguration");
|
||||
}
|
||||
}
|
||||
|
||||
// here we define filters, which define layout of what can be seen in 'Solution View' of MSVC
|
||||
// Basically there are two types of entities - container filters and real filters
|
||||
// - container filter just provides a container to group together real filters
|
||||
// - real filter can select elements from the set according to some rule, put it into XML
|
||||
// and remove from the list
|
||||
Vector makeFilters(TreeSet files) {
|
||||
Vector rv = new Vector();
|
||||
String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/");
|
||||
|
||||
ContainerFilter rt = new ContainerFilter("Runtime");
|
||||
rt.add(new DirectoryFilter("share/vm/prims", sbase));
|
||||
rt.add(new DirectoryFilter("share/vm/runtime", sbase));
|
||||
rt.add(new DirectoryFilter("share/vm/oops", sbase));
|
||||
rv.add(rt);
|
||||
|
||||
ContainerFilter gc = new ContainerFilter("GC");
|
||||
gc.add(new DirectoryFilter("share/vm/memory", sbase));
|
||||
gc.add(new DirectoryFilter("share/vm/gc_interface", sbase));
|
||||
|
||||
ContainerFilter gc_impl = new ContainerFilter("Implementations");
|
||||
gc_impl.add(new DirectoryFilter("CMS",
|
||||
"share/vm/gc_implementation/concurrentMarkSweep",
|
||||
sbase));
|
||||
gc_impl.add(new DirectoryFilter("Parallel Scavenge",
|
||||
"share/vm/gc_implementation/parallelScavenge",
|
||||
sbase));
|
||||
gc_impl.add(new DirectoryFilter("Shared",
|
||||
"share/vm/gc_implementation/shared",
|
||||
sbase));
|
||||
// for all leftovers
|
||||
gc_impl.add(new DirectoryFilter("Misc",
|
||||
"share/vm/gc_implementation",
|
||||
sbase));
|
||||
|
||||
gc.add(gc_impl);
|
||||
rv.add(gc);
|
||||
|
||||
rv.add(new DirectoryFilter("C1", "share/vm/c1", sbase));
|
||||
|
||||
rv.add(new DirectoryFilter("C2", "share/vm/opto", sbase));
|
||||
|
||||
ContainerFilter comp = new ContainerFilter("Compiler Common");
|
||||
comp.add(new DirectoryFilter("share/vm/asm", sbase));
|
||||
comp.add(new DirectoryFilter("share/vm/ci", sbase));
|
||||
comp.add(new DirectoryFilter("share/vm/code", sbase));
|
||||
comp.add(new DirectoryFilter("share/vm/compiler", sbase));
|
||||
rv.add(comp);
|
||||
|
||||
rv.add(new DirectoryFilter("Interpreter",
|
||||
"share/vm/interpreter",
|
||||
sbase));
|
||||
|
||||
ContainerFilter misc = new ContainerFilter("Misc");
|
||||
misc.add(new DirectoryFilter("share/vm/libadt", sbase));
|
||||
misc.add(new DirectoryFilter("share/vm/services", sbase));
|
||||
misc.add(new DirectoryFilter("share/vm/utilities", sbase));
|
||||
misc.add(new DirectoryFilter("share/vm/classfile", sbase));
|
||||
rv.add(misc);
|
||||
|
||||
rv.add(new DirectoryFilter("os_cpu", sbase));
|
||||
|
||||
rv.add(new DirectoryFilter("cpu", sbase));
|
||||
|
||||
rv.add(new DirectoryFilter("os", sbase));
|
||||
|
||||
ContainerFilter generated = new ContainerFilter("Generated");
|
||||
ContainerFilter c1Generated = new ContainerFilter("C1");
|
||||
c1Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler1/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
|
||||
c1Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler1/generated/jvmtifiles/.*"}));
|
||||
generated.add(c1Generated);
|
||||
ContainerFilter c2Generated = new ContainerFilter("C2");
|
||||
c2Generated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*compiler2/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
|
||||
c2Generated.add(new SpecificPathFilter("adfiles", new String[] {".*compiler2/generated/adfiles/.*"}));
|
||||
c2Generated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*compiler2/generated/jvmtifiles/.*"}));
|
||||
generated.add(c2Generated);
|
||||
ContainerFilter coreGenerated = new ContainerFilter("Core");
|
||||
coreGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*core/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
|
||||
coreGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*core/generated/jvmtifiles/.*"}));
|
||||
generated.add(coreGenerated);
|
||||
ContainerFilter tieredGenerated = new ContainerFilter("Tiered");
|
||||
tieredGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*tiered/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
|
||||
tieredGenerated.add(new SpecificPathFilter("adfiles", new String[] {".*tiered/generated/adfiles/.*"}));
|
||||
tieredGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*tiered/generated/jvmtifiles/.*"}));
|
||||
generated.add(tieredGenerated);
|
||||
ContainerFilter kernelGenerated = new ContainerFilter("Kernel");
|
||||
kernelGenerated.add(new SpecificPathFilter("C++ Interpreter Generated", new String[] {".*kernel/generated/jvmtifiles/bytecodeInterpreterWithChecks.+"}));
|
||||
kernelGenerated.add(new SpecificPathFilter("jvmtifiles", new String[] {".*kernel/generated/jvmtifiles/.*"}));
|
||||
generated.add(kernelGenerated);
|
||||
rv.add(generated);
|
||||
|
||||
rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"}));
|
||||
|
||||
// this one is to catch files not caught by other filters
|
||||
//rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"}));
|
||||
rv.add(new TerminatorFilter("Source Files"));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void writeFiles(Vector allConfigs) {
|
||||
|
||||
Hashtable allFiles = computeAttributedFiles(allConfigs);
|
||||
|
||||
Vector allConfigNames = new Vector();
|
||||
for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
|
||||
allConfigNames.add(((BuildConfig)i.next()).get("Name"));
|
||||
}
|
||||
|
||||
TreeSet sortedFiles = sortFiles(allFiles);
|
||||
|
||||
startTag("Files", null);
|
||||
|
||||
for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) {
|
||||
doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next());
|
||||
}
|
||||
|
||||
|
||||
startTag("Filter",
|
||||
new String[] {
|
||||
"Name", "Resource Files",
|
||||
"Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
}
|
||||
);
|
||||
endTag("Filter");
|
||||
|
||||
endTag("Files");
|
||||
}
|
||||
|
||||
void doWriteFiles(TreeSet allFiles, Vector allConfigNames, NameFilter filter) {
|
||||
startTag("Filter",
|
||||
new String[] {
|
||||
"Name", filter.name(),
|
||||
"Filter", filter.filterString()
|
||||
}
|
||||
);
|
||||
|
||||
if (filter instanceof ContainerFilter) {
|
||||
|
||||
Iterator i = ((ContainerFilter)filter).babies();
|
||||
while (i.hasNext()) {
|
||||
doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Iterator i = allFiles.iterator();
|
||||
while (i.hasNext()) {
|
||||
FileInfo fi = (FileInfo)i.next();
|
||||
|
||||
if (!filter.match(fi)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
startTag("File",
|
||||
new String[] {
|
||||
"RelativePath", fi.full.replace('/', '\\')
|
||||
}
|
||||
);
|
||||
|
||||
FileAttribute a = fi.attr;
|
||||
if (a.pchRoot) {
|
||||
writeCustomToolConfig(allConfigNames,
|
||||
new String[] {
|
||||
"Name", "VCCLCompilerTool",
|
||||
"UsePrecompiledHeader", "1"
|
||||
});
|
||||
}
|
||||
|
||||
if (a.noPch) {
|
||||
writeCustomToolConfig(allConfigNames,
|
||||
new String[] {
|
||||
"Name", "VCCLCompilerTool",
|
||||
"UsePrecompiledHeader", "0"
|
||||
});
|
||||
}
|
||||
|
||||
if (a.configs != null) {
|
||||
for (Iterator j=allConfigNames.iterator(); j.hasNext();) {
|
||||
String cfg = (String)j.next();
|
||||
if (!a.configs.contains(cfg)) {
|
||||
startTag("FileConfiguration",
|
||||
new String[] {
|
||||
"Name", cfg,
|
||||
"ExcludedFromBuild", "TRUE"
|
||||
});
|
||||
tag("Tool", new String[] {"Name", "VCCLCompilerTool"});
|
||||
endTag("FileConfiguration");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endTag("File");
|
||||
|
||||
// we not gonna look at this file anymore
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
||||
endTag("Filter");
|
||||
}
|
||||
|
||||
|
||||
void writeConfiguration(BuildConfig cfg) {
|
||||
startTag("Configuration",
|
||||
new String[] {
|
||||
"Name", cfg.get("Name"),
|
||||
"OutputDirectory", cfg.get("OutputDir"),
|
||||
"IntermediateDirectory", cfg.get("OutputDir"),
|
||||
"ConfigurationType", "2",
|
||||
"UseOfMFC", "0",
|
||||
"ATLMinimizesCRunTimeLibraryUsage", "FALSE"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
tagV("Tool", cfg.getV("CompilerFlags"));
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCCustomBuildTool"
|
||||
}
|
||||
);
|
||||
|
||||
tagV("Tool", cfg.getV("LinkerFlags"));
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCPostBuildEventTool"
|
||||
}
|
||||
);
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCPreBuildEventTool"
|
||||
}
|
||||
);
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCPreLinkEventTool",
|
||||
"Description", BuildConfig.getFieldString(null, "PrelinkDescription"),
|
||||
//Caution: String.replace(String,String) is available from JDK5 onwards only
|
||||
"CommandLine", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace
|
||||
("\t", "
"))
|
||||
}
|
||||
);
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCResourceCompilerTool",
|
||||
// XXX???
|
||||
"PreprocessorDefinitions", "NDEBUG",
|
||||
"Culture", "1033"
|
||||
}
|
||||
);
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCWebServiceProxyGeneratorTool"
|
||||
}
|
||||
);
|
||||
|
||||
tag ("Tool",
|
||||
new String[] {
|
||||
"Name", "VCXMLDataGeneratorTool"
|
||||
}
|
||||
);
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCWebDeploymentTool"
|
||||
}
|
||||
);
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCManagedWrapperGeneratorTool"
|
||||
}
|
||||
);
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCAuxiliaryManagedWrapperGeneratorTool"
|
||||
}
|
||||
);
|
||||
|
||||
tag("Tool",
|
||||
new String[] {
|
||||
"Name", "VCMIDLTool",
|
||||
"PreprocessorDefinitions", "NDEBUG",
|
||||
"MkTypLibCompatible", "TRUE",
|
||||
"SuppressStartupBanner", "TRUE",
|
||||
"TargetEnvironment", "1",
|
||||
"TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb",
|
||||
"HeaderFileName", ""
|
||||
}
|
||||
);
|
||||
|
||||
endTag("Configuration");
|
||||
}
|
||||
|
||||
int indent;
|
||||
|
||||
private void startTagPrim(String name,
|
||||
String[] attrs,
|
||||
boolean close) {
|
||||
doIndent();
|
||||
printWriter.print("<"+name);
|
||||
indent++;
|
||||
|
||||
if (attrs != null) {
|
||||
printWriter.println();
|
||||
for (int i=0; i<attrs.length; i+=2) {
|
||||
doIndent();
|
||||
printWriter.print(" " + attrs[i]+"=\""+attrs[i+1]+"\"");
|
||||
if (i < attrs.length - 2) {
|
||||
printWriter.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (close) {
|
||||
indent--;
|
||||
//doIndent();
|
||||
printWriter.println("/>");
|
||||
} else {
|
||||
//doIndent();
|
||||
printWriter.println(">");
|
||||
}
|
||||
}
|
||||
|
||||
void startTag(String name, String[] attrs) {
|
||||
startTagPrim(name, attrs, false);
|
||||
}
|
||||
|
||||
void startTagV(String name, Vector attrs) {
|
||||
String s[] = new String [attrs.size()];
|
||||
for (int i=0; i<attrs.size(); i++) {
|
||||
s[i] = (String)attrs.elementAt(i);
|
||||
}
|
||||
startTagPrim(name, s, false);
|
||||
}
|
||||
|
||||
void endTag(String name) {
|
||||
indent--;
|
||||
doIndent();
|
||||
printWriter.println("</"+name+">");
|
||||
}
|
||||
|
||||
void tag(String name, String[] attrs) {
|
||||
startTagPrim(name, attrs, true);
|
||||
}
|
||||
|
||||
void tagV(String name, Vector attrs) {
|
||||
String s[] = new String [attrs.size()];
|
||||
for (int i=0; i<attrs.size(); i++) {
|
||||
s[i] = (String)attrs.elementAt(i);
|
||||
}
|
||||
startTagPrim(name, s, true);
|
||||
}
|
||||
|
||||
|
||||
void doIndent() {
|
||||
for (int i=0; i<indent; i++) {
|
||||
printWriter.print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
protected String getProjectExt() {
|
||||
return ".vcproj";
|
||||
}
|
||||
}
|
||||
|
||||
class CompilerInterfaceVC7 extends CompilerInterface {
|
||||
void getBaseCompilerFlags_common(Vector defines, Vector includes, String outDir,Vector rv) {
|
||||
|
||||
// advanced M$ IDE (2003) can only recognize name if it's first or
|
||||
// second attribute in the tag - go guess
|
||||
addAttr(rv, "Name", "VCCLCompilerTool");
|
||||
addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
|
||||
addAttr(rv, "PreprocessorDefinitions",
|
||||
Util.join(";", defines).replace("\"","""));
|
||||
addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp");
|
||||
addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch");
|
||||
addAttr(rv, "AssemblerListingLocation", outDir);
|
||||
addAttr(rv, "ObjectFile", outDir+Util.sep);
|
||||
addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb");
|
||||
// Set /nologo optin
|
||||
addAttr(rv, "SuppressStartupBanner", "TRUE");
|
||||
// Surpass the default /Tc or /Tp. 0 is compileAsDefault
|
||||
addAttr(rv, "CompileAs", "0");
|
||||
// Set /W3 option. 3 is warningLevel_3
|
||||
addAttr(rv, "WarningLevel", "3");
|
||||
// Set /WX option,
|
||||
addAttr(rv, "WarnAsError", "TRUE");
|
||||
// Set /GS option
|
||||
addAttr(rv, "BufferSecurityCheck", "FALSE");
|
||||
// Set /Zi option. 3 is debugEnabled
|
||||
addAttr(rv, "DebugInformationFormat", "3");
|
||||
}
|
||||
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
getBaseCompilerFlags_common(defines,includes, outDir, rv);
|
||||
// Set /Yu option. 3 is pchUseUsingSpecific
|
||||
// Note: Starting VC8 pchUseUsingSpecific is 2 !!!
|
||||
addAttr(rv, "UsePrecompiledHeader", "3");
|
||||
// Set /EHsc- option
|
||||
addAttr(rv, "ExceptionHandling", "FALSE");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getBaseLinkerFlags(String outDir, String outDll) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
addAttr(rv, "Name", "VCLinkerTool");
|
||||
addAttr(rv, "AdditionalOptions",
|
||||
"/export:JNI_GetDefaultJavaVMInitArgs " +
|
||||
"/export:JNI_CreateJavaVM " +
|
||||
"/export:JNI_GetCreatedJavaVMs "+
|
||||
"/export:jio_snprintf /export:jio_printf "+
|
||||
"/export:jio_fprintf /export:jio_vfprintf "+
|
||||
"/export:jio_vsnprintf ");
|
||||
addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib");
|
||||
addAttr(rv, "OutputFile", outDll);
|
||||
// Set /INCREMENTAL option. 1 is linkIncrementalNo
|
||||
addAttr(rv, "LinkIncremental", "1");
|
||||
addAttr(rv, "SuppressStartupBanner", "TRUE");
|
||||
addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
|
||||
addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"vm.pdb");
|
||||
// Set /SUBSYSTEM option. 2 is subSystemWindows
|
||||
addAttr(rv, "SubSystem", "2");
|
||||
addAttr(rv, "BaseAddress", "0x8000000");
|
||||
addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
|
||||
// Set /MACHINE option. 1 is machineX86
|
||||
addAttr(rv, "TargetMachine", "1");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void getDebugCompilerFlags_common(String opt,Vector rv) {
|
||||
|
||||
// Set /On option
|
||||
addAttr(rv, "Optimization", opt);
|
||||
// Set /FR option. 1 is brAllInfo
|
||||
addAttr(rv, "BrowseInformation", "1");
|
||||
addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep);
|
||||
// Set /MD option. 2 is rtMultiThreadedDLL
|
||||
addAttr(rv, "RuntimeLibrary", "2");
|
||||
// Set /Oy- option
|
||||
addAttr(rv, "OmitFramePointers", "FALSE");
|
||||
|
||||
}
|
||||
|
||||
Vector getDebugCompilerFlags(String opt) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
getDebugCompilerFlags_common(opt,rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getDebugLinkerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void getProductCompilerFlags_common(Vector rv) {
|
||||
// Set /O2 option. 2 is optimizeMaxSpeed
|
||||
addAttr(rv, "Optimization", "2");
|
||||
// Set /Oy- option
|
||||
addAttr(rv, "OmitFramePointers", "FALSE");
|
||||
}
|
||||
|
||||
Vector getProductCompilerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
getProductCompilerFlags_common(rv);
|
||||
// Set /Ob option. 1 is expandOnlyInline
|
||||
addAttr(rv, "InlineFunctionExpansion", "1");
|
||||
// Set /GF option.
|
||||
addAttr(rv, "StringPooling", "TRUE");
|
||||
// Set /MD option. 2 is rtMultiThreadedDLL
|
||||
addAttr(rv, "RuntimeLibrary", "2");
|
||||
// Set /Gy option
|
||||
addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getProductLinkerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
// Set /OPT:REF option. 2 is optReferences
|
||||
addAttr(rv, "OptimizeReferences", "2");
|
||||
// Set /OPT:optFolding option. 2 is optFolding
|
||||
addAttr(rv, "EnableCOMDATFolding", "2");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
String getOptFlag() {
|
||||
return "2";
|
||||
}
|
||||
|
||||
String getNoOptFlag() {
|
||||
return "0";
|
||||
}
|
||||
|
||||
String makeCfgName(String flavourBuild) {
|
||||
return flavourBuild + "|" + Util.os;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class WinGammaPlatformVC8 extends WinGammaPlatformVC7 {
|
||||
|
||||
String projectVersion() {return "8.00";};
|
||||
|
||||
}
|
||||
|
||||
class CompilerInterfaceVC8 extends CompilerInterfaceVC7 {
|
||||
|
||||
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
getBaseCompilerFlags_common(defines,includes, outDir, rv);
|
||||
// Set /Yu option. 2 is pchUseUsingSpecific
|
||||
addAttr(rv, "UsePrecompiledHeader", "2");
|
||||
// Set /EHsc- option. 0 is cppExceptionHandlingNo
|
||||
addAttr(rv, "ExceptionHandling", "0");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Vector getDebugCompilerFlags(String opt) {
|
||||
Vector rv = new Vector();
|
||||
|
||||
getDebugCompilerFlags_common(opt,rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Vector getProductCompilerFlags() {
|
||||
Vector rv = new Vector();
|
||||
|
||||
getProductCompilerFlags_common(rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
public class WinGammaPlatformVC9 extends WinGammaPlatformVC8 {
|
||||
|
||||
String projectVersion() {return "9.00";};
|
||||
|
||||
}
|
||||
|
||||
class CompilerInterfaceVC9 extends CompilerInterfaceVC8 {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue