fyn 1.1.20 → 1.1.21
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.
- package/addon.gypi +185 -0
- package/bin/node-gyp.js +3 -0
- package/dist/Find-VisualStudio.cs +250 -0
- package/dist/fyn.js +84722 -60935
- package/gyp/AUTHORS +16 -0
- package/gyp/LICENSE +28 -0
- package/gyp/data/win/large-pdb-shim.cc +12 -0
- package/gyp/gyp +8 -0
- package/gyp/gyp.bat +5 -0
- package/gyp/gyp_main.py +45 -0
- package/gyp/pylib/gyp/MSVSNew.py +367 -0
- package/gyp/pylib/gyp/MSVSProject.py +206 -0
- package/gyp/pylib/gyp/MSVSSettings.py +1270 -0
- package/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
- package/gyp/pylib/gyp/MSVSToolFile.py +59 -0
- package/gyp/pylib/gyp/MSVSUserFile.py +153 -0
- package/gyp/pylib/gyp/MSVSUtil.py +271 -0
- package/gyp/pylib/gyp/MSVSVersion.py +574 -0
- package/gyp/pylib/gyp/__init__.py +666 -0
- package/gyp/pylib/gyp/common.py +654 -0
- package/gyp/pylib/gyp/common_test.py +78 -0
- package/gyp/pylib/gyp/easy_xml.py +165 -0
- package/gyp/pylib/gyp/easy_xml_test.py +109 -0
- package/gyp/pylib/gyp/flock_tool.py +55 -0
- package/gyp/pylib/gyp/generator/__init__.py +0 -0
- package/gyp/pylib/gyp/generator/analyzer.py +808 -0
- package/gyp/pylib/gyp/generator/android.py +1173 -0
- package/gyp/pylib/gyp/generator/cmake.py +1321 -0
- package/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
- package/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
- package/gyp/pylib/gyp/generator/eclipse.py +464 -0
- package/gyp/pylib/gyp/generator/gypd.py +89 -0
- package/gyp/pylib/gyp/generator/gypsh.py +58 -0
- package/gyp/pylib/gyp/generator/make.py +2518 -0
- package/gyp/pylib/gyp/generator/msvs.py +3978 -0
- package/gyp/pylib/gyp/generator/msvs_test.py +44 -0
- package/gyp/pylib/gyp/generator/ninja.py +2936 -0
- package/gyp/pylib/gyp/generator/ninja_test.py +55 -0
- package/gyp/pylib/gyp/generator/xcode.py +1394 -0
- package/gyp/pylib/gyp/generator/xcode_test.py +25 -0
- package/gyp/pylib/gyp/input.py +3137 -0
- package/gyp/pylib/gyp/input_test.py +98 -0
- package/gyp/pylib/gyp/mac_tool.py +771 -0
- package/gyp/pylib/gyp/msvs_emulation.py +1271 -0
- package/gyp/pylib/gyp/ninja_syntax.py +174 -0
- package/gyp/pylib/gyp/simple_copy.py +61 -0
- package/gyp/pylib/gyp/win_tool.py +374 -0
- package/gyp/pylib/gyp/xcode_emulation.py +1939 -0
- package/gyp/pylib/gyp/xcode_ninja.py +302 -0
- package/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
- package/gyp/pylib/gyp/xml_fix.py +65 -0
- package/gyp/requirements_dev.txt +2 -0
- package/gyp/setup.py +42 -0
- package/gyp/test_gyp.py +260 -0
- package/gyp/tools/README +15 -0
- package/gyp/tools/Xcode/README +5 -0
- package/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
- package/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
- package/gyp/tools/emacs/README +12 -0
- package/gyp/tools/emacs/gyp-tests.el +63 -0
- package/gyp/tools/emacs/gyp.el +275 -0
- package/gyp/tools/emacs/run-unit-tests.sh +7 -0
- package/gyp/tools/emacs/testdata/media.gyp +1105 -0
- package/gyp/tools/emacs/testdata/media.gyp.fontified +1107 -0
- package/gyp/tools/graphviz.py +102 -0
- package/gyp/tools/pretty_gyp.py +156 -0
- package/gyp/tools/pretty_sln.py +181 -0
- package/gyp/tools/pretty_vcproj.py +339 -0
- package/node-gyp-bin/node-gyp +6 -0
- package/node-gyp-bin/node-gyp.cmd +5 -0
- package/package.json +7 -3
- package/src/win_delay_load_hook.cc +39 -0
package/addon.gypi
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
'variables' : {
|
|
3
|
+
'node_engine_include_dir%': 'deps/v8/include',
|
|
4
|
+
'node_host_binary%': 'node',
|
|
5
|
+
'node_with_ltcg%': 'true',
|
|
6
|
+
},
|
|
7
|
+
'target_defaults': {
|
|
8
|
+
'type': 'loadable_module',
|
|
9
|
+
'win_delay_load_hook': 'true',
|
|
10
|
+
'product_prefix': '',
|
|
11
|
+
|
|
12
|
+
'conditions': [
|
|
13
|
+
[ 'node_engine=="chakracore"', {
|
|
14
|
+
'variables': {
|
|
15
|
+
'node_engine_include_dir%': 'deps/chakrashim/include'
|
|
16
|
+
},
|
|
17
|
+
}]
|
|
18
|
+
],
|
|
19
|
+
|
|
20
|
+
'include_dirs': [
|
|
21
|
+
'<(node_root_dir)/include/node',
|
|
22
|
+
'<(node_root_dir)/src',
|
|
23
|
+
'<(node_root_dir)/deps/openssl/config',
|
|
24
|
+
'<(node_root_dir)/deps/openssl/openssl/include',
|
|
25
|
+
'<(node_root_dir)/deps/uv/include',
|
|
26
|
+
'<(node_root_dir)/deps/zlib',
|
|
27
|
+
'<(node_root_dir)/<(node_engine_include_dir)'
|
|
28
|
+
],
|
|
29
|
+
'defines!': [
|
|
30
|
+
'BUILDING_UV_SHARED=1', # Inherited from common.gypi.
|
|
31
|
+
'BUILDING_V8_SHARED=1', # Inherited from common.gypi.
|
|
32
|
+
],
|
|
33
|
+
'defines': [
|
|
34
|
+
'NODE_GYP_MODULE_NAME=>(_target_name)',
|
|
35
|
+
'USING_UV_SHARED=1',
|
|
36
|
+
'USING_V8_SHARED=1',
|
|
37
|
+
# Warn when using deprecated V8 APIs.
|
|
38
|
+
'V8_DEPRECATION_WARNINGS=1'
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
'target_conditions': [
|
|
42
|
+
['_type=="loadable_module"', {
|
|
43
|
+
'product_extension': 'node',
|
|
44
|
+
'defines': [
|
|
45
|
+
'BUILDING_NODE_EXTENSION'
|
|
46
|
+
],
|
|
47
|
+
'xcode_settings': {
|
|
48
|
+
'OTHER_LDFLAGS': [
|
|
49
|
+
'-undefined dynamic_lookup'
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
}],
|
|
53
|
+
|
|
54
|
+
['_type=="static_library"', {
|
|
55
|
+
# set to `1` to *disable* the -T thin archive 'ld' flag.
|
|
56
|
+
# older linkers don't support this flag.
|
|
57
|
+
'standalone_static_library': '<(standalone_static_library)'
|
|
58
|
+
}],
|
|
59
|
+
|
|
60
|
+
['_type!="executable"', {
|
|
61
|
+
'conditions': [
|
|
62
|
+
[ 'OS=="android"', {
|
|
63
|
+
'cflags!': [ '-fPIE' ],
|
|
64
|
+
}]
|
|
65
|
+
]
|
|
66
|
+
}],
|
|
67
|
+
|
|
68
|
+
['_win_delay_load_hook=="true"', {
|
|
69
|
+
# If the addon specifies `'win_delay_load_hook': 'true'` in its
|
|
70
|
+
# binding.gyp, link a delay-load hook into the DLL. This hook ensures
|
|
71
|
+
# that the addon will work regardless of whether the node/iojs binary
|
|
72
|
+
# is named node.exe, iojs.exe, or something else.
|
|
73
|
+
'conditions': [
|
|
74
|
+
[ 'OS=="win"', {
|
|
75
|
+
'defines': [ 'HOST_BINARY=\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\"', ],
|
|
76
|
+
'sources': [
|
|
77
|
+
'<(node_gyp_dir)/src/win_delay_load_hook.cc',
|
|
78
|
+
],
|
|
79
|
+
'msvs_settings': {
|
|
80
|
+
'VCLinkerTool': {
|
|
81
|
+
'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ],
|
|
82
|
+
# Don't print a linker warning when no imports from either .exe
|
|
83
|
+
# are used.
|
|
84
|
+
'AdditionalOptions': [ '/ignore:4199' ],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
}],
|
|
88
|
+
],
|
|
89
|
+
}],
|
|
90
|
+
],
|
|
91
|
+
|
|
92
|
+
'conditions': [
|
|
93
|
+
[ 'OS=="mac"', {
|
|
94
|
+
'defines': [
|
|
95
|
+
'_DARWIN_USE_64_BIT_INODE=1'
|
|
96
|
+
],
|
|
97
|
+
'xcode_settings': {
|
|
98
|
+
'DYLIB_INSTALL_NAME_BASE': '@rpath'
|
|
99
|
+
},
|
|
100
|
+
}],
|
|
101
|
+
[ 'OS=="aix"', {
|
|
102
|
+
'ldflags': [
|
|
103
|
+
'-Wl,-bimport:<(node_exp_file)'
|
|
104
|
+
],
|
|
105
|
+
}],
|
|
106
|
+
[ 'OS=="zos"', {
|
|
107
|
+
'cflags': [
|
|
108
|
+
'-q64',
|
|
109
|
+
'-Wc,DLL',
|
|
110
|
+
'-qlonglong',
|
|
111
|
+
'-qenum=int',
|
|
112
|
+
'-qxclang=-fexec-charset=ISO8859-1'
|
|
113
|
+
],
|
|
114
|
+
'defines': [
|
|
115
|
+
'_ALL_SOURCE=1',
|
|
116
|
+
'MAP_FAILED=-1',
|
|
117
|
+
'_UNIX03_SOURCE=1'
|
|
118
|
+
],
|
|
119
|
+
'ldflags': [
|
|
120
|
+
'-q64',
|
|
121
|
+
'<(node_exp_file)'
|
|
122
|
+
],
|
|
123
|
+
}],
|
|
124
|
+
[ 'OS=="win"', {
|
|
125
|
+
'conditions': [
|
|
126
|
+
['node_engine=="chakracore"', {
|
|
127
|
+
'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
|
|
128
|
+
'libraries': [ '<@(node_engine_libs)' ],
|
|
129
|
+
}],
|
|
130
|
+
['node_with_ltcg=="true"', {
|
|
131
|
+
'msvs_settings': {
|
|
132
|
+
'VCCLCompilerTool': {
|
|
133
|
+
'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
|
|
134
|
+
},
|
|
135
|
+
'VCLibrarianTool': {
|
|
136
|
+
'AdditionalOptions': [
|
|
137
|
+
'/LTCG:INCREMENTAL', # incremental link-time code generation
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
'VCLinkerTool': {
|
|
141
|
+
'OptimizeReferences': 2, # /OPT:REF
|
|
142
|
+
'EnableCOMDATFolding': 2, # /OPT:ICF
|
|
143
|
+
'LinkIncremental': 1, # disable incremental linking
|
|
144
|
+
'AdditionalOptions': [
|
|
145
|
+
'/LTCG:INCREMENTAL', # incremental link-time code generation
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}]
|
|
150
|
+
],
|
|
151
|
+
'libraries': [
|
|
152
|
+
'-lkernel32.lib',
|
|
153
|
+
'-luser32.lib',
|
|
154
|
+
'-lgdi32.lib',
|
|
155
|
+
'-lwinspool.lib',
|
|
156
|
+
'-lcomdlg32.lib',
|
|
157
|
+
'-ladvapi32.lib',
|
|
158
|
+
'-lshell32.lib',
|
|
159
|
+
'-lole32.lib',
|
|
160
|
+
'-loleaut32.lib',
|
|
161
|
+
'-luuid.lib',
|
|
162
|
+
'-lodbc32.lib',
|
|
163
|
+
'-lDelayImp.lib',
|
|
164
|
+
'-l"<(node_lib_file)"'
|
|
165
|
+
],
|
|
166
|
+
'msvs_disabled_warnings': [
|
|
167
|
+
# warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
|
|
168
|
+
# needs to have dll-interface to be used by
|
|
169
|
+
# clients of class 'node::ObjectWrap'
|
|
170
|
+
4251
|
|
171
|
+
],
|
|
172
|
+
}, {
|
|
173
|
+
# OS!="win"
|
|
174
|
+
'defines': [
|
|
175
|
+
'_LARGEFILE_SOURCE',
|
|
176
|
+
'_FILE_OFFSET_BITS=64'
|
|
177
|
+
],
|
|
178
|
+
}],
|
|
179
|
+
[ 'OS in "freebsd openbsd netbsd solaris android" or \
|
|
180
|
+
(OS=="linux" and target_arch!="ia32")', {
|
|
181
|
+
'cflags': [ '-fPIC' ],
|
|
182
|
+
}],
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
}
|
package/bin/node-gyp.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// Copyright 2017 - Refael Ackermann
|
|
2
|
+
// Distributed under MIT style license
|
|
3
|
+
// See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
|
|
4
|
+
|
|
5
|
+
// Usage:
|
|
6
|
+
// powershell -ExecutionPolicy Unrestricted -Command "Add-Type -Path Find-VisualStudio.cs; [VisualStudioConfiguration.Main]::PrintJson()"
|
|
7
|
+
// This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.
|
|
8
|
+
|
|
9
|
+
using System;
|
|
10
|
+
using System.Text;
|
|
11
|
+
using System.Runtime.InteropServices;
|
|
12
|
+
using System.Collections.Generic;
|
|
13
|
+
|
|
14
|
+
namespace VisualStudioConfiguration
|
|
15
|
+
{
|
|
16
|
+
[Flags]
|
|
17
|
+
public enum InstanceState : uint
|
|
18
|
+
{
|
|
19
|
+
None = 0,
|
|
20
|
+
Local = 1,
|
|
21
|
+
Registered = 2,
|
|
22
|
+
NoRebootRequired = 4,
|
|
23
|
+
NoErrors = 8,
|
|
24
|
+
Complete = 4294967295,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[Guid("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848")]
|
|
28
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
29
|
+
[ComImport]
|
|
30
|
+
public interface IEnumSetupInstances
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
void Next([MarshalAs(UnmanagedType.U4), In] int celt,
|
|
34
|
+
[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface), Out] ISetupInstance[] rgelt,
|
|
35
|
+
[MarshalAs(UnmanagedType.U4)] out int pceltFetched);
|
|
36
|
+
|
|
37
|
+
void Skip([MarshalAs(UnmanagedType.U4), In] int celt);
|
|
38
|
+
|
|
39
|
+
void Reset();
|
|
40
|
+
|
|
41
|
+
[return: MarshalAs(UnmanagedType.Interface)]
|
|
42
|
+
IEnumSetupInstances Clone();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")]
|
|
46
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
47
|
+
[ComImport]
|
|
48
|
+
public interface ISetupConfiguration
|
|
49
|
+
{
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[Guid("26AAB78C-4A60-49D6-AF3B-3C35BC93365D")]
|
|
53
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
54
|
+
[ComImport]
|
|
55
|
+
public interface ISetupConfiguration2 : ISetupConfiguration
|
|
56
|
+
{
|
|
57
|
+
|
|
58
|
+
[return: MarshalAs(UnmanagedType.Interface)]
|
|
59
|
+
IEnumSetupInstances EnumInstances();
|
|
60
|
+
|
|
61
|
+
[return: MarshalAs(UnmanagedType.Interface)]
|
|
62
|
+
ISetupInstance GetInstanceForCurrentProcess();
|
|
63
|
+
|
|
64
|
+
[return: MarshalAs(UnmanagedType.Interface)]
|
|
65
|
+
ISetupInstance GetInstanceForPath([MarshalAs(UnmanagedType.LPWStr), In] string path);
|
|
66
|
+
|
|
67
|
+
[return: MarshalAs(UnmanagedType.Interface)]
|
|
68
|
+
IEnumSetupInstances EnumAllInstances();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[Guid("B41463C3-8866-43B5-BC33-2B0676F7F42E")]
|
|
72
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
73
|
+
[ComImport]
|
|
74
|
+
public interface ISetupInstance
|
|
75
|
+
{
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[Guid("89143C9A-05AF-49B0-B717-72E218A2185C")]
|
|
79
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
80
|
+
[ComImport]
|
|
81
|
+
public interface ISetupInstance2 : ISetupInstance
|
|
82
|
+
{
|
|
83
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
84
|
+
string GetInstanceId();
|
|
85
|
+
|
|
86
|
+
[return: MarshalAs(UnmanagedType.Struct)]
|
|
87
|
+
System.Runtime.InteropServices.ComTypes.FILETIME GetInstallDate();
|
|
88
|
+
|
|
89
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
90
|
+
string GetInstallationName();
|
|
91
|
+
|
|
92
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
93
|
+
string GetInstallationPath();
|
|
94
|
+
|
|
95
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
96
|
+
string GetInstallationVersion();
|
|
97
|
+
|
|
98
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
99
|
+
string GetDisplayName([MarshalAs(UnmanagedType.U4), In] int lcid);
|
|
100
|
+
|
|
101
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
102
|
+
string GetDescription([MarshalAs(UnmanagedType.U4), In] int lcid);
|
|
103
|
+
|
|
104
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
105
|
+
string ResolvePath([MarshalAs(UnmanagedType.LPWStr), In] string pwszRelativePath);
|
|
106
|
+
|
|
107
|
+
[return: MarshalAs(UnmanagedType.U4)]
|
|
108
|
+
InstanceState GetState();
|
|
109
|
+
|
|
110
|
+
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
|
|
111
|
+
ISetupPackageReference[] GetPackages();
|
|
112
|
+
|
|
113
|
+
ISetupPackageReference GetProduct();
|
|
114
|
+
|
|
115
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
116
|
+
string GetProductPath();
|
|
117
|
+
|
|
118
|
+
[return: MarshalAs(UnmanagedType.VariantBool)]
|
|
119
|
+
bool IsLaunchable();
|
|
120
|
+
|
|
121
|
+
[return: MarshalAs(UnmanagedType.VariantBool)]
|
|
122
|
+
bool IsComplete();
|
|
123
|
+
|
|
124
|
+
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
|
|
125
|
+
ISetupPropertyStore GetProperties();
|
|
126
|
+
|
|
127
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
128
|
+
string GetEnginePath();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[Guid("DA8D8A16-B2B6-4487-A2F1-594CCCCD6BF5")]
|
|
132
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
133
|
+
[ComImport]
|
|
134
|
+
public interface ISetupPackageReference
|
|
135
|
+
{
|
|
136
|
+
|
|
137
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
138
|
+
string GetId();
|
|
139
|
+
|
|
140
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
141
|
+
string GetVersion();
|
|
142
|
+
|
|
143
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
144
|
+
string GetChip();
|
|
145
|
+
|
|
146
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
147
|
+
string GetLanguage();
|
|
148
|
+
|
|
149
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
150
|
+
string GetBranch();
|
|
151
|
+
|
|
152
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
153
|
+
string GetType();
|
|
154
|
+
|
|
155
|
+
[return: MarshalAs(UnmanagedType.BStr)]
|
|
156
|
+
string GetUniqueId();
|
|
157
|
+
|
|
158
|
+
[return: MarshalAs(UnmanagedType.VariantBool)]
|
|
159
|
+
bool GetIsExtension();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
[Guid("c601c175-a3be-44bc-91f6-4568d230fc83")]
|
|
163
|
+
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
164
|
+
[ComImport]
|
|
165
|
+
public interface ISetupPropertyStore
|
|
166
|
+
{
|
|
167
|
+
|
|
168
|
+
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)]
|
|
169
|
+
string[] GetNames();
|
|
170
|
+
|
|
171
|
+
object GetValue([MarshalAs(UnmanagedType.LPWStr), In] string pwszName);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
[Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")]
|
|
175
|
+
[CoClass(typeof(SetupConfigurationClass))]
|
|
176
|
+
[ComImport]
|
|
177
|
+
public interface SetupConfiguration : ISetupConfiguration2, ISetupConfiguration
|
|
178
|
+
{
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
[Guid("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D")]
|
|
182
|
+
[ClassInterface(ClassInterfaceType.None)]
|
|
183
|
+
[ComImport]
|
|
184
|
+
public class SetupConfigurationClass
|
|
185
|
+
{
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public static class Main
|
|
189
|
+
{
|
|
190
|
+
public static void PrintJson()
|
|
191
|
+
{
|
|
192
|
+
ISetupConfiguration query = new SetupConfiguration();
|
|
193
|
+
ISetupConfiguration2 query2 = (ISetupConfiguration2)query;
|
|
194
|
+
IEnumSetupInstances e = query2.EnumAllInstances();
|
|
195
|
+
|
|
196
|
+
int pceltFetched;
|
|
197
|
+
ISetupInstance2[] rgelt = new ISetupInstance2[1];
|
|
198
|
+
List<string> instances = new List<string>();
|
|
199
|
+
while (true)
|
|
200
|
+
{
|
|
201
|
+
e.Next(1, rgelt, out pceltFetched);
|
|
202
|
+
if (pceltFetched <= 0)
|
|
203
|
+
{
|
|
204
|
+
Console.WriteLine(String.Format("[{0}]", string.Join(",", instances.ToArray())));
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
try
|
|
209
|
+
{
|
|
210
|
+
instances.Add(InstanceJson(rgelt[0]));
|
|
211
|
+
}
|
|
212
|
+
catch (COMException)
|
|
213
|
+
{
|
|
214
|
+
// Ignore instances that can't be queried.
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private static string JsonString(string s)
|
|
220
|
+
{
|
|
221
|
+
return "\"" + s.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"";
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private static string InstanceJson(ISetupInstance2 setupInstance2)
|
|
225
|
+
{
|
|
226
|
+
// Visual Studio component directory:
|
|
227
|
+
// https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids
|
|
228
|
+
|
|
229
|
+
StringBuilder json = new StringBuilder();
|
|
230
|
+
json.Append("{");
|
|
231
|
+
|
|
232
|
+
string path = JsonString(setupInstance2.GetInstallationPath());
|
|
233
|
+
json.Append(String.Format("\"path\":{0},", path));
|
|
234
|
+
|
|
235
|
+
string version = JsonString(setupInstance2.GetInstallationVersion());
|
|
236
|
+
json.Append(String.Format("\"version\":{0},", version));
|
|
237
|
+
|
|
238
|
+
List<string> packages = new List<string>();
|
|
239
|
+
foreach (ISetupPackageReference package in setupInstance2.GetPackages())
|
|
240
|
+
{
|
|
241
|
+
string id = JsonString(package.GetId());
|
|
242
|
+
packages.Add(id);
|
|
243
|
+
}
|
|
244
|
+
json.Append(String.Format("\"packages\":[{0}]", string.Join(",", packages.ToArray())));
|
|
245
|
+
|
|
246
|
+
json.Append("}");
|
|
247
|
+
return json.ToString();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|