fyn 1.1.19 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +4 -3
  2. package/addon.gypi +185 -0
  3. package/bin/node-gyp.js +3 -0
  4. package/dist/Find-VisualStudio.cs +250 -0
  5. package/dist/fyn.js +86694 -56317
  6. package/dist/fyn.js.LICENSE.txt +81 -0
  7. package/gyp/AUTHORS +16 -0
  8. package/gyp/LICENSE +28 -0
  9. package/gyp/data/win/large-pdb-shim.cc +12 -0
  10. package/gyp/gyp +8 -0
  11. package/gyp/gyp.bat +5 -0
  12. package/gyp/gyp_main.py +45 -0
  13. package/gyp/pylib/gyp/MSVSNew.py +367 -0
  14. package/gyp/pylib/gyp/MSVSProject.py +206 -0
  15. package/gyp/pylib/gyp/MSVSSettings.py +1270 -0
  16. package/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  17. package/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  18. package/gyp/pylib/gyp/MSVSUserFile.py +153 -0
  19. package/gyp/pylib/gyp/MSVSUtil.py +271 -0
  20. package/gyp/pylib/gyp/MSVSVersion.py +574 -0
  21. package/gyp/pylib/gyp/__init__.py +666 -0
  22. package/gyp/pylib/gyp/common.py +654 -0
  23. package/gyp/pylib/gyp/common_test.py +78 -0
  24. package/gyp/pylib/gyp/easy_xml.py +165 -0
  25. package/gyp/pylib/gyp/easy_xml_test.py +109 -0
  26. package/gyp/pylib/gyp/flock_tool.py +55 -0
  27. package/gyp/pylib/gyp/generator/__init__.py +0 -0
  28. package/gyp/pylib/gyp/generator/analyzer.py +808 -0
  29. package/gyp/pylib/gyp/generator/android.py +1173 -0
  30. package/gyp/pylib/gyp/generator/cmake.py +1321 -0
  31. package/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
  32. package/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
  33. package/gyp/pylib/gyp/generator/eclipse.py +464 -0
  34. package/gyp/pylib/gyp/generator/gypd.py +89 -0
  35. package/gyp/pylib/gyp/generator/gypsh.py +58 -0
  36. package/gyp/pylib/gyp/generator/make.py +2518 -0
  37. package/gyp/pylib/gyp/generator/msvs.py +3978 -0
  38. package/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  39. package/gyp/pylib/gyp/generator/ninja.py +2936 -0
  40. package/gyp/pylib/gyp/generator/ninja_test.py +55 -0
  41. package/gyp/pylib/gyp/generator/xcode.py +1394 -0
  42. package/gyp/pylib/gyp/generator/xcode_test.py +25 -0
  43. package/gyp/pylib/gyp/input.py +3137 -0
  44. package/gyp/pylib/gyp/input_test.py +98 -0
  45. package/gyp/pylib/gyp/mac_tool.py +771 -0
  46. package/gyp/pylib/gyp/msvs_emulation.py +1271 -0
  47. package/gyp/pylib/gyp/ninja_syntax.py +174 -0
  48. package/gyp/pylib/gyp/simple_copy.py +61 -0
  49. package/gyp/pylib/gyp/win_tool.py +374 -0
  50. package/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  51. package/gyp/pylib/gyp/xcode_ninja.py +302 -0
  52. package/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
  53. package/gyp/pylib/gyp/xml_fix.py +65 -0
  54. package/gyp/requirements_dev.txt +2 -0
  55. package/gyp/setup.py +42 -0
  56. package/gyp/test_gyp.py +260 -0
  57. package/gyp/tools/README +15 -0
  58. package/gyp/tools/Xcode/README +5 -0
  59. package/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
  60. package/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
  61. package/gyp/tools/emacs/README +12 -0
  62. package/gyp/tools/emacs/gyp-tests.el +63 -0
  63. package/gyp/tools/emacs/gyp.el +275 -0
  64. package/gyp/tools/emacs/run-unit-tests.sh +7 -0
  65. package/gyp/tools/emacs/testdata/media.gyp +1105 -0
  66. package/gyp/tools/emacs/testdata/media.gyp.fontified +1107 -0
  67. package/gyp/tools/graphviz.py +102 -0
  68. package/gyp/tools/pretty_gyp.py +156 -0
  69. package/gyp/tools/pretty_sln.py +181 -0
  70. package/gyp/tools/pretty_vcproj.py +339 -0
  71. package/node-gyp-bin/node-gyp +6 -0
  72. package/node-gyp-bin/node-gyp.cmd +5 -0
  73. package/package.json +15 -10
  74. package/src/win_delay_load_hook.cc +39 -0
@@ -0,0 +1,81 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ * depd
9
+ * Copyright(c) 2014 Douglas Christopher Wilson
10
+ * MIT Licensed
11
+ */
12
+
13
+ /*!
14
+ * depd
15
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
16
+ * MIT Licensed
17
+ */
18
+
19
+ /*!
20
+ * depd
21
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
22
+ * MIT Licensed
23
+ */
24
+
25
+ /*!
26
+ * depd
27
+ * Copyright(c) 2015 Douglas Christopher Wilson
28
+ * MIT Licensed
29
+ */
30
+
31
+ /*!
32
+ * humanize-ms - index.js
33
+ * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
34
+ * MIT Licensed
35
+ */
36
+
37
+ /*!
38
+ * negotiator
39
+ * Copyright(c) 2012 Federico Romero
40
+ * Copyright(c) 2012-2014 Isaac Z. Schlueter
41
+ * Copyright(c) 2015 Douglas Christopher Wilson
42
+ * MIT Licensed
43
+ */
44
+
45
+ /*! *****************************************************************************
46
+ Copyright (c) Microsoft Corporation.
47
+
48
+ Permission to use, copy, modify, and/or distribute this software for any
49
+ purpose with or without fee is hereby granted.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
52
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
53
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
54
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
55
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
56
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
57
+ PERFORMANCE OF THIS SOFTWARE.
58
+ ***************************************************************************** */
59
+
60
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
61
+
62
+ /**
63
+ * @license
64
+ * Lodash <https://lodash.com/>
65
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
66
+ * Released under MIT license <https://lodash.com/license>
67
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
68
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
69
+ */
70
+
71
+ /**
72
+ * @preserve
73
+ * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
74
+ *
75
+ * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
76
+ * @see http://github.com/homebrewing/brauhaus-diff
77
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
78
+ * @see http://github.com/garycourt/murmurhash-js
79
+ * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
80
+ * @see http://sites.google.com/site/murmurhash/
81
+ */
package/gyp/AUTHORS ADDED
@@ -0,0 +1,16 @@
1
+ # Names should be added to this file like so:
2
+ # Name or Organization <email address>
3
+
4
+ Google Inc. <*@google.com>
5
+ Bloomberg Finance L.P. <*@bloomberg.net>
6
+ IBM Inc. <*@*.ibm.com>
7
+ Yandex LLC <*@yandex-team.ru>
8
+
9
+ Steven Knight <knight@baldmt.com>
10
+ Ryan Norton <rnorton10@gmail.com>
11
+ David J. Sankel <david@sankelsoftware.com>
12
+ Eric N. Vander Weele <ericvw@gmail.com>
13
+ Tom Freudenberg <th.freudenberg@gmail.com>
14
+ Julien Brianceau <jbriance@cisco.com>
15
+ Refael Ackermann <refack@gmail.com>
16
+ Ujjwal Sharma <ryzokuken@disroot.org>
package/gyp/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2020 Node.js contributors. All rights reserved.
2
+ Copyright (c) 2009 Google Inc. All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above
11
+ copyright notice, this list of conditions and the following disclaimer
12
+ in the documentation and/or other materials provided with the
13
+ distribution.
14
+ * Neither the name of Google Inc. nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,12 @@
1
+ // Copyright (c) 2013 Google Inc. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ // This file is used to generate an empty .pdb -- with a 4KB pagesize -- that is
6
+ // then used during the final link for modules that have large PDBs. Otherwise,
7
+ // the linker will generate a pdb with a page size of 1KB, which imposes a limit
8
+ // of 1GB on the .pdb. By generating an initial empty .pdb with the compiler
9
+ // (rather than the linker), this limit is avoided. With this in place PDBs may
10
+ // grow to 2GB.
11
+ //
12
+ // This file is referenced by the msvs_large_pdb mechanism in MSVSUtil.py.
package/gyp/gyp ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # Copyright 2013 The Chromium Authors. All rights reserved.
3
+ # Use of this source code is governed by a BSD-style license that can be
4
+ # found in the LICENSE file.
5
+
6
+ set -e
7
+ base=$(dirname "$0")
8
+ exec python "${base}/gyp_main.py" "$@"
package/gyp/gyp.bat ADDED
@@ -0,0 +1,5 @@
1
+ @rem Copyright (c) 2009 Google Inc. All rights reserved.
2
+ @rem Use of this source code is governed by a BSD-style license that can be
3
+ @rem found in the LICENSE file.
4
+
5
+ @python "%~dp0gyp_main.py" %*
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # Copyright (c) 2009 Google Inc. All rights reserved.
4
+ # Use of this source code is governed by a BSD-style license that can be
5
+ # found in the LICENSE file.
6
+
7
+ import os
8
+ import sys
9
+ import subprocess
10
+
11
+
12
+ def IsCygwin():
13
+ # Function copied from pylib/gyp/common.py
14
+ try:
15
+ out = subprocess.Popen(
16
+ "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
17
+ )
18
+ stdout, _ = out.communicate()
19
+ return "CYGWIN" in stdout.decode("utf-8")
20
+ except Exception:
21
+ return False
22
+
23
+
24
+ def UnixifyPath(path):
25
+ try:
26
+ if not IsCygwin():
27
+ return path
28
+ out = subprocess.Popen(
29
+ ["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
30
+ )
31
+ stdout, _ = out.communicate()
32
+ return stdout.decode("utf-8")
33
+ except Exception:
34
+ return path
35
+
36
+
37
+ # Make sure we're using the version of pylib in this repo, not one installed
38
+ # elsewhere on the system. Also convert to Unix style path on Cygwin systems,
39
+ # else the 'gyp' library will not be found
40
+ path = UnixifyPath(sys.argv[0])
41
+ sys.path.insert(0, os.path.join(os.path.dirname(path), "pylib"))
42
+ import gyp # noqa: E402
43
+
44
+ if __name__ == "__main__":
45
+ sys.exit(gyp.script_main())
@@ -0,0 +1,367 @@
1
+ # Copyright (c) 2012 Google Inc. All rights reserved.
2
+ # Use of this source code is governed by a BSD-style license that can be
3
+ # found in the LICENSE file.
4
+
5
+ """New implementation of Visual Studio project generation."""
6
+
7
+ import hashlib
8
+ import os
9
+ import random
10
+ from operator import attrgetter
11
+
12
+ import gyp.common
13
+
14
+
15
+ def cmp(x, y):
16
+ return (x > y) - (x < y)
17
+
18
+
19
+ # Initialize random number generator
20
+ random.seed()
21
+
22
+ # GUIDs for project types
23
+ ENTRY_TYPE_GUIDS = {
24
+ "project": "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}",
25
+ "folder": "{2150E333-8FDC-42A3-9474-1A3956D46DE8}",
26
+ }
27
+
28
+ # ------------------------------------------------------------------------------
29
+ # Helper functions
30
+
31
+
32
+ def MakeGuid(name, seed="msvs_new"):
33
+ """Returns a GUID for the specified target name.
34
+
35
+ Args:
36
+ name: Target name.
37
+ seed: Seed for MD5 hash.
38
+ Returns:
39
+ A GUID-line string calculated from the name and seed.
40
+
41
+ This generates something which looks like a GUID, but depends only on the
42
+ name and seed. This means the same name/seed will always generate the same
43
+ GUID, so that projects and solutions which refer to each other can explicitly
44
+ determine the GUID to refer to explicitly. It also means that the GUID will
45
+ not change when the project for a target is rebuilt.
46
+ """
47
+ # Calculate a MD5 signature for the seed and name.
48
+ d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper()
49
+ # Convert most of the signature to GUID form (discard the rest)
50
+ guid = (
51
+ "{"
52
+ + d[:8]
53
+ + "-"
54
+ + d[8:12]
55
+ + "-"
56
+ + d[12:16]
57
+ + "-"
58
+ + d[16:20]
59
+ + "-"
60
+ + d[20:32]
61
+ + "}"
62
+ )
63
+ return guid
64
+
65
+
66
+ # ------------------------------------------------------------------------------
67
+
68
+
69
+ class MSVSSolutionEntry:
70
+ def __cmp__(self, other):
71
+ # Sort by name then guid (so things are in order on vs2008).
72
+ return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
73
+
74
+
75
+ class MSVSFolder(MSVSSolutionEntry):
76
+ """Folder in a Visual Studio project or solution."""
77
+
78
+ def __init__(self, path, name=None, entries=None, guid=None, items=None):
79
+ """Initializes the folder.
80
+
81
+ Args:
82
+ path: Full path to the folder.
83
+ name: Name of the folder.
84
+ entries: List of folder entries to nest inside this folder. May contain
85
+ Folder or Project objects. May be None, if the folder is empty.
86
+ guid: GUID to use for folder, if not None.
87
+ items: List of solution items to include in the folder project. May be
88
+ None, if the folder does not directly contain items.
89
+ """
90
+ if name:
91
+ self.name = name
92
+ else:
93
+ # Use last layer.
94
+ self.name = os.path.basename(path)
95
+
96
+ self.path = path
97
+ self.guid = guid
98
+
99
+ # Copy passed lists (or set to empty lists)
100
+ self.entries = sorted(entries or [], key=attrgetter("path"))
101
+ self.items = list(items or [])
102
+
103
+ self.entry_type_guid = ENTRY_TYPE_GUIDS["folder"]
104
+
105
+ def get_guid(self):
106
+ if self.guid is None:
107
+ # Use consistent guids for folders (so things don't regenerate).
108
+ self.guid = MakeGuid(self.path, seed="msvs_folder")
109
+ return self.guid
110
+
111
+
112
+ # ------------------------------------------------------------------------------
113
+
114
+
115
+ class MSVSProject(MSVSSolutionEntry):
116
+ """Visual Studio project."""
117
+
118
+ def __init__(
119
+ self,
120
+ path,
121
+ name=None,
122
+ dependencies=None,
123
+ guid=None,
124
+ spec=None,
125
+ build_file=None,
126
+ config_platform_overrides=None,
127
+ fixpath_prefix=None,
128
+ ):
129
+ """Initializes the project.
130
+
131
+ Args:
132
+ path: Absolute path to the project file.
133
+ name: Name of project. If None, the name will be the same as the base
134
+ name of the project file.
135
+ dependencies: List of other Project objects this project is dependent
136
+ upon, if not None.
137
+ guid: GUID to use for project, if not None.
138
+ spec: Dictionary specifying how to build this project.
139
+ build_file: Filename of the .gyp file that the vcproj file comes from.
140
+ config_platform_overrides: optional dict of configuration platforms to
141
+ used in place of the default for this target.
142
+ fixpath_prefix: the path used to adjust the behavior of _fixpath
143
+ """
144
+ self.path = path
145
+ self.guid = guid
146
+ self.spec = spec
147
+ self.build_file = build_file
148
+ # Use project filename if name not specified
149
+ self.name = name or os.path.splitext(os.path.basename(path))[0]
150
+
151
+ # Copy passed lists (or set to empty lists)
152
+ self.dependencies = list(dependencies or [])
153
+
154
+ self.entry_type_guid = ENTRY_TYPE_GUIDS["project"]
155
+
156
+ if config_platform_overrides:
157
+ self.config_platform_overrides = config_platform_overrides
158
+ else:
159
+ self.config_platform_overrides = {}
160
+ self.fixpath_prefix = fixpath_prefix
161
+ self.msbuild_toolset = None
162
+
163
+ def set_dependencies(self, dependencies):
164
+ self.dependencies = list(dependencies or [])
165
+
166
+ def get_guid(self):
167
+ if self.guid is None:
168
+ # Set GUID from path
169
+ # TODO(rspangler): This is fragile.
170
+ # 1. We can't just use the project filename sans path, since there could
171
+ # be multiple projects with the same base name (for example,
172
+ # foo/unittest.vcproj and bar/unittest.vcproj).
173
+ # 2. The path needs to be relative to $SOURCE_ROOT, so that the project
174
+ # GUID is the same whether it's included from base/base.sln or
175
+ # foo/bar/baz/baz.sln.
176
+ # 3. The GUID needs to be the same each time this builder is invoked, so
177
+ # that we don't need to rebuild the solution when the project changes.
178
+ # 4. We should be able to handle pre-built project files by reading the
179
+ # GUID from the files.
180
+ self.guid = MakeGuid(self.name)
181
+ return self.guid
182
+
183
+ def set_msbuild_toolset(self, msbuild_toolset):
184
+ self.msbuild_toolset = msbuild_toolset
185
+
186
+
187
+ # ------------------------------------------------------------------------------
188
+
189
+
190
+ class MSVSSolution:
191
+ """Visual Studio solution."""
192
+
193
+ def __init__(
194
+ self, path, version, entries=None, variants=None, websiteProperties=True
195
+ ):
196
+ """Initializes the solution.
197
+
198
+ Args:
199
+ path: Path to solution file.
200
+ version: Format version to emit.
201
+ entries: List of entries in solution. May contain Folder or Project
202
+ objects. May be None, if the folder is empty.
203
+ variants: List of build variant strings. If none, a default list will
204
+ be used.
205
+ websiteProperties: Flag to decide if the website properties section
206
+ is generated.
207
+ """
208
+ self.path = path
209
+ self.websiteProperties = websiteProperties
210
+ self.version = version
211
+
212
+ # Copy passed lists (or set to empty lists)
213
+ self.entries = list(entries or [])
214
+
215
+ if variants:
216
+ # Copy passed list
217
+ self.variants = variants[:]
218
+ else:
219
+ # Use default
220
+ self.variants = ["Debug|Win32", "Release|Win32"]
221
+ # TODO(rspangler): Need to be able to handle a mapping of solution config
222
+ # to project config. Should we be able to handle variants being a dict,
223
+ # or add a separate variant_map variable? If it's a dict, we can't
224
+ # guarantee the order of variants since dict keys aren't ordered.
225
+
226
+ # TODO(rspangler): Automatically write to disk for now; should delay until
227
+ # node-evaluation time.
228
+ self.Write()
229
+
230
+ def Write(self, writer=gyp.common.WriteOnDiff):
231
+ """Writes the solution file to disk.
232
+
233
+ Raises:
234
+ IndexError: An entry appears multiple times.
235
+ """
236
+ # Walk the entry tree and collect all the folders and projects.
237
+ all_entries = set()
238
+ entries_to_check = self.entries[:]
239
+ while entries_to_check:
240
+ e = entries_to_check.pop(0)
241
+
242
+ # If this entry has been visited, nothing to do.
243
+ if e in all_entries:
244
+ continue
245
+
246
+ all_entries.add(e)
247
+
248
+ # If this is a folder, check its entries too.
249
+ if isinstance(e, MSVSFolder):
250
+ entries_to_check += e.entries
251
+
252
+ all_entries = sorted(all_entries, key=attrgetter("path"))
253
+
254
+ # Open file and print header
255
+ f = writer(self.path)
256
+ f.write(
257
+ "Microsoft Visual Studio Solution File, "
258
+ "Format Version %s\r\n" % self.version.SolutionVersion()
259
+ )
260
+ f.write("# %s\r\n" % self.version.Description())
261
+
262
+ # Project entries
263
+ sln_root = os.path.split(self.path)[0]
264
+ for e in all_entries:
265
+ relative_path = gyp.common.RelativePath(e.path, sln_root)
266
+ # msbuild does not accept an empty folder_name.
267
+ # use '.' in case relative_path is empty.
268
+ folder_name = relative_path.replace("/", "\\") or "."
269
+ f.write(
270
+ 'Project("%s") = "%s", "%s", "%s"\r\n'
271
+ % (
272
+ e.entry_type_guid, # Entry type GUID
273
+ e.name, # Folder name
274
+ folder_name, # Folder name (again)
275
+ e.get_guid(), # Entry GUID
276
+ )
277
+ )
278
+
279
+ # TODO(rspangler): Need a way to configure this stuff
280
+ if self.websiteProperties:
281
+ f.write(
282
+ "\tProjectSection(WebsiteProperties) = preProject\r\n"
283
+ '\t\tDebug.AspNetCompiler.Debug = "True"\r\n'
284
+ '\t\tRelease.AspNetCompiler.Debug = "False"\r\n'
285
+ "\tEndProjectSection\r\n"
286
+ )
287
+
288
+ if isinstance(e, MSVSFolder):
289
+ if e.items:
290
+ f.write("\tProjectSection(SolutionItems) = preProject\r\n")
291
+ for i in e.items:
292
+ f.write(f"\t\t{i} = {i}\r\n")
293
+ f.write("\tEndProjectSection\r\n")
294
+
295
+ if isinstance(e, MSVSProject):
296
+ if e.dependencies:
297
+ f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
298
+ for d in e.dependencies:
299
+ f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
300
+ f.write("\tEndProjectSection\r\n")
301
+
302
+ f.write("EndProject\r\n")
303
+
304
+ # Global section
305
+ f.write("Global\r\n")
306
+
307
+ # Configurations (variants)
308
+ f.write("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n")
309
+ for v in self.variants:
310
+ f.write(f"\t\t{v} = {v}\r\n")
311
+ f.write("\tEndGlobalSection\r\n")
312
+
313
+ # Sort config guids for easier diffing of solution changes.
314
+ config_guids = []
315
+ config_guids_overrides = {}
316
+ for e in all_entries:
317
+ if isinstance(e, MSVSProject):
318
+ config_guids.append(e.get_guid())
319
+ config_guids_overrides[e.get_guid()] = e.config_platform_overrides
320
+ config_guids.sort()
321
+
322
+ f.write("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n")
323
+ for g in config_guids:
324
+ for v in self.variants:
325
+ nv = config_guids_overrides[g].get(v, v)
326
+ # Pick which project configuration to build for this solution
327
+ # configuration.
328
+ f.write(
329
+ "\t\t%s.%s.ActiveCfg = %s\r\n"
330
+ % (
331
+ g, # Project GUID
332
+ v, # Solution build configuration
333
+ nv, # Project build config for that solution config
334
+ )
335
+ )
336
+
337
+ # Enable project in this solution configuration.
338
+ f.write(
339
+ "\t\t%s.%s.Build.0 = %s\r\n"
340
+ % (
341
+ g, # Project GUID
342
+ v, # Solution build configuration
343
+ nv, # Project build config for that solution config
344
+ )
345
+ )
346
+ f.write("\tEndGlobalSection\r\n")
347
+
348
+ # TODO(rspangler): Should be able to configure this stuff too (though I've
349
+ # never seen this be any different)
350
+ f.write("\tGlobalSection(SolutionProperties) = preSolution\r\n")
351
+ f.write("\t\tHideSolutionNode = FALSE\r\n")
352
+ f.write("\tEndGlobalSection\r\n")
353
+
354
+ # Folder mappings
355
+ # Omit this section if there are no folders
356
+ if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]):
357
+ f.write("\tGlobalSection(NestedProjects) = preSolution\r\n")
358
+ for e in all_entries:
359
+ if not isinstance(e, MSVSFolder):
360
+ continue # Does not apply to projects, only folders
361
+ for subentry in e.entries:
362
+ f.write(f"\t\t{subentry.get_guid()} = {e.get_guid()}\r\n")
363
+ f.write("\tEndGlobalSection\r\n")
364
+
365
+ f.write("EndGlobal\r\n")
366
+
367
+ f.close()