diff --git a/build-tools/declgen.js b/build-tools/declgen.js index f80f42a746630b1d749693bc1d02618c89046f5f..396c383e1f847cc8fae5a119a96ed5efb8ac9598 100644 --- a/build-tools/declgen.js +++ b/build-tools/declgen.js @@ -103,11 +103,11 @@ function getResolveModule(dirPath, moduleName, extensions) { const filePath = path.join(dirPath, fileName + extension); resolvedModuleFull.resolvedFileName = filePath; resolvedModuleFull.extension = extension; + if (!fs.existsSync(filePath)) { + continue; + } break; } - if (resolvedModuleFull.resolvedFileName === '') { - return undefined; - } return resolvedModuleFull; } diff --git a/compile_ets_ts.py b/compile_ets_ts.py index 1d368e7f78c8961a1e7b2599fc5fcbd0456c1481..f2c8772ab4d0df7f00c2aeac7345c23f66b1f173 100755 --- a/compile_ets_ts.py +++ b/compile_ets_ts.py @@ -120,7 +120,6 @@ def run_compile_ets_ts(tool_dir: str, node_path: str, config_json_path: str, out panda_path = os.path.join(tool_dir, "build-tools/ets2panda/lib") # 执行的js路径 tool_path = os.path.join(tool_dir, "build-tools/driver/build-system/dist/entry.js") - json_path = Path(config_json_path).resolve() node_path = os.path.abspath(node_path) env = os.environ.copy() env["LD_LIBRARY_PATH"] = str(panda_path) @@ -129,14 +128,13 @@ def run_compile_ets_ts(tool_dir: str, node_path: str, config_json_path: str, out interop_path_bridge = os.path.join(out_interop_path, "ets1.2interop/bridge") os.makedirs(interop_path_declaration, exist_ok=True) os.makedirs(interop_path_bridge, exist_ok=True) - cmd = [node_path, tool_path, json_path] + cmd = [node_path, tool_path, config_json_path] result = subprocess.run(cmd, env=env, check=True, cwd=tool_dir, text=True, capture_output=True) with open(os.path.abspath(os.path.join(out_interop_path, INTEROP_NAME, "interop_tool.log")), 'w', encoding='utf-8') as f: f.write("=== Output from interop1.2 tool ===\n") f.write(result.stdout) print(f"run_compile_ets_ts success: {result.returncode}") except subprocess.CalledProcessError as e: - subprocess.run(cmd, env=env, check=True, cwd=tool_dir, text=True, capture_output=True) print(f"run_compile_ets_ts error: {e.returncode}") print("run_compile_ets_ts:", e.stderr) except Exception as e: