Unverified 提交 95390bd8 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

Improvements to the build system (#1245)

上级 6821b55c
...@@ -11,7 +11,6 @@ const IS_WINDOWS = os.platform() === 'win32'; ...@@ -11,7 +11,6 @@ const IS_WINDOWS = os.platform() === 'win32';
const MAYOR_VERSION = PKG.version.split('.')[0]; const MAYOR_VERSION = PKG.version.split('.')[0];
const PYTHON = getPython(); const PYTHON = getPython();
const PIP_INVOKE_DIR = path.resolve('worker/pip_invoke'); const PIP_INVOKE_DIR = path.resolve('worker/pip_invoke');
const INVOKE_VERSION = process.env.INVOKE_VERSION ?? '2.2.0';
const FLATBUFFERS_VERSION = '23.3.3'; const FLATBUFFERS_VERSION = '23.3.3';
const WORKER_RELEASE_DIR = 'worker/out/Release'; const WORKER_RELEASE_DIR = 'worker/out/Release';
const WORKER_RELEASE_BIN = IS_WINDOWS ? 'mediasoup-worker.exe' : 'mediasoup-worker'; const WORKER_RELEASE_BIN = IS_WINDOWS ? 'mediasoup-worker.exe' : 'mediasoup-worker';
...@@ -318,7 +317,8 @@ function installInvoke() ...@@ -318,7 +317,8 @@ function installInvoke()
// Install pip invoke into custom location, so we don't depend on system-wide // Install pip invoke into custom location, so we don't depend on system-wide
// installation. // installation.
executeCmd( executeCmd(
`"${PYTHON}" -m pip install --upgrade --target="${PIP_INVOKE_DIR}" invoke==${INVOKE_VERSION}`, /* exitOnError */ true `"${PYTHON}" -m pip install --upgrade --target="${PIP_INVOKE_DIR}" invoke`,
/* exitOnError */ true
); );
} }
...@@ -331,15 +331,7 @@ function deleteNodeLib() ...@@ -331,15 +331,7 @@ function deleteNodeLib()
logInfo('deleteNodeLib()'); logInfo('deleteNodeLib()');
if (!IS_WINDOWS) fs.rmSync('node/lib', { recursive: true, force: true });
{
executeCmd('rm -rf node/lib');
}
else
{
// NOTE: This command fails in Windows if the dir doesn't exist.
executeCmd('rmdir /s /q "node/lib"', /* exitOnError */ false);
}
} }
function buildTypescript({ force = false } = { force: false }) function buildTypescript({ force = false } = { force: false })
...@@ -584,7 +576,7 @@ async function downloadPrebuiltWorker() ...@@ -584,7 +576,7 @@ async function downloadPrebuiltWorker()
const resolvedBinPath = path.resolve(WORKER_RELEASE_BIN_PATH); const resolvedBinPath = path.resolve(WORKER_RELEASE_BIN_PATH);
execSync( execSync(
resolvedBinPath, `"${resolvedBinPath}"`,
{ {
stdio : [ 'ignore', 'ignore', 'ignore' ], stdio : [ 'ignore', 'ignore', 'ignore' ],
// Ensure no env is passed to avoid accidents. // Ensure no env is passed to avoid accidents.
......
...@@ -21,23 +21,22 @@ ...@@ -21,23 +21,22 @@
"types": "node/lib/index.d.ts", "types": "node/lib/index.d.ts",
"files": [ "files": [
"node/lib", "node/lib",
"worker/src", "worker/deps/libwebrtc",
"worker/include",
"worker/fbs", "worker/fbs",
"worker/test/src",
"worker/test/include",
"worker/fuzzer/src",
"worker/fuzzer/include", "worker/fuzzer/include",
"worker/scripts/*.mjs", "worker/fuzzer/src",
"worker/include",
"worker/src",
"worker/scripts/*.json", "worker/scripts/*.json",
"worker/scripts/*.mjs",
"worker/scripts/*.py", "worker/scripts/*.py",
"worker/scripts/*.sh", "worker/scripts/*.sh",
"worker/subprojects/*.wrap", "worker/subprojects/*.wrap",
"worker/deps/libwebrtc", "worker/test/include",
"worker/tasks.py", "worker/test/src",
"worker/Makefile",
"worker/meson.build", "worker/meson.build",
"worker/meson_options.txt", "worker/meson_options.txt",
"worker/tasks.py",
"npm-scripts.mjs" "npm-scripts.mjs"
], ],
"engines": { "engines": {
......
...@@ -21,9 +21,9 @@ include = [ ...@@ -21,9 +21,9 @@ include = [
"/test/src", "/test/src",
"/build.rs", "/build.rs",
"/Cargo.toml", "/Cargo.toml",
"/Makefile",
"/meson.build", "/meson.build",
"/meson_options.txt", "/meson_options.txt",
"/tasks.py"
] ]
[package.metadata.docs.rs] [package.metadata.docs.rs]
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
PYTHON ?= $(shell command -v python3 2> /dev/null || echo python) PYTHON ?= $(shell command -v python3 2> /dev/null || echo python)
PIP_INVOKE_DIR = $(shell pwd)/pip_invoke PIP_INVOKE_DIR = $(shell pwd)/pip_invoke
INVOKE_VERSION ?= 2.2.0
# Instruct Python where to look for invoke module. # Instruct Python where to look for invoke module.
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
...@@ -48,7 +47,7 @@ invoke: ...@@ -48,7 +47,7 @@ invoke:
ifeq ($(wildcard $(PIP_INVOKE_DIR)),) ifeq ($(wildcard $(PIP_INVOKE_DIR)),)
# Install pip invoke into custom location, so we don't depend on system-wide # Install pip invoke into custom location, so we don't depend on system-wide
# installation. # installation.
$(PYTHON) -m pip install --upgrade --target="$(PIP_INVOKE_DIR)" invoke==$(INVOKE_VERSION) $(PYTHON) -m pip install --upgrade --target="$(PIP_INVOKE_DIR)" invoke
endif endif
meson-ninja: invoke meson-ninja: invoke
......
...@@ -107,10 +107,8 @@ fn main() { ...@@ -107,10 +107,8 @@ fn main() {
// Install Python invoke package in custom folder // Install Python invoke package in custom folder
let pip_invoke_dir = format!("{out_dir}/pip_invoke"); let pip_invoke_dir = format!("{out_dir}/pip_invoke");
let invoke_version = "2.2.0";
let python = env::var("PYTHON").unwrap_or("python3".to_string()); let python = env::var("PYTHON").unwrap_or("python3".to_string());
let mut pythonpath = if env::var("PYTHONPATH").is_ok() { let mut pythonpath = if let Ok(original_pythonpath) = env::var("PYTHONPATH") {
let original_pythonpath = env::var("PYTHONPATH").unwrap();
format!("{pip_invoke_dir}:{original_pythonpath}") format!("{pip_invoke_dir}:{original_pythonpath}")
} else { } else {
pip_invoke_dir.clone() pip_invoke_dir.clone()
...@@ -126,8 +124,9 @@ fn main() { ...@@ -126,8 +124,9 @@ fn main() {
.arg("pip") .arg("pip")
.arg("install") .arg("install")
.arg("--upgrade") .arg("--upgrade")
.arg(format!("--target={pip_invoke_dir}")) .arg("--target")
.arg(format!("invoke=={invoke_version}")) .arg(pip_invoke_dir)
.arg("invoke")
.spawn() .spawn()
.expect("Failed to start") .expect("Failed to start")
.wait() .wait()
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论