src/share/tools/ProjectCreator/BuildConfig.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2009, 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. --- 1,7 ---- /* ! * 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.
*** 46,55 **** --- 46,58 ---- 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
*** 69,79 **** protected void init(Vector includes, Vector defines) { initDefaultDefines(defines); initDefaultCompilerFlags(includes); initDefaultLinkerFlags(); ! handleDB((String)getFieldInContext("IncludeDB")); } protected void initDefaultCompilerFlags(Vector includes) { Vector compilerFlags = new Vector(); --- 72,82 ---- protected void init(Vector includes, Vector defines) { initDefaultDefines(defines); initDefaultCompilerFlags(includes); initDefaultLinkerFlags(); ! handleDB(); } protected void initDefaultCompilerFlags(Vector includes) { Vector compilerFlags = new Vector();
*** 108,123 **** return tree; } ! Vector getPreferredPaths(Database currentDB) { 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 = currentDB.getMacros(); iter.hasNext(); ) { Macro macro = (Macro) iter.next(); if (macro.name.equals("os_family") || macro.name.equals("arch")) { preferredPaths.add(macro.contents); } --- 111,126 ---- 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); }
*** 127,169 **** return preferredPaths; } ! void handleDB(String dbFile) { WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject"); - Database db = new Database(platform, platform.defaultGrandIncludeThreshold()); - try { File incls = new File(get("OutputDir")+Util.sep+"incls"); - FileName oldInclTempl = platform.getInclFileTemplate(); - FileName oldGITempl = platform.getGIFileTemplate(); - FileName oldGDTempl = platform.getGDFileTemplate(); - - platform.setInclFileTemplate(new FileName(platform, incls.getPath()+Util.sep, - "_", "", ".incl", "", "")); - platform.setGIFileTemplate(new FileName(platform, incls.getPath()+Util.sep, - "", "_precompiled", ".incl", "", "")); incls.mkdirs(); ! db.get(getFieldString(null, "Platform"), dbFile); ! db.compute(); ! ! db.put(); ! ! //platform.setInclFileTemplate(oldInclTempl); ! //platform.setGIFileTemplate(oldInclTempl); } catch (Exception e) { ! e.printStackTrace(); ! throw new RuntimeException("cannot do db: "+e); } ! putSpecificField("AllFilesHash", computeAllFiles(platform, db)); } void addAll(Iterator i, Hashtable hash, WinGammaPlatform platform, DirectoryTree tree, Vector preferredPaths, Vector filesNotFound, Vector filesDuplicate) { for (; i.hasNext(); ) { String fileName = (String) i.next(); --- 130,169 ---- 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();
*** 173,209 **** tree, preferredPaths, filesNotFound, filesDuplicate); if (prefixedName != null) { ! addTo(hash, Util.normalize(prefixedName), fileName); } } } } void addTo(Hashtable ht, String key, String value) { ht.put(expandFormat(key), expandFormat(value)); } ! Hashtable computeAllFiles(WinGammaPlatform platform, Database db) { Hashtable rv = new Hashtable(); DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt")); ! Vector preferredPaths = getPreferredPaths(db); // Hold errors until end Vector filesNotFound = new Vector(); Vector filesDuplicate = new Vector(); // find all files ! Vector dbFiles = new Vector(); ! for (Iterator i=db.getAllFiles().iterator(); i.hasNext(); ) { ! FileList fl = (FileList) i.next(); ! dbFiles.add(fl.getName()); } ! addAll(dbFiles.iterator(), rv, platform, tree, preferredPaths, filesNotFound, filesDuplicate); Vector addFiles = new Vector(); collectRelevantVectors(addFiles, "AdditionalFile"); --- 173,217 ---- 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");
*** 354,376 **** } Vector getIncludes() { Vector rv = new Vector(); - // for generated includes - rv.add(get("OutputDir")); - collectRelevantVectors(rv, "AbsoluteInclude"); 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(); --- 362,387 ---- } 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();
*** 379,394 **** return (cfg != null && (cfg.startsWith("compiler1") || cfg.startsWith("compiler2"))); } ! // Filters out the IncludeDB statement, which is the only command- ! // line argument we explicitly specialize for the tiered build static boolean appliesToTieredBuild(String cfg, String key) { ! return (appliesToTieredBuild(cfg) && ! (key != null && ! !key.equals("IncludeDB"))); } static String getTieredBuildCfg(String cfg) { assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; return "tiered" + cfg.substring(9); --- 390,403 ---- 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);
*** 439,449 **** 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)) { putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val); } } private static void putFieldHashImpl(String cfg, String field, String name, Object val) { --- 448,458 ---- 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) {
*** 457,467 **** ht.put(name, val); } static void addFieldVector(String cfg, String field, String element) { addFieldVectorImpl(cfg, field, element); ! if (appliesToTieredBuild(cfg)) { addFieldVectorImpl(getTieredBuildCfg(cfg), field, element); } } private static void addFieldVectorImpl(String cfg, String field, String element) { --- 466,476 ---- 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) {