diff --git a/docs/ts/DEVELOP_ZH.md b/docs/ts/DEVELOP_ZH.md index 9d7786c5..d4a74519 100755 --- a/docs/ts/DEVELOP_ZH.md +++ b/docs/ts/DEVELOP_ZH.md @@ -136,4 +136,4 @@ ts工具框架由C++语法解释器和代码生成器两部分组成。C++语法 具体的插件开发步骤,可以左键单击以下链接了解: -[IntelliJ插件开发说明](https://gitee.com/openharmony/napi_generator/blob/master/napi_IntelliJ_plugin/docs/ts/DEVELOP_ZH.md) \ No newline at end of file +[IntelliJ插件开发说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/ts/ts_IntelliJ_plugin/docs/ts/DEVELOP_ZH.md) \ No newline at end of file diff --git a/docs/ts/INSTRUCTION_ZH.md b/docs/ts/INSTRUCTION_ZH.md index 4aece1d5..cec5208c 100755 --- a/docs/ts/INSTRUCTION_ZH.md +++ b/docs/ts/INSTRUCTION_ZH.md @@ -95,4 +95,4 @@ Ts接口生成工具支持两种入口,分别是可执行程序、IntelliJ插 具体的插件使用步骤,可以左键单击以下链接了解: -[IntelliJ插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/napi_IntelliJ_plugin/docs/ts/INSTRUCTION_ZH.md) +[IntelliJ插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_IntelliJ_plugin/docs/ts/INSTRUCTION_ZH.md) diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md b/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md index 43273c48..3346f0a0 100644 --- a/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md +++ b/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md @@ -39,7 +39,7 @@ ASSIST统一入口工具,可以将各北向工具统一起来,用户只需 具体的工具使用步骤,可以左键单击以下链接了解: -[工具使用说明](暂无) +[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md) ## 开发说明 @@ -55,7 +55,7 @@ ASSIST统一入口工具,可以将各北向工具统一起来,用户只需 开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发: - [工具开发说明](暂无) + [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md) ## 相关仓 diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md b/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md new file mode 100644 index 00000000..8a64b83f --- /dev/null +++ b/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md @@ -0,0 +1,59 @@ +# ASSIST_TOOLS工具IntelliJ插件开发说明 + +若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的IntelliJ插件。 + +## IntelliJ插件打包说明 + +### 环境说明 + +系统:建议Windows 10 + +### 开发步骤 + +#### 环境准备 + +1.下载并安装IDEA Community、JDK11配置好环境。IDEA Community版本可以左键单击以下链接下载。 + +[下载链接](https://www.jetbrains.com/idea/download/) + +2.打开IDEA Community应用程序。 +依次点击项目File>Open 选择napi_generator/hdc/assist/assist_tools_IntelliJ_plugin项目文件夹。 + +![](../../figures/IntelliJ_env_config_open_proj.png) + +3.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,Language level也选择版本11,选择或者新建complier output目录为项目文件下的out目录。 +![](../../figures/IntelliJ_env_proj_structure.png) + +4.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。 +![](../../figures/IntelliJ_env_Proj_Module.png) + +5.在New Module对话框中,选择IntelliJ Platform Plugin。若Module SDK中无可选SDK,请在Module SDK 下拉框中点击 Add IntelliJ Platform Plugin SDK 选择IDEA Community安装目录,点击OK,在Select Internal Java Platform 选择 JAVA SDK 11(213版本只支持 11),点击New Module对话框中Next。 +![](../../figures/IntelliJ_env_Proj_Module_New.png) + +6.Content root选择~/napi_generator/napi_IntelliJ_plugin文件夹,module name填写generator。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。 +![](../../figures/IntelliJ_env_module_root.png) + +7.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。 +![](../../figures/IntelliJ_env_config_SDKs.png) + +8.在SDKs->IntelliJ IDEA Community 2021.3.3->Classpath下导入程序需要的依赖:napi_generator.jar包和ts_generator.jar包 + +![](../../figures/IntelliJ_env_config_SDKs_Classpath.png) + +9.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择generator,点击ok,等待安装完成。 + +![](../../figures/IntelliJ_env_configurations.png) + +![](../../figures/IntelliJ_env_run_debug.png) + +10.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。 + +![](../../figures/IntelliJ_env_built_pro.png) + +11.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。 + +![](../../figures/IntelliJ_env_built_jar.png) + +![](../../figures/IntelliJ_env_select_moudles.png) + +![](../../figures/IntelliJ_env_built_jar_success.png) diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md b/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md new file mode 100644 index 00000000..3381a92f --- /dev/null +++ b/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md @@ -0,0 +1,71 @@ +# ASSIST_TOOLS工具IntelliJ插件使用说明 + +## 简介 + +Assist_tools工具目前支持一种入口,即IntelliJ插件,本文主要介绍IntelliJ插件使用说明。IntelliJ插件下载路径如下,选择generator.jar下载。 + +[下载链接1](暂无) + +[下载链接2](暂无) + +[下载链接3](暂无) + +## IntelliJ插件使用方法 + +### 依赖 + +系统:建议Windows 10 + +开发工具:DevEco Studio + +### 使用指导 + +1.新建或打开项目工程,以下以新建项目工程为例。 + +File->New->Create Project。 + +![](../../figures/DevEco_step_newFile.png) + +Ability Template选择Empty Ability,单击Next。 + +![](../../figures/DevEco_step_firstNext.png) + +填写Project name、Save location,其它选项可不修改,单击Finish,新的工程就创建好了。 + +![](../../figures/DevEco_step_finish.png) + +2.安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的generator.jar,安装成功之后重启IDE。 + +![](../../figures/DevEco_step_pluginsOk.png) + +![](../../figures/DevEco_step_napiPlugins.png) + +3.点击Tools->Assist Tools,工具弹出统一入口窗口 + +![](../../figures/DevEco_step_assist.png) + +![](../../figures/DevEco_step_assist_frame.png) + +4.点击NAPI,然后点击Next,工具弹出Generate Napi Frame弹窗。接口文件文本框填写.d.ts文件路径;生成框架路径文本框填写生成框架存放路径;编译脚本路径填写生成CMakeList.txt文件输出路径;number目的类型此处选择char;启用import功能不选择(待转换.d.ts文件未引用其它文件);点击ok,执行结束后将会在输出路径下生成napi框架文件。 + +![](../../figures/DevEco_step_assist_napiGenerate.png) + +![](../../figures/DevEco_step_assist_napiGenerateSuccess.png) + + + +5.点击H2Ts,若不启用工具链,则直接点击Next,工具弹出Generate Ts Frame弹窗。文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击ok,执行结束后将会在输出路径下生成ts框架文件。 + +![](../../figures/DevEco_step_assist_tsGenerate.png) + +![](../../figures/DevEco_step_assist_tsGenerateSuccess.png) + +若启用工具链,点击启用工具链按钮,选择启用工具链所需的工具,至少选择两个工具,点击Next,将会弹出Generate Ts Farme弹窗;文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击Next,将会生成.d.ts文件;接着会弹出Generate Napi Frame弹窗,弹窗中自动填入.h文件生成的.d.ts文件路径,点击ok,执行结束后将会在输出路径下生成napi框架文件。 + +![](../../figures/DevEco_step_assist_importToolChain.png) + +![](../../figures/DevEco_step_assist_tsNapiGenerate.png) + +![](../../figures/DevEco_step_assist_tsNapiGenerate2.png) + +![](../../figures/DevEco_step_assist_napiGenerateSuccess.png) diff --git a/hdc/assist/figures/DevEco_step_assist.png b/hdc/assist/figures/DevEco_step_assist.png new file mode 100644 index 00000000..978d7d8e Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_frame.png b/hdc/assist/figures/DevEco_step_assist_frame.png new file mode 100644 index 00000000..ee462c22 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_frame.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_importToolChain.png b/hdc/assist/figures/DevEco_step_assist_importToolChain.png new file mode 100644 index 00000000..91fe539c Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_importToolChain.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_napiGenerate.png b/hdc/assist/figures/DevEco_step_assist_napiGenerate.png new file mode 100644 index 00000000..98c01e1c Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_napiGenerate.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_napiGenerateSuccess.png b/hdc/assist/figures/DevEco_step_assist_napiGenerateSuccess.png new file mode 100644 index 00000000..bc7c337a Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_napiGenerateSuccess.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_tsGenerate.png b/hdc/assist/figures/DevEco_step_assist_tsGenerate.png new file mode 100644 index 00000000..b9021130 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_tsGenerate.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_tsGenerateSuccess.png b/hdc/assist/figures/DevEco_step_assist_tsGenerateSuccess.png new file mode 100644 index 00000000..4ba68ffe Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_tsGenerateSuccess.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate.png b/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate.png new file mode 100644 index 00000000..40c806fa Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate.png differ diff --git a/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate2.png b/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate2.png new file mode 100644 index 00000000..ae1d1d4b Binary files /dev/null and b/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate2.png differ diff --git a/hdc/assist/figures/DevEco_step_finish.png b/hdc/assist/figures/DevEco_step_finish.png new file mode 100644 index 00000000..b02a3bd8 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_finish.png differ diff --git a/hdc/assist/figures/DevEco_step_firstNext.png b/hdc/assist/figures/DevEco_step_firstNext.png new file mode 100644 index 00000000..81250461 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_firstNext.png differ diff --git a/hdc/assist/figures/DevEco_step_napiPlugins.png b/hdc/assist/figures/DevEco_step_napiPlugins.png new file mode 100644 index 00000000..6cdf8d45 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_napiPlugins.png differ diff --git a/hdc/assist/figures/DevEco_step_newFile.png b/hdc/assist/figures/DevEco_step_newFile.png new file mode 100644 index 00000000..3b69aa21 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_newFile.png differ diff --git a/hdc/assist/figures/DevEco_step_pluginsOk.png b/hdc/assist/figures/DevEco_step_pluginsOk.png new file mode 100644 index 00000000..b5b783f7 Binary files /dev/null and b/hdc/assist/figures/DevEco_step_pluginsOk.png differ diff --git a/hdc/assist/figures/IntelliJ_env_Proj_Module.png b/hdc/assist/figures/IntelliJ_env_Proj_Module.png new file mode 100644 index 00000000..5b7cd4c3 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_Proj_Module.png differ diff --git a/hdc/assist/figures/IntelliJ_env_Proj_Module_New.png b/hdc/assist/figures/IntelliJ_env_Proj_Module_New.png new file mode 100644 index 00000000..d8c18041 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_Proj_Module_New.png differ diff --git a/hdc/assist/figures/IntelliJ_env_built_jar.png b/hdc/assist/figures/IntelliJ_env_built_jar.png new file mode 100644 index 00000000..c58a2e7c Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_built_jar.png differ diff --git a/hdc/assist/figures/IntelliJ_env_built_jar_success.png b/hdc/assist/figures/IntelliJ_env_built_jar_success.png new file mode 100644 index 00000000..8a523e27 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_built_jar_success.png differ diff --git a/hdc/assist/figures/IntelliJ_env_built_pro.png b/hdc/assist/figures/IntelliJ_env_built_pro.png new file mode 100644 index 00000000..706d14a7 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_built_pro.png differ diff --git a/hdc/assist/figures/IntelliJ_env_config_SDKs.png b/hdc/assist/figures/IntelliJ_env_config_SDKs.png new file mode 100644 index 00000000..0d88eb74 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_config_SDKs.png differ diff --git a/hdc/assist/figures/IntelliJ_env_config_SDKs_Classpath.png b/hdc/assist/figures/IntelliJ_env_config_SDKs_Classpath.png new file mode 100644 index 00000000..c9f0adfd Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_config_SDKs_Classpath.png differ diff --git a/hdc/assist/figures/IntelliJ_env_config_open_proj.png b/hdc/assist/figures/IntelliJ_env_config_open_proj.png new file mode 100644 index 00000000..c1fc11e0 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_config_open_proj.png differ diff --git a/hdc/assist/figures/IntelliJ_env_configurations.png b/hdc/assist/figures/IntelliJ_env_configurations.png new file mode 100644 index 00000000..b7b59e97 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_configurations.png differ diff --git a/hdc/assist/figures/IntelliJ_env_module_root.png b/hdc/assist/figures/IntelliJ_env_module_root.png new file mode 100644 index 00000000..b60aba3d Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_module_root.png differ diff --git a/hdc/assist/figures/IntelliJ_env_proj_structure.png b/hdc/assist/figures/IntelliJ_env_proj_structure.png new file mode 100644 index 00000000..ce351442 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_proj_structure.png differ diff --git a/hdc/assist/figures/IntelliJ_env_run_debug.png b/hdc/assist/figures/IntelliJ_env_run_debug.png new file mode 100644 index 00000000..2a66273f Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_run_debug.png differ diff --git a/hdc/assist/figures/IntelliJ_env_select_moudles.png b/hdc/assist/figures/IntelliJ_env_select_moudles.png new file mode 100644 index 00000000..b1b12957 Binary files /dev/null and b/hdc/assist/figures/IntelliJ_env_select_moudles.png differ diff --git a/hdc/ts/figures/DevEco_step_finish.png b/hdc/ts/figures/DevEco_step_finish.png new file mode 100644 index 00000000..b02a3bd8 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_finish.png differ diff --git a/hdc/ts/figures/DevEco_step_firstNext.png b/hdc/ts/figures/DevEco_step_firstNext.png new file mode 100644 index 00000000..81250461 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_firstNext.png differ diff --git a/hdc/ts/figures/DevEco_step_napiPlugins.png b/hdc/ts/figures/DevEco_step_napiPlugins.png new file mode 100644 index 00000000..6cdf8d45 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_napiPlugins.png differ diff --git a/hdc/ts/figures/DevEco_step_newFile.png b/hdc/ts/figures/DevEco_step_newFile.png new file mode 100644 index 00000000..3b69aa21 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_newFile.png differ diff --git a/hdc/ts/figures/DevEco_step_pluginsOk.png b/hdc/ts/figures/DevEco_step_pluginsOk.png new file mode 100644 index 00000000..b5b783f7 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_pluginsOk.png differ diff --git a/hdc/ts/figures/DevEco_step_ts.png b/hdc/ts/figures/DevEco_step_ts.png new file mode 100644 index 00000000..7d0cc5cd Binary files /dev/null and b/hdc/ts/figures/DevEco_step_ts.png differ diff --git a/hdc/ts/figures/DevEco_step_tsGenerate.png b/hdc/ts/figures/DevEco_step_tsGenerate.png new file mode 100644 index 00000000..bcdc65b4 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_tsGenerate.png differ diff --git a/hdc/ts/figures/DevEco_step_ts_ok.png b/hdc/ts/figures/DevEco_step_ts_ok.png new file mode 100644 index 00000000..5354e619 Binary files /dev/null and b/hdc/ts/figures/DevEco_step_ts_ok.png differ diff --git a/hdc/ts/figures/IntelliJ_env_Proj_Module.png b/hdc/ts/figures/IntelliJ_env_Proj_Module.png new file mode 100644 index 00000000..5b7cd4c3 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_Proj_Module.png differ diff --git a/hdc/ts/figures/IntelliJ_env_Proj_Module_New.png b/hdc/ts/figures/IntelliJ_env_Proj_Module_New.png new file mode 100644 index 00000000..d8c18041 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_Proj_Module_New.png differ diff --git a/hdc/ts/figures/IntelliJ_env_built_jar.png b/hdc/ts/figures/IntelliJ_env_built_jar.png new file mode 100644 index 00000000..c58a2e7c Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_built_jar.png differ diff --git a/hdc/ts/figures/IntelliJ_env_built_jar_success.png b/hdc/ts/figures/IntelliJ_env_built_jar_success.png new file mode 100644 index 00000000..8a523e27 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_built_jar_success.png differ diff --git a/hdc/ts/figures/IntelliJ_env_built_pro.png b/hdc/ts/figures/IntelliJ_env_built_pro.png new file mode 100644 index 00000000..706d14a7 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_built_pro.png differ diff --git a/hdc/ts/figures/IntelliJ_env_config_SDKs.png b/hdc/ts/figures/IntelliJ_env_config_SDKs.png new file mode 100644 index 00000000..0d88eb74 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_config_SDKs.png differ diff --git a/hdc/ts/figures/IntelliJ_env_config_SDKs_Classpath.png b/hdc/ts/figures/IntelliJ_env_config_SDKs_Classpath.png new file mode 100644 index 00000000..0c9ec0f0 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_config_SDKs_Classpath.png differ diff --git a/hdc/ts/figures/IntelliJ_env_config_open_proj.png b/hdc/ts/figures/IntelliJ_env_config_open_proj.png new file mode 100644 index 00000000..85dec13c Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_config_open_proj.png differ diff --git a/hdc/ts/figures/IntelliJ_env_configurations.png b/hdc/ts/figures/IntelliJ_env_configurations.png new file mode 100644 index 00000000..b7b59e97 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_configurations.png differ diff --git a/hdc/ts/figures/IntelliJ_env_module_root.png b/hdc/ts/figures/IntelliJ_env_module_root.png new file mode 100644 index 00000000..82ef14d0 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_module_root.png differ diff --git a/hdc/ts/figures/IntelliJ_env_proj_structure.png b/hdc/ts/figures/IntelliJ_env_proj_structure.png new file mode 100644 index 00000000..ce351442 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_proj_structure.png differ diff --git a/hdc/ts/figures/IntelliJ_env_run_debug.png b/hdc/ts/figures/IntelliJ_env_run_debug.png new file mode 100644 index 00000000..2a66273f Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_run_debug.png differ diff --git a/hdc/ts/figures/IntelliJ_env_select_moudles.png b/hdc/ts/figures/IntelliJ_env_select_moudles.png new file mode 100644 index 00000000..b1b12957 Binary files /dev/null and b/hdc/ts/figures/IntelliJ_env_select_moudles.png differ diff --git a/hdc/ts/figures/h-2-ts-succ.png b/hdc/ts/figures/h-2-ts-succ.png new file mode 100644 index 00000000..ea4e1cf0 Binary files /dev/null and b/hdc/ts/figures/h-2-ts-succ.png differ diff --git a/hdc/ts/figures/header_parser_not_exist.png b/hdc/ts/figures/header_parser_not_exist.png new file mode 100644 index 00000000..708eb953 Binary files /dev/null and b/hdc/ts/figures/header_parser_not_exist.png differ diff --git a/hdc/ts/ts_IntelliJ_plugin/README_zh.md b/hdc/ts/ts_IntelliJ_plugin/README_zh.md new file mode 100644 index 00000000..fa8dac76 --- /dev/null +++ b/hdc/ts/ts_IntelliJ_plugin/README_zh.md @@ -0,0 +1,131 @@ +# TS框架生成工具IntelliJ插件说明 + +## 简介 + +ts(type-script)接口生成工具,它可以根据定义在c++头文件中的接口,生成type-script语言的ts接口文件。目前工具支持可执行文件、IntelliJ插件两种入口,本文主要介绍IntelliJ插件使用说明。 + +## 目录 + + ├── ts # TS框架代码生成工具 + │ ├── ... # 其它文件 + │ ├── ts_IntelliJ_plugin # IntelliJ插件代码 + │ │ ├── docs # IntelliJ插件说明 + │ │ ├── resources # IntelliJ插件说明 + │ │ ├── src # IntelliJ插件源码 + │ │ └── README_zh # IntelliJ插件说明 + +## 约束 + +系统:建议Windows 10 + +依赖版本:JDK 11 + +开发工具:DevEco stdio、IDEA Community 2021.3.3 + +## 使用方法 + +### 使用对象 + +系统开发者、应用Native开发者 + +### 使用场景 + +1) 系统框架层新增子系统,需对应用层提供接口。 +2) 系统框架层子系统能力增强后,需对应用层提供新接口。 +3) 应用层引入C++三方库,需增加OpenHarmony应用层接口。 + +### 工具使用 + +插件下载路径如下,选择generator.jar下载。 + +[下载链接1]( http://ftpkaihongdigi.i234.me:5000/sharing/PC6uOorrM) + +[下载链接2]( http://ftp.kaihong.com:5000/sharing/PC6uOorrM) + +[下载链接3]( http://ftp.kaihongdigi.com:5000/sharing/PC6uOorrM) + +具体的工具使用步骤,可以左键单击以下链接了解: + +[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md) + +### 工具输出 + +根据使用者指定的.h文件,工具会输出对应的ts接口文件。为了方便使用者快速上手工具,可供测试的test.h文件样例如下: + +``` +#include < string > + #include < vector > + using namespace std; + + class TestA { + public: + char16_t string1; + void add(string v, long double v1[]); + }; + double count(double v, double v1[]); + + namespace Space { + class TestBB { + public: + short string4; + bool ifExist(bool v, bool v1[]); + }; + uint32_t max(uint32_t v, uint32_t v1[]); + } +``` + +在window环境下的,根据输入文件test.h,生成的输出文件,如下所示:![](../figures/h-2-ts-succ.png) + +其中生成的"test.d.ts"文件,定义了应用开发接口,如下所示: + + +```c++ +declare class TestA { + string1: string; + add(v: string, v1: Array): void; +} +declare namespace Space { + function max(v: number, v1: Array): number; + class TestBB { + string4: number; + ifExist(v: boolean, v1: Array): boolean; + } +} +declare function count(v: number, v1: Array): number; + +export default Space; +``` + +## 开发说明 + +### 对象 + +工具的开发者 + +### 开发场景 + +若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。 + +### 开发步骤 + +开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发: + + [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md) + +## 版本说明 + +当前版本已支持的特性和待开发的特性,如下所示: + + [已支持特性](https://gitee.com/openharmony/napi_generator/blob/master/docs/ts/ts_Gen-1.0.md) + + [待支持特性](https://gitee.com/openharmony/napi_generator/blob/master/docs/ts/ROADMAP_ZH.md) + +## FAQ + +对于常见问题解决方法指导如下: + + [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/docs/ts/FAQ.md) + +## 相关仓 + +暂无 \ No newline at end of file diff --git a/napi_IntelliJ_plugin/docs/ts/DEVELOP_ZH.md b/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md similarity index 58% rename from napi_IntelliJ_plugin/docs/ts/DEVELOP_ZH.md rename to hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md index 44fc3607..9eb8bd19 100644 --- a/napi_IntelliJ_plugin/docs/ts/DEVELOP_ZH.md +++ b/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md @@ -25,39 +25,43 @@ [下载链接](https://www.jetbrains.com/idea/download/) 3.打开IDEA Community应用程序。 -依次点击项目File>Open 选择napi_generator/napi_IntelliJ_plugin项目文件夹。 +依次点击项目File>Open 选择napi_generator/hdc/ts/ts_IntelliJ_plugin项目文件夹。 -![](../../../figures/IntelliJ_env_config_open_proj.png) +![](../../figures/IntelliJ_env_config_open_proj.png) 4.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,Language level也选择版本11,选择或者新建complier output目录为项目文件下的out目录。 -![](../../../figures/IntelliJ_env_proj_structure.png) +![](../../figures/IntelliJ_env_proj_structure.png) 5.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。 -![](../../../figures/IntelliJ_env_Proj_Module.png) +![](../../figures/IntelliJ_env_Proj_Module.png) 6.在New Module对话框中,选择IntelliJ Platform Plugin。若Module SDK中无可选SDK,请在Module SDK 下拉框中点击 Add IntelliJ Platform Plugin SDK 选择IDEA Community安装目录,点击OK,在Select Internal Java Platform 选择 JAVA SDK 11(213版本只支持 11),点击New Module对话框中Next。 -![](../../../figures/IntelliJ_env_Proj_Module_New.png) +![](../../figures/IntelliJ_env_Proj_Module_New.png) -7.Content root选择~/napi_generator/napi_IntelliJ_plugin文件夹,module name填写generator。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。 -![](../../../figures/IntelliJ_env_module_root.png) +7.Content root选择~/napi_generator/hdc/ts/ts_IntelliJ_plugin文件夹,module name填写generator。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。 +![](../../figures/IntelliJ_env_module_root.png) 8.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。 -![](../../../figures/IntelliJ_env_config_SDKs.png) +![](../../figures/IntelliJ_env_config_SDKs.png) -9.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择generator,点击ok,等待安装完成。 +9.在SDKs->IntelliJ IDEA Community 2021.3.3->Classpath下导入程序需要的依赖:napi_generator.jar包 -![](../../../figures/IntelliJ_env_configurations.png) +![](../../figures/IntelliJ_env_config_SDKs_Classpath.png) -![](../../../figures/IntelliJ_env_run_debug.png) +10.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择generator,点击ok,等待安装完成。 -10.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。 +![](../../figures/IntelliJ_env_configurations.png) -![](../../../figures/IntelliJ_env_built_pro.png) +![](../../figures/IntelliJ_env_run_debug.png) -11.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。 +11.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。 -![](../../../figures/IntelliJ_env_built_jar.png) +![](../../figures/IntelliJ_env_built_pro.png) -![](../../../figures/IntelliJ_env_select_moudles.png) +12.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。 -![](../../../figures/IntelliJ_env_built_jar_success.png) +![](../../figures/IntelliJ_env_built_jar.png) + +![](../../figures/IntelliJ_env_select_moudles.png) + +![](../../figures/IntelliJ_env_built_jar_success.png) diff --git a/napi_IntelliJ_plugin/docs/ts/INSTRUCTION_ZH.md b/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md old mode 100755 new mode 100644 similarity index 59% rename from napi_IntelliJ_plugin/docs/ts/INSTRUCTION_ZH.md rename to hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md index 915978a9..5bc4e302 --- a/napi_IntelliJ_plugin/docs/ts/INSTRUCTION_ZH.md +++ b/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md @@ -1,53 +1,53 @@ -# Ts接口生成工具IntelliJ插件使用说明 - -## 简介 - -Ts接口生成工具目前支持两种入口,分别是可执行程序、IntelliJ插件,本文主要介绍IntelliJ插件使用说明。IntelliJ插件下载路径如下,选择generator.jar下载。 - -[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT) - -[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT) - -[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT) - -## IntelliJ插件使用方法 - -### 依赖 - -系统:建议Windows 10 - -开发工具:DevEco Studio - -### 使用指导 - -1.新建或打开项目工程,以下以新建项目工程为例。 - -File->New->Create Project。 - -![](../../../figures/DevEco_step_newFile.png) - -Ability Template选择Empty Ability,单击Next。 - -![](../../../figures/DevEco_step_firstNext.png) - -填写Project name、Save location,其它选项可不修改,单击Finish,新的工程就创建好了。 - -![](../../../figures/DevEco_step_finish.png) - -2.安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的generator.jar,安装成功之后重启IDE。 - -![](../../../figures/DevEco_step_pluginsOk.png) - -![](../../../figures/DevEco_step_napiPlugins.png) - -3.把需要转换的.h文件放在DevEco stdio新建项目的src目录下。 - -![](../../../figures/DevEco_step_ts.png) - -4.选择.h文件,点击右键选择Generate Napi Frame,工具弹出Generate Napi Frame弹窗,选择Ts-Gen页签。文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击ok。 - -![](../../../figures/DevEco_step_tsGenerate.png) - -![](../../../figures/DevEco_step_ts_ok.png) - -5.执行结束后会在out目录下生成.d.ts代码文件。 +# Ts接口生成工具IntelliJ插件使用说明 + +## 简介 + +Ts接口生成工具目前支持两种入口,分别是可执行程序、IntelliJ插件,本文主要介绍IntelliJ插件使用说明。IntelliJ插件下载路径如下,选择generator.jar下载。 + +[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT) + +[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT) + +[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT) + +## IntelliJ插件使用方法 + +### 依赖 + +系统:建议Windows 10 + +开发工具:DevEco Studio + +### 使用指导 + +1.新建或打开项目工程,以下以新建项目工程为例。 + +File->New->Create Project。 + +![](../../figures/DevEco_step_newFile.png) + +Ability Template选择Empty Ability,单击Next。 + +![](../../figures/DevEco_step_firstNext.png) + +填写Project name、Save location,其它选项可不修改,单击Finish,新的工程就创建好了。 + +![](../../figures/DevEco_step_finish.png) + +2.安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的generator.jar,安装成功之后重启IDE。 + +![](../../figures/DevEco_step_pluginsOk.png) + +![](../../figures/DevEco_step_napiPlugins.png) + +3.把需要转换的.h文件放在DevEco stdio新建项目的src目录下。 + +![](../../figures/DevEco_step_ts.png) + +4.选择.h文件,点击右键选择Generate Ts Frame,工具弹出Generate Ts Frame弹窗,选择Ts-Gen页签。文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击ok。 + +![](../../figures/DevEco_step_tsGenerate.png) + +![](../../figures/DevEco_step_ts_ok.png) + +5.执行结束后会在输出目录下生成.d.ts代码文件。