Mercurial > hg > truffle
comparison src/share/tools/ProjectCreator/FileTreeCreatorVC10.java @ 12014:31f3b1e1c5e5
8016601: Unable to build hsx24 on Windows using project creator and Visual Studio
Summary: ProjectCreator tool is modified to support two new options: '-relativeAltSrcInclude' and '-altRelativeInclude' which prevents IDE linker errors. Also fixed some cmd line build linker warnings. Misc cleanups.
Reviewed-by: rdurbin, coleenp
author | dcubed |
---|---|
date | Thu, 08 Aug 2013 09:21:30 -0700 |
parents | 1a9b9cfcef41 |
children | bd0e82136b03 |
comparison
equal
deleted
inserted
replaced
12013:195ff07bc7f6 | 12014:31f3b1e1c5e5 |
---|---|
1 /* | |
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
1 import static java.nio.file.FileVisitResult.CONTINUE; | 25 import static java.nio.file.FileVisitResult.CONTINUE; |
2 | 26 |
3 import java.io.IOException; | 27 import java.io.IOException; |
4 import java.nio.file.FileSystems; | 28 import java.nio.file.FileSystems; |
5 import java.nio.file.FileVisitResult; | 29 import java.nio.file.FileVisitResult; |
19 public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { | 43 public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { |
20 DirAttributes currentFileAttr = attributes.peek().clone(); | 44 DirAttributes currentFileAttr = attributes.peek().clone(); |
21 boolean usePch = false; | 45 boolean usePch = false; |
22 boolean disablePch = false; | 46 boolean disablePch = false; |
23 boolean useIgnore = false; | 47 boolean useIgnore = false; |
48 boolean isAltSrc = false; // only needed as a debugging crumb | |
49 boolean isReplacedByAltSrc = false; | |
24 String fileName = file.getFileName().toString(); | 50 String fileName = file.getFileName().toString(); |
25 | 51 |
26 // TODO hideFile | 52 // TODO hideFile |
27 | 53 |
28 // usePch applies to all configs for a file. | 54 // usePch applies to all configs for a file. |
29 if (fileName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"))) { | 55 if (fileName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"))) { |
30 usePch = true; | 56 usePch = true; |
57 } | |
58 | |
59 String fileLoc = vcProjLocation.relativize(file).toString(); | |
60 | |
61 // isAltSrc and isReplacedByAltSrc applies to all configs for a file | |
62 if (BuildConfig.matchesRelativeAltSrcInclude( | |
63 file.toAbsolutePath().toString())) { | |
64 // current file is an alternate source file so track it | |
65 isAltSrc = true; | |
66 BuildConfig.trackRelativeAltSrcFile( | |
67 file.toAbsolutePath().toString()); | |
68 } else if (BuildConfig.matchesRelativeAltSrcFile( | |
69 file.toAbsolutePath().toString())) { | |
70 // current file is a regular file that matches an alternate | |
71 // source file so yack about replacing the regular file | |
72 isReplacedByAltSrc = true; | |
73 System.out.println("INFO: alternate source file '" + | |
74 BuildConfig.getMatchingRelativeAltSrcFile( | |
75 file.toAbsolutePath().toString()) + | |
76 "' replaces '" + fileLoc + "'"); | |
31 } | 77 } |
32 | 78 |
33 for (BuildConfig cfg : allConfigs) { | 79 for (BuildConfig cfg : allConfigs) { |
34 if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { | 80 if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { |
35 useIgnore = true; | 81 useIgnore = true; |
56 } | 102 } |
57 } | 103 } |
58 } | 104 } |
59 | 105 |
60 String tagName = wg.getFileTagFromSuffix(fileName); | 106 String tagName = wg.getFileTagFromSuffix(fileName); |
61 String fileLoc = vcProjLocation.relativize(file).toString(); | |
62 | 107 |
63 if (!useIgnore && !disablePch && !usePch) { | 108 if (!useIgnore && !disablePch && !usePch && !isReplacedByAltSrc) { |
64 wg.tag(tagName, new String[] { "Include", fileLoc}); | 109 wg.tag(tagName, new String[] { "Include", fileLoc}); |
65 } else { | 110 } else { |
66 wg.startTag( | 111 wg.startTag( |
67 tagName, | 112 tagName, |
68 new String[] { "Include", fileLoc}); | 113 new String[] { "Include", fileLoc}); |
75 if (usePch) { | 120 if (usePch) { |
76 wg.tagData("PrecompiledHeader", "Create", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); | 121 wg.tagData("PrecompiledHeader", "Create", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); |
77 } | 122 } |
78 if (disablePch) { | 123 if (disablePch) { |
79 wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); | 124 wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); |
125 } | |
126 if (isReplacedByAltSrc) { | |
127 wg.tagData("ExcludedFromBuild", "true", "Condition", | |
128 "'$(Configuration)|$(Platform)'=='" + | |
129 cfg.get("Name") + "'"); | |
80 } | 130 } |
81 } | 131 } |
82 wg.endTag(); | 132 wg.endTag(); |
83 } | 133 } |
84 | 134 |
135 } | 185 } |
136 | 186 |
137 public void writeFileTree() throws IOException { | 187 public void writeFileTree() throws IOException { |
138 Files.walkFileTree(this.startDir, this); | 188 Files.walkFileTree(this.startDir, this); |
139 } | 189 } |
140 | 190 } |
141 | |
142 } |