Skip to content

Commit

Permalink
workerChannel: add into node/src
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed May 21, 2024
1 parent 1b248e8 commit f437881
Showing 10 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion node/src/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as os from 'node:os';
import { info, warn } from 'node:console';
import * as flatbuffers from 'flatbuffers';
import { WorkerChannel } from '../workerChannel/src';
import { WorkerChannel } from './workerChannel/src';
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './enhancedEvents';
import { InvalidStateError } from './errors';
2 changes: 1 addition & 1 deletion node/src/Worker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as process from 'node:process';
import * as path from 'node:path';
import { WorkerChannel } from '../workerChannel/src';
import { WorkerChannel } from './workerChannel/src';
import { version } from './';
import { Logger } from './Logger';
import { EnhancedEventEmitter } from './enhancedEvents';
Original file line number Diff line number Diff line change
@@ -14,12 +14,12 @@
'cflags_cc!': [ '-fno-exceptions' ],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")",
"<(module_root_dir)/../../worker/include",
"<(module_root_dir)/../../../worker/include",
],
'conditions': [
['mediasoup_worker_lib==""', {
'libraries': [
'<(module_root_dir)/../../worker/out/<(mediasoup_build_type)/build/libmediasoup-worker.a'
'<(module_root_dir)/../../../worker/out/<(mediasoup_build_type)/build/libmediasoup-worker.a'
],
}, {
"libraries": [
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventEmitter } from 'events';
import { EnhancedEventEmitter } from '../../src/enhancedEvents';
import { EnhancedEventEmitter } from '../../enhancedEvents';

const buildType = process.env.MEDIASOUP_BUILDTYPE ?? 'Release';

File renamed without changes.
File renamed without changes.
17 changes: 16 additions & 1 deletion npm-scripts.mjs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ const WORKER_RELEASE_BIN_PATH = `${WORKER_RELEASE_DIR}/${WORKER_RELEASE_BIN}`;
const WORKER_PREBUILD_DIR = 'worker/prebuild';
const WORKER_PREBUILD_TAR = getWorkerPrebuildTarName();
const WORKER_PREBUILD_TAR_PATH = `${WORKER_PREBUILD_DIR}/${WORKER_PREBUILD_TAR}`;
const WORKER_CHANNEL_ADDON_PATH = 'node/workerChannel';
const WORKER_CHANNEL_ADDON_PATH = 'node/src/workerChannel';
const GH_OWNER = 'versatica';
const GH_REPO = 'mediasoup';

@@ -334,6 +334,8 @@ function buildTypescript({ force = false } = { force: false }) {

deleteNodeLib();
executeCmd('tsc --project node');

copyAddon();
}

function buildWorker() {
@@ -354,6 +356,19 @@ function buildWorkerLib() {
executeCmd(
`cd ${WORKER_CHANNEL_ADDON_PATH} && node scripts.mjs binding:build`
);

copyAddon();
}

function copyAddon() {
const buildType = process.env.MEDIASOUP_BUILDTYPE || 'Release';
const outDir = `node/lib/workerChannel/build/${buildType}`;

ensureDir(outDir);

fs.cpSync(`${WORKER_CHANNEL_ADDON_PATH}/build/${buildType}`, outDir, {
recursive: true,
});
}

function cleanWorkerArtifacts() {

0 comments on commit f437881

Please sign in to comment.