@nativescript/windows-hermes 0.1.0-alpha.146 → 0.1.0-beta.6
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/framework/__PROJECT_NAME__/RuntimeHost.cs +56 -12
- package/framework/__PROJECT_NAME__/__PROJECT_NAME__.csproj +19 -2
- package/framework/libs/x64/nativescript.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.pdb +0 -0
- package/framework/tools/dotnet-tool-x64.exe +0 -0
- package/framework/tools/dotnet-tool.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.dll +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.pdb +0 -0
- package/framework/tools/nsbundle_pack-x64.exe +0 -0
- package/framework/tools/nsbundle_pack.exe +0 -0
- package/framework/tools/sbg-x64.exe +0 -0
- package/framework/tools/sbg.exe +0 -0
- package/framework/tools/typings-generator-x64.exe +0 -0
- package/framework/tools/typings-generator.exe +0 -0
- package/package.json +1 -1
|
@@ -53,6 +53,7 @@ namespace __PROJECT_NAME__
|
|
|
53
53
|
private static extern void runtime_free_js_error(IntPtr ptr);
|
|
54
54
|
|
|
55
55
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_has_devtools))]
|
|
56
|
+
[return: MarshalAs(UnmanagedType.U1)]
|
|
56
57
|
private static extern bool runtime_has_devtools();
|
|
57
58
|
|
|
58
59
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_pump_timers))]
|
|
@@ -110,6 +111,21 @@ namespace __PROJECT_NAME__
|
|
|
110
111
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_free_string))]
|
|
111
112
|
private static extern void runtime_free_string(IntPtr ptr);
|
|
112
113
|
|
|
114
|
+
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_devtools_wait_for_debugger))]
|
|
115
|
+
[return: MarshalAs(UnmanagedType.U1)]
|
|
116
|
+
private static extern bool runtime_devtools_wait_for_debugger(long runtime, uint timeoutMs);
|
|
117
|
+
|
|
118
|
+
// iOS uses 41000 and Android 42000.
|
|
119
|
+
private const ushort DevtoolsPort = 43000;
|
|
120
|
+
private const uint DebuggerWaitTimeoutMs = 30000;
|
|
121
|
+
|
|
122
|
+
// LocalFolder sentinel files shared with the CLI's WindowsApplicationManager.
|
|
123
|
+
private const string InspectorMarker = "ns-inspector";
|
|
124
|
+
private const string DebugBreakMarker = "ns-debugbreak";
|
|
125
|
+
private const string DebuggerStartedMarker = "ns-debugger-started";
|
|
126
|
+
|
|
127
|
+
private bool _waitForDebugger;
|
|
128
|
+
|
|
113
129
|
public string DevtoolsFrontendUrl { get; private set; }
|
|
114
130
|
|
|
115
131
|
private bool _devtoolsAvailable;
|
|
@@ -130,7 +146,7 @@ namespace __PROJECT_NAME__
|
|
|
130
146
|
IntPtr urlPtr = IntPtr.Zero;
|
|
131
147
|
try
|
|
132
148
|
{
|
|
133
|
-
urlPtr = runtime_devtools_start(_runtime,
|
|
149
|
+
urlPtr = runtime_devtools_start(_runtime, DevtoolsPort);
|
|
134
150
|
if (urlPtr == IntPtr.Zero) return;
|
|
135
151
|
var wsUrl = Marshal.PtrToStringUTF8(urlPtr);
|
|
136
152
|
DevtoolsFrontendUrl = wsUrl != null
|
|
@@ -139,6 +155,8 @@ namespace __PROJECT_NAME__
|
|
|
139
155
|
if (DevtoolsFrontendUrl != null)
|
|
140
156
|
{
|
|
141
157
|
_devtoolsAvailable = true;
|
|
158
|
+
// The server may fall back to the next free port.
|
|
159
|
+
WriteMarker(DebuggerStartedMarker, new Uri(wsUrl).Port.ToString());
|
|
142
160
|
System.Diagnostics.Debug.WriteLine($"[NativeScript DevTools] {DevtoolsFrontendUrl}");
|
|
143
161
|
}
|
|
144
162
|
}
|
|
@@ -191,31 +209,48 @@ namespace __PROJECT_NAME__
|
|
|
191
209
|
}
|
|
192
210
|
}
|
|
193
211
|
catch { }
|
|
194
|
-
|
|
212
|
+
DeleteMarker(DebuggerStartedMarker);
|
|
213
|
+
var debugBreak = ConsumeMarker(DebugBreakMarker);
|
|
214
|
+
if (ConsumeMarker(InspectorMarker) || debugBreak)
|
|
215
|
+
{
|
|
195
216
|
StartDevtoolsSafely();
|
|
217
|
+
_waitForDebugger = debugBreak && _devtoolsAvailable;
|
|
218
|
+
}
|
|
196
219
|
#endif
|
|
197
220
|
_initialized = true;
|
|
198
221
|
}
|
|
199
222
|
|
|
200
223
|
#if DEBUG
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
private static bool ConsumeDebugBreakMarker()
|
|
224
|
+
private static string MarkerPath(string name) =>
|
|
225
|
+
Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, name);
|
|
226
|
+
|
|
227
|
+
private static bool ConsumeMarker(string name)
|
|
206
228
|
{
|
|
207
229
|
try
|
|
208
230
|
{
|
|
209
|
-
var markerPath =
|
|
210
|
-
|
|
211
|
-
"ns-debugbreak");
|
|
212
|
-
if (!System.IO.File.Exists(markerPath))
|
|
231
|
+
var markerPath = MarkerPath(name);
|
|
232
|
+
if (!File.Exists(markerPath))
|
|
213
233
|
return false;
|
|
214
|
-
|
|
234
|
+
File.Delete(markerPath);
|
|
215
235
|
return true;
|
|
216
236
|
}
|
|
217
237
|
catch { return false; }
|
|
218
238
|
}
|
|
239
|
+
|
|
240
|
+
private static void WriteMarker(string name, string contents)
|
|
241
|
+
{
|
|
242
|
+
try { File.WriteAllText(MarkerPath(name), contents); }
|
|
243
|
+
catch (Exception ex)
|
|
244
|
+
{
|
|
245
|
+
System.Diagnostics.Debug.WriteLine($"[NativeScript DevTools] Could not write {name}: {ex.Message}");
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private static void DeleteMarker(string name)
|
|
250
|
+
{
|
|
251
|
+
try { File.Delete(MarkerPath(name)); }
|
|
252
|
+
catch { }
|
|
253
|
+
}
|
|
219
254
|
#endif
|
|
220
255
|
|
|
221
256
|
/// Reads a file that may live inside a sealed app.nsbundle instead of on disk: tries the
|
|
@@ -244,6 +279,15 @@ namespace __PROJECT_NAME__
|
|
|
244
279
|
if (!_initialized)
|
|
245
280
|
throw new InvalidOperationException("Runtime must be initialized before running scripts.");
|
|
246
281
|
|
|
282
|
+
#if DEBUG
|
|
283
|
+
if (_waitForDebugger)
|
|
284
|
+
{
|
|
285
|
+
// --debug-brk: hold the first script until DevTools attaches.
|
|
286
|
+
_waitForDebugger = false;
|
|
287
|
+
if (!runtime_devtools_wait_for_debugger(_runtime, DebuggerWaitTimeoutMs))
|
|
288
|
+
System.Diagnostics.Debug.WriteLine("[NativeScript DevTools] No debugger attached, continuing.");
|
|
289
|
+
}
|
|
290
|
+
#endif
|
|
247
291
|
var entryPath = ResolveEntryScriptPath();
|
|
248
292
|
if (entryPath == null)
|
|
249
293
|
{
|
|
@@ -101,6 +101,17 @@
|
|
|
101
101
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
102
102
|
</Content>
|
|
103
103
|
|
|
104
|
+
<!-- The app's metadata filter (App_Resources/Windows/native-api-usage.json, which the CLI writes
|
|
105
|
+
out next to this project): the runtime reads it next to the exe. -->
|
|
106
|
+
<Content Include="$(NSWindowsRoot)\whitelist.mdg" Condition="Exists('$(NSWindowsRoot)\whitelist.mdg')">
|
|
107
|
+
<Link>whitelist.mdg</Link>
|
|
108
|
+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
109
|
+
</Content>
|
|
110
|
+
<Content Include="$(NSWindowsRoot)\blacklist.mdg" Condition="Exists('$(NSWindowsRoot)\blacklist.mdg')">
|
|
111
|
+
<Link>blacklist.mdg</Link>
|
|
112
|
+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
113
|
+
</Content>
|
|
114
|
+
|
|
104
115
|
<!-- Logo and splash assets required for the packaged desktop app manifest -->
|
|
105
116
|
<Content Include="Assets\**\*" Condition="Exists('Assets')">
|
|
106
117
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
@@ -175,6 +186,12 @@
|
|
|
175
186
|
SkipUnchangedFiles="true" />
|
|
176
187
|
</Target>
|
|
177
188
|
|
|
189
|
+
<!-- A filter the app dropped must not stay in force from an earlier build's copy. -->
|
|
190
|
+
<Target Name="RemoveStaleMetadataFilter" BeforeTargets="CopyFilesToOutputDirectory">
|
|
191
|
+
<Delete Files="$(OutDir)whitelist.mdg" Condition="!Exists('$(NSWindowsRoot)\whitelist.mdg')" />
|
|
192
|
+
<Delete Files="$(OutDir)blacklist.mdg" Condition="!Exists('$(NSWindowsRoot)\blacklist.mdg')" />
|
|
193
|
+
</Target>
|
|
194
|
+
|
|
178
195
|
<!-- Run the Static Binding Generator (sbg) when project contains an sbg entry script
|
|
179
196
|
or when pre-existing metadata is present. Generated proxies will be written
|
|
180
197
|
into $(NSGenDir) and included in compilation. -->
|
|
@@ -193,11 +210,11 @@
|
|
|
193
210
|
Search order: pre-built tools/ binary, then cargo run for dev. -->
|
|
194
211
|
<Exec
|
|
195
212
|
Command=""$(SbgExe)""
|
|
196
|
-
EnvironmentVariables="NSWINRT_AUTO_METADATA_PATH=$(SBGMetadataSource);SBG_OUTPUT_DIR=$(SBG_OUTPUT_DIR);SBG_METADATA_SOURCE=$(SBGMetadataSource);SBG_TARGET_FRAMEWORK=$(TargetFramework);SBG_TARGET_PLATFORM_MIN_VERSION=$(TargetPlatformMinVersion);SBG_USE_UWP=false;SBG_APP_CS_SOURCES_DIR=$(MSBuildProjectDirectory)"
|
|
213
|
+
EnvironmentVariables="NSWINRT_AUTO_METADATA_PATH=$(SBGMetadataSource);SBG_OUTPUT_DIR=$(SBG_OUTPUT_DIR);SBG_METADATA_SOURCE=$(SBGMetadataSource);SBG_TARGET_FRAMEWORK=$(TargetFramework);SBG_TARGET_PLATFORM_MIN_VERSION=$(TargetPlatformMinVersion);SBG_USE_UWP=false;SBG_APP_CS_SOURCES_DIR=$(MSBuildProjectDirectory);SBG_WHITELIST=$(NSWindowsRoot)\whitelist.mdg;SBG_BLACKLIST=$(NSWindowsRoot)\blacklist.mdg"
|
|
197
214
|
Condition="'$(SbgExe)' != '' and Exists('$(SBGMetadataSource)')" />
|
|
198
215
|
<Exec WorkingDirectory="$(WindowsRuntimeRepoRoot)"
|
|
199
216
|
Command="cargo run --quiet --manifest-path "$(WindowsRuntimeRepoRoot)\Cargo.toml" -p sbg"
|
|
200
|
-
EnvironmentVariables="NSWINRT_AUTO_METADATA_PATH=$(SBGMetadataSource);SBG_OUTPUT_DIR=$(SBG_OUTPUT_DIR);SBG_METADATA_SOURCE=$(SBGMetadataSource);SBG_TARGET_FRAMEWORK=$(TargetFramework);SBG_TARGET_PLATFORM_MIN_VERSION=$(TargetPlatformMinVersion);SBG_USE_UWP=false;SBG_APP_CS_SOURCES_DIR=$(MSBuildProjectDirectory)"
|
|
217
|
+
EnvironmentVariables="NSWINRT_AUTO_METADATA_PATH=$(SBGMetadataSource);SBG_OUTPUT_DIR=$(SBG_OUTPUT_DIR);SBG_METADATA_SOURCE=$(SBGMetadataSource);SBG_TARGET_FRAMEWORK=$(TargetFramework);SBG_TARGET_PLATFORM_MIN_VERSION=$(TargetPlatformMinVersion);SBG_USE_UWP=false;SBG_APP_CS_SOURCES_DIR=$(MSBuildProjectDirectory);SBG_WHITELIST=$(NSWindowsRoot)\whitelist.mdg;SBG_BLACKLIST=$(NSWindowsRoot)\blacklist.mdg"
|
|
201
218
|
Condition="'$(SbgExe)' == '' and Exists('$(SBGMetadataSource)') and Exists('$(WindowsRuntimeRepoRoot)\Cargo.toml')" />
|
|
202
219
|
<!-- The proxies are picked up here, after sbg ran: a glob evaluated with the project would
|
|
203
220
|
still compile proxies an earlier run generated for extensions that are gone. -->
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/framework/tools/sbg.exe
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|