1 import java.io.File;
2 import java.io.FileNotFoundException;
3 import java.io.IOException;
4 import java.io.PrintWriter;
5 import java.io.UnsupportedEncodingException;
6 import java.nio.file.FileSystems;
7 import java.util.Iterator;
8 import java.util.LinkedList;
9 import java.util.UUID;
10 import java.util.Vector;
11
12 public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
13
14
15 LinkedList <String>filters = new LinkedList<String>();
16 LinkedList <String[]>filterDeps = new LinkedList<String[]>();
17
18 @Override
19 protected String getProjectExt() {
20 return ".vcxproj";
21 }
22
23 @Override
24 public void writeProjectFile(String projectFileName, String projectName,
25 Vector<BuildConfig> allConfigs) throws IOException {
26 System.out.println();
27 System.out.print(" Writing .vcxproj file: " + projectFileName);
28
29 String projDir = Util.normalize(new File(projectFileName).getParent());
30
31 printWriter = new PrintWriter(projectFileName, "UTF-8");
32 printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
33 startTag("Project",
34 "DefaultTargets", "Build",
35 "ToolsVersion", "4.0",
36 "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
37 startTag("ItemGroup",
38 "Label", "ProjectConfigurations");
39 for (BuildConfig cfg : allConfigs) {
40 startTag("ProjectConfiguration",
41 "Include", cfg.get("Name"));
42 tagData("Configuration", cfg.get("Id"));
43 tagData("Platform", cfg.get("PlatformName"));
44 endTag();
45 }
46 endTag();
47
97 startTag("Link");
98 tagV(cfg.getV("LinkerFlags"));
99 endTag();
100
101 startTag("PreLinkEvent");
102 tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription"));
103 tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n")));
104 endTag();
105
106 endTag();
107 }
108
109 writeFiles(allConfigs, projDir);
110
111 tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
112 startTag("ImportGroup", "Label", "ExtensionTargets");
113 endTag();
114
115 endTag();
116 printWriter.close();
117 System.out.println(" Done.");
118
119 writeFilterFile(projectFileName, projectName, allConfigs, projDir);
120 writeUserFile(projectFileName, allConfigs);
121 }
122
123
124 private void writeUserFile(String projectFileName, Vector<BuildConfig> allConfigs) throws FileNotFoundException, UnsupportedEncodingException {
125 String userFileName = projectFileName + ".user";
126 if (new File(userFileName).exists()) {
127 return;
128 }
129 System.out.print(" Writing .vcxproj.user file: " + userFileName);
130 printWriter = new PrintWriter(userFileName, "UTF-8");
131
132 printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
133 startTag("Project",
134 "ToolsVersion", "4.0",
135 "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
136
137 for (BuildConfig cfg : allConfigs) {
|
1 /*
2 * Copyright (c) 2011, 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
25 import java.io.File;
26 import java.io.FileNotFoundException;
27 import java.io.IOException;
28 import java.io.PrintWriter;
29 import java.io.UnsupportedEncodingException;
30 import java.nio.file.FileSystems;
31 import java.util.Iterator;
32 import java.util.LinkedList;
33 import java.util.UUID;
34 import java.util.Vector;
35
36 public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
37
38
39 LinkedList <String>filters = new LinkedList<String>();
40 LinkedList <String[]>filterDeps = new LinkedList<String[]>();
41
42 @Override
43 protected String getProjectExt() {
44 return ".vcxproj";
45 }
46
47 @Override
48 public void writeProjectFile(String projectFileName, String projectName,
49 Vector<BuildConfig> allConfigs) throws IOException {
50 System.out.println();
51 System.out.println(" Writing .vcxproj file: " + projectFileName);
52
53 String projDir = Util.normalize(new File(projectFileName).getParent());
54
55 printWriter = new PrintWriter(projectFileName, "UTF-8");
56 printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
57 startTag("Project",
58 "DefaultTargets", "Build",
59 "ToolsVersion", "4.0",
60 "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
61 startTag("ItemGroup",
62 "Label", "ProjectConfigurations");
63 for (BuildConfig cfg : allConfigs) {
64 startTag("ProjectConfiguration",
65 "Include", cfg.get("Name"));
66 tagData("Configuration", cfg.get("Id"));
67 tagData("Platform", cfg.get("PlatformName"));
68 endTag();
69 }
70 endTag();
71
121 startTag("Link");
122 tagV(cfg.getV("LinkerFlags"));
123 endTag();
124
125 startTag("PreLinkEvent");
126 tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription"));
127 tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n")));
128 endTag();
129
130 endTag();
131 }
132
133 writeFiles(allConfigs, projDir);
134
135 tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
136 startTag("ImportGroup", "Label", "ExtensionTargets");
137 endTag();
138
139 endTag();
140 printWriter.close();
141 System.out.println(" Done writing .vcxproj file.");
142
143 writeFilterFile(projectFileName, projectName, allConfigs, projDir);
144 writeUserFile(projectFileName, allConfigs);
145 }
146
147
148 private void writeUserFile(String projectFileName, Vector<BuildConfig> allConfigs) throws FileNotFoundException, UnsupportedEncodingException {
149 String userFileName = projectFileName + ".user";
150 if (new File(userFileName).exists()) {
151 return;
152 }
153 System.out.print(" Writing .vcxproj.user file: " + userFileName);
154 printWriter = new PrintWriter(userFileName, "UTF-8");
155
156 printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
157 startTag("Project",
158 "ToolsVersion", "4.0",
159 "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
160
161 for (BuildConfig cfg : allConfigs) {
|