OpenHarmony Arkts编译工具链开发

编译typescript

准备鸿蒙全套代码,进入third_party/typescript/目录,执行如下命令:

npm install -g gulp
npm install
npm run gulp LKG
npm pack
cp *.tgz build_package/

拷贝到typescript代码目录下的build_package目录。

编译工具链

npm install
npm run build
npm run compile

默认编译的工程为compiler目录下sample工程。

ArkTs编译流程

以一个文件编译为例。为了更好更快搞清楚ArkTs编译过程中如何进行特殊的语法校验支持,通过VsCode断点编译单个文件的流程。在设置断点Debug之前,我们需要做如下前置准备:

  • 去掉ArkTs compiler工程中的uglify配置,修改为如下配置:
      "scripts": {
         
       "lint": "eslint --fix ./src --ext .ts",
       "build": "./node_modules/.bin/babel ./src --out-dir lib --extensions .ts",
       "create": "node ./lib/create.js --env projectName",
       "compile": "npm run build && webpack --config webpack.config.js --env buildMode=debug projectName",
       "test": "npm run build && mocha -r mocha-context/register test/test.js && mocha -r mocha-context/register test/test.js --partialUpdate",
       "generateDeclarations": "node ./build_declarations_file.js ../../../interface/sdk-js/api/@internal/component/ets ./declarations ./lib",
       "postinstall": "node npm-install.js",
       "fastbuild": "rollup -c rollup.config.js"
     },
    
  • 添加调试配置
    在这里插入图片描述
  • 设置断点
    在这里插入图片描述
  • 开始调试
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值