Mercurial > hg > graal-compiler
comparison src/share/tools/ProjectCreator/FileTreeCreatorVC10.java @ 12039:3cce976666d9
Merge hs25-b46
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 10 Oct 2013 14:20:04 +0200 |
parents | 482037339440 bd0e82136b03 |
children |
comparison
equal
deleted
inserted
replaced
11958:a0f5be106e67 | 12039:3cce976666d9 |
---|---|
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 | 106 |
61 String tagName = wg.getFileTagFromSuffix(fileName); | 107 String tagName = wg10.getFileTagFromSuffix(fileName); |
62 String fileLoc = vcProjLocation.relativize(file).toString(); | |
63 | 108 |
64 if (!useIgnore && !disablePch && !usePch) { | 109 if (!useIgnore && !disablePch && !usePch && !isReplacedByAltSrc) { |
65 wg.tag(tagName, new String[] { "Include", fileLoc}); | 110 wg.tag(tagName, new String[] { "Include", fileLoc}); |
66 } else { | 111 } else { |
67 wg.startTag( | 112 wg.startTag( |
68 tagName, | 113 tagName, |
69 new String[] { "Include", fileLoc}); | 114 new String[] { "Include", fileLoc}); |
77 wg.tagData("PrecompiledHeader", "Create", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); | 122 wg.tagData("PrecompiledHeader", "Create", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); |
78 } | 123 } |
79 if (disablePch) { | 124 if (disablePch) { |
80 wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); | 125 wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); |
81 } | 126 } |
127 if (isReplacedByAltSrc) { | |
128 wg.tagData("ExcludedFromBuild", "true", "Condition", | |
129 "'$(Configuration)|$(Platform)'=='" + | |
130 cfg.get("Name") + "'"); | |
131 } | |
82 } | 132 } |
83 wg.endTag(); | 133 wg.endTag(); |
84 } | 134 } |
85 | 135 |
86 String filter = startDir.relativize(file.getParent().toAbsolutePath()).toString(); | 136 String filter = startDir.relativize(file.getParent().toAbsolutePath()).toString(); |
87 wg.addFilterDependency(fileLoc, filter); | 137 wg10.addFilterDependency(fileLoc, filter); |
88 | 138 |
89 return CONTINUE; | 139 return CONTINUE; |
90 } | 140 } |
91 | 141 |
92 @Override | 142 @Override |
111 } | 161 } |
112 | 162 |
113 if (!hide) { | 163 if (!hide) { |
114 String name = startDir.relativize(path.toAbsolutePath()).toString(); | 164 String name = startDir.relativize(path.toAbsolutePath()).toString(); |
115 if (!"".equals(name)) { | 165 if (!"".equals(name)) { |
116 wg.addFilter(name); | 166 wg10.addFilter(name); |
117 } | 167 } |
118 | 168 |
119 attributes.push(newAttr); | 169 attributes.push(newAttr); |
120 return super.preVisitDirectory(path, attrs); | 170 return super.preVisitDirectory(path, attrs); |
121 } else { | 171 } else { |
136 } | 186 } |
137 | 187 |
138 public void writeFileTree() throws IOException { | 188 public void writeFileTree() throws IOException { |
139 Files.walkFileTree(this.startDir, this); | 189 Files.walkFileTree(this.startDir, this); |
140 } | 190 } |
141 | 191 } |
142 | |
143 } |