Skip to content

Commit 698eb92

Browse files
authored
Merge pull request #164 from agracio/standalone-fix
Standalone fix
2 parents a02c010 + 0074af3 commit 698eb92

31 files changed

+108
-65
lines changed

.github/workflows/build.yml

+26-25
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ on:
66
build-version:
77
description: 'Electron version to build'
88
required: true
9-
default: '30.0.0'
9+
default: '30'
1010
type: choice
1111
options:
12-
- 29.0.0
13-
- 30.0.0
14-
- 31.0.0
15-
- 32.0.0
16-
- 33.0.0
12+
- 29
13+
- 30
14+
- 31
15+
- 32
1716
# test-version:
1817
# description: 'Electron version to test build'
1918
# required: true
@@ -51,20 +50,22 @@ jobs:
5150
id: electron-test-version
5251
shell: bash
5352
run: |
54-
if [[ ${{ inputs.build-version }} == '29.0.0' ]]; then
53+
if [[ ${{ inputs.build-version }} == '29' ]]; then
5554
echo "test-version=29.4.6" >> $GITHUB_OUTPUT
56-
elif [[ ${{ inputs.build-version }} == '30.0.0' ]]; then
55+
elif [[ ${{ inputs.build-version }} == '30' ]]; then
5756
echo "test-version=30.5.1" >> $GITHUB_OUTPUT
58-
elif [[ ${{ inputs.build-version }} == '31.0.0' ]]; then
57+
elif [[ ${{ inputs.build-version }} == '31' ]]; then
5958
echo "test-version=31.6.0" >> $GITHUB_OUTPUT
60-
elif [[ ${{ inputs.build-version }} == '32.0.0' ]]; then
61-
echo "test-version=32.1.2" >> $GITHUB_OUTPUT
59+
elif [[ ${{ inputs.build-version }} == '32' ]]; then
60+
echo "test-version=32.2.0" >> $GITHUB_OUTPUT
61+
elif [[ ${{ inputs.build-version }} == '33' ]]; then
62+
echo "test-version=33.0.0" >> $GITHUB_OUTPUT
6263
fi
6364
6465
- name: Setup env
6566
uses: ./.github/actions/setup-env
6667
with:
67-
electron: ${{ inputs.build-version }}
68+
electron: '${{ inputs.build-version }}.0.0'
6869
os: ${{ matrix.os }}
6970

7071
- name: install node-gyp
@@ -73,68 +74,68 @@ jobs:
7374

7475
- name: Create release folder
7576
run: |
76-
mkdir "release\ia32\${{ inputs.build-version }}"
77-
mkdir "release\x64\${{ inputs.build-version }}"
78-
mkdir "release\arm64\${{ inputs.build-version }}"
77+
mkdir "release\ia32\${{ inputs.build-version }}.0.0"
78+
mkdir "release\x64\${{ inputs.build-version }}.0.0"
79+
mkdir "release\arm64\${{ inputs.build-version }}.0.0"
7980
8081
- name: Build ia32
8182
timeout-minutes: 30
8283
shell: pwsh
8384
run: |
84-
node-gyp configure --target=${{ inputs.build-version }} --disturl=https://electronjs.org/headers --runtime=electron --release --arch=ia32
85+
node-gyp configure --target=${{ inputs.build-version }}.0.0 --disturl=https://electronjs.org/headers --runtime=electron --release --arch=ia32
8586
86-
if ( '${{ inputs.build-version }}' -eq '32.0.0'){
87+
if ( '${{ inputs.build-version }}' -ge 32){
8788
(Get-Content -Raw build/build_managed.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/build_managed.vcxproj
8889
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
8990
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
9091
}
9192
9293
node-gyp build
93-
cmd /c copy /y build\Release\edge_*.node release\ia32\${{ inputs.build-version }}
94+
cmd /c copy /y build\Release\edge_*.node release\ia32\${{ inputs.build-version }}.0.0
9495
cmd /c rmdir /S /Q build
9596
9697
- name: Build x64
9798
timeout-minutes: 30
9899
shell: pwsh
99100
run: |
100-
node-gyp configure --target=${{ inputs.build-version }} --disturl=https://electronjs.org/headers --runtime=electron --release --arch=x64
101+
node-gyp configure --target=${{ inputs.build-version }}.0.0 --disturl=https://electronjs.org/headers --runtime=electron --release --arch=x64
101102
102-
if ( '${{ inputs.build-version }}' -eq '32.0.0'){
103+
if ( '${{ inputs.build-version }}' -ge 32){
103104
(Get-Content -Raw build/build_managed.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/build_managed.vcxproj
104105
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
105106
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
106107
}
107108
108109
node-gyp build
109-
cmd /c copy /y build\Release\edge_*.node release\x64\${{ inputs.build-version }}
110+
cmd /c copy /y build\Release\edge_*.node release\x64\${{ inputs.build-version }}.0.0
110111
cmd /c rmdir /S /Q build
111112
112113
- name: Build arm64
113114
timeout-minutes: 30
114115
shell: pwsh
115116
run: |
116-
node-gyp configure --target=${{ inputs.build-version }} --disturl=https://electronjs.org/headers --runtime=electron --release --arch=arm64
117+
node-gyp configure --target=${{ inputs.build-version }}.0.0 --disturl=https://electronjs.org/headers --runtime=electron --release --arch=arm64
117118
118119
(Get-Content -Raw build/build_managed.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/build_managed.vcxproj
119120
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
120121
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
121122
122-
if ( '${{ inputs.build-version }}' -eq '32.0.0'){
123+
if ( '${{ inputs.build-version }}' -ge 32){
123124
(Get-Content -Raw build/build_managed.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/build_managed.vcxproj
124125
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
125126
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
126127
}
127128
128129
node-gyp build
129-
cmd /c copy /y build\Release\edge_*.node release\arm64\${{ inputs.build-version }}
130+
cmd /c copy /y build\Release\edge_*.node release\arm64\${{ inputs.build-version }}.0.0
130131
cmd /c rmdir /S /Q build
131132
132133
133134
- name: Upload artifacts
134135
uses: actions/upload-artifact@v4
135136
if: success()
136137
with:
137-
name: electron-edge-js-${{ inputs.build-version }}
138+
name: electron-edge-js-${{ inputs.build-version }}.0.0
138139
path: |
139140
release
140141

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
os: [macos-13, macos-14, ubuntu-22.04, windows-2022]
4646
# os: [ macos-14, ubuntu-22.04]
4747
# electron: [32.1.2]
48-
electron: [29.4.6, 30.5.1, 31.6.0, 32.1.2]
48+
electron: [29.4.6, 30.5.1, 31.6.0, 32.2.0]
4949
# electron: [31.6.0, 32.1.0]
5050

5151
name: test-${{ matrix.os }}-v${{ matrix.electron }}
-1.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
-1.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
-1.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
2.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
1.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.

package-lock.json

+9-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dependencies": {
4444
"edge-cs": "npm:@agracio/edge-cs@^1.3.7",
4545
"follow-redirects": "^1.15.9",
46-
"nan": "git://github.com/oc-soft/npm-nan"
46+
"nan": "^2.22.0"
4747
},
4848
"devDependencies": {
4949
"electron": "^32.0.0",

src/CoreCLREmbedding/coreclrembedding.cpp

+44-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
#include <libproc.h>
3232
#endif
3333

34+
// Special entry for coreclr path
35+
pal::string_t m_coreclr_standalone_path;
36+
37+
// Special entry for JIT path
38+
pal::string_t m_clrjit_standalone_path;
39+
3440
GetFuncFunction getFunc;
3541
CallFuncFunction callFunc;
3642
ContinueTaskFunction continueTask;
@@ -177,6 +183,25 @@ pal::string_t GetOSVersion()
177183
#endif
178184
}
179185

186+
void init_known_entry_path(const pal::string_t& edgeAppDir)
187+
{
188+
trace::info(_X("CoreClrEmbedding::Initialize - Resolving CoreCLR and CLRJit for standalone"));
189+
pal::string_t coreclr(edgeAppDir);
190+
append_path(&coreclr, LIBCORECLR_NAME);
191+
if(pal::file_exists(coreclr))
192+
{
193+
trace::info(_X("CoreClrEmbedding::Initialize - Resolved CoreCLR to %s"), coreclr.c_str());
194+
m_coreclr_standalone_path = coreclr;
195+
}
196+
pal::string_t clrjit(edgeAppDir);
197+
append_path(&clrjit, LIBCLRJIT_NAME);
198+
if(pal::file_exists(clrjit))
199+
{
200+
trace::info(_X("CoreClrEmbedding::Initialize - Resolved CLRJit to %s"), clrjit.c_str());
201+
m_clrjit_standalone_path = clrjit;
202+
}
203+
}
204+
180205
HRESULT CoreClrEmbedding::Initialize(BOOL debugMode)
181206
{
182207
trace::setup();
@@ -338,13 +363,14 @@ HRESULT CoreClrEmbedding::Initialize(BOOL debugMode)
338363

339364
if (mode != host_mode_t::standalone && dotnetExecutablePath.empty())
340365
{
341-
throwV8Exception("This is not a published, standalone application and we are unable to locate the .NET Core SDK. Please make sure that it is installed; see http://microsoft.com/net/core for more details.");
366+
throwV8Exception("This is not a published, standalone application and we are unable to locate the .NET Core SDK. Please make sure that it is installed; see https://microsoft.com/net/core for more details.");
342367
}
343368

344369
pal::string_t configFile, devConfigFile, sdkPath;
345370

346371
if (mode != host_mode_t::standalone)
347372
{
373+
trace::verbose(_X("CoreClrEmbedding::Initialize - host mode: muxer"));
348374
pal::string_t sdkDirectory;
349375

350376
fx_muxer_t::resolve_sdk_dotnet_path(dotnetDirectory, &sdkDirectory);
@@ -357,6 +383,8 @@ HRESULT CoreClrEmbedding::Initialize(BOOL debugMode)
357383

358384
else
359385
{
386+
trace::verbose(_X("CoreClrEmbedding::Initialize - host mode: standalone"));
387+
init_known_entry_path(edgeAppDir);
360388
get_runtime_config_paths_from_app(entryPointAssembly, &configFile, &devConfigFile);
361389
}
362390

@@ -446,14 +474,26 @@ HRESULT CoreClrEmbedding::Initialize(BOOL debugMode)
446474
return StatusCode::ResolverResolveFailure;
447475
}
448476

449-
pal::string_t clr_path = probe_paths.coreclr;
477+
pal::string_t clr_path;
478+
pal::string_t clrjit_path;
479+
480+
if (mode != host_mode_t::standalone)
481+
{
482+
clr_path = probe_paths.coreclr;
483+
clrjit_path = probe_paths.clrjit;
484+
}
485+
else
486+
{
487+
clr_path = m_coreclr_standalone_path;
488+
clrjit_path = m_clrjit_standalone_path;
489+
}
490+
450491
if (clr_path.empty() || !pal::realpath(&clr_path))
451492
{
452-
trace::error(_X("CoreClrEmbedding::Initialize - Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1"));;
493+
trace::error(_X("CoreClrEmbedding::Initialize - Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1"));
453494
return StatusCode::CoreClrResolveFailure;
454495
}
455496

456-
pal::string_t clrjit_path = probe_paths.clrjit;
457497
if (clrjit_path.empty())
458498
{
459499
trace::warning(_X("CoreClrEmbedding::Initialize - Could not resolve CLRJit path"));

0 commit comments

Comments
 (0)