Skip to content

Commit 61d503f

Browse files
committed
merging changes from macos branch
1 parent a561357 commit 61d503f

28 files changed

+119
-30
lines changed

.github/actions/build/action.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ runs:
1818
- name: Build ${{ inputs.arch }}
1919
shell: pwsh
2020
run: |
21-
node-gyp configure --target=${{ inputs.node }} --runtime=node --release --arch=${{ inputs.arch }}
21+
22+
node-gyp configure --target=${{ inputs.node }} --runtime=node --release --arch=${{ inputs.arch }}
2223
2324
if ( '${{ inputs.arch }}' -eq 'arm64' -And '${{ runner.os }}' -eq 'Windows'){
2425
(Get-Content -Raw build/build_managed.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/build_managed.vcxproj
@@ -27,12 +28,17 @@ runs:
2728
}
2829
2930
node-gyp build
31+
3032
if ( '${{ runner.os }}' -eq 'Windows'){
3133
cmd /c copy /y build\Release\edge_*.node release\win32\${{ inputs.arch }}\${{ inputs.node-major }}
3234
cmd /c rmdir /S /Q build
3335
}
3436
3537
if ( '${{ runner.os }}' -eq 'macOS'){
38+
Get-ChildItem -Path build/Release
3639
Copy-Item "build/Release/edge_coreclr.node" -Destination "release/darwin/${{ inputs.arch }}/${{ inputs.node-major }}"
40+
Copy-Item "build/Release/edge_nativeclr.node" -Destination "release/darwin/${{ inputs.arch }}/${{ inputs.node-major }}"
41+
Copy-Item "build/Release/MonoEmbedding.exe" -Destination "release/darwin/${{ inputs.arch }}/${{ inputs.node-major }}"
42+
3743
node-gyp clean
3844
}

.github/actions/setup-env/action.yml

+21-9
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ runs:
2828
path: ~/.cache/node-gyp
2929
key: '${{ inputs.os }}-${{ inputs.node}}'
3030

31-
# - name: Cache node-gyp macOs
32-
# if: runner.os == 'macOS'
33-
# uses: actions/cache@v4
34-
# env:
35-
# cache-name: cache-node-gyp
36-
# with:
37-
# path: ~/Library/Caches/node-gyp
38-
# key: '${{ inputs.os }}-${{ inputs.node}}'
39-
31+
- name: Cache node-gyp macOs
32+
if: runner.os == 'macOS'
33+
uses: actions/cache@v4
34+
env:
35+
cache-name: cache-node-gyp
36+
with:
37+
path: ~/Library/Caches/node-gyp
38+
key: '${{ inputs.os }}-${{ inputs.node}}'
4039

4140
- name: Cache node modules
4241
id: cache-nodemodules
@@ -52,6 +51,19 @@ runs:
5251
with:
5352
dotnet-version: '8.0.x' # SDK Version to use; x will use the latest version of the 8.0 channel
5453

54+
- name: Setup Mono
55+
if: inputs.os == 'macos-14' || inputs.os == 'macos-15'
56+
shell: bash
57+
run: |
58+
brew install mono --overwrite
59+
brew reinstall pkg-config
60+
61+
- name: Setup Mono
62+
if: runner.os == 'Linux'
63+
shell: bash
64+
run: |
65+
sudo apt -q install mono-complete pkg-config
66+
5567
- name: Versions
5668
shell: bash
5769
run: |

.github/actions/test-build/action.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ runs:
6969
try {
7070
const fs = require('fs')
7171
fs.copyFileSync('release/darwin-edge-js-${{ inputs.node }}/darwin/x64/${{ inputs.node }}/edge_coreclr.node', 'lib/native/darwin/x64/${{ inputs.node }}/edge_coreclr.node');
72+
fs.copyFileSync('release/darwin-edge-js-${{ inputs.node }}/darwin/x64/${{ inputs.node }}/edge_nativeclr.node', 'lib/native/darwin/x64/${{ inputs.node }}/edge_nativeclr.node');
73+
fs.copyFileSync('release/darwin-edge-js-${{ inputs.node }}/darwin/x64/${{ inputs.node }}/MonoEmbedding.exe', 'lib/native/darwin/x64/${{ inputs.node }}/MonoEmbedding.exe');
7274
fs.copyFileSync('release/darwin-edge-js-${{ inputs.node }}/darwin/arm64/${{ inputs.node }}/edge_coreclr.node', 'lib/native/darwin/arm64/${{ inputs.node }}/edge_coreclr.node');
75+
fs.copyFileSync('release/darwin-edge-js-${{ inputs.node }}/darwin/arm64/${{ inputs.node }}/edge_nativeclr.node', 'lib/native/darwin/arm64/${{ inputs.node }}/edge_nativeclr.node');
76+
fs.copyFileSync('release/darwin-edge-js-${{ inputs.node }}/darwin/arm64/${{ inputs.node }}/MonoEmbedding.exe', 'lib/native/darwin/arm64/${{ inputs.node }}/MonoEmbedding.exe');
7377
} catch(err) {
7478
core.error("Error creating release directory")
7579
core.setFailed(err)
@@ -93,12 +97,12 @@ runs:
9397
if: runner.os == 'macOS'
9498
uses: andstor/file-existence-action@v3
9599
with:
96-
files: "lib/native/darwin/${{ runner.arch }}/${{ inputs.node }}/edge_coreclr.node"
100+
files: "lib/native/darwin/${{ runner.arch }}/${{ inputs.node }}/edge_coreclr.node, lib/native/darwin/${{ runner.arch }}/${{ inputs.node }}/edge_nativeclr.node"
97101
fail: true
98102
ignore_case: true
99103

100104
- name: Run .NET 4.5 tests
101-
if: runner.os == 'Windows'
105+
if: inputs.os != 'macos-13'
102106
shell: bash
103107
run: node tools/test.js CI
104108

.github/workflows/main.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,12 @@ jobs:
9898
node: ${{ matrix.node }}
9999
os: ${{ matrix.os }}
100100

101-
# - if: runner.os == 'macOS' && matrix.node == '16.x'
102-
# name: Add missing packages for macOS NodeJs 16
103-
# run: |
104-
# pip install setuptools
105-
106-
- if: runner.os == 'Windows'
107-
name: Run .NET 4.5 tests
101+
- name: Run .NET 4.5 tests
102+
if: matrix.os != 'macos-13'
108103
shell: bash
109104
run: node tools/test.js CI
110105

111-
- if: runner.os == 'macOS' || runner.os == 'Linux'
112-
name: "Run .net core tests"
106+
- name: "Run .net core tests"
113107
run: node tools/test.js CI
114108
env:
115109
EDGE_USE_CORECLR: 1

binding.gyp

+68-1
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,51 @@
199199
'src/common/callbackhelper.cpp',
200200
'src/common/edge.cpp'
201201
]
202+
},
203+
{
204+
'conditions': [
205+
[
206+
'"<!((which mono 2>/dev/null) || echo not_found)"!="not_found"',
207+
{
208+
'conditions': [
209+
[
210+
'"<!((pkg-config mono-2 --libs 2>/dev/null) || echo not_found)"!="not_found"',
211+
{
212+
'sources+': [
213+
'src/mono/clractioncontext.cpp',
214+
'src/mono/clrfunc.cpp',
215+
'src/mono/clrfuncinvokecontext.cpp',
216+
'src/mono/monoembedding.cpp',
217+
'src/mono/task.cpp',
218+
'src/mono/dictionary.cpp',
219+
'src/mono/nodejsfunc.cpp',
220+
'src/mono/nodejsfuncinvokecontext.cpp',
221+
'src/mono/utils.cpp',
222+
'src/common/utils.cpp',
223+
'src/common/v8synchronizationcontext.cpp',
224+
'src/common/callbackhelper.cpp',
225+
'src/common/edge.cpp'
226+
],
227+
228+
'include_dirs': [
229+
'<!@(pkg-config mono-2 --cflags-only-I | sed s/-I//g)',
230+
'<!@(pkg-config glib-2.0 --cflags-only-I | sed s/-I//g)',
231+
],
232+
'link_settings': {
233+
'libraries': [
234+
'<!@(pkg-config mono-2 --libs)'
235+
]
236+
}
237+
}
238+
]
239+
],
240+
},
241+
{
242+
'type': 'none'
243+
}
244+
]
245+
]
202246
}
203-
204247
]
205248
],
206249
'configurations': {
@@ -270,6 +313,30 @@
270313
},
271314
{
272315
'conditions': [
316+
[
317+
'"<!((which mono 2>/dev/null) || echo not_found)"!="not_found"',
318+
{
319+
'actions+': [
320+
{
321+
'action_name': 'compile_mono_embed',
322+
'inputs': [
323+
'src/mono/*.cs'
324+
],
325+
'outputs': [
326+
'build/$(BUILDTYPE)/monoembedding.exe'
327+
],
328+
'action': [
329+
'mcs',
330+
'-sdk:4.5',
331+
'-target:exe',
332+
'-out:build/$(BUILDTYPE)/MonoEmbedding.exe',
333+
'src/mono/*.cs',
334+
'src/common/*.cs'
335+
]
336+
}
337+
]
338+
}
339+
],
273340
[
274341
'"<!((which dotnet 2>/dev/null) || echo not_found)"!="not_found"',
275342
{

lib/edge.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ else if (process.platform === 'win32') {
2828
edgeNative = path.resolve(__dirname, './native/' + process.platform + '/' + process.arch + '/' + determineVersion() + '/' + (process.env.EDGE_USE_CORECLR ? 'edge_coreclr' : 'edge_nativeclr'));
2929
}
3030
else if(process.platform === 'darwin'){
31-
edgeNative = path.resolve(__dirname, './native/' + process.platform + '/' + process.arch + '/' + nodeVersion + '/' + 'edge_coreclr.node');
31+
edgeNative = path.resolve(__dirname, './native/' + process.platform + '/' + process.arch + '/' + nodeVersion + '/' + (process.env.EDGE_USE_CORECLR ? 'edge_coreclr.node' : 'edge_nativeclr.node'));
3232
if(!fs.existsSync(edgeNative)){
3333
edgeNative = builtEdge;
3434
if(!fs.existsSync(edgeNative)){
9.5 KB
Binary file not shown.
103 KB
Binary file not shown.
9.5 KB
Binary file not shown.
103 KB
Binary file not shown.
9.5 KB
Binary file not shown.
103 KB
Binary file not shown.
9.5 KB
Binary file not shown.
103 KB
Binary file not shown.
9.5 KB
Binary file not shown.
119 KB
Binary file not shown.
9.5 KB
Binary file not shown.
77.6 KB
Binary file not shown.
9.5 KB
Binary file not shown.
81.9 KB
Binary file not shown.
9.5 KB
Binary file not shown.
81.8 KB
Binary file not shown.
9.5 KB
Binary file not shown.
81.7 KB
Binary file not shown.
9.5 KB
Binary file not shown.
81.9 KB
Binary file not shown.

tools/install.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,12 @@ else {
9090
if(process.platform === 'darwin'){
9191

9292
const nodeVersion = process.versions.node.split(".")[0]
93-
const edjeNative = path.resolve(__dirname, '../lib/native/' + process.platform + '/' + process.arch + '/' + nodeVersion + '/' + 'edge_coreclr.node');
93+
const edjeNative = path.resolve(__dirname, '../lib/native/' + process.platform + '/' + process.arch + '/' + nodeVersion + '/' + 'edge_nativeclr.node');
94+
const edjeNativeClr = path.resolve(__dirname, '../lib/native/' + process.platform + '/' + process.arch + '/' + nodeVersion + '/' + 'edge_coreclr.node');
9495

95-
if(fs.existsSync(edjeNative)){
96+
if(fs.existsSync(edjeNative) && fs.existsSync(edjeNativeClr)){
9697
spawn('dotnet', ['build', '--configuration', 'Release'], { stdio: 'inherit', cwd: path.resolve(__dirname, '..', 'lib', 'bootstrap') })
97-
.on('close', function() {
98-
require('./checkplatform');
99-
});
98+
10099
}
101100
else{
102101
spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });

tools/test.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ const marge = require('mochawesome-report-generator')
1212

1313
var runner = process.argv[2];
1414

15-
if (process.platform !== 'win32') {
16-
process.env.EDGE_USE_CORECLR = 1
15+
// if (process.platform !== 'win32') {
16+
// process.env.EDGE_USE_CORECLR = 1
17+
// }
18+
19+
if(process.platform === 'linux' && !process.env.EDGE_USE_CORECLR){
20+
Object.assign(process.env, {
21+
// Work around Mono problem: undefined symbol: mono_add_internal_call_with_flags
22+
LD_PRELOAD: 'libmono-2.0.so libmonosgen-2.0.so libstdc++.so.6',
23+
});
1724
}
1825

1926
if(process.argv[3] === 'coreclr'){

0 commit comments

Comments
 (0)