插件里怎样调用构建呢?

如何在插件中调用构建命令呢,有这样的api吗,谢谢
之前的也没有人回复https://forum.cocos.org/t/topic/109882

改一下下面代码中的参数就行

let param = {
  "android": {
    "packageName": "org.cocos2d.demo"
  },
  "android-instant": {
    "REMOTE_SERVER_ROOT": "",
    "host": "",
    "packageName": "org.cocos2d.demo",
    "pathPattern": "",
    "recordPath": "",
    "scheme": "https",
    "skipRecord": false
  },
  "appBundle": false,
  "encryptJs": true,
  "excludeScenes": [],
  "fb-instant-games": {},
  "includeSDKBox": false,
  "inlineSpriteFrames": true,
  "inlineSpriteFrames_native": true,
  "ios": {
    "packageName": "org.cocos2d.demo"
  },
  "mac": {
    "packageName": "org.cocos2d.demo"
  },
  "md5Cache": true,
  "mergeStartScene": false,
  "optimizeHotUpdate": false,
  "orientation": {
    "landscapeLeft": true,
    "landscapeRight": true,
    "portrait": false,
    "upsideDown": false
  },
  "packageName": "org.cocos2d.demo",
  "startScene": "89f287d9-9020-4b89-bdfc-27f6ac486962",
  "title": "NewProject234",
  "webOrientation": "auto",
  "win32": {},
  "xxteaKey": "19de9489-ec8f-41",
  "zipCompressJs": true,
  "actualPlatform": "web-mobile",
  "apiLevel": "",
  "appABIs": [],
  "buildPath": "/Users/timo/Downloads/NewProject234/build",
  "buildScriptsOnly": false,
  "debug": false,
  "embedWebDebugger": false,
  "keystoreAlias": "",
  "keystoreAliasPassword": "",
  "keystorePassword": "",
  "keystorePath": "",
  "platform": "web-mobile",
  "previewHeight": "720",
  "previewWidth": "1280",
  "sourceMaps": false,
  "template": "link",
  "useDebugKeystore": true,
  "vsVersion": "auto",
  "dest": "/Users/timo/Downloads/NewProject234/build/web-mobile",
  "scenes": ["89f287d9-9020-4b89-bdfc-27f6ac486962"],
  "excludedModules": ["3D Physics/Builtin"]
}

Editor.Ipc.sendToMain('builder:start-task', 'build', param)

:+1:厉害了 我试下 谢谢

请问这个是从哪里查看的呢

在控制台拦截"Editor.Ipc.sendToMain"函数,打印就好了

Editor.Ipc.sendToMain = (function (orgFunc) {
  return function (...args) {
    console.log('send to main', ...args);
    return orgFunc(...args);
  }
})(Editor.Ipc.sendToMain);

:+1:好嘞


大佬你好,我先获取了构建选项信息,然后开始构建,但是打印出来是更新系统进度,就卡在那不知道怎么回事?

这个是build的进度,多等会儿试试

耗时应该和你在界面中手动操作是一样的

我之前试过是可以的

一直是0的话,检查一下参数是不是有问题

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。