diff --git a/hdc/api/FAQ.md b/hdc/api/FAQ.md
deleted file mode 100755
index 26aa28efa9d20befb79bbdda5aa5838043b484fb..0000000000000000000000000000000000000000
--- a/hdc/api/FAQ.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# API扫描工具 问题反馈
-
-## 问题反馈
-
-1、工具扫描三方库时,报错“Error: EBUSY: resource busy or locked, open 'result.xlsx'”。
-
-
-
-问题定位:工具扫描三方库项目时result.txt文档打开,扫描结果无法写入result.txt文档,因此报错“resource busy or locked”。
-
-问题解决:关闭result.txt文档,重新扫描三方库,即可解决以上问题。
\ No newline at end of file
diff --git a/hdc/api/README_ZH.md b/hdc/api/README_ZH.md
deleted file mode 100755
index 0373d2de38d94866393d6ae367745f89924c97a2..0000000000000000000000000000000000000000
--- a/hdc/api/README_ZH.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# API扫描工具
-
-## 简介
-
-本文主要介绍API扫描工具,它可以扫描三方库中包含OpenHarmony源码不包含的接口,并输出result.xlsx文档。开发者移植三方库到OpenHarmony源码中,若三方库中包含一些OpenHarmony中不存在的接口,便会增加移植难度。此时可使用API扫描工具,提前预知风险接口,降低移植难度,提高开发效率。目前工具支持VS Code插件一种入口。
-
-更多工具的架构和实现原理详情,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/docs/INSTRUCTION_ZH.md)
-
- ├── napi_generator # NAPI框架代码生成工具
- │ ├── ... # 其他文档
- │ ├── hdc
- │ │ ├── ... # 其他工具
- │ │ ├── api # api扫描工具
- │ │ | ├── api_scan_vs_plugin # VS Code插件源码
- │ │ | ├── ...
-
-## 约束
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-移植三方库到OpenHarmony前预知风险接口。
-
-### 工具使用
-
-工具支持VS Code插件,可在VS Code插件市场直接下载。
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库项目源码,工具会输出风险接口。为了方便使用者快速上手工具,此处使用opencv项目为例,项目目录如下:
-
-
-
-在window环境下的,根据输入三方库项目,生成的输出文件result.xlsx,如下所示:
-
-
-
-其中生成的result.xlsx文件,风险接口如下所示:
-
-
-
-
-
-## 版本说明
-
-暂无
-
-## FAQ
-
- [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/FAQ.md)
-
-## 参与贡献
-
-暂无
-
-## 相关仓
-
-暂无
diff --git a/hdc/api/api_scan_IntelliJ_plugin/README_zh.md b/hdc/api/api_scan_IntelliJ_plugin/README_zh.md
deleted file mode 100755
index 59b8ad7813b04da384c335199b183c72579cad44..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/README_zh.md
+++ /dev/null
@@ -1,85 +0,0 @@
-# API扫描工具IntelliJ插件说明(暂不支持)
-
-## 简介
-
-API扫描工具,它可以根据用户给定三方库项目扫描输出风险接口。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口,本文主要介绍IntelliJ插件使用说明。
-
-## 目录
-
- ├── api # API扫描工具
- │ ├── ... # 其他文件
- │ ├── api_scan_IntelliJ_plugin # IntelliJ插件代码
- │ │ ├── docs # IntelliJ插件说明
- │ │ ├── resources # IntelliJ插件说明
- │ │ ├── src # IntelliJ插件源码
- │ │ └── README_zh # IntelliJ插件说明
-
-## 约束
-
-系统:建议Windows 10
-
-依赖版本:JDK 11
-
-开发工具:DevEco Studio、IDEA Community 2021.3.3
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-移植三方库到OpenHarmony前预知风险接口。
-
-### 工具使用
-
-插件下载路径如下:
-
-[下载链接](暂无)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_IntelliJ_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库项目源码,工具会输出风险接口。为了方便使用者快速上手工具,此处使用opencv项目为例,项目目录如下:
-
-
-
-在window环境下的,根据输入三方库项目,生成的输出文件result.xlsx,如下所示:
-
-
-
-其中生成的result.xlsx文件,风险接口如下所示:
-
-
-
-
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发:
-
-[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/docs/DEVELOP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/docs/DEVELOP_ZH.md b/hdc/api/api_scan_IntelliJ_plugin/docs/DEVELOP_ZH.md
deleted file mode 100755
index 93e1e3d788eb0ad62a3564489960f1d88f6dd378..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Api Scan代码扫描工具IntelliJ插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的IntelliJ插件。
-
-## IntelliJ插件打包说明
-
-### 环境说明
-
-系统:建议Windows 10
-
-### 开发步骤
-
-#### 环境准备
-
-1.下载API扫描工具可执行程序,并放置在napi_generator/hdc/api_scan_IntelliJ_plugin/resources/cmds目录下对应系统的文件夹下,下载链接如下:
-
-[下载链接](暂无)
-
-2.下载并安装IDEA Community、JDK11配置好环境。IDEA Community版本可以左键单击以下链接下载。
-
-[下载链接](https://www.jetbrains.com/idea/download/)
-
-3.打开IDEA Community应用程序。
-依次点击项目File>Open 选择napi_generator/hdc/api_scan_IntelliJ_plugin项目文件夹。
-
-
-4.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,选择或者新建complier output目录为项目文件下的out目录。
-
-
-5.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。
-
-
-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。
-
-
-7.Content root选择napi_generator/hdc/api_scan_IntelliJ_plugin文件夹,module name填写api_scan_IntelliJ_plugin。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。
-
-
-8.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。
-
-
-9.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择api_scan_IntelliJ_plugin,点击ok,等待安装完成。
-
-
-
-10.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。
-
-
-
-11.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。
-
-
-
-
diff --git a/hdc/api/api_scan_IntelliJ_plugin/docs/INSTRUCTION_ZH.md b/hdc/api/api_scan_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 041f4af0c552b3ac5e4e80b5c68d67f4cccc3093..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# API扫描工具IntelliJ插件使用说明
-
-## 简介
-
-API扫描工具目前支持三种入口,分别是可执行程序、IntelliJ插件、VS Code插件,本文主要介绍IntelliJ插件使用说明。IntelliJ插件下载路径如下:
-
-[下载链接](暂无)
-
-## IntelliJ插件使用方法
-
-### 依赖
-
-系统:建议Windows 10
-
-开发工具:DevEco Studio
-
-### 使用指导
-
-1、新建或打开项目工程,以下以新建项目工程为例。
-
-File->New->Create Project。
-
-
-
-Ability Template选择Empty Ability,单击Next。
-
-
-
-填写Project name、Save location,其他选项可不修改,单击Finish,新的工程就创建好了。
-
-
-
-2、安装插件。File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的api_scan_IntelliJ_plugin.jar,安装成功之后重启IDE。
-
-
-
-
-
-3、Tools->API Scan,打开API Scan选择框。
-
-
-
-4、工具打开API Scan窗口,扫描项目路径框填写将要扫描项目的绝对路径,结果输出路径框自动填写与扫描项目相同路径,使用者可以根据实际情况修改结果输出路径,然后点击ok。
-
-
-
-5、执行结束后会在结果输出路径下生成result.xlsx文件。
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/resources/META-INF/plugin.xml b/hdc/api/api_scan_IntelliJ_plugin/resources/META-INF/plugin.xml
deleted file mode 100755
index e2491df2184adcacba29194afb07461d0c29d6a4..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
- com.kh.scan
- API Scan
- 1.0
- 深圳开鸿数字产业发展有限公司
-
-
-
- com.intellij.modules.lang
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/linux/INTELLIJ_README_LINUX_zh.md b/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/linux/INTELLIJ_README_LINUX_zh.md
deleted file mode 100644
index d0893365de6d626394ae4428b4f42c5f224c3530..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/linux/INTELLIJ_README_LINUX_zh.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# 目录说明
- 此目录用于存放napi_generator-linux可执行文件
-
-[可执行文件下载](http://ftpkaihongdigi.i234.me:5000/fsdownload/PPVcNMgVv/2022-06-13)
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/mac/INTELLIJ_README_MAC_zh.md b/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/mac/INTELLIJ_README_MAC_zh.md
deleted file mode 100644
index 2b79c41e144f94743618a7ba57c625ac67e24a78..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/mac/INTELLIJ_README_MAC_zh.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# 目录说明
- 此目录用于存放napi_generator-macos可执行文件
-
-[可执行文件下载](http://ftpkaihongdigi.i234.me:5000/fsdownload/PPVcNMgVv/2022-06-13)
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/win/INTELLIJ_README_WIN_zh.md b/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/win/INTELLIJ_README_WIN_zh.md
deleted file mode 100644
index 95286c4fe3e5f61535020d5365a6af63851ed558..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/resources/cmds/win/INTELLIJ_README_WIN_zh.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# 目录说明
- 此目录用于存放napi_generator-win.exe可执行文件
-
-[可执行文件下载](http://ftpkaihongdigi.i234.me:5000/fsdownload/PPVcNMgVv/2022-06-13)
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/resources/images/openDisk.png b/hdc/api/api_scan_IntelliJ_plugin/resources/images/openDisk.png
deleted file mode 100755
index 5956a0e538a400c7deaf41167ae5ea70348b8584..0000000000000000000000000000000000000000
Binary files a/hdc/api/api_scan_IntelliJ_plugin/resources/images/openDisk.png and /dev/null differ
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/action/ScanDirAction.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/action/ScanDirAction.java
deleted file mode 100755
index 7707f01a62a981bd4b4cb93acc2d0de6cdbb2ec4..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/action/ScanDirAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.prefs.Preferences;
-
-/**
- * 编译文件夹选择框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select generator file path
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ScanDirAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
- private final JTextField outScanResultPathTextField;
-
- public ScanDirAction(JButton button, JTextField textField, JTextField outScanResultPathTextField) {
- this.button = button;
- this.textField = textField;
- this.outScanResultPathTextField = outScanResultPathTextField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- Preferences preferences = Preferences.userRoot();
- String filePath = textField.getText();
- if (filePath.isBlank()) {
- filePath = preferences.get("interPathRecord", "");
- }
- JFileChooser fcDlg = new JFileChooser(filePath);
- fcDlg.setDialogTitle("请选择扫描项目路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- preferences.put("interPathRecord", filepath);
- textField.setText(filepath);
- outScanResultPathTextField.setText(filepath);
- }
- }
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/action/ScanResultDirAction.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/action/ScanResultDirAction.java
deleted file mode 100755
index 6fa76065b502553fceaf9246a10afe4eadcd46ae..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/action/ScanResultDirAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * 脚本选择对话框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select compile script
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ScanResultDirAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
-
- public ScanResultDirAction(JButton button, JTextField textField) {
- this.button = button;
- this.textField = textField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser(textField.getText());
- fcDlg.setDialogTitle("请选择输出结果路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- textField.setText(filepath);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialog.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialog.java
deleted file mode 100755
index 6d9809f0870fc29b793ff0d8ffda05c3e9831114..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialog.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.ValidationInfo;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * 主界面对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ApiScanDialog extends DialogWrapper {
- private static final Logger LOG = Logger.getInstance(ApiScanDialog.class);
- private static final String TITLE = "API Scan";
- private static final String URL = "https://gitee.com/openharmony/napi_generator/tree/master/hdc/API-Scan";
-
- private final ApiScanDialogPane genDiag;
-
- /**
- * 构造函数
- *
- * @param project projectId
- */
- public ApiScanDialog(Project project) {
- super(true);
- this.setResizable(false);
- setTitle(TITLE);
- setModal(true);
- genDiag = new ApiScanDialogPane(project);
- init();
- }
-
- /**
- * 创建视图
- *
- * @return 组件内容
- */
- @Nullable
- @Override
- protected JComponent createCenterPanel() {
- return genDiag.getContentPanel();
- }
-
-
- /**
- * 校验数据
- *
- * @return 检测文本框架是否有目录。
- */
- @Nullable
- @Override
- protected ValidationInfo doValidate() {
- return genDiag.validationInfo();
- }
-
- /**
- * ok/cancel按钮
- *
- * @return Action[] buttos list
- */
- @NotNull
- @Override
- protected Action[] createActions() {
- DialogWrapperExitAction exitAction = new DialogWrapperExitAction("Cancel", CANCEL_EXIT_CODE);
- CustomOKAction okAction = new CustomOKAction();
-
- // 设置默认的焦点按钮
- okAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
- return new Action[]{exitAction, okAction};
- }
-
- @NotNull
- @Override
- protected Action[] createLeftSideActions() {
- CustomHelpAction helpAction = new CustomHelpAction();
- return new Action[]{helpAction};
- }
-
- /**
- * 自定义 ok Action
- */
- protected class CustomOKAction extends DialogWrapperAction {
-
- protected CustomOKAction() {
- super("OK");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- ValidationInfo validationInfo = doValidate();
- if (validationInfo != null) {
- LOG.info(validationInfo.message);
- } else {
- if (genDiag.runFun()) {
- close(CANCEL_EXIT_CODE);
- }
- }
- }
- }
-
- /**
- * 自定义 help Action
- */
- protected class CustomHelpAction extends DialogWrapperAction {
-
- protected CustomHelpAction() {
- super("Help");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- try {
- Desktop.getDesktop().browse(new URI(URL));
- } catch (URISyntaxException | IOException e) {
- LOG.error("Open help error:" + e);
- }
- }
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.form b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.form
deleted file mode 100755
index 79e8446465b7e101b305c3d4ba9b1d2ace2febde..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.form
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java
deleted file mode 100755
index 796f03238f3531be7170d7e2ff44a073d75ffcab..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.dialog;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.ValidationInfo;
-import com.kh.scan.action.ScanDirAction;
-import com.kh.scan.action.ScanResultDirAction;
-import com.kh.scan.utils.FileInfo;
-import com.kh.scan.utils.FileUtil;
-import com.kh.scan.utils.GenNotification;
-import org.apache.http.util.TextUtils;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * GenerateDialogPane生成工具主界面
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select generate dialog
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ApiScanDialogPane extends JDialog {
- private static final Logger LOG = Logger.getInstance(ApiScanDialogPane.class);
-
- private JPanel contentPane;
- private JTextField scanDirPathTextField;
- private JTextField outScanResultPathTextField;
- private JButton selectScanPath;
- private JButton outSelectPath;
- private boolean generateSuccess = true;
- private String sErrorMessage = "";
- private String scanDir;
- private String scanResultDir;
- private final Project project;
- private BlockingQueue blockingQueue = new LinkedBlockingQueue(100);
- private ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 64, 60L,
- TimeUnit.SECONDS, blockingQueue,
- new ThreadPoolExecutor.AbortPolicy());
-
-
- /**
- * 构造函数
- *
- * @param project projectId
- */
- public ApiScanDialogPane(Project project) {
- this.project = project;
- contentPane.registerKeyboardAction(actionEvent -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- selectScanPath.addActionListener(new ScanDirAction(selectScanPath, scanDirPathTextField,
- outScanResultPathTextField));
- outSelectPath.addActionListener(new ScanResultDirAction(outSelectPath, outScanResultPathTextField));
- }
-
- @Override
- public synchronized void addWindowListener(WindowListener windowListener) {
- super.addWindowListener(windowListener);
- new WindowAdapter() {
- /**
- * close dialog
- *
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- };
- }
-
- /**
- * 验证文本选择框是否空。是否替换已存在的内容
- *
- * @return ValidationInfo 返回不符要求的信息。
- */
- @Nullable
- public ValidationInfo validationInfo() {
- String scanResultDirPath = outScanResultPathTextField.getText();
- String scanDirPath = scanDirPathTextField.getText();
- boolean isEmptyFile = TextUtils.isEmpty(scanDirPath) || TextUtils.isEmpty(scanResultDirPath);
-
- ValidationInfo validationInfo = null;
- if (isEmptyFile) {
- String warnMsg = "扫描项目路径、结果输出路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
-
- File file = new File(scanResultDirPath + "/result.xlsx");
- if (file.exists()) {
- ConfirmDialog confirmDialog = new ConfirmDialog("是否替换已存在的扫描结果?");
- if (!confirmDialog.showAndGet()) {
- validationInfo = new ValidationInfo(String.format("不替换现有扫描结果文件:%s", file));
- return validationInfo;
- }
- }
- return validationInfo;
- }
-
- private void onCancel() {
- dispose();
- }
-
- private void warningMessage(String title) {
- String notiContent = "请选择扫描项目路径、结果输出路径";
- GenNotification.notifyMessage(this.project, notiContent, title, NotificationType.WARNING);
- }
-
- /**
- * 获取指定输出目录下的文件列表
- *
- * @param outPath 输出目录
- * @return 文件信息列表
- */
- public List getFileInfoList(File outPath) {
- List fileInfoList = new ArrayList<>();
- File[] files = outPath.listFiles();
- for (File file : files) {
- fileInfoList.add(new FileInfo(file));
- }
- return fileInfoList;
- }
-
- /**
- * 执行主程序入口
- *
- * @return 执行状态
- */
- public boolean runFun() {
- GenNotification.notifyMessage(this.project, "", "正在生成", NotificationType.INFORMATION);
- scanDir = scanDirPathTextField.getText();
- scanResultDir = outScanResultPathTextField.getText();
- String command;
- command = genCommand();
-
- File outPath = new File(outScanResultPathTextField.getText());
- List oldFileList = getFileInfoList(outPath);
-
- try {
- if (!TextUtils.isEmpty(command) && callExtProcess(command)) {
- List newFileList = getFileInfoList(outPath);
- newFileList.removeAll(oldFileList);
- if (generateSuccess) {
- GenNotification.notifyGenResult(project, newFileList, "Api Scan Successfully",
- NotificationType.INFORMATION);
- return true;
- } else {
- GenNotification.notifyMessage(project, sErrorMessage, "提示", NotificationType.ERROR);
- return false;
- }
- }
- } catch (IOException | InterruptedException ex) {
- GenNotification.notifyMessage(project, scanDirPathTextField.getText(), "Command exec error",
- NotificationType.ERROR);
- LOG.error(ex);
- }
- return false;
- }
-
- /**
- * 生成命令行指令
- *
- * @return 返回命令行执行内容
- */
- private String genCommand() {
- String sysName = System.getProperties().getProperty("os.name").toUpperCase();
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- String execFn;
- if (sysName.contains("WIN")) {
- execFn = "cmds/win/search-win.exe";
- tmpDirFile += "search-win.exe";
- } else if (sysName.contains("LINUX")) {
- execFn = "cmds/linux/search-linux";
- tmpDirFile += "/search-linux";
- } else {
- execFn = "cmds/mac/search-macos";
- tmpDirFile += "/search-macos";
- }
- File file = new File(tmpDirFile);
- try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(execFn)) {
- if (inputStream == null) {
- throw new IOException("exec File InputStream is Null");
- }
- byte[] bs = inputStream.readAllBytes();
- writeTmpFile(tmpDirFile, bs);
- if (sysName.contains("LINUX") || sysName.contains("MAC OS")) {
- executable(tmpDirFile);
- }
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + execFn,
- NotificationType.ERROR);
- LOG.error(e);
-
- return "";
- }
- String command = file.toString();
- command = command + " -d " + scanDir + " -o " + scanResultDir;
- return command;
- }
-
- private boolean callExtProcess(String command) throws IOException, InterruptedException {
- if (TextUtils.isEmpty(command)) {
- GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
- return false;
- }
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- Process process = Runtime.getRuntime().exec(command, null, new File(tmpDirFile));
- threadPool.execute(new BlockThread(process));
- StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
- outputConsumer.start();
- outputConsumer.join();
- process.destroy();
- return true;
- }
-
- /**
- * 赋值可执行文件权限。
- *
- * @param execFn 可执行命令
- * @throws IOException 打开文件异常
- * @throws InterruptedException 中断异常
- */
- private void executable(String execFn) throws IOException, InterruptedException {
- callExtProcess("chmod a+x " + execFn);
- }
-
- /**
- * 拷贝可执行文件到临时文件夹
- *
- * @param path 目标文件路径
- * @param bs 字节内容
- * @throws IOException exception
- */
- private void writeTmpFile(String path, byte[] bs) throws IOException {
- File file = new File(path);
- if (!file.exists()) {
- boolean isNewFile = file.createNewFile();
- if (!isNewFile) {
- LOG.info("writeTmpFile createNewFile error");
- }
- }
- FileOutputStream fw = new FileOutputStream(file);
- fw.write(bs, 0, bs.length);
- fw.close();
- }
-
- /**
- * 获取生成成功结果文件。
- *
- * @param process 进程ID
- */
- private void genResultLog(Process process) {
- BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
- BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String sErr;
- String sOut;
- sErr = getErrorResult(stdError);
- if (TextUtils.isEmpty(sErr)) {
- sOut = genInputLog(stdInput);
- if (!generateIsSuccess(sOut)) {
- sErrorMessage = sOut;
- }
- return;
- }
- generateSuccess = false;
- sErrorMessage = sErr;
- }
-
- /**
- * 获取生成失败结果文件。
- *
- * @param stdError error buff
- * @return ErrorResult
- */
- private String getErrorResult(BufferedReader stdError) {
- StringBuilder sErr = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdError.readLine()) == null) {
- break;
- }
- sErr.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sErr.toString();
- }
-
- private boolean generateIsSuccess(String sOut) {
- generateSuccess = sOut.contains("success") || TextUtils.isEmpty(sOut);
- return generateSuccess;
- }
-
- /**
- * 获取生成文本内容。
- *
- * @param stdInput input buff
- * @return 返回当前输入框内容
- */
- private String genInputLog(BufferedReader stdInput) {
- StringBuilder sOut = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdInput.readLine()) == null) {
- break;
- }
- sOut.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sOut.toString();
- }
-
- static class StreamConsumer extends Thread {
- InputStream is;
-
- StreamConsumer(InputStream is) {
- super.setName("StreamConsumer");
- this.is = is;
- }
-
- @Override
- public void run() {
- try {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- while ((line = br.readLine()) != null) {
- LOG.info(line);
- }
- } catch (IOException ioException) {
- LOG.error("StreamConsumer io error" + ioException);
- }
- }
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-
- class BlockThread extends Thread {
- Process process;
-
- BlockThread(Process process) {
- super.setName("BlockThread");
- this.process = process;
- }
-
- @Override
- public void run() {
- BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
- genResultLog(process);
- try {
- while (br.readLine() != null) {
- LOG.info(" callExtProcess ");
- }
- } catch (IOException ioException) {
- LOG.error(" callExtProcess error" + ioException);
- }
- }
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDiagPane.form b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDiagPane.form
deleted file mode 100755
index 5f38c1c861433d37e59b9eb8ac5ce02d539d762d..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDiagPane.form
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDiagPane.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDiagPane.java
deleted file mode 100755
index 013c69f8f5de7009eda9f36a32263ac27dc4eedc..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDiagPane.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.dialog;
-
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JDialog;
-import javax.swing.ImageIcon;
-
-/**
- * ConfirmDiagPane自定义确认对话框
- * 解决ShowConfirmDiag 在Deveco里面会出现界面错位问题。
- *
- * @author: zhaoxudong@kaihong.com
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ConfirmDiagPane extends JDialog {
- private JPanel contentPane;
- private JLabel msgLabel;
- private JLabel iconLabel;
-
- /**
- * 构造函数
- *
- * @param sErrorMessage 错误信息
- */
- public ConfirmDiagPane(String sErrorMessage) {
- msgLabel.setText(sErrorMessage);
- iconLabel.setIcon(new ImageIcon(""));
- }
-
-
- JPanel getContentPanel() {
- return contentPane;
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDialog.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDialog.java
deleted file mode 100755
index 2fb5abd1e8726c5c06387c2e0714466cffad7237..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ConfirmDialog.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.dialog;
-
-import com.intellij.openapi.ui.DialogWrapper;
-import org.jetbrains.annotations.Nullable;
-import javax.swing.JComponent;
-
-/**
- * 自定义确认对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ConfirmDialog extends DialogWrapper {
- private final ConfirmDiagPane confirmDiagPane;
-
- /**
- * 构造函数
- * @param message 弹出框信息内容
- */
- public ConfirmDialog(String message) {
- super(true);
- confirmDiagPane = new ConfirmDiagPane(message);
- setOKButtonText("Yes");
- setCancelButtonText("No");
- setUndecorated(true);
- setResizable(false);
- init();
- }
-
- @Override
- @Nullable
- protected JComponent createCenterPanel() {
- return confirmDiagPane.getContentPanel();
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/ng/ApiScanMenu.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/ng/ApiScanMenu.java
deleted file mode 100755
index 9f52434e4be2fbb2d57b81169c93df832a7bf616..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/ng/ApiScanMenu.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.ng;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import com.kh.scan.dialog.ApiScanDialog;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * 工具菜单入口
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class ApiScanMenu extends AnAction {
-
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
-
- if (project == null) {
- return;
- }
- ApiScanDialog wrapper = new ApiScanDialog(project);
- wrapper.showAndGet();
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/FileInfo.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/FileInfo.java
deleted file mode 100644
index 66e6a8c91d998f3bfa3dfff30679f23a6353a07f..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/FileInfo.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.utils;
-
-import java.io.File;
-import java.util.Objects;
-
-/**
- * 文件信息类,提供自定义的文件对象比较方法
- *
- * @author: goujingjing
- * @see: generator dialog
- * @version: v1.0.0
- * @since 2023-01-31
- */
-public class FileInfo {
- private String name;
- private String path;
- private long lastModifiedTime;
-
- public FileInfo(File file) {
- name = file.getName();
- path = file.getPath();
- lastModifiedTime = file.lastModified();
- }
-
- /**
- * 获取文件路径
- *
- * @return 文件路径
- */
- public String getPath() {
- return path;
- }
-
- /**
- * 重写比较方法,文件名和最后修改时间都相同才认为相等(被修改覆盖过的文件也认为是新文件)
- *
- * @param obj 待比较的文件对象
- * @return 是否为相同文件
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- FileInfo fileInfo = (FileInfo) obj;
- return lastModifiedTime == fileInfo.lastModifiedTime && Objects.equals(name, fileInfo.name)
- && Objects.equals(path, fileInfo.path);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name, path, lastModifiedTime);
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/FileUtil.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/FileUtil.java
deleted file mode 100755
index 7f077beb4bd5153f8634e21df5ab891420a049a9..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/FileUtil.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.utils;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.apache.http.util.TextUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * 文本文件工具
- *
- * @author: zhaoxudong@kaihong.com
- * @see: file utils
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class FileUtil {
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private static final int COMPILE_SDK_VERSION = 5;
-
- /**
- * 获取换行符
- *
- * @return 换行符
- */
- public static String getNewline() {
- return System.getProperty("line.separator");
- }
-
- /**
- * check project SDK
- *
- * @param project projectid
- * @param baseFile project root file
- * @return boolean
- */
- public static boolean checkProjectSDK(Project project, String baseFile) {
-
- String gradlePath = "";
- File baseDir = new File(baseFile);
- if (baseDir.isDirectory()) {
- File[] childFile = baseDir.listFiles();
- assert childFile != null;
- for (File file : childFile) {
- if (file.getName().equals("build.gradle") || file.getName().equals("build-profile.json5")) {
- gradlePath = file.getPath();
- }
- }
- }
-
- Properties properties = new Properties();
- if (TextUtils.isBlank(gradlePath)) {
- GenNotification.notifyMessage(project, "项目结构中没有grandle配置文件。", "当前项目结构不支持",
- NotificationType.WARNING);
- return true;
- }
- try {
- properties.load(new FileInputStream(gradlePath));
- } catch (IOException e) {
- GenNotification.notifyMessage(project, e.getMessage(), "提示", NotificationType.ERROR);
- LOG.error(String.format("Can not load file :%s . %s", gradlePath, e));
- return true;
- }
- String ohosSDK = properties.getProperty("compileSdkVersion");
-
- if (ohosSDK != null && Integer.parseInt(ohosSDK) < COMPILE_SDK_VERSION) {
- GenNotification.notifyMessage(project, "SKD版本过低,NAPI仅支持5.0及以上版本", "提示",
- NotificationType.WARNING);
- return true;
- }
- return false;
- }
-}
diff --git a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/GenNotification.java b/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/GenNotification.java
deleted file mode 100755
index 6364d460df67bc10ca7b3ed0cadb212441da07dd..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_IntelliJ_plugin/src/com/kh/scan/utils/GenNotification.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.scan.utils;
-
-import com.intellij.ide.actions.OpenFileAction;
-import com.intellij.notification.NotificationType;
-import com.intellij.notification.Notification;
-import com.intellij.notification.NotificationGroup;
-import com.intellij.notification.NotificationAction;
-import com.intellij.notification.NotificationType;
-import com.intellij.notification.Notifications;
-import com.intellij.notification.NotificationDisplayType;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * 通知框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-10-14
- */
-public class GenNotification {
-
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private GenNotification() {
- }
-
- /**
- * 消息通知
- *
- * @param project projectId
- * @param content 提示内容
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- */
- public static void notifyMessage(@javax.annotation.Nullable Project project, String content, String title,
- NotificationType type) {
- Notification notification = new Notification("Generate.Result.Group", "Notes Message", content, type);
- notification.setTitle(title);
- notification.setContent(content);
-
- if (NotificationType.ERROR.equals(type)) {
- LOG.error(content);
- } else if (NotificationType.WARNING.equals(type)) {
- LOG.warn(content);
- } else {
- LOG.info(content);
- }
-
- Notifications.Bus.notify(notification, project);
-
- }
-
- /**
- * 消息通知
- *
- * @param project projectid
- * @param newFileList 新增文件列表
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- */
- public static void notifyGenResult(@javax.annotation.Nullable Project project, List newFileList,
- String title, NotificationType type) {
- NotificationGroup notificationGroup = new NotificationGroup("Generate.Result.Group",
- NotificationDisplayType.STICKY_BALLOON);
- Notification notification = notificationGroup.createNotification("", type);
- notification.setTitle(title);
- notification.setContent(null);
- addAction(project, newFileList, notification);
- Notifications.Bus.notify(notification, project);
- }
-
- private static void addAction(Project project, List newFileList, Notification notification) {
- LOG.info("generated file list log:");
- for (FileInfo fs : newFileList) {
- String filePath = fs.getPath();
- NotificationAction action = new NotificationAction(filePath) {
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent,
- @NotNull Notification notification) {
- OpenFileAction.openFile(filePath, project);
- }
- };
- notification.addAction(action);
-
- }
- }
-}
diff --git a/hdc/api/api_scan_vs_plugin/README_zh.md b/hdc/api/api_scan_vs_plugin/README_zh.md
deleted file mode 100755
index 46f7b81e2b40291926fa6814e87c14adb531ea58..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/README_zh.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# API扫描工具VS code插件说明
-
-## 简介
-
-API扫描工具,它可以根据用户给定三方库项目扫描输出风险接口以及.h头文件。目前工具支持VS Code插件一种入口,本文主要介绍VS Code插件使用说明。
-
-## 目录
-
- ├── api # API扫描工具
- │ ├── ... # 其他文件
- │ ├── api_scan_vs_plugin # VS Code插件代码
- │ │ ├── docs # VS Code插件说明
- │ │ ├── src # VS Code插件源码
- │ │ ├── package.json # package.json 文件
- │ │ └── README_zh.md # VS Code插件说明
-
-## 约束
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-1)移植三方库到OpenHarmony前预知风险接口或.h头文件。
-
-### 工具使用
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库项目源码,工具会输出风险接口、.h头文件。为了方便使用者快速上手工具,此处使用opencv项目为例,项目目录如下:
-
-
-
-在window环境下的,根据输入三方库项目,生成的输出文件result.xlsx,如下所示:
-
-
-
-其中生成的result.xlsx文件,sheet1为风险接口,如下所示:
-
-
-
-sheet2为风险.h头文件,如下所示:
-
-
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md b/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 91c5ea585dc9ae3e17e83003bfbdaceaabec5e32..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# API扫描工具VSCode插件使用说明
-## 简介
-
-API扫描工具目前支持一种入口,即VS Code插件,本文主要介绍VS Code插件使用说明。
-
-## VS Code插件使用方法
-
-### 说明
-
-visual studio code 版本需1.62.0及以上。
-
-### 步骤
-
-1、 打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-2、 在应用商店搜索api_scan插件,再单击安装。
-
-
-
-3、 安装完成后就会在VS Code的插件管理器中能看到API Scan这个插件了。
-
-
-
-4、 选中任意文件或文件夹,单击右键,选择API Scan选项。
-
-
-
-5、 工具打开API Scan窗口,扫描项目路径框填写将要扫描项目的绝对路径,结果输出路径框自动填写与扫描项目相同路径,使用者可以根据实际情况修改结果输出路径,然后点击ok。
-
-
-
-6、执行结束后会在结果输出路径下生成result.xlsx文件。
diff --git a/hdc/api/api_scan_vs_plugin/package.json b/hdc/api/api_scan_vs_plugin/package.json
deleted file mode 100755
index bbbd314eea5a16f8a5339369f4e3d4250c8b68da..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/package.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "api_scan_vs_plugin",
- "version": "1.0.0",
- "description": "This tool can scan the Android APIs in OpenHarmony Projects.",
- "main": "index.js",
- "directories": {
- "doc": "docs"
- },
- "dependencies": {
- "mocha": "^9.2.1",
- "node-gyp": "^8.4.1",
- "stdio": "^2.1.1",
- "typescript": "^4.5.5"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git@gitee.com:joeysun001/napi_generator.git"
- },
- "author": "",
- "license": "ISC",
- "pkg": {
- "assets": [
- "src/node_modules/typescript/**/*"
- ]
- }
-}
diff --git a/hdc/api/api_scan_vs_plugin/src/LICENSE b/hdc/api/api_scan_vs_plugin/src/LICENSE
deleted file mode 100644
index 72f817fb44de8b9fd23fe71230b9dc5ccbe4ca35..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/src/README.md b/hdc/api/api_scan_vs_plugin/src/README.md
deleted file mode 100644
index b42f82d565ed6e2312f71d7f9776511b3476478b..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# API Scan扫描工具使用说明
-
-## 简介
-
-API扫描工具,它可以扫描三方库中包含OpenHarmony源码不包含的接口,并输出result.xlsx文档。开发者移植三方库到OpenHarmony源码中,若三方库中包含一些OpenHarmony中不存在的接口,便会增加移植难度。此时可使用API扫描工具,提前预知风险接口,降低移植难度,提高开发效率。
-
-## 约束
-
-visual studio code 版本需1.62.0及以上。
-
-## 操作简介
-
-1.安装VS Code插件。
-
-2.打开任意文件夹或文件,鼠标单击右键选择“API Scan”插件。
-
-3.在窗口中填写相应参数。
-
-详细说明见[工具使用说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 合作共建
-
-[联系方式](https://www.kaihong.com/)
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/src/extension.js b/hdc/api/api_scan_vs_plugin/src/extension.js
deleted file mode 100755
index c52d9a23e2cfbaa01f0e2032de3fa1ec89962bcb..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/extension.js
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// The module 'vscode' contains the VS Code extensibility API
-// Import the module and reference it with the alias vscode in your code below
-const vscode = require('vscode');
-const fs = require('fs');
-const re = require("./gen/tools/VsPluginRe");
-const { VsPluginLog } = require("./gen/tools/VsPluginLog");
-const { detectPlatform, readFile } = require('./gen/tools/VsPluginTool');
-const path = require('path');
-var exeFilePath = null;
-const dirCache={};
-var globalPanel = null;
-
-var importToolChain = false;
-var extensionIds = [];
-var nextPluginId = null;
-// this method is called when your extension is activated
-// your extension is activated the very first time the command is executed
-
-/**
- * @param {vscode.ExtensionContext} context
- */
-function activate(context) {
- // Use the console to output diagnostic information (console.log) and errors (console.error)
- // This line of code will only be executed once when your extension is activated
- console.log('Congratulations, your extension "ApiScan" is now active!');
- let disposable = register(context, 'api_scan');
- let disposableMenu = register(context, 'api_scan_menu');
- context.subscriptions.push(disposable);
- context.subscriptions.push(disposableMenu);
- var platform = detectPlatform();
- if (platform == 'win') {
- exeFilePath = __dirname + "/search-win.exe";
- } else if (platform == 'mac') {
- exeFilePath = __dirname + "/search-macos";
- } else if (platform == 'Linux') {
- exeFilePath = __dirname + "/search-linux";
- }
-}
-
-function executorApiscan(name, genDir) {
- if (genDir == "" || genDir == null) {
- genDir = name;
- }
- var command = exeFilePath + " -d " + name + " -o " + genDir;
- var exec = require('child_process').exec;
- exec(command, function (error, stdout, stderr) {
- VsPluginLog.logInfo('VsPlugin: stdout =' + stdout + ", stderr =" + stderr);
- if (error || stdout.indexOf("errno") > 0) {
- vscode.window.showErrorMessage("genError:" + (error != null ? error : "") + stdout);
- return VsPluginLog.logError("VsPlugin:" + error + stdout);
- }
- vscode.window.showInformationMessage("Api Scan Successfully");
- });
-}
-
-function exeFileExit() {
- if (fs.existsSync(exeFilePath)) {
- return true;
- }
- return false;
-}
-
-function register(context, command) {
- let disposable = vscode.commands.registerCommand(command, function (uri, boolValue, items) {
- // The code you place here will be executed every time your command is executed
- // Display a message box to the user
- globalPanel = vscode.window.createWebviewPanel(
- 'api_scan', // Identifies the type of WebView
- 'Api Scan', // Title of the panel displayed to the user
- vscode.ViewColumn.Two, // Display the WebView panel in the form of new columns in the editor
- {
- enableScripts: true, // Enable or disable JS, default is Enable
- retainContextWhenHidden: true, // Keep the WebView state when it is hidden to avoid being reset
- }
- );
-
- if (typeof(boolValue) == 'boolean' && Array.isArray(items)) {
- if (boolValue == true) {
- //遍历数组item,查看当前插件id是数组的第几个元素,并拿出下一个元素,并判断当前id是否是最后一个元素并做相应处理
- let myExtensionId = 'kaihong.ApiScan';
- for (let i = 0; i < items.length; i++) {
- if (myExtensionId == items[i] && (i == items.length - 1)) {
- importToolChain = false;
- } else if (myExtensionId == items[i] && (i != items.length - 1)) {
- importToolChain = boolValue;
- nextPluginId = items[i + 1];
- }
- extensionIds.push(items[i]);
- }
- }
- }
-
- globalPanel.webview.html = getWebviewContent(context, importToolChain);
- let msg;
- globalPanel.webview.onDidReceiveMessage(message => {
- msg = message.msg;
- if (msg == "cancel") {
- globalPanel.dispose();
- }
- else if (msg == "api_scan") {
- checkReceiveMsg(message);
- } else {
- selectPath(globalPanel, message);
- }
- }, undefined, context.subscriptions);
- // 路径有效性判断
- if (uri.fsPath !== undefined) {
- let fn = re.getFileInPath(uri.fsPath);
- let tt = re.match("[a-zA-Z_0-9]", fn);
- var result = {
- msg: "selectASFilePath",
- path: tt ? uri.fsPath : ""
- }
- globalPanel.webview.postMessage(result);
- }
- });
- return disposable;
-}
-
-function checkReceiveMsg(message) {
- let name = message.fileNames;
- let genDir = message.genDir;
- let buttonName = message.buttonName;
- name = re.replaceAll(name, " ", "");
- if ("" == name) {
- vscode.window.showErrorMessage("Please enter the path!");
- return;
- }
- if (exeFileExit()) {
- executorApiscan(name, genDir);
- if (buttonName == 'Next') {
- startNextPlugin();
- }
- } else {
- vscode.window.showInformationMessage("Copy executable program to " + __dirname);
- }
-}
-
-/**
-* 获取插件执行命令
-*/
-function nextPluginExeCommand(nextPluginId) {
- if (nextPluginId == "kaihong.ApiScan") {
- return 'api_scan';
- } else if (nextPluginId == "kaihong.gn-gen") {
- return 'generate_gn';
- } else if (nextPluginId == "kaihong.service-gen") {
- return 'generate_service';
- } else if (nextPluginId == "kaihong.ts-gen") {
- return 'generate_ts';
- } else if (nextPluginId == "kaihong.napi-gen") {
- return 'generate_napi';
- } else {
- return null;
- }
-}
-
-/**
-* 执行完毕后开启工具链中下一个插件
-*/
-function startNextPlugin() {
- const extension = vscode.extensions.getExtension(nextPluginId);
- if (extension) {
- let startNextPlugin = nextPluginExeCommand(nextPluginId);
- try {
- vscode.commands.executeCommand(startNextPlugin, '', importToolChain, extensionIds);
- } catch (error) {
- console.error(error);
- }
- }
-}
-
-/**
-* 选择本地目录/文件夹
-*/
-function selectPath(panel, message) {
- const options = {
- canSelectMany: false,//是否可以选择多个
- canSelectFolders: true,//是否选择文件夹
- defaultUri:vscode.Uri.file(message.filePath)//默认打开本地路径
- };
-
- return vscode.window.showOpenDialog(options).then(fileUri => {
- if (fileUri && fileUri[0]) {
- console.log('Selected file: ' + fileUri[0].fsPath);
- let filePath = "";
- for (let index = 0; index < fileUri.length; index++) {
- filePath += fileUri[index].fsPath.concat(",");
- }
- var result = {
- msg: message.msg,
- path: filePath.length > 0 ? filePath.substring(0, filePath.length - 1) : filePath
- }
- panel.webview.postMessage(result);
- return fileUri[0].fsPath
- }
- });
-}
-
-// this method is called when your extension is deactivated
-function deactivate() { }
-
-function getWebviewContent(context, importToolChain) {
- let data = readFile(__dirname + '/vs_plugin_view.html');
- data = getWebViewContent(context, '/vs_plugin_view.html');
- let content = data.toString();
- if (importToolChain) {
- content = content.replace('Ok', 'Next');
- }
- return content;
-}
-
-function getWebViewContent(context, templatePath) {
- const resourcePath = path.join(context.extensionPath, templatePath);
- const dirPath = path.dirname(resourcePath);
- let html = fs.readFileSync(resourcePath, 'utf-8');
- html = html.replace(/( {
- if ($2.indexOf("https://") < 0) {
- return $1 + globalPanel.webview.asWebviewUri(vscode.Uri.file(path.resolve(dirPath, $2))) + '"';
- } else {
- return $1 + $2 + '"';
- }
- });
- return html;
-}
-
-module.exports = {
- activate,
- deactivate
-}
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginLog.js b/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginLog.js
deleted file mode 100755
index 6ce4e7e3b09ec80708e81e93c2ffd3261a60f2a4..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginLog.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-
-class VsPluginLog {
- constructor() {
- }
-}
-VsPluginLog.LEV_NONE = 0;
-VsPluginLog.LEV_ERROR = 1;
-VsPluginLog.LEV_DEBUG = 2;
-VsPluginLog.LEV_INFO = 3;
-
-const LEV_STR = ["[NON]", "[ERR]", "[DBG]", "[INF]"]
-var logLevel = VsPluginLog.LEV_ERROR;
-var logFileName = null;
-var logResultMessage = [true, ""]
-
-function getDateString() {
- let nowDate = new Date();
- return nowDate.toLocaleString();
-}
-
-function saveLog(dateStr, levStr, detail) {
- if (logFileName) {
- let logStr = dateStr + " " + levStr + " " + detail + "\n";
- fs.appendFileSync(logFileName, logStr);
- }
-}
-
-VsPluginLog.init = function (level, fileName) {
- logLevel = level in [VsPluginLog.LEV_NONE, VsPluginLog.LEV_ERROR, VsPluginLog.LEV_DEBUG, VsPluginLog.LEV_INFO]
- ? level : VsPluginLog.LEV_ERROR;
- logFileName = fileName ? fileName : "napi_generator.log";
-}
-
-function recordLog(lev, ...args) {
- let dataStr = getDateString();
- let detail = args.join(" ");
- saveLog(dataStr, LEV_STR[lev], detail);
- if (lev == VsPluginLog.LEV_ERROR) {
- logResultMessage = [false, detail];
- }
- if (logLevel < lev) return;
- VsPluginLog.logInfo(dataStr + LEV_STR[lev] + detail);
-}
-
-VsPluginLog.logError = function (...args) {
- recordLog(VsPluginLog.LEV_ERROR, args);
-}
-
-VsPluginLog.logDebug = function (...args) {
- recordLog(VsPluginLog.LEV_DEBUG, args);
-}
-
-VsPluginLog.logInfo = function (...args) {
- recordLog(VsPluginLog.LEV_INFO, args);
-}
-
-VsPluginLog.getResult = function () {
- return logResultMessage;
-}
-
-module.exports = {
- VsPluginLog
-}
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginRe.js b/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginRe.js
deleted file mode 100755
index 909d7d54ea6331ab45c2fd58ea20f2444b66f254..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginRe.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-
-function search(ss, data) {
- ss = replaceAll(ss, "\\.", "\\.")
- let reg = new RegExp(ss);
- let tt = reg.exec(data);
- if (tt == null) return null;
- let ret = { "regs": [] }
- for (let i = 0; i < tt.length; i++) {
- let p = data.indexOf(tt[i]);
- if (tt[i] == null) {
- ret["regs"].push([-1, -1])
- }
- else {
- ret["regs"].push([p, p + tt[i].length])
- }
- }
-
- return ret;
-}
-
-function match(ss, data) {
- let tt = search(ss, data)
- if (tt != null && tt.regs[0][0] == 0) return tt;
- return null;
-}
-
-function getFileInPath(tpath) {
- return path.parse(tpath).base;
-}
-
-function getPathInPath(tpath) {
- return path.parse(tpath).dir;
-}
-
-function all(sfrom) {
- return new RegExp(sfrom, "g");
-}
-
-function replaceAll(ss, sfrom, sto) {
- return ss.replace(all(sfrom), sto)
-}
-
-module.exports = {
- search,
- match,
- getFileInPath,
- getPathInPath,
- replaceAll,
- all
-}
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js b/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js
deleted file mode 100755
index c00a6a7114c5d9df6fba42dc6ff0a9170760ffb3..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const os = require('os');
-const tsc = require("../../node_modules/typescript");
-const fs = require('fs');
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-function replaceAll(s, sfrom, sto) {
- while (s.indexOf(sfrom) >= 0) {
- s = s.replace(sfrom, sto)
- }
- return s;
-}
-
-function detectPlatform() {
- if (os.type() == 'Windows_NT') {
- return 'win';
- } else if (os.type() == 'Darwin') {
- return 'mac';
- } else if (os.type() == 'Linux') {
- return 'Linux';
- }
-}
-
-function checkFileError(ifname) {
- let program = tsc.createProgram([ifname], {})
- let emitResult = program.emit();
- let allDiagnostics = tsc.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
-
- let errorMsg = ''
- allDiagnostics.forEach(diagnostic => {
- if (diagnostic.file) {
- let { line, character } = tsc.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
- let message = tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
- errorMsg += `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}\n`;
- } else {
- errorMsg += tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + "\n";
- }
- });
-
- if (allDiagnostics.length > 0) {
- return [false, errorMsg];
- }
- return [true, ""];
-}
-
-function utf8ArrayToStr(array) {
- var out, i, len, c;
- var char2, char3;
-
- out = "";
- len = array.length;
- i = 0;
- while (i < len) {
- c = array[i++];
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- out += String.fromCharCode(c);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- char2 = array[i++];
- out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- char2 = array[i++];
- char3 = array[i++];
- out += String.fromCharCode(((c & 0x0F) << 12) |
- ((char2 & 0x3F) << 6) |
- ((char3 & 0x3F) << 0));
- break;
- }
- }
-
- return out;
- }
-
- function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
- }
-
-module.exports = {
- replaceAll,
- detectPlatform,
- checkFileError,
- readFile
-}
\ No newline at end of file
diff --git a/hdc/api/api_scan_vs_plugin/src/images/APIScan.png b/hdc/api/api_scan_vs_plugin/src/images/APIScan.png
deleted file mode 100644
index 170d094f65402ae674bb746ccbba8a1d57e3ce09..0000000000000000000000000000000000000000
Binary files a/hdc/api/api_scan_vs_plugin/src/images/APIScan.png and /dev/null differ
diff --git a/hdc/api/api_scan_vs_plugin/src/images/file.png b/hdc/api/api_scan_vs_plugin/src/images/file.png
deleted file mode 100755
index f5c365a02e99414acb29c643fc2d64d150cff9f0..0000000000000000000000000000000000000000
Binary files a/hdc/api/api_scan_vs_plugin/src/images/file.png and /dev/null differ
diff --git a/hdc/api/api_scan_vs_plugin/src/images/path.png b/hdc/api/api_scan_vs_plugin/src/images/path.png
deleted file mode 100755
index 56f408a584f243956fab1916d9152f34364cdf78..0000000000000000000000000000000000000000
Binary files a/hdc/api/api_scan_vs_plugin/src/images/path.png and /dev/null differ
diff --git a/hdc/api/api_scan_vs_plugin/src/jsconfig.json b/hdc/api/api_scan_vs_plugin/src/jsconfig.json
deleted file mode 100755
index 53b981c57b79a7a2dac9995ee4ce04b8c94e0b17..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/jsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "ES2020",
- "checkJs": true, /* Typecheck .js files. */
- "lib": [
- "ES2020"
- ]
- },
- "exclude": [
- "node_modules"
- ]
-}
diff --git a/hdc/api/api_scan_vs_plugin/src/package.json b/hdc/api/api_scan_vs_plugin/src/package.json
deleted file mode 100755
index 7471d18fc3d68c2ae9d940e9ad52f0ebf3509f67..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/package.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "name": "ApiScan",
- "displayName": "API Scan",
- "description": "This tool can scan the Android APIs in OpenHarmony Projects",
- "keywords": [
- "api_scan",
- "api"
- ],
- "icon": "images/APIScan.png",
- "version": "0.0.1",
- "engines": {
- "vscode": "^1.62.0"
- },
- "categories": [
- "Other"
- ],
- "activationEvents": [
- "onStartupFinished"
- ],
- "publisher": "kaihong",
- "main": "./extension.js",
- "contributes": {
- "commands": [
- {
- "command": "api_scan",
- "title": "API Scan"
- },
- {
- "command": "api_scan_menu",
- "title": "API Scan"
- }
- ],
- "menus": {
- "explorer/context": [
- {
- "when": "resourceScheme == file",
- "command": "api_scan"
- }
- ],
- "editor/context": [
- {
- "command": "api_scan_menu"
- }
- ]
- }
- },
- "scripts": {
- "lint": "eslint .",
- "pretest": "npm run lint",
- "test": "node ./test/runTest.js"
- },
- "devDependencies": {
- "@types/glob": "^7.1.4",
- "@types/mocha": "^9.0.0",
- "@types/node": "14.x",
- "@types/vscode": "^1.62.0",
- "@vscode/test-electron": "^1.6.2",
- "eslint": "^8.1.0",
- "glob": "^7.1.7",
- "mocha": "^9.1.3",
- "webpack": "^5.64.4",
- "webpack-cli": "^4.9.1"
- },
- "dependencies": {
- "compressing": "^1.5.1",
- "node-gyp": "^9.0.0",
- "stdio": "^2.1.1",
- "typescript": "^4.8.4",
- "vsce": "^2.11.0"
- },
- "repository": {
- "type": "gitee",
- "url": "https://gitee.com/openharmony/napi_generator/tree/master/hdc/api"
- }
-}
diff --git a/hdc/api/api_scan_vs_plugin/src/vs_plugin_view.html b/hdc/api/api_scan_vs_plugin/src/vs_plugin_view.html
deleted file mode 100755
index 4a66dee2cea167dd67b8de27a283b3c8ffd63c19..0000000000000000000000000000000000000000
--- a/hdc/api/api_scan_vs_plugin/src/vs_plugin_view.html
+++ /dev/null
@@ -1,203 +0,0 @@
-
-
-
-
-
-
- Napi
-
-
-
-
-
-
-
-
-
api-scan
-
-
- 扫描项目路径:
-
-
-
-
-
- 结果输出路径:
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/api/docs/INSTRUCTION_ZH.md b/hdc/api/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 54e5b6de6b54b9cba1652cb7d004288d1d974d5f..0000000000000000000000000000000000000000
--- a/hdc/api/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# API扫描工具使用说明
-## 简介
-
-API扫描工具支持一种入口,即VS Code插件,使用者可以根据自己的需要下载工具使用。
-
-VS Code插件可在VS Code插件市场直接下载。
-
-## 工具介绍
-
-通过API扫描工具,开发者可以扫描输出三方库中存在,而OpenHarmony源码中不存在的风险接口,移植之前预知风险,降低移植难度,提高开发效率。
-
-
-
-## 生成result文件
-
-### VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[VS插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md)
-
diff --git a/hdc/api/figures/DevEco_step_apiPlugins.png b/hdc/api/figures/DevEco_step_apiPlugins.png
deleted file mode 100755
index 87e14428d55dcb4d7755527a42b7629df8603cf0..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_apiPlugins.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_api_ok.png b/hdc/api/figures/DevEco_step_api_ok.png
deleted file mode 100755
index 3b1c59736060ae827a143b64ca9ad69a4644eb05..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_api_ok.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_apiscan.png b/hdc/api/figures/DevEco_step_apiscan.png
deleted file mode 100755
index e811593cb71755c1babf04cb6280736842a12498..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_apiscan.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_finish.png b/hdc/api/figures/DevEco_step_finish.png
deleted file mode 100755
index b02a3bd8ab283840a1401131153e1b67d83dd772..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_finish.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_firstNext.png b/hdc/api/figures/DevEco_step_firstNext.png
deleted file mode 100755
index 812504617e554fa1985f1bda04fa2af3b122a4a0..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_firstNext.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_newFile.png b/hdc/api/figures/DevEco_step_newFile.png
deleted file mode 100755
index 3b69aa21918c6a0377fad1e9dfdc6f702d046510..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_newFile.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_pluginsOk.png b/hdc/api/figures/DevEco_step_pluginsOk.png
deleted file mode 100755
index b5b783f70c60e3f60c9d3be287925da4d11d8592..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_pluginsOk.png and /dev/null differ
diff --git a/hdc/api/figures/DevEco_step_project.png b/hdc/api/figures/DevEco_step_project.png
deleted file mode 100755
index 1376085535222a681660e1ec1805aec629b5926e..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/DevEco_step_project.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_Proj_Module.png b/hdc/api/figures/IntelliJ_env_Proj_Module.png
deleted file mode 100755
index 10e6d48e7f611a32abf6c6a48f435c73263aba60..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_Proj_Module.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_Proj_Module_New.png b/hdc/api/figures/IntelliJ_env_Proj_Module_New.png
deleted file mode 100755
index d8c180413b38fbd8e8e5c21116612ea400671f07..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_Proj_Module_New.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_built_jar.png b/hdc/api/figures/IntelliJ_env_built_jar.png
deleted file mode 100755
index 383c2bcb94a5d2ff3e66ac52189693989adcbee3..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_built_jar.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_built_jar_success.png b/hdc/api/figures/IntelliJ_env_built_jar_success.png
deleted file mode 100755
index 9b118268cb84b6a186b22fc85be353cb7afdb0cd..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_built_jar_success.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_built_pro.png b/hdc/api/figures/IntelliJ_env_built_pro.png
deleted file mode 100755
index 6669efb0511c68538e0fe36cff8c6cc7fe49ca7f..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_built_pro.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_config_SDKs.png b/hdc/api/figures/IntelliJ_env_config_SDKs.png
deleted file mode 100755
index 1f026eac672bfa70968ac36802c72442383868e2..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_config_SDKs.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_config_open_proj.png b/hdc/api/figures/IntelliJ_env_config_open_proj.png
deleted file mode 100755
index ba8b0c6aaac7235e82521267d988468f3d6a8ea3..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_config_open_proj.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_configurations.png b/hdc/api/figures/IntelliJ_env_configurations.png
deleted file mode 100755
index 88912da6ffa083640e033ce1dd56302d3b202bcf..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_configurations.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_module_root.png b/hdc/api/figures/IntelliJ_env_module_root.png
deleted file mode 100755
index 93fb1672c83500058bec23f184fea6c5ca547328..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_module_root.png and /dev/null differ
diff --git a/hdc/api/figures/IntelliJ_env_proj_structure.png b/hdc/api/figures/IntelliJ_env_proj_structure.png
deleted file mode 100755
index 732efe349051f1d060311096019f52cce0524799..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/IntelliJ_env_proj_structure.png and /dev/null differ
diff --git a/hdc/api/figures/opencv.png b/hdc/api/figures/opencv.png
deleted file mode 100755
index 25b65bf93415eafe4a0551a6f1ec5739d80d49f1..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/opencv.png and /dev/null differ
diff --git a/hdc/api/figures/opencv_h.png b/hdc/api/figures/opencv_h.png
deleted file mode 100755
index fcbc3c84be529df201d3e223a4191c841dd04065..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/opencv_h.png and /dev/null differ
diff --git a/hdc/api/figures/opencv_include.png b/hdc/api/figures/opencv_include.png
deleted file mode 100755
index b902646dbe5dc3f2a7a242206252b2f1976ab2a2..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/opencv_include.png and /dev/null differ
diff --git a/hdc/api/figures/opencv_result.png b/hdc/api/figures/opencv_result.png
deleted file mode 100755
index 99a26fff5c4dd077abea38616666182b4025b715..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/opencv_result.png and /dev/null differ
diff --git a/hdc/api/figures/pic-api-frame.png b/hdc/api/figures/pic-api-frame.png
deleted file mode 100755
index 54fc76bb2e52188ee41db756916b0954caf555cc..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic-api-frame.png and /dev/null differ
diff --git a/hdc/api/figures/pic-api-frm.png b/hdc/api/figures/pic-api-frm.png
deleted file mode 100644
index 5c2e370e2c5d908059203203d3c7ae8a295b1eb5..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic-api-frm.png and /dev/null differ
diff --git a/hdc/api/figures/pic-plug-in-api-c++.png b/hdc/api/figures/pic-plug-in-api-c++.png
deleted file mode 100755
index 7d9b3c44745600f21761520c9adc30c0fd6614a8..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic-plug-in-api-c++.png and /dev/null differ
diff --git a/hdc/api/figures/pic-plug-in-api.png b/hdc/api/figures/pic-plug-in-api.png
deleted file mode 100755
index f153ed1df467e723ecdfc969a52b86449575002e..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic-plug-in-api.png and /dev/null differ
diff --git a/hdc/api/figures/pic-plug-in-search.png b/hdc/api/figures/pic-plug-in-search.png
deleted file mode 100755
index e07f4d60a8af69af2f72582ca74b3e6bdba8d1b8..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic-plug-in-search.png and /dev/null differ
diff --git a/hdc/api/figures/pic-plug-in-select.png b/hdc/api/figures/pic-plug-in-select.png
deleted file mode 100755
index be87ce8274eb6142a74dc47ae5d993c459732a88..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic-plug-in-select.png and /dev/null differ
diff --git a/hdc/api/figures/pic_admin.png b/hdc/api/figures/pic_admin.png
deleted file mode 100644
index 47dac015dd5490a280f07b467d71b7c3bec4e615..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/pic_admin.png and /dev/null differ
diff --git a/hdc/api/figures/result_open.png b/hdc/api/figures/result_open.png
deleted file mode 100755
index 108a29a374c438693315b6f6c9effb899f933af3..0000000000000000000000000000000000000000
Binary files a/hdc/api/figures/result_open.png and /dev/null differ
diff --git a/hdc/api/src/package.json b/hdc/api/src/package.json
deleted file mode 100755
index 507d800a7ba5fbc907bed3bd4dfa5a1b692aa0be..0000000000000000000000000000000000000000
--- a/hdc/api/src/package.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "search",
- "version": "1.0.0",
- "description": "",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "ISC",
- "dependencies": {
- "stdio": "^2.1.1",
- "typescript": "^4.8.4",
- "xlsx": "^0.18.5"
- },
- "bin": "./scan.js",
- "pkg": {
- "assets": [
- "node_modules/typescript/**/*",
- "./*.xlsx"
- ]
- }
-}
diff --git a/hdc/api/src/scan.js b/hdc/api/src/scan.js
deleted file mode 100755
index 2db1d8b8de74a7e6e6732ee03edbb4abb0761154..0000000000000000000000000000000000000000
--- a/hdc/api/src/scan.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const xlsx = require("xlsx");
-const fs = require("fs");
-const path = require("path");
-const stdio = require("stdio");
-
-let ops = stdio.getopt({
- 'directory': { key: 'd', args: 1, description: "scan directory" },
- 'output': { key: 'o', args: 1, description: "output directory", default: "." },
-});
-
-let distDir = ops.directory;
-let outDir = ops.output;
-
-function union(a, b) {
- let ret = new Set();
- a.forEach((n1) => {
- ret.add(n1);
- });
- b.forEach((n1) => {
- ret.add(n1);
- });
- return ret;
-}
-
-function intersection(a, b) {
- let ret = new Set();
- a.forEach((n1) => {
- if (b.has(n1)) {
- ret.add(n1);
- }
- })
- return ret;
-}
-
-function collectFromSheet(sheet) {
- let row = 2;
- let collectInclude = new Set()
- let collectFunction = new Set()
- while (true) {
- let idx = "B" + row;
- if (!(idx in sheet)) {
- break;
- }
- collectInclude.add(sheet[idx].w);
-
- if (sheet["C" + row].w == "Function") {
- collectFunction.add(sheet["D" + row].w);
- }
- row += 1;
- }
- return [collectInclude, collectFunction]
-}
-let wb = xlsx.readFile(path.join(__dirname, "Andr_N_Games_api.xlsx"));
-
-let c1 = collectFromSheet(wb.Sheets.Games);
-let c2 = collectFromSheet(wb.Sheets.N);
-
-let androidFeature = {
- include: union(c1[0], c2[0]),
- function: union(c1[1], c2[1]),
-}
-//////////////////////////////////////////////////////
-
-let projectFiles = {
- c: [],
- cpp: [],
- h: [],
-}
-
-let projectFeature = {
- "function": new Set(),
- "include": new Set()
-}
-
-function collectFromFile(fn) {
- let data = fs.readFileSync(fn, { encoding: "utf8" });
-
- for (let ss of data.matchAll(/([A-Za-z_][A-Za-z0-9_]*) *\(/g)) {
- projectFeature["function"].add(ss[1]);
- }
-
- for (let ss of data.matchAll(/# *include *(<|") *([A-Za-z_][A-Za-z0-9_\-/]*(.h(pp)*)*) *(>|")/g)) {
- let s = ss[2].split("/");
- s = s[s.length - 1];
- projectFeature["include"].add(s);
- }
-}
-
-function collectFile (pth, f) {
- let fn = path.join(pth, f);
- let st;
- try {
- st = fs.statSync(fn);
- } catch(err){
- return;
- }
- if (st.isDirectory()) {
- collectFeature(fn);
- }
- else if (st.isFile()) {
- if (f.endsWith(".h")) {
- projectFiles.h.push(fn);
- collectFromFile(fn);
- }
- else if (f.endsWith(".cpp")) {
- projectFiles.cpp.push(fn);
- collectFromFile(fn);
- }
- else if (f.endsWith(".c")) {
- projectFiles.c.push(fn);
- collectFromFile(fn);
- }
- }
-}
-
-function collectFeature(pth) {
- let files = fs.readdirSync(pth);
-
- for (let f of files) {
- collectFile(pth, f);
- }
-}
-
-collectFeature(distDir)
-
-let result = {
- function: intersection(androidFeature["function"], projectFeature["function"]),
- include: intersection(androidFeature["include"], projectFeature["include"]),
-}
-console.log(result);
-///////////////////////////////save to excel
-function string2u8buff(s) {
- let buf = new ArrayBuffer(s.length);
- let view = new Uint8Array(buf);
- for (let i = 0; i !== s.length; ++i) {
- view[i] = s.charCodeAt(i) & 0xff;
- }
- return view;
-}
-
-let wopts = {
- bookType: "xlsx",
- bookSST: false,
- type: 'binary'
-};
-let workbook = xlsx.utils.book_new();
-
-let s1 = []
-for (let f of result.function) {
- s1.push({ function: f })
-}
-let sheet1 = xlsx.utils.json_to_sheet(s1);
-xlsx.utils.book_append_sheet(workbook, sheet1, 'sheet1');
-
-let s2 = []
-for (let f of result.include) {
- s2.push({ include: f })
-}
-let sheet2 = xlsx.utils.json_to_sheet(s2);
-xlsx.utils.book_append_sheet(workbook, sheet2, 'sheet2');
-
-let wbout = xlsx.write(workbook, wopts);
-let ddd = string2u8buff(wbout);
-let outPath = path.join(outDir, "result.xlsx");
-console.log("output:", outPath);
-fs.writeFileSync(outPath, ddd);
diff --git a/hdc/appCodeGen/src/analyze.js b/hdc/appCodeGen/src/analyze.js
deleted file mode 100755
index e8e71a7531fbc45bee1de740a65d00de7669a848..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("./tools/re");
-const { removeExplains, removeEmptyLine, replaceTab, checkOutBody, getLicense } = require("./tools/tool");
-const { NumberIncrease } = require("./tools/common");
-const { readFile } = require("./tools/FileRW");
-
-const { analyzeNamespace } = require("./analyze/namespace");
-const { NapiLog } = require("./tools/NapiLog");
-
-function analyzeFile(fn) {
- NumberIncrease.reset();
- let data = readFile(fn);
- let licenseData = getLicense(data)
- // 去除注释
- data = removeExplains(data)
- // 去除空行
- data = removeEmptyLine(data)
- // 去除Tab
- data = replaceTab(data)
- let result = {
- exportDefault: [],
- exports: [],
- imports:[],
- declareType: [],
- declareFunction: [],
- declareNamespace: [],
- declareInterface: [],
- declareLicense: [],
- }
- while (true) {
- // import
- let matchImport = re.search("import ([{}A-Za-z ,]+) from [\"']{1}([@_./a-zA-Z]+)[\"']{1};*", data);
- if (matchImport != null) {
- result.imports.push(re.getReg(data, matchImport.regs[0]))
- data = re.removeReg(data, matchImport.regs[0]);
- }
- else break;
- }
-
- if (null != licenseData) {
- result.declareLicense.push(licenseData)
- }
- return analyze(data, result)
-}
-
-function analyze(data, result) {
- while (true) {
- let oldData = data
- data = removeEmptyLine(data)
- let matchs = re.match(" *\n*", data)
- // 只剩下空格和回车时,解析完成
- if (matchs && matchs.regs[0][1] == data.length) break
- matchs = re.match("export default ([a-zA-Z0-9_]+);", data);
- if (matchs != null) {
- let exportName = re.getReg(data, matchs.regs[1])
- data = re.removeReg(data, matchs.regs[0]);
- result.exportDefault.push(exportName)
- }
- data = re.replaceAll(data, "\n{", "{");
- let matchType = analyzeMatchType(matchs, data, result)
- if (matchType != null) {
- data = matchType[0]
- if (matchType[1] != null) {
- result = matchType[1]
- }
- }
- let namespace = analyzeMatchNamespace(matchs, data, result)
- if (namespace != null) {
- data = namespace[0]
- result = namespace[1]
- }
- let interface = analyzeMatchInterface(matchs, data, result)
- if (interface != null) {
- data = interface[0]
- result = interface[1]
- }
- let functionMatch = analyzeMatchFunction(matchs, data, result)
- if (functionMatch != null) {
- data = functionMatch[0]
- result = functionMatch[1]
- }
- if (oldData == data) {
- NapiLog.logError("\nvvv 解析文件失败 vvv");
- NapiLog.logError("[", data.substring(0, data.length > 64 ? 64 : data.length), "]");
- break;
- }
- }
- return result
-}
-
-function analyzeMatchNamespace(matchs, data, result) {
- matchs = re.match("declare namespace ([a-zA-Z_0-9]+) *({)", data);
- // 解析declare
- if (matchs != null) {
- let namespaceName = re.getReg(data, matchs.regs[1])
- let namespaceData = checkOutBody(data, matchs.regs[2][0], null, true)
- data = data.substring(matchs.regs[2][1] + namespaceData.length + 1, data.length)
- result.declareNamespace.push({
- name: namespaceName,
- body: analyzeNamespace(namespaceData)
- })
- }
- return [data, result]
-}
-
-function analyzeMatchInterface(matchs, data, result) {
- matchs = re.match("(export )*(declare )*interface ([A-Za-z_0-9<>= ]+) (extends [a-zA-Z]+ )*({)", data)
- if (matchs) {
- let interfaceName = re.getReg(data, matchs.regs[3])
- let interfaceData = checkOutBody(data, matchs.regs[5][0], null, true)
- data = data.substring(matchs.regs[5][1] + interfaceData.length + 1, data.length)
- result.declareInterface.push({
- name: interfaceName,
- body: {}
- })
- }
- return [data, result]
-}
-
-function analyzeMatchFunction(matchs, data, result) {
- matchs = re.match("declare function ([A-Za-z0-9_]+)\\(([\n a-zA-Z:;=,_0-9?<>{}|]*)\\) *:"
- + "*([A-Za-z0-9_<>{}:, .]+);*", data)
- if (matchs) {
- let functionName = re.getReg(data, matchs.regs[1])
- let functionBody = re.getReg(data, matchs.regs[2])
- data = re.removeReg(data, matchs.regs[0])
- result.declareFunction.push({
- name: functionName,
- body: functionBody
- })
- }
- return [data, result]
-}
-
-function analyzeMatchType(matchs, data, result) {
- matchs = re.match("(export )*type ([a-zA-Z]+) *= *([()a-zA-Z :=>,\"| ]+);", data)
- if (matchs) {
- let exportName = re.getReg(data, matchs.regs[2])
- let exportBody = re.getReg(data, matchs.regs[3])
- data = re.removeReg(data, matchs.regs[0]);
- result.declareType.push({
- name: exportName,
- body: exportBody
- })
- if (matchs.regs[1][0] != -1) {
- result.exports.push(exportName)
- }
- }
-
- matchs = re.match("(export )*type ([a-zA-Z]+) *= *(\n{)", data)
- if (matchs) {
- let exportName = re.getReg(data, matchs.regs[2])
- let exportBody = checkOutBody(data, matchs.regs[3][0], null, true)
- data = data.substring(matchs.regs[3][1] + exportBody.length + 2, data.length)
- result.declareType.push({
- name: exportName,
- body: exportBody
- })
- if (matchs.regs[1][0] != -1) {
- result.exports.push(exportName)
- }
- }
- return [data, result]
-}
-
-module.exports = {
- analyzeFile
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/analyze/enum.js b/hdc/appCodeGen/src/analyze/enum.js
deleted file mode 100755
index a7f288080c50b515caee2ee2375824b5c3fdc893..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/enum.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const { NumberIncrease } = require("../tools/common");
-const re = require("../tools/re");
-
-/** Enum解析 */
-function analyzeEnum(data) {
- let body = re.replaceAll(data, "\n", "").split(",")
- let result = {
- element: [],
- function: [],
- enumValueType: 0 // 0代表数字,1代表字符串
- }
- for (let i in body) {
- let bodyContent = body[i]
- while (bodyContent.length > 0 && bodyContent[0] == ' ') {
- bodyContent = bodyContent.substring(1, bodyContent.length)
- }
- while (bodyContent.length > 0 && bodyContent[-1] == ' ') {
- bodyContent = bodyContent.substring(0, bodyContent.length - 1)
- }
- if (bodyContent == "") {
- break
- }
- analyzeEnumResult(result, bodyContent, i)
- }
- return result
-}
-
-function analyzeEnumResult(result, bodyContent, index) {
- let regString = re.match(" *([a-zA-Z0-9_]+) * = *\"([\x21-\x7e]+)*\"", bodyContent)
- let regSingleQuotes = re.match(" *([a-zA-Z0-9_]+) * = *'([\x21-\x7e]+)*'", bodyContent)
- let regNumber = re.match(" *([a-zA-Z0-9_]+) * = *([a-zA-Z_0-9<>-]+)", bodyContent)
- let reg = re.match(" *([a-zA-Z0-9_]+) *", bodyContent)
- if (regString) {
- let elementName = re.getReg(bodyContent, regString.regs[1])
- let elementValue = re.getReg(bodyContent, regString.regs[2])
- result.element.push({
- name: elementName,
- value: elementValue,
- type: 'string'
- })
- result.enumValueType = 1
- } else if (regSingleQuotes) {
- let elementName = re.getReg(bodyContent, regSingleQuotes.regs[1])
- let elementValue = re.getReg(bodyContent, regSingleQuotes.regs[2])
- result.element.push({
- name: elementName,
- value: elementValue,
- type: 'string'
- })
- result.enumValueType = 1
- } else if (regNumber) {
- let elementName = re.getReg(bodyContent, regNumber.regs[1])
- let elementValue = re.getReg(bodyContent, regNumber.regs[2])
- typeof (elementValue)
- result.element.push({
- name: elementName,
- value: elementValue,
- type: "NUMBER_TYPE_" + NumberIncrease.getAndIncrease()
- })
- result.enumValueType = 0
- } else if (reg) {
- let elementName = re.getReg(bodyContent, reg.regs[1])
- let elementValue = index
- result.element.push({
- name: elementName,
- value: elementValue,
- type: "NUMBER_TYPE_" + NumberIncrease.getAndIncrease()
- })
- result.enumValueType = 0
- }
- return result
-}
-
-module.exports = {
- analyzeEnum,
- analyzeEnumResult
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/analyze/function.js b/hdc/appCodeGen/src/analyze/function.js
deleted file mode 100755
index c8bf59e15b965971732712a693156f457f4d9e5e..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/function.js
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("../tools/re");
-const { FuncType, NumberIncrease, isEnum, EnumValueType, enumIndex, isType, typeIndex, isOnObjCallback,
- getOnObjCallbackType, getLogErrInfo } = require("../tools/common");
-const { analyzeParams } = require("./params");
-const { analyzeReturn } = require("./return");
-const { NapiLog } = require("../tools/NapiLog");
-const { randomInt } = require("crypto");
-const { print } = require("../tools/tool");
-
-function analyzeSubInterface(data) {
- let body = re.replaceAll(data, "\n", "").split(";") // # replace(" ", "").
- let result = {
- value: [],
- function: [],
- parentNameList: [],
- childList: [],
- parentList: []
- }
- for (let i in body) {
- let t = body[i]
- while (t.length > 0 && t[0] === ' ') // 去除前面的空格
- t = t.substring(1, t.length)
- while (t.length > 0 && t[-1] === ' ') // 去除后面的空格
- t = t.substring(0, t.length - 1)
- if (t === "") break // 如果t为空直接返回
- let tt = re.match(" *([a-zA-Z0-9_]+) *: *([a-zA-Z_0-9<>,:{}[\\] ]+)", t)
- if (tt) { // 变量
-
- let valueName = re.getReg(t, tt.regs[1])
- let valueType = re.getReg(t, tt.regs[2])
- let index = valueType.indexOf("number")
- while (index !== -1) {
- valueType = valueType.replace("number", "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- index = valueType.indexOf("number")
- }
- result.value.push({
- name: valueName,
- type: valueType
- })
- }
- }
- return result
-}
-
-function getFuncParaType(v, interfaceName, data, results) {
- let arrayType = re.match("(Async)*Callback<(Array<([a-zA-Z_0-9]+)>)>", v["type"])
- let parameter = v["type"]
- if (arrayType) {
- parameter = re.getReg(v["type"], arrayType.regs[2])
- }
- if (isEnum(parameter, data)) {
- let index = enumIndex(parameter, data)
- if (data.enum[index].body.enumValueType === EnumValueType.ENUM_VALUE_TYPE_NUMBER) {
- v["type"] = v["type"].replace(parameter, "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- } else if (data.enum[index].body.enumValueType === EnumValueType.ENUM_VALUE_TYPE_STRING) {
- v["type"] = v["type"].replace(parameter, "string")
- } else {
- NapiLog.logError("analyzeFunction getFuncParaType is not support this type %s."
- .format(data.enum[index].body.enumValueType), getLogErrInfo);
- return null
- }
- }
- // interface & class中的方法参数类型是enum的情况
- else if (isEnum(parameter, results)) {
- let index = enumIndex(parameter, results)
- if (results.enum[index].body.enumValueType === EnumValueType.ENUM_VALUE_TYPE_NUMBER) {
- v["type"] = v["type"].replace(parameter, "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- } else if (results.enum[index].body.enumValueType === EnumValueType.ENUM_VALUE_TYPE_STRING) {
- v["type"] = v["type"].replace(parameter, "string")
- } else {
- NapiLog.logError("analyzeFunction getFuncParaType is not support this type %s."
- .format(results.enum[index].body.enumValueType), getLogErrInfo());
- return null
- }
- }
-
- let interfaceType = re.match("{([A-Za-z0-9_]+:[A-Za-z0-9_,]+)([A-Za-z0-9_]+:[A-Za-z0-9_]+)}$", v["type"])
- if (interfaceType) {
- v["type"] = interfaceName
- }
-
- if (parameter.indexOf("number") >= 0) {
- v["type"] = v["type"].replace("number", "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- }
-
- // type的处理
- if (isType(parameter, data)) {
- let index = typeIndex(parameter, data)
- if (data.type[index].isEnum) {
- v["type"] = v["type"].replace(parameter, "string")
- }
- }
- return v
-}
-
-function analyzeFuncNoNameInterface(data, values, results) {
- values = re.replaceAll(re.replaceAll(values, " ", ""), "\n", "")
- let interfaceName = ""
- let matchNoName = "([:{<}>,;a-zA-Z_0-9]*)\\?*(:[A-Za-z0-9_,;]*)?:((Async)*Callback<)?{(([A-Za-z0-9_]+:"+
- "[A-Za-z0-9_,;]+)*)([A-Za-z0-9_]+:[A-Za-z0-9_]+)}(}|,|;|>)?$"
- let matchs = re.match(matchNoName, values)
- if (matchs) {
- let st = values.lastIndexOf("{")
- let end = values.indexOf("}")
- let number = NumberIncrease.getAndIncrease();
- interfaceName = "AUTO_INTERFACE_%s".format(number)
- let interfaceBody = values.substring(st+1, end)
- let typeInterface = "{%s}".format(interfaceBody)
- values = re.replaceAll(values, typeInterface, interfaceName)
- interfaceBody = re.replaceAll(interfaceBody, ",", ";")
- if (Object.prototype.hasOwnProperty.call(data, "interface")) {
- data.interface.push({
- name: interfaceName,
- body: analyzeSubInterface(interfaceBody)
- })
- } else if (Object.prototype.hasOwnProperty.call(results, "interface")) {
- results.interface.push({
- name: interfaceName,
- body: analyzeSubInterface(interfaceBody)
- })
- }
- }
-
- matchs = re.match(matchNoName, values)
- if(matchs) {
- let resNoNameInter = analyzeFuncNoNameInterface(data, values)
- values = resNoNameInter.values
- }
-
- let result = {
- interfaceName: interfaceName,
- values: values
- }
- return result
-}
-
-function analyseSubReturn(ret, data, results) {
- // 匿名interface返回值 function fun4(input: string): { read: number; written: number };
- let tt = null
- if (ret.indexOf(":") > 0) {
- ret = re.replaceAll(re.replaceAll(ret, " ", ""), "\n", "")
- ret = re.replaceAll(ret, ",", ";")
- ret = ret.substring(1, ret.length - 1)
- tt = ret.split(";")
- }
- if (tt) {
- let len = tt.length
- let res = ""
- let interfaceName = ""
- for (let i=0; i= 0) {
- ret = ret.replaceAll("number", "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- }
- return ret
-}
-
-function getObjCallFunc(results, onObjCbType, values, ret) {
- if (results !== undefined) {
- results.callFunction.push({
- "name": onObjCbType,
- "body": values,
- "ret": ret
- })
- }
-}
-function getFuncResult(name, funcType, values, ret, isStatic) {
- let result = {
- name: name,
- type: funcType,
- value: values,
- ret: ret,
- isStatic: isStatic
- }
- return result
-}
-
-function getArrowCallFunc(tmp, results) {
- let callbackFunc = null
-
- if (tmp[2][0] !== undefined) {
- callbackFunc = tmp[2][0] // 当方法的参数是回调方法,并且回调方法写法为=>函数
- }
- if (results !== undefined && callbackFunc !== null) {
- results.callFunction.push(callbackFunc)
- }
-}
-
-/**函数解析 */
-function analyzeFunction(data, isStatic, name, values, ret, results, interfaceName = '') {
- let res = analyzeFuncNoNameInterface(data, values, results)
- let tmp
- let funcType
-
- if (res) {
- tmp = analyzeParams(name, res.values)
- if (tmp !== null) {
- values = tmp[0]
- funcType = tmp[1]
- getArrowCallFunc(tmp, results)
- }
- }
-
- tmp = analyzeReturn(ret)
- ret = tmp[0]
- if (tmp[1]) { // 返回类型为 Promise, 解析成等价的AsyncCallback方法
- funcType = FuncType.ASYNC
- // 返回值是Promise的匿名interface
- let paramTypeVal = analyseSubReturn(ret.substring(8, ret.length - 1), data, results);
- // 将返回值Promise改为AsyncCallback,作为方法的入参
- let paramType = ret.replace("Promise", "AsyncCallback")
- if (paramTypeVal) {
- // 匿名interface处理
- let paramAsync = paramType.substring(14, paramType.length - 1)
- paramType = paramType.replace(paramAsync, paramTypeVal);
- }
- values.push({name: "promise", optional: false, type: paramType})
- ret = "void" // 返回值由Promise改为void,与AsyncCallback接口保持一致
- }
- for (let j in values) {
- let v = values[j]
- v = getFuncParaType(v, res.interfaceName, data, results)
- if (v === null) {
- NapiLog.logError("analyzeFunction is not support this type %s.".format(v), getLogErrInfo());
- }
- }
- ret = analyseSubReturn(ret, data, results)
- let result = getFuncResult(name, funcType, values, ret, isStatic)
- if (isOnObjCallback(name)) {
- let onObjCbType = getOnObjCallbackType(name, interfaceName)
- getObjCallFunc(results, onObjCbType, values, ret)
- }
- return result
-}
-
-module.exports = {
- analyzeFunction,
- analyzeSubInterface,
- getFuncParaType,
- analyzeFuncNoNameInterface,
- analyseSubReturn
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/analyze/interface.js b/hdc/appCodeGen/src/analyze/interface.js
deleted file mode 100755
index 1796e486fcf2a37e85f43078792bbbb4aeba7595..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/interface.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("../tools/re");
-const { NumberIncrease } = require("../tools/common");
-const { addUniqFunc2List } = require("../tools/tool");
-const { analyzeFunction } = require("./function");
-
-/* 匿名interface */
-function analyzeNoNameInterface(valueType, valueName, rsltInterface) {
- valueType = re.replaceAll(valueType, " ", "")
- let matchs = re.match("{(([A-Za-z0-9_]+:[A-Za-z0-9_,;]+)*)([A-Za-z0-9_]+:[A-Za-z0-9_]+)}$", valueType)
- if (matchs) {
- let number = NumberIncrease.getAndIncrease();
- let interfaceTypeName = 'AUTO_INTERFACE_%s_%s'.format(valueName, number)
- let interfaceBody = valueType.substring(1, valueType.length-1)
- interfaceBody = re.replaceAll(interfaceBody, ",", ";\n")
- rsltInterface.push({
- name: interfaceTypeName,
- body: analyzeInterface(interfaceBody, rsltInterface)
- })
- valueType = interfaceTypeName
- }
- return valueType
-}
-
-/* 去除单行注释// */
-function parseNotes(data) {
- let notes = data.indexOf("//") >= 0 ? data.substring(data.indexOf("//"), data.length) : "";
- while(notes != "") {
- notes = notes.substring(0, notes.indexOf("\n"));
- data = data.replace(notes, "");
- notes = ""
- let st = data.indexOf("//");
- if(st >= 0) {
- notes = data.substring(st, data.length);
- }
- }
- return data
-}
-
-/**interface解析 */
-function analyzeInterface(data, rsltInterface = null, results, interfaceName = '') { // same as class
- let body = data
- body = body.indexOf("//") < 0 ? body : parseNotes(body)
- let arr = [...body.matchAll(/;\s*\n+/g)]
- for (let i = 0; i < arr.length; i++) {
- let result = arr[i]
- body = re.replaceAll(body, result[0], ";\n")
- }
- body = body.split(";\n")
- let result = {
- value: [],
- function: []
- }
- for (let i in body) {
- let t = body[i]
- t = re.replaceAll(t, "\n", "")
- while (t.length > 0 && t[0] == ' ') t = t.substring(1, t.length) // 去除前面的空格
- while (t.length > 0 && t[-1] == ' ') t = t.substring(0, t.length - 1) // 去除后面的空格
- if (t == "") break // 如果t为空直接返回
- let tt = re.match(" *([a-zA-Z0-9_]+)(\\?*)*: *([a-zA-Z_0-9<>,:{}[\\]| ]+)", t)
- if (tt && t.indexOf("=>") < 0) { // 接口成员变量, 但不包括带'=>'的成员,带'=>'的接口成员需要按函数处理
- let valueName = re.getReg(t, tt.regs[1])
- let valueType = re.getReg(t, tt.regs[3])
- let index = valueType.indexOf("number")
- let optionalFlag = re.getReg(t, tt.regs[2]) == '?' ? true : false;
- while (index !== -1) {
- valueType = valueType.replace("number", "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- index = valueType.indexOf("number")
- }
- valueType = analyzeNoNameInterface(valueType, valueName, rsltInterface)
- result.value.push({
- name: valueName,
- type: valueType,
- optional: optionalFlag
- })
- }
- tt = re.match("(static )* *(\\$*[A-Za-z0-9_]+) *[:]? *\\(([\n 'a-zA-Z\'\'\"\":;=,_0-9?<>{}()=>|[\\]]*)\\)"
- + " *(:|=>)? *([A-Za-z0-9_<>{}:;, .[\\]]+)?", t)
- if (tt) { // 接口函数成员
- let ret = re.getReg(t, tt.regs[5]) == ''? 'void': re.getReg(t, tt.regs[5])
- let funcDetail = analyzeFunction(data, re.getReg(t, tt.regs[1]) != '', re.getReg(t, tt.regs[2]),
- re.getReg(t, tt.regs[3]), ret, results, interfaceName)
- if (funcDetail != null) {
- // 完全一样的方法不重复添加 (如同名同参的AsyncCallback和Promise方法)
- addUniqFunc2List(funcDetail, result.function)
- }
- }
- }
- return result
-}
-
-module.exports = {
- analyzeInterface,
- parseNotes
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/analyze/namespace.js b/hdc/appCodeGen/src/analyze/namespace.js
deleted file mode 100755
index cc5c64a1f420ad04f4996540f9c261ca3756c45e..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/namespace.js
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("../tools/re");
-const { removeEmptyLine, checkOutBody, addUniqFunc2List } = require("../tools/tool");
-const { analyzeFunction } = require("./function");
-const { analyzeInterface, parseNotes } = require("./interface");
-const { analyzeEnum } = require("./enum");
-const { NapiLog } = require("../tools/NapiLog");
-const { analyzeType, analyzeType2, analyzeType2Result } = require("./type");
-const { NumberIncrease, EnumValueType, getLogErrInfo } = require("../tools/common");
-
-function preProcessData(data) {
- data = data.indexOf("//") < 0 ? data : parseNotes(data);
- data = re.replaceAll(data, "\n{", "{");
- return data;
-}
-
-function getDataByResult(result) {
- let data = null
- if (result !== null) {
- data = result
- }
- return data
-}
-
-/**namespace解析 */
-function analyzeNamespace(data) {
- let result = {
- exports: [],
- enum: [],
- const: [],
- type: [],
- function: [],
- interface: [],
- class: [],
- namespace: [],
- callFunction: [],
- }
- while (data !== '\n') {
- let oldData = data
- data = removeEmptyLine(data)
- let matchs = re.match(" *\n*", data)
- data = preProcessData(data);
- // 只剩下空格和回车时,解析完成
- if (matchs && matchs.regs[0][1] === data.length) break
- let parseEnumResult = parseEnum(matchs, data, result)
- data = getDataByResult(parseEnumResult)
-
- result = parseEnumType(result);
-
- let parseInterResult = parseInterface(matchs, data, result)
- data = getDataByResult(parseInterResult)
-
- let parseFunctionResult = parseFunction(matchs, data, result)
- data = getDataByResult(parseFunctionResult)
-
- let parseTypeResult = parseType(matchs, data, result)
- data = getDataByResult(parseTypeResult)
-
- let parseClassResult = parseClass(matchs, data, result)
- data = getDataByResult(parseClassResult)
-
- let parseNamespaceResult = parseNamespace(matchs, data, result)
- data = getDataByResult(parseNamespaceResult)
-
- data = removeReg(matchs, data, result)
- if (oldData === data) {
- NapiLog.logError("解析Namespace失败");
- NapiLog.logError("[", data.substring(0, data.length > 128 ? 128 : data.length), "]");
- break;
- }
- }
- return result
-}
-
-function parseEnumType(result) {
- if (null === result) {
- return null;
- }
-
- for (let i in result.enum) {
- let enumm = result.enum[i]
-
- // interface 匹配
- for (let i in result.interface) {
- let interf = result.interface[i]
- if(!isValidValue(interf)) {
- NapiLog.logError("parseEnumType interf is null!");
- return null;
- }
-
- // function 匹配
- for (let j in interf.body.function) {
- let func = interf.body.function[j];
- if(!isValidValue(func)) {
- NapiLog.logError("parseEnumType func is null!");
- return null;
- }
-
- // 参数匹配
- for (let k in func.value) {
- let v = func.value[k];
- if(!isValidValue(v)) {
- NapiLog.logError("parseEnumType func.value is null!");
- return null;
- }
-
- if (v.type === enumm.name) {
- if (enumm.body.enumValueType === EnumValueType.ENUM_VALUE_TYPE_NUMBER) {
- v.type = "NUMBER_TYPE_" + NumberIncrease.getAndIncrease();
- } else if (enumm.body.enumValueType === EnumValueType.ENUM_VALUE_TYPE_STRING) {
- v.type = "string";
- } else {
- NapiLog.logError("parseEnumType for interface function value is not support this type %s."
- .format(enumm.body.enumValueType), getLogErrInfo());
- return null;
- }
- result.interface[i].body.function[j].value[k].type = v.type;
- }
- }
- }
- }
- }
- return result
-}
-
-function parseNamespace(matchs, data, result) {
- matchs = re.match("(export )*namespace ([a-zA-Z0-9]+) ({)", data)
- if (matchs) {
- let namespaceName = re.getReg(data, matchs.regs[2])
- let namespaceBody = checkOutBody(data, matchs.regs[3][0], null, true)
- result.namespace.push({
- name: namespaceName,
- body: analyzeNamespace(namespaceBody)
- })
- data = data.substring(matchs.regs[3][0] + namespaceBody.length + 2, data.length)
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(namespaceName)
- }
- }
- return data
-}
-
-function parseClass(matchs, data, result) {
- matchs = re.match(
- "(export )*class ([A-Za-z_0-9]+)()* *(extends [a-zA-Z_0-9, ]+)* *(implements [a-zA-Z_0-9, ]+)* *({)"
- , data)
- if (matchs) {
- // class类型也解析成interface结构,该结构在后面生成C++代码时会按napi_define_class处理成C++的class
- return createInterfaceData(matchs, data, result)
- }
- return data
-}
-
-function parseEnum(matchs, data, result) {
- matchs = re.match("(export )*enum *([A-Za-z_0-9]+) *({)", data)
- if (matchs !== null) {
- let enumName = re.getReg(data, matchs.regs[2]);
- let enumBody = checkOutBody(data, matchs.regs[3][0], null, null)
- result.enum.push({
- name: enumName,
- body: analyzeEnum(enumBody.substring(1, enumBody.length - 1))
- })
- data = data.substring(matchs.regs[3][0] + enumBody.length)
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(enumName)
- }
- }
- matchs = re.match("(export )*const ([A-Za-z_0-9]+) *[:=]{1} ([A-Za-z_0-9]+);", data)
- if (matchs) {
- let constName = re.getReg(data, matchs.regs[1])
- result.const.push({
- name: constName,
- body: re.getReg(data, matchs.regs[2])
- })
- data = re.removeReg(data, matchs.regs[0])
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(constName)
- }
- }
- return data
-}
-
-function isValidValue(value) {
- if (value === null || value === undefined) {
- return false;
- }
- return true;
-}
-
-function getTypeInfo(result, typeName, typeType, isEnum) {
- if (!isValidValue(result) || !isValidValue(result.type)) {
- NapiLog.logError("getTypeInfo: result or result.type is invalid!");
- }
- result.type.push({
- name: typeName,
- body: typeType,
- isEnum: isEnum
- })
-}
-
-function parseType(matchs, data, result) {
- matchs = re.match("(export )*type ([a-zA-Z]+) *= *([\\(\\):=a-zA-Z<> |]+);", data)
- if (matchs) {
- let typeName = re.getReg(data, matchs.regs[2]);
- let typeType = re.getReg(data, matchs.regs[3]);
- let index = typeType.indexOf("number")
- if (index !== -1) {
- typeType = typeType.replace("number", "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- }
- getTypeInfo(result, typeName, typeType, false);
- data = re.removeReg(data, matchs.regs[0])
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(typeName)
- }
- }
-
- matchs = re.match("(export )*type ([a-zA-Z]+) *= *([\\(\\):=a-zA-Z<> |\n']+);", data)
- if (matchs) {
- let typeName = re.getReg(data, matchs.regs[2]);
- let typeBody = re.getReg(data, matchs.regs[3]);
-
- getTypeInfo(result, typeName, analyzeType2(typeBody.substring(1, typeBody.length - 1)), true);
- data = re.removeReg(data, matchs.regs[0])
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(typeName)
- }
- }
-
- matchs = re.match("(export )*type ([a-zA-Z]+) *= *({)", data)
- if (matchs) {
- let typeName = re.getReg(data, matchs.regs[2]);
- let typeBody = checkOutBody(data, matchs.regs[3][0], null, true)
- if (typeBody === null) {
- NapiLog.logError("ParseType typeBody is null!");
- }
- let bodyObj = analyzeType(typeBody.substring(1, typeBody.length - 1), result.type)
- getTypeInfo(result, typeName, bodyObj, false);
- data = data.substring(matchs.regs[3][0] + typeBody.length + 2, data.length)
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(typeName)
- }
- }
- return data
-}
-
-function parseFunction(matchs, data, result) {
- matchs = re.match("(export )*function (\\$*[A-Za-z0-9_]+) *(\\()", data)
- if (null == matchs) {
- matchs = re.match("(export )*function (static )*(\\$*[A-Za-z0-9_]+) *(\\()", data)
- }
- if (null == matchs) {
- matchs = re.match("(export )*function (static )*(register\\$*[A-Za-z0-9_]+) *(\\()", data)
- }
- if (matchs) {
- let funcName = re.getReg(data,
- matchs.regs.length === 5 ? [matchs.regs[2][0], matchs.regs[3][1]] : matchs.regs[2])
- let funcValue = checkOutBody(data,
- matchs.regs.length === 5 ? matchs.regs[4][0] : matchs.regs[3][0], ["(", ")"], null)
- let funcRet = checkOutBody(data.substring(matchs.regs.length === 5 ?
- matchs.regs[4][0] : matchs.regs[3][0] + funcValue.length), 0, ["", "\n"], null)
- data = data.substring(matchs.regs.length === 5 ?
- matchs.regs[4][0] : matchs.regs[3][0] + funcValue.length + funcRet.length)
- let matchFunc = re.match(" *: *([A-Za-z0-9_<>{}\\[\\]:;, .=]+);*", funcRet)
- let matchFuncArray = re.match(" *: *([A-Za-z0-9]+)(\\[]);*", funcRet)
- if (matchFuncArray) {
- funcRet = re.getReg(funcRet, [matchFuncArray.regs[1][0], matchFuncArray.regs[2][1]])
- }
- else if (matchFunc) {
- funcRet = re.getReg(funcRet, matchFunc.regs[1])
- }
- else {
- funcRet = "void"
- }
- funcRet = re.replaceAll(re.replaceAll(funcRet, " ", ""), "\n", "")
-
- if(funcRet[funcRet.length-1] === ";"){
- funcRet = funcRet.substring(0, funcRet.length-1)
- }
- let funcDetail = analyzeFunction(
- result, false, funcName, funcValue.substring(1, funcValue.length - 1), funcRet, result)
- if (funcDetail !== null) {
- // 完全一样的方法不重复添加 (如同名同参的AsyncCallback和Promise方法)
- addUniqFunc2List(funcDetail, result.function)
- }
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(funcName)
- }
- }
- return data
-}
-
-/**
- * 提取当前类继承或实现的父类名称列表
- * @param firstKey 继承/实现关键字 (extends或implements)
- * @param secondKey 继承/实现关键字 (extends或implements)
- * @param parentStr 正则匹配到的继承语句 (如 extends xx1, xx2 implements yy1, yy2)
- * @returns 继承的名称列表 ([xx1, xx2, yy1, yy2])
- */
-function getParentNameList(firstKey, secondKey, parentStr) {
- if (parentStr === '') {
- return []
- }
-
- let firstParents = ''
- let secondParents = ''
- if (parentStr.indexOf(secondKey) > 0) {
- // 同时出现extends和implements关键字的情况 (如 extends xx1, xx2 implements yy1, yy2)
- firstParents = parentStr.split(secondKey)[0].split(firstKey)[1]
- secondParents = parentStr.split(secondKey)[1].trim()
- } else {
- // 只有extends或implements一种关键字的情况 (如 extends xx1, xx2 或者 implements yy1, yy2)
- firstParents = parentStr.split(firstKey)[1]
- }
-
- let nameList = firstParents.split(",")
- if (secondParents !== '') {
- let secondList = secondParents.split(",")
- nameList.push(...secondList)
- }
-
- return nameList
-}
-
-/**
- * 创建interface数据结构
- * @param matchs 正则匹配对象
- * @param data 原始ts文件内容
- * @param result 解析后的ts数据结构
- * @returns data 原始ts文件内容中剩余未解析的部分
- */
-function createInterfaceData (matchs, data, result) {
- let interfaceName = re.getReg(data, matchs.regs[2])
- let interfaceBody = checkOutBody(data, matchs.regs[6][0], null, null)
- let bodyObj = analyzeInterface(interfaceBody.substring(1, interfaceBody.length - 1), result.interface,
- result, interfaceName)
- let extendsParent = re.getReg(data, matchs.regs[4])
- let implementParent = re.getReg(data, matchs.regs[5])
- bodyObj.parentNameList = []
- if(extendsParent !== '') {
- bodyObj.parentNameList = getParentNameList("extends", "implements", extendsParent)
- }
- if(implementParent !== '') {
- bodyObj.parentNameList = getParentNameList("implements", "extends", implementParent)
- }
- for (let i in bodyObj.parentNameList) {
- bodyObj.parentNameList[i] = bodyObj.parentNameList[i].trim()
- if (bodyObj.parentNameList[i] === interfaceName) {
- // 接口不能自己继承自己
- NapiLog.logError("The interface [%s] can not extends with itself.".format(interfaceName))
- return data
- }
- }
-
- bodyObj.parentList = [] // 该接口继承的父类型列表
- bodyObj.childList = [] // 继承自该接口的子类型列表
-
- result.interface.push({
- name: interfaceName,
- body: bodyObj
- })
- let rr = matchs.regs[6][0]
- rr = matchs.regs[6][0] + interfaceBody.length
- let tmp = data[rr]
- data = data.substring(matchs.regs[6][0] + interfaceBody.length, data.length)
- if (matchs.regs[1][0] !== -1) {
- result.exports.push(interfaceName)
- }
- return data
-}
-
-function parseInterface(matchs, data, result) {
- matchs = re.match(
- "(export )*interface ([A-Za-z_0-9]+)()* *(extends [a-zA-Z_0-9, ]+)* *(implements [a-zA-Z_0-9, ]+)* *({)"
- , data)
- if (matchs) {
- return createInterfaceData (matchs, data, result)
- }
- return data
-}
-
-function removeReg(matchs, data, result) {
- matchs = re.match("export { ([a-zA-Z]+) };", data)
- if (matchs) {
- let exportName = re.getReg(data, matchs.regs[1])
- result.exports.push(exportName)
- data = re.removeReg(data, matchs.regs[0])
- }
- matchs = re.match("export import [a-zA-Z]+ = [a-zA-Z\\.]+;", data)
- if (matchs) {
- data = re.removeReg(data, matchs.regs[0])
- }
- matchs = re.match("readonly [a-zA-Z]+: [a-z\\[\\]]+;*", data)
- if (matchs) {
- data = re.removeReg(data, matchs.regs[0])
- }
- return data
-}
-module.exports = {
- analyzeNamespace,
- parseNamespace,
- parseEnum,
- parseFunction,
- parseInterface,
- parseClass,
- parseType
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/analyze/params.js b/hdc/appCodeGen/src/analyze/params.js
deleted file mode 100755
index 46b8c30fe53210cf18f1b0ffc4b55124209350f5..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/params.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("../tools/re");
-const { checkOutBody, print } = require("../tools/tool");
-const { FuncType, NumberIncrease,isFuncType, isArrowFunc,isRegisterFunc } = require("../tools/common");
-const { NapiLog } = require("../tools/NapiLog");
-
-function isSyncFuncType(type, funcType) {
- let isSync = false;
- if (funcType === FuncType.DIRECT && type.indexOf("Callback") >= 0 && type.indexOf("AsyncCallback") < 0 ||
- isFuncType(type) || isArrowFunc(type)) {
- isSync = true;
- }
- return isSync;
-}
-
-/**
- * on方法中回调方法的解析
- * @param {*} valueType 回调方法体
- * @param {*} valueName 参数名
- * @param {*} rsltCallFunction 解析结果
- */
-function analyzeCallbackFunction(valueType, valueName, rsltCallFunction) {
-
- if (valueType.indexOf('=>') > 0) {
- valueType = re.replaceAll(valueType, ' ', '')
- }
- let matchs = re.match("\\(([a-zA-Z_0-9:,]+)*\\)=>([a-zA-Z_0-9]+)", valueType)
-
- if (matchs) {
- let number = NumberIncrease.getAndIncrease();
- let functionTypeName = 'AUTO_CALLFUNCTION_%s_%s'.format(valueName, number)
-
- let functionRet = re.getReg(valueType, matchs.regs[2]);
- let functionBody = re.getReg(valueType, matchs.regs[1]);
-
- let tmp = analyzeParams(functionTypeName, functionBody)
- let bodyRes = tmp[0]
- for (let i in bodyRes) {
- let hasProperty = Object.prototype.hasOwnProperty.call(bodyRes[i], "type")
- if (hasProperty && bodyRes[i].type === "number") {
- bodyRes[i].type = "NUMBER_TYPE_" + NumberIncrease.getAndIncrease();
- }
- }
-
- rsltCallFunction.push({
- "name": functionTypeName,
- "body": bodyRes,
- "ret": functionRet
- })
- valueType = functionTypeName
- }
- return valueType
-}
-
-/**函数参数解析 */
-function analyzeParams(funcName, values) {
- let result = []
- let rsltCallFunction = []
- let funcType = FuncType.DIRECT
- let optionalParamCount = 0; // 可选参数的个数
- while (values.length > 0) {
- let v = checkOutBody(values, 0, ["", ","])
- if (v === null) {
- v = values
- }
-
- values = values.substring(v.length, values.length)
- let matchs = re.match("([a-zA-Z_0-9\\.]+)(\\?*): *([a-zA-Z<,>|_0-9\\[\\]\\(\\):='{}]+)", v)
- if (matchs === null && (funcName === "on" || funcName === "off")) {
- // on和off的第一个参数的类型可以是一串字符
- matchs = re.match("([a-zA-Z_0-9\\.]+)(\\?*): *\"([a-zA-Z|_0-9\\[\\]\\(\\):='{}]+)\"", v)
- }
- if (matchs !== null) {
- let type = re.getReg(v, matchs.regs[3])
- if (type.indexOf("Map") < 0 && !isArrowFunc(type)) {
- type = type.replace(/,/g, "")
- }
-
- let valueName = re.getReg(v, matchs.regs[1])
- type = analyzeCallbackFunction(type, valueName, rsltCallFunction)
-
- let optionalFlag = re.getReg(v, matchs.regs[2]) === '?' ? true : false;
- let checkParamOk = true;
- if (optionalFlag) {
- optionalParamCount++;
- } else if (optionalParamCount > 0) {
- // 可选参数之后不能再有必选参数,须是可选参数。
- NapiLog.logError("Invalid parameter [%s] of function [%s],".format(v, funcName)
- + " the required parameter cannot follow an optional parameter.");
- checkParamOk = false;
- }
- if (checkParamOk) {
- result.push({ "name": re.getReg(v, matchs.regs[1]), "type": type, "optional": optionalFlag})
- if (type.indexOf("AsyncCallback") >= 0) {
- funcType = FuncType.ASYNC
- }
-
- if (isSyncFuncType(type, funcType)) {
- funcType = FuncType.SYNC
- }
- }
- }
- else {
- NapiLog.logError("Failed to analyse parameter [%s] of function [%s].".format(v, funcName));
- }
- }
- return [result, funcType, rsltCallFunction]
-}
-
-module.exports = {
- analyzeParams
-}
diff --git a/hdc/appCodeGen/src/analyze/return.js b/hdc/appCodeGen/src/analyze/return.js
deleted file mode 100755
index d651b952eb464d8310df7cd1f05388cf09b843af..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/return.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("../tools/re");
-
-/**函数返回值解析 */
-function analyzeReturn(ret) {
- let isPromise = false
- if (ret.indexOf("Promise") >= 0) {
- isPromise = true
- }
- return [ret, isPromise]
-}
-
-module.exports = {
- analyzeReturn
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/analyze/type.js b/hdc/appCodeGen/src/analyze/type.js
deleted file mode 100755
index f89658a4e94fe26bb01129cbf81b084ea25d50af..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/analyze/type.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("../tools/re");
-const { NumberIncrease } = require("../tools/common");
-
-/* 去除单行注释// */
-function parseNotes(data) {
- let notes = data.indexOf("//") >= 0 ? data.substring(data.indexOf("//"), data.length) : "";
- while(notes != "") {
- notes = notes.substring(0, notes.indexOf("\n"));
- data = data.replace(notes, "");
- notes = ""
- let st = data.indexOf("//");
- if(st >= 0) {
- notes = data.substring(st, data.length);
- }
- }
- return data
-}
-
-/**type解析 */
-function analyzeType(data, rsltInterface = null) { // same as class
- let body = data
- body = body.indexOf("//") < 0 ? body : parseNotes(body)
- body = re.replaceAll(body, "\n", "").split(";")
- let result = {
- value: [],
- // function: []
- }
- for (let i in body) {
- let t = body[i]
- while (t.length > 0 && t[0] == ' ') // 去除前面的空格
- t = t.substring(1, t.length)
- while (t.length > 0 && t[-1] == ' ') // 去除后面的空格
- t = t.substring(0, t.length - 1)
- if (t == "") break // 如果t为空直接返回
- let tt = re.match(" *([a-zA-Z0-9_]+)(\\?*)*: *([a-zA-Z_0-9<>,:{}[\\]| ]+)", t)
- if (tt && t.indexOf("=>") < 0) { // 接口成员变量, 但不包括带'=>'的成员,带'=>'的接口成员需要按函数处理
- let valueName = re.getReg(t, tt.regs[1])
- let valueType = re.getReg(t, tt.regs[3])
- let index = valueType.indexOf("number")
- let optionalFlag = re.getReg(t, tt.regs[2]) == '?' ? true : false;
- while (index !== -1) {
- valueType = valueType.replace("number", "NUMBER_TYPE_" + NumberIncrease.getAndIncrease())
- index = valueType.indexOf("number")
- }
- result.value.push({
- name: valueName,
- type: valueType,
- optional: optionalFlag
- })
- }
- }
- return result
-}
-
-function analyzeType2(data) {
- let body = re.replaceAll(data, " ", "").split("'|'")
- let result = {
- element: [],
- function: [],
- enumValueType: 0 // 0代表数字,1代表字符串
- }
- for (let i in body) {
- let bodyContent = body[i]
- while (bodyContent.length > 0 && bodyContent[0] == ' ') {
- bodyContent = bodyContent.substring(1, bodyContent.length)
- }
- while (bodyContent.length > 0 && bodyContent[-1] == ' ') {
- bodyContent = bodyContent.substring(0, bodyContent.length - 1)
- }
- if (bodyContent == "") {
- break
- }
- analyzeType2Result(result, bodyContent, i)
- }
- return result
-}
-
-function analyzeType2Result(result, bodyContent, index) {
- let regString = re.match(" *([a-zA-Z0-9_]+) *", bodyContent)
- if (regString) {
- let elementName = re.getReg(bodyContent, regString.regs[1])
- elementName = 'NAME_' + elementName.toUpperCase()
- let elementValue = re.getReg(bodyContent, regString.regs[1])
- result.element.push({
- name: elementName,
- value: elementValue,
- type: 'string'
- })
- result.enumValueType = 1
- }
- return result
-}
-
-module.exports = {
- analyzeType,
- analyzeType2,
- analyzeType2Result,
- parseNotes
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/app_code_gen.js b/hdc/appCodeGen/src/app_code_gen.js
deleted file mode 100755
index 80a2fa373410f78a59b5f2b075171151e2889c2a..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/app_code_gen.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const main = require("./main");
-
-const re = require("./tools/re");
-const { checkFileError } = require("./tools/common");
-const { NapiLog } = require("./tools/NapiLog");
-const path = require("path");
-const stdio = require("stdio");
-var fs = require('fs');
-const { print } = require("./tools/tool");
-
-let ops = stdio.getopt({
- 'filename': { key: 'f', args: 1, description: ".d.ts file", default: "@ohos.napitest.d.ts" },
- 'out': { key: 'o', args: 1, description: "output directory", default: "." },
- 'loglevel': { key: 'l', args: 1, description: "Log Level : 0~3", default: "1" },
-
- /* 需要测试的接口函数可配置:写在json文件里:
- * [{
- * "classOrInterfName": "",
- * "functionName": "funNum"
- * }]
- * 配置cfg.json文件路径
- */
- 'functionsCfg': {key: 'c', args: 1, description: "configured file including the functions for test", default: ""}
-});
-
-NapiLog.init(ops.loglevel, path.join("" + ops.out, "napi_gen.log"))
-
-let fileNames = ops.filename;
-if (fileNames == null) {
- NapiLog.logInfo("fileNames cannot be empty!");
-} else if (fileNames !== '') {
- readFiles();
-}
-
-function readFiles() {
- fileNames = fileNames.replace(/(^\s*)|(\s*$)/g, ''); // trim before and after espace
- let regex = ',';
- let filenameArray = fileNames.toString().split(regex);
-
- let n = filenameArray.length;
- for (let i = 0; i < n; i++) {
- let fileName = filenameArray[i];
- if (fileName !== ' ') {
- fileName = fileName.replace(/(^\s*)|(\s*$)/g, '');
- checkGenerate(fileName);
- }
- }
-}
-
-/**
- * 获取Json配置文件内容
- * @returns
- */
-function getJsonCfg(currentPath) {
- let jsonCfg = null; // cfg.json 配置文件
- currentPath = currentPath.replace(/(^\s*)|(\s*$)/g, ''); // trim before and after espace
- let jsonFilePath = path.join(currentPath);
- let jsonFile = fs.readFileSync(jsonFilePath, { encoding: "utf8" });
- jsonCfg = JSON.parse(jsonFile);
- return jsonCfg;
-}
-
-function checkGenerate(fileName) {
- NapiLog.logInfo("check file []".format(fileName))
-
- let fn = re.getFileInPath(fileName);
- let tt = re.match('(@ohos\.)*([.a-z_A-Z0-9]+).d.ts', fn);
- if (tt) {
- let result = checkFileError(fileName);
- let funcConfig
- if (ops.functionsCfg) {
- funcConfig = getJsonCfg(ops.functionsCfg);
- }
- if (result[0]) {
- main.doGenerate(fileName, ops.out, funcConfig);
- }
- else {
- NapiLog.logError(result[1]);
- }
- }
- else {
- NapiLog.logError('file name ' + fn + ' format invalid in function of checkGenerate!');
- }
-}
-
-let ret = NapiLog.getResult();
-if (ret[0]) {
- print('success');
- NapiLog.logInfo('success');
-}
-else {
- print('fail\n' + ret[1]);
- NapiLog.logInfo('fail\n' + ret[1]);
-}
-
-
-module.exports = {
- getJsonCfg
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/generate.js b/hdc/appCodeGen/src/generate.js
deleted file mode 100755
index 8492135d1836a9cbae3dcc5d1df5b2b1969d21a6..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/generate.js
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-// 生成BUILD.gn
-// 生成tool_utility.h,生成tool_utility.cpp
-const { replaceAll } = require("./tools/tool");
-// const { generateNamespace } = require("./generate/namespace");
-const { writeFile } = require("./tools/FileRW");
-const re = require("./tools/re");
-
-const { jsonCfgList } = require("./tools/common");
-const os = require("os");
-const path = require('path')
-const { NapiLog } = require("./tools/NapiLog");
-
-const DIRECT = 1;
-const SYNC = 2;
-const ASYNC = 4;
-const PROMISE = 8;
-const MAXINT = 100;
-const SUBSTREND = 11;
-const LENGTH = 5;
-const MODTWO = 2;
-var fs = require('fs');
-
-let indexEtsTemplete = `\
-import napitest from '@ohos.[import_module_name]';
-import hilog from '@ohos.hilog';
-
-@Entry
-@Component
-struct Index {
- @State message: string = 'Hello NAPI Sample';
-
- build() {
- Row() {
- Column() {
- Text(this.message)
- .fontSize(50)
- .fontWeight(FontWeight.Bold)
- [test_interface_button]
- }
- .width('100%')
- }
- .height('100%')
- }
-}
-`
-let buttonTemplate = `
-Button() {
- Text('[button_test_interface_name]')
- .fontSize(20)
- .fontWeight(FontWeight.Bold)
- }
- .type(ButtonType.Capsule)
- .margin({
- top: 10
- })
- .backgroundColor('#0D9FFB')
- .width('90%')
- .height('5%')
- .onClick(() => {
- hilog.info(0x0000, 'testTag', 'button onClick!');
-
- [button_test_interface_code]
-
- hilog.info(0x0000, 'testTag', 'button onClick end !');
- });
-`
-
-// var genFileList = []
-// function deleteFolder(folderPath) {
-// if (fs.existsSync(folderPath)) {
-// fs.rmSync(folderPath, {"recursive": true})
-// }
-// }
-
-// function createFolder(folderPath) {
-// if (!fs.existsSync(folderPath)) {
-// fs.mkdirSync(folderPath)
-// }
-// }
-
-// function formatCode(destDir) {
-// let sysInfo = os.platform()
-// let clangFmtName = sysInfo === 'win32' ? "clang-format.exe" : "clang-format"
-// let callPath = NapiLog.getCallPath();
-// callPath = callPath.substring(callPath.indexOf("[") + 1, callPath.indexOf("src"));
-// let dumyClangFmtFile = path.join(callPath, clangFmtName)
-// let dumyFmtCfgFile = path.join(callPath, ".clang-format")
-
-// if(!fs.existsSync(dumyClangFmtFile)) {
-// NapiLog.logInfo("Warning: clang-format does not exist, can not format cpp file.");
-// return
-// }
-
-// // 使用pkg打包的napi_generator工具,其中的clang-format程序在运行时是解压到一个名为snapshot的虚拟目录中的,如C:\snapshot\napi_generator\
-// // 虚拟目录中的clang-format程序不能直接运行,必须先将它拷贝到本地硬盘的真实目录下。
-// createFolder(path.resolve("./tmpLocal"))
-// let localClangFmtFile = path.resolve("./tmpLocal/" + clangFmtName) // clang-format可执行程序
-// let localFmtCfgFile = path.resolve("./tmpLocal/.clang-format") // clang-format格式化配置文件
-// fs.copyFileSync(dumyClangFmtFile, localClangFmtFile)
-// fs.copyFileSync(dumyFmtCfgFile, localFmtCfgFile)
-
-// let execSync = require("child_process").execSync
-// if (sysInfo != 'win32') {
-// // linux系统下需要为临时复制的clang-format程序增加可执行权限
-// execSync("chmod +x " + "\"" + localClangFmtFile + "\"")
-// }
-
-// for (let i = 0; i < genFileList.length; ++i) {
-// // 文件路径前后要用引号包含,防止因为路径中存在空格而导致命令执行失败 (windows的文件夹允许有空格)
-// let cmd = "\"" + localClangFmtFile + "\" -style=file -i \"" + path.resolve(path.join(destDir, genFileList[i]))
-// + "\""
-// try {
-// execSync(cmd) // C++文件格式化
-// } catch (err) {
-// NapiLog.logError("Failed to format code, exception: " + err.stderr)
-// }
-// }
-// // 格式化结束后,删除临时目录文件
-// deleteFolder(path.resolve("./tmpLocal"))
-// }
-let FuncCfgList = []
-function analyzeJsonCfg(jsonCfg) {
- let len = jsonCfg.length;
-
- // 将json文件的数据存入jsonCfgList中,目前只配一个
- for (let i = 0; i < len; i++) {
- FuncCfgList.push({
- classOrInterfName: jsonCfg[i].classOrInterfName,
- functionName: jsonCfg[i].functionName
- })
- }
-}
-
-// 随机生成字符串
-function generateRandomString(length) {
- var result = '';
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- var charactersLength = characters.length;
-
- for (var i = 0; i < length; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
-
- return result;
-}
-
-// 随机生成整数
-function generateRandomInteger(min, max) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min + 1)) + min;
-}
-
-// 生成index.ets文件中测试接口相关的ETS代码
-function genIndexETSCode(indexEts, testFuncName, funcInfo, className = null) {
- // 判断接口函数是否是要测试的接口函数
- if (testFuncName === funcInfo.name) {
- let funcType = funcInfo.type;
- let funcValue = funcInfo.value;
- let retValue = funcInfo.ret;
-
- // index.ets文件中测试接口button代码生成
- if (funcType === DIRECT) {
- indexEts = callDirectFunction(testFuncName, funcValue, retValue, indexEts, className);
- } else if (funcType === SYNC) {
- NapiLog.logInfo('SYNC type of function is not supported!');
- } else if (funcType === ASYNC) {
- NapiLog.logInfo('ASYNC type of function is not supported!');
- } else if (funcType === PROMISE) {
- NapiLog.logInfo('PROMISE type of function is not supported!');
- } else {
- NapiLog.logInfo('This type of function(%s) is not supported!'.format(funcType));
- }
- } else {
- NapiLog.logInfo("test function(%s) is not current function(%s)!".format(testFuncName, funcInfo.name));
- }
- return indexEts;
-}
-
-function generateAppCode(structOfTs, destDir, moduleName, jsonCfg) {
- let ns0 = structOfTs.declareNamespace[0];
- let license = structOfTs.declareLicense[0];
- if (ns0 === undefined) {
- NapiLog.logError('generateAll error:get namespace fail!');
- return;
- }
-
- // 分析配置测试接口的Json文件
- if (jsonCfg) {
- analyzeJsonCfg(jsonCfg);
- }
-
- // 从文件分析的数据中拿到接口名,接口参数类型与个数,读取出来以此给接口参数赋初值。
- // 当前只支持一个接口的测试代码生成
- let indexEts = ''
- // 测试interface中的方法
- for (let i in ns0.body.interface) {
- let ii = ns0.body.interface[i]
- indexEts = genInterClassFunc(ii, indexEts, FuncCfgList[0].classOrInterfName, FuncCfgList[0].functionName);
- }
-
- // 测试class中的方法
- for (let i in ns0.body.class) {
- let ii = ns0.body.class[i]
- indexEts = genInterClassFunc(ii, indexEts, FuncCfgList[0].classOrInterfName, FuncCfgList[0].functionName);
- }
-
- // 测试namespace域中的方法
- for (let i in ns0.body.function) {
- let ii = ns0.body.function[i];
- indexEts = genIndexETSCode(indexEts, FuncCfgList[0].functionName, ii);
- }
-
- // index.ets文件生成
- indexEts = replaceAll(indexEts, "[import_module_name]", moduleName)
- writeFile(re.pathJoin(destDir, "Index.ets"), null != license ? (license + "\n" + indexEts) : indexEts)
-}
-
-// 遍历 interface/class 中的function,生成对interface/class中的接口测试的代码
-function genInterClassFunc(ii, indexEts, testClass = null, testFunc) {
- let className = ii.name;
- let interfaceBody = ii.body;
-
- if (testClass !== className) {
- NapiLog.logInfo("test class(%s) is not current class(%s)!".format(testClass, className));
- return indexEts;
- }
- // 遍历interface中的成员方法
- for (let j = 0; j < interfaceBody.function.length; j++) {
- // index.ets文件中测试接口button代码生成
- indexEts = genIndexETSCode(indexEts, testFunc, interfaceBody.function[j], className);
- }
- return indexEts;
-}
-
-// 调用direct方法
-function callDirectFunction(funcName, funcValue, retValue, indexEts, className = null) {
- let testInterfaceName = funcName;
- let testInterfaceButton = replaceAll(buttonTemplate, "[button_test_interface_name]", testInterfaceName);
- let testInterfaceValue = ''; // 给方法参数赋初值
- let funcParamValue = ''; // 调用方法参数
- // 给接口参数赋初值
- for (let j in funcValue) {
- if (funcValue[j].type === 'string') {
- testInterfaceValue += 'let %s: string = "%s";\n'.format(funcValue[j].name, generateRandomString(LENGTH));
- funcParamValue += funcValue[j].name + ', ';
- } else if (funcValue[j].type === 'boolean') {
- let randomBool = false;
- if (generateRandomInteger(0, LENGTH) % MODTWO === 0) {
- randomBool = true;
- }
- testInterfaceValue += 'let %s: boolean = %s;\n'.format(funcValue[j].name, randomBool);
- funcParamValue += funcValue[j].name + ', ';
- } else if (funcValue[j].type.substring(0, SUBSTREND) === 'NUMBER_TYPE') {
- testInterfaceValue += 'let %s: number = %s;\n'.format(funcValue[j].name, generateRandomInteger(0, MAXINT));
- funcParamValue += funcValue[j].name + ', ';
- } else {
- console.error('The current parameter type is not supported.');
- }
- }
- funcParamValue = funcParamValue.substring(0, funcParamValue.lastIndexOf(','));
- // 返回值的处理
- let useFunction = '';
- if (retValue === 'void') {
- useFunction = '%s.%s(%s);'.format(className === null? 'napitest': className + 'Obj', funcName, funcParamValue);
- } else if (retValue === 'string') {
- useFunction = 'let strRet: string = %s.%s(%s);\n'.format(className === null? 'napitest': className + 'Obj', funcName, funcParamValue);
- useFunction += 'hilog.info(0x0000, "testTag", "%s.%s ret: " + strRet);'.format(className === null? 'napitest': className + 'Obj', funcName);
- } else if (retValue === 'boolean') {
- useFunction = 'let boolRet: boolean = %s.%s(%s);\n'.format(className === null? 'napitest': className + 'Obj', funcName, funcParamValue);
- useFunction += 'hilog.info(0x0000, "testTag", "%s.%s ret: " + boolRet);'.format(className === null? 'napitest': className + 'Obj', funcName);
- } else if (retValue.substring(0, SUBSTREND) === 'NUMBER_TYPE') {
- useFunction = 'let numRet: number = %s.%s(%s);\n'.format(className === null? 'napitest': className + 'Obj', funcName, funcParamValue);
- useFunction += 'hilog.info(0x0000, "testTag", "%s.%s ret: " + numRet);'.format(className === null? 'napitest': className + 'Obj', funcName);
- } else {
- console.error('The current return type is not supported.');
- }
- let useInterface = ''
- if (className !== null) {
- useInterface = 'let %sObj: napitest.%s = new napitest.%s();\n'.format(className, className, className)
- }
- let buttonTestInterface = `%s%s%s`.format(useInterface, testInterfaceValue, useFunction);
- testInterfaceButton = replaceAll(testInterfaceButton, "[button_test_interface_code]", buttonTestInterface);
- indexEts = replaceAll(indexEtsTemplete, "[test_interface_button]", testInterfaceButton);
- return indexEts;
-}
-
-module.exports = {
- generateAppCode
-}
diff --git a/hdc/appCodeGen/src/main.js b/hdc/appCodeGen/src/main.js
deleted file mode 100755
index a268f0d56ad895b8b3f462b79de623e3989610a3..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/main.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const { analyzeFile } = require("./analyze");
-const { generateAppCode } = require("./generate");
-const { NapiLog } = require("./tools/NapiLog");
-const re = require("./tools/re");
-var fs = require('fs');
-
-function doGenerate(ifname, destdir, jsonCfg) {
- // step1: analyze file
- let structOfTs = analyzeFile(ifname);
- let fn = re.getFileInPath(ifname);
- let tt = re.match('(@ohos\.)*([.a-z_A-Z0-9]+).d.ts', fn);
- if (structOfTs === undefined || structOfTs.declareNamespace.length == 0 ||
- structOfTs.declareNamespace[0].name === undefined) {
- NapiLog.logError('analyzeFile file fail and file name is: ' + fn);
- return;
- }
-
- // step2: generate code
- if (tt) {
- let moduleName = re.getReg(fn, tt.regs[2]);
-
- structOfTs.imports = [];
- generateAppCode(structOfTs, destdir, moduleName, jsonCfg);
- } else {
- NapiLog.logError('file name ' + fn + ' format invalid in function of doGenerate!');
- }
- return structOfTs.declareNamespace[0].name
-}
-
-module.exports = {
- doGenerate
-}
diff --git a/hdc/appCodeGen/src/tools/FileRW.js b/hdc/appCodeGen/src/tools/FileRW.js
deleted file mode 100755
index a54d11468b7acf8d0ac2c9a49fafb5227261c3bb..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/tools/FileRW.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-
-function utf8ArrayToStr(array) {
- var out, i, len, c;
- var char2, char3;
-
- out = "";
- len = array.length;
- i = 0;
- while (i < len) {
- c = array[i++];
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- out += String.fromCharCode(c);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- char2 = array[i++];
- out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- char2 = array[i++];
- char3 = array[i++];
- out += String.fromCharCode(((c & 0x0F) << 12) |
- ((char2 & 0x3F) << 6) |
- ((char3 & 0x3F) << 0));
- break;
- }
- }
-
- return out;
-}
-
-function stringToUint8Array(string, options = { stream: false }) {
- if (options.stream) {
- throw new Error(`Failed to encode: the 'stream' option is unsupported.`);
- }
- let pos = 0;
- const len = string.length;
- let at = 0; // output position
- let tlen = Math.max(32, len + (len >> 1) + 7); // 1.5x size
- let target = new Uint8Array((tlen >> 3) << 3); // ... but at 8 byte offset
-
- while (pos < len) {
- let value = string.charCodeAt(pos++);
- let isContinue = false;
- if (value >= 0xd800 && value <= 0xdbff) {
- if (pos < len) {// high surrogate
- const extra = string.charCodeAt(pos);
- if ((extra & 0xfc00) === 0xdc00) {
- ++pos;
- value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;
- }
- }
- if (value >= 0xd800 && value <= 0xdbff) {
- isContinue = true; // drop lone surrogate
- }
- }
-
- if (!isContinue) {
- // expand the buffer if we couldn't write 4 bytes
- if (at + 4 > target.length) {
- tlen += 8; // minimum extra
- tlen *= (1.0 + (pos / string.length) * 2); // take 2x the remaining
- tlen = (tlen >> 3) << 3; // 8 byte offset
-
- target = uint8Array(tlen, target);
- }
-
- let calculateResult = calculate(value, target, at)
- isContinue = calculateResult[0]
- target = calculateResult[1]
- at = calculateResult[2]
- }
- }
- return target.slice(0, at);
-}
-
-function calculate(value, target, at) {
- let isContinue = false
- if ((value & 0xffffff80) === 0) { // 1-byte
- target[at++] = value; // ASCII
- isContinue = true;
- } else if ((value & 0xfffff800) === 0) { // 2-byte
- target[at++] = ((value >> 6) & 0x1f) | 0xc0;
- } else if ((value & 0xffff0000) === 0) { // 3-byte
- target[at++] = ((value >> 12) & 0x0f) | 0xe0;
- target[at++] = ((value >> 6) & 0x3f) | 0x80;
- } else if ((value & 0xffe00000) === 0) { // 4-byte
- target[at++] = ((value >> 18) & 0x07) | 0xf0;
- target[at++] = ((value >> 12) & 0x3f) | 0x80;
- target[at++] = ((value >> 6) & 0x3f) | 0x80;
- } else {
- isContinue = true;
- }
- if (!isContinue) {
- target[at++] = (value & 0x3f) | 0x80;
- }
- return [isContinue, target, at]
-}
-
-function uint8Array(tlen, target) {
- const update = new Uint8Array(tlen);
- update.set(target);
- return update
-}
-
-function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
-}
-function writeFile(fn, str) {
- let data = stringToUint8Array(str);
- fs.writeFileSync(fn, data);
-}
-
-module.exports = {
- readFile,
- writeFile
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/tools/NapiLog.js b/hdc/appCodeGen/src/tools/NapiLog.js
deleted file mode 100755
index cc674d86d6f95920d4532179004e763536c94064..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/tools/NapiLog.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-const path = require("path");
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-class NapiLog {
- constructor() {
- }
-}
-NapiLog.LEV_NONE = 0;
-NapiLog.LEV_ERROR = 1;
-NapiLog.LEV_DEBUG = 2;
-NapiLog.LEV_INFO = 3;
-
-const LEV_STR = ["[NON]", "[ERR]", "[DBG]", "[INF]"]
-var logLevel = NapiLog.LEV_ERROR;
-var logFileName = null;
-var logResultMessage = [true, ""]
-
-function getDateString() {
- let nowDate = new Date();
- return nowDate.toLocaleString();
-}
-
-function saveLog(dateStr, levStr, detail) {
- if (logFileName) {
- let logStr = dateStr + " " + levStr + " " + detail + "\n";
- fs.appendFileSync(logFileName, logStr);
- }
-}
-
-NapiLog.init = function (level, fileName) {
- logLevel = level in [NapiLog.LEV_NONE, NapiLog.LEV_ERROR, NapiLog.LEV_DEBUG, NapiLog.LEV_INFO]
- ? level : NapiLog.LEV_ERROR;
- logFileName = fileName ? fileName : "napi_generator.log";
-}
-
-/**
- * 通过调用栈获取当前正在执行的方法名,代码行数及文件路径
- * @param {} callerFuncName 指定取调用栈中哪个方法名所在的帧作为目标帧
- * @returns
- */
-NapiLog.getCallPath = function(callerFuncName = null) {
- let callPath = ""
- let stackArray = new Error().stack.split('\n');
-
- // 如果没有指定目标方法,默认在调用栈中查找当前方法"getCallPath"所在的帧
- let destFuncName = callerFuncName != null ? callerFuncName : "getCallPath"
-
- for (let i = stackArray.length -1; i >=0 ; --i) {
- // debug模式和打包后的可执行程序调用栈函数名不同, 以NapiLog.log()方法为例:
- // vscode debug模式下调用栈打印的方法名为NapiLog.log,而可执行程序的调用栈中显示为Function.log()
- let callerMatch = (stackArray[i].indexOf("NapiLog." + destFuncName) > 0
- || stackArray[i].indexOf("Function." + destFuncName) > 0)
- if (callerMatch) {
- let stackMsg = stackArray[i+1].trim()
- let leftIndex = stackMsg.indexOf("(")
- let rightIndex = stackMsg.indexOf(")")
-
- if (leftIndex > 0 && rightIndex > 0) {
- let funInfo = stackMsg.substring(0, leftIndex);
- let srcPath = stackMsg.substring(leftIndex + 1, rightIndex)
- let colNumIndex = srcPath.lastIndexOf(":")
- let colNum = srcPath.substring(colNumIndex + 1, srcPath.length)
- let lineNumIndex = srcPath.lastIndexOf(":", colNumIndex - 1)
- let lineNum = srcPath.substring(lineNumIndex + 1, colNumIndex)
- let filePath = srcPath.substring(0, lineNumIndex)
-
- callPath = "%s[%s(%s:%s)]".format(funInfo,filePath,lineNum,colNum)
- }
- break;
- }
- }
-
- return callPath;
-}
-
-function print(...args) {
- if (vscode) {
- vscode.window.showInformationMessage(...args);
- }
- console.log(args + "");
-}
-
-function recordLog(lev, ...args) {
- let origMsgInfo = args;
- let callPath = NapiLog.getCallPath("log");
- let dataStr = getDateString();
- let detail = args.join(" ");
- saveLog(dataStr + " " + callPath, LEV_STR[lev], detail);
- if (lev === NapiLog.LEV_ERROR) {
- logResultMessage = [false, detail];
- }
- let logStr = callPath + " " + detail;
- if (logLevel <= lev) return logStr;
- NapiLog.logInfo(origMsgInfo[0]);
- return logStr;
-}
-
-NapiLog.logError = function (...args) {
- let logInfo = recordLog(NapiLog.LEV_ERROR, args);
- print(logInfo);
-}
-
-NapiLog.logDebug = function (...args) {
- recordLog(NapiLog.LEV_DEBUG, args);
-}
-
-NapiLog.logInfo = function (...args) {
- recordLog(NapiLog.LEV_INFO, args);
-}
-
-NapiLog.getResult = function () {
- return logResultMessage;
-}
-
-module.exports = {
- NapiLog
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/tools/common.js b/hdc/appCodeGen/src/tools/common.js
deleted file mode 100755
index 152d277a54e633911c972d92b831d5dcab3b278a..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/tools/common.js
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("./re");
-const tsc = require("../../../../node_modules/typescript");
-
-function checkFileError(ifname) {
- let program = tsc.createProgram([ifname], {target: tsc.ScriptTarget.Latest,})
- let emitResult = program.emit();
- let allDiagnostics = tsc.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
-
- let errorMsg = ''
- allDiagnostics.forEach(diagnostic => {
- if (diagnostic.file) {
- let { line, character } = tsc.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
- let message = tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
- errorMsg += `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}\n`;
- } else {
- errorMsg += tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + "\n";
- }
- });
-
- if (allDiagnostics.length > 0) {
- return [false, errorMsg];
- }
- return [true, ""];
-}
-
-class FuncType { }
-FuncType.DIRECT = 1
-FuncType.SYNC = 2
-FuncType.ASYNC = 4
-FuncType.PROMISE = 8
-FuncType.ToString = function (type) {
- if (type === FuncType.DIRECT) return "DIRECT";
- else if (type === FuncType.SYNC) return "SYNC";
- else if (type === FuncType.ASYNC) return "ASYNC";
- else if (type === FuncType.PROMISE) return "PROMISE";
- return "UNKNOW";
-}
-
-class NumberIncrease { }
-NumberIncrease.num = 1
-NumberIncrease.getAndIncrease = function () {
- return NumberIncrease.num++;
-}
-NumberIncrease.get = function () {
- return NumberIncrease.num;
-}
-NumberIncrease.reset = function () {
- NumberIncrease.num = 1
-}
-
-class InterfaceList { }
-InterfaceList.interfacess_ = [];
-InterfaceList.push = function (ifs) {
- InterfaceList.interfacess_.push(ifs)
-}
-InterfaceList.pop = function () {
- InterfaceList.interfacess_.pop()
-}
-InterfaceList.getValue = function (name) {
- let ifs = InterfaceList.interfacess_[InterfaceList.interfacess_.length - 1]
- for (let i in ifs) {
- let vv = ifs[i];
- if (ifs[i].name === name) {
- var hasProperty = Object.prototype.hasOwnProperty.call(ifs[i].body, "allProperties")
- if (hasProperty) {
- return ifs[i].body.allProperties.values;
- } else {
- return ifs[i].body.value;
- }
- }
- }
- return null;
-}
-
-InterfaceList.getBody = function (name) {
- let ifs = InterfaceList.interfacess_[InterfaceList.interfacess_.length - 1]
- for (let i in ifs) {
- if (ifs[i].name === name) {
- return ifs[i].body;
- }
- }
- return null;
-}
-
-class CallFunctionList { }
-CallFunctionList.callFuncs = [];
-CallFunctionList.push = function (ifs) {
- CallFunctionList.callFuncs.push(ifs)
-}
-CallFunctionList.pop = function () {
- CallFunctionList.callFuncs.pop()
-}
-CallFunctionList.getValue = function (name) {
- if (CallFunctionList.callFuncs.length === 0) {
- return null
- }
-
- let cfs = CallFunctionList.callFuncs[CallFunctionList.callFuncs.length - 1]
- if (cfs === undefined) {
- return null
- }
-
- for (let i = 0; i < cfs.length; i++) {
- if (cfs[i].name === name) {
- return [cfs[i].body, cfs[i].ret]
- }
- }
- return null
-}
-
-CallFunctionList.getObjOnFuncName = function (interfaceName) {
- let cfs = CallFunctionList.callFuncs[CallFunctionList.callFuncs.length - 1]
- let funNames = []
- for (let i = 0; i < cfs.length; i++) {
- if (cfs[i].name.indexOf(interfaceName) === 0) {
- let funName = cfs[i].name.substring(interfaceName.length+1, cfs[i].name.length)
- funNames.push(funName)
- }
- }
- return funNames
-}
-
-class TypeList { }
-TypeList.types = [];
-TypeList.push = function (ifs) {
- TypeList.types.push(ifs)
-}
-TypeList.pop = function () {
- TypeList.types.pop()
-}
-TypeList.getValue = function (name) {
- let ifs = TypeList.types[TypeList.types.length - 1]
- for (let i in ifs) {
- if (ifs[i].name === name) {
- var hasProperty = Object.prototype.hasOwnProperty.call(ifs[i].body, "allProperties")
- if (hasProperty) {
- return ifs[i].body.allProperties.values;
- } else {
- return ifs[i].body;
- }
- }
- }
- return null;
-}
-
-class EnumList { }
-EnumList.enum_ = [];
-EnumList.push = function (ifs) {
- EnumList.enum_.push(ifs)
-}
-EnumList.pop = function () {
- EnumList.enum_.pop()
-}
-EnumList.getValue = function (name) {
- let ifs = EnumList.enum_[EnumList.enum_.length - 1]
- for (let i in ifs) {
- if (ifs[i].name === name) {
- return ifs[i].body.element;
- }
- }
- return null;
-}
-
-function getArrayType(type) {
- let tt = re.match("Array<([a-zA-Z_0-9]+)>", type)
- if (tt != null) {
- return re.getReg(type, tt.regs[1])
- }
-
- tt = re.match("Array<{([[a-z:]+)([a-z:]]+)([a-zA-Z_1-9:]+)", type)
- if (tt != null) {
- let res = ''
- let len = tt.regs.length
- for (let i=1; i]+)>", type)
- let ttMap = re.search(",([a-zA-Z_0-9]+)>>", type)
- let ttArray = re.search("Array<([a-zA-Z_0-9]+)>", type)
-
- if(ttArray === null) {
- ttArray = re.search("([a-zA-Z_0-9]+)\\[\\]>", type)
- }
-
- let valueType
- let valueMapType
- let valueArrayType
- if (ttKey === null && ttValue === null && ttMap === null) {
- ttKey = re.search("key:([a-zA-Z_0-9]+)", type)
- ttValue = re.search(":([a-zA-Z_0-9]+)}", type)
- ttMap = re.search(":([a-zA-Z_0-9]+)}}", type)
- ttArray = re.search("Array<([a-zA-Z_0-9]+)>", type)
- if (ttArray === null) {
- ttArray = re.search(":([a-zA-Z_0-9]+)\\[\\]}", type)
- }
- }
-
- if (ttValue != null) {
- valueType = re.getReg(type, ttValue.regs[1])
- if (valueType.indexOf("Array<") === 0) {
- valueArrayType = re.getReg(valueType, ttArray.regs[1])
- valueType = undefined
- } else if (ttMap != undefined) {
- valueMapType = re.getReg(type, ttMap.regs[1])
- valueType = undefined
- }
- }
- if (ttMap != null) {
- valueMapType = re.getReg(type, ttMap.regs[1])
- }
- if (ttArray != null) {
- valueArrayType = re.getReg(type, ttArray.regs[1])
- }
- return [re.getReg(type, ttKey.regs[1]), valueType, valueMapType, valueArrayType]
-}
-
-function getUnionType(type) {
- type = type.replace(/\s*/g,"")
- var typeArr = new Array()
- typeArr = type.split("|")
- return typeArr
-}
-
-function isFuncType(type) {
- let isFunction = false;
- if (type === null || type === undefined) {
- return isFunction;
- }
-
- if (type === 'function' || type === 'Function') {
- isFunction = true;
- return isFunction;
- }
-}
-
-function isRegisterFunc(name) {
- let regIndex = name.indexOf('register');
- let isRegister = false
- if (regIndex === 0) {
- isRegister = true
- }
- return isRegister
-}
-
-function isUnRegisterFunc(name) {
- let unRegIndex = name.indexOf('unRegister');
- let isRegister = false
- if (unRegIndex === 0) {
- isRegister = true
- }
- return isRegister
-}
-
-function isOnObjCallback(name) {
- let regIndex = name.indexOf('on');
- let flag = false
- let onLen = 2;
- if (regIndex === 0 && name.length > onLen) {
- flag = true
- }
- return flag
-}
-
-// 箭头函数,如funTest(cb: (wid: boolean) => void): string;
-function isArrowFunc(type) {
- let arrowFunc = false;
- if (type.indexOf('AUTO_CALLFUNCTION') >= 0 || type.indexOf('=>') > 0) {
- arrowFunc = true;
- }
- return arrowFunc;
-}
-
-function isOnOffRegisterFunc(name) {
- let flag = false;
- if (name === 'on' || name === 'off' || isRegisterFunc(name) || isUnRegisterFunc(name) ||
- isOnObjCallback(name)) {
- flag = true;
- }
- return flag;
-}
-
-function isCreateThreadsafeFunc(name) {
- let index = name.indexOf('createThreadSafeFunc');
- let isTdSafeFunc = false
- if (index === 0) {
- isTdSafeFunc = true
- }
- return isTdSafeFunc
-}
-
-function getOnObjCallbackType(funcName, interName) {
- let onObjCbType = ''
- if (interName != '') {
- onObjCbType = interName + '_' + funcName
- } else {
- onObjCbType = funcName
- }
- return 'AUTO_CALLFUNCTION_' + onObjCbType
-}
-
-function getOnCallbackFunAndInterName(CallbackType) {
- CallbackType = CallbackType.replaceAll('AUTO_CALLFUNCTION_', '')
- let CallbackTypes = CallbackType.split('_')
- let funcName = CallbackTypes[1];
- let interName = CallbackTypes[0];
- return [interName, funcName]
-}
-
-class jsonCfgList { }
-jsonCfgList.jsonCfg = [];
-jsonCfgList.push = function (ifs) {
- jsonCfgList.jsonCfg.push(ifs)
-}
-jsonCfgList.pop = function () {
- jsonCfgList.jsonCfg.pop()
-}
-jsonCfgList.getValue = function (className, inter) {
- let ifs = jsonCfgList.jsonCfg[jsonCfgList.jsonCfg.length - 1]
- for (let i in ifs) {
- if (ifs[i].interfaceName.className === className && ifs[i].interfaceName.funcName === inter) {
- return ifs[i].serviceCode
- }
- }
- return null;
-}
-
-function getLogErrInfo() {
- let errInfo = " Please refer to for support capacity:"
- + "https://gitee.com/openharmony/napi_generator/tree/master/release-notes"
- return errInfo
-}
-
-module.exports = {
- FuncType,
- EnumValueType,
- NumberIncrease,
- InterfaceList,
- TypeList,
- CallFunctionList,
- isType,
- typeIndex,
- getArrayType,
- getArrayTypeTwo,
- checkFileError,
- isEnum,
- enumIndex,
- getMapType,
- EnumList,
- jsType2CType,
- getUnionType,
- isFuncType,
- isArrowFunc,
- jsonCfgList,
- isRegisterFunc,
- isUnRegisterFunc,
- isOnObjCallback,
- isOnOffRegisterFunc,
- getOnObjCallbackType,
- getLogErrInfo,
- isCreateThreadsafeFunc
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/tools/re.js b/hdc/appCodeGen/src/tools/re.js
deleted file mode 100755
index ff9657b5d0ea63dedc2a0c05899da0516bfb34f1..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/tools/re.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-
-function search(ss, data) {
- ss = replaceAll(ss, "\\.", "\\.")
- let reg = new RegExp(ss);
- let tt = reg.exec(data);
- if (tt == null) return null;
- let ret = { "regs": [] }
- for (let i = 0; i < tt.length; i++) {
- let p = data.indexOf(tt[i]);
- if (tt[i] == null) {
- ret["regs"].push([-1, -1])
- }
- else {
- ret["regs"].push([p, p + tt[i].length])
- }
- }
-
- return ret;
-}
-
-function match(ss, data) {
- let tt = search(ss, data)
- if (tt != null && tt.regs[0][0] == 0) return tt;
- return null;
-}
-
-function removeReg(data, reg) {
- return data.substring(0, reg[0]) + data.substring(reg[1], data.length)
-}
-
-function getReg(data, reg) {
- return data.substring(reg[0], reg[1])
-}
-
-function getFileInPath(tpath) {
- return path.parse(tpath).base;
-}
-
-function getPathInPath(tpath) {
- return path.parse(tpath).dir;
-}
-
-function all(sfrom) {
- return new RegExp(sfrom, "g");
-}
-
-function replaceAll(ss, sfrom, sto) {
- return ss.replace(all(sfrom), sto)
-}
-
-function pathJoin(...args) {
- return path.join(...args)
-}
-
-module.exports = {
- search,
- match,
- removeReg,
- getReg,
- getFileInPath,
- getPathInPath,
- pathJoin,
- replaceAll,
- all
-}
\ No newline at end of file
diff --git a/hdc/appCodeGen/src/tools/tool.js b/hdc/appCodeGen/src/tools/tool.js
deleted file mode 100755
index b7ffe5541c9599dd47dc7b0d829591f60ee8ac78..0000000000000000000000000000000000000000
--- a/hdc/appCodeGen/src/tools/tool.js
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const re = require("./re");
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-const NUM_CONST_MAP = new Map([
- [0, "XNapiTool::ZERO"], [1, "XNapiTool::ONE"], [2, "XNapiTool::TWO"], [3, "XNapiTool::THREE"],
- [4, "XNapiTool::FOUE"], [5, "XNapiTool::FIVE"], [6, "XNapiTool::SIX"], [7, "XNapiTool::SEVEN"],
- [8, "XNapiTool::EIGHT"], [9, "XNapiTool::NINE"]
-]);
-
-function print(...args) {
- if (vscode) {
- vscode.window.showInformationMessage(...args);
- }
- console.log(...args);
-}
-
-String.prototype.format = function (...args) {
- var result = this;
- let reg = new RegExp("%[sd]{1}")
- for (let i = 0; i < args.length; i++) {
- let p = result.search(reg)
- if (p < 0) break;
- result = result.substring(0, p) + args[i] + result.substring(p + 2, result.length)
- }
- return result;
-}
-
-String.prototype.replaceAll = function (...args) {
- let result = this;
- while (result.indexOf(args[0]) >= 0) {
- result = result.replace(args[0], args[1])
- }
- return result;
-}
-
-function checkOutBody(body, off, flag, binside) {
- off = off || 0;
- flag = flag || ["{", "}"];
- binside = binside || false;
- let idx = {
- "(": ")",
- "{": "}",
- "<": ">",
- //"<": "<",
- //">": ">",
- };
- let csl = {};
- let csr = {};
- for (let f in idx) {
- csl[f] = 0
- csr[idx[f]] = 0
- }
- let cs1 = 0
- if (flag[0].length > 0 && body.substring(off, off + flag[0].length) !== flag[0]) {
- return null;
- }
-
- for (let i = off + flag[0].length; i < body.length; i++) {
- if (body[i] === '"') cs1 += 1
- if (cs1 % 2 === 0) {
- let tb1 = true;
- for (let k in csl) {
- if (csl[k] !== csr[idx[k]]) {
- tb1 = false;
- break;
- }
- }
- if (tb1 && body.substring(i, i + flag[1].length) === flag[1]) {
- if (binside)
- return body.substring(off + flag[0].length, i);
- return body.substring(off, i + flag[1].length);
- }
-
- if (body[i] in csl) {
- csl[body[i]] += 1;
- if (body[i] in csr) csr[body[i]] += 1;
- }
- if (body[i] in csr) {
- if (!(body[i] === '>' && body[i-1] === '=')) { // 尖括号匹配时忽略关键字 "=>"
- csr[body[i]] += 1;
- }
- }
- }
- }
- return null;
-}
-
-function removeExplains(data) {
- // 去除 /** */ 类型的注释
- while (data.indexOf("/*") >= 0) {
- let i1 = data.indexOf("/*")
- let i2 = data.indexOf("*/") + 2
- data = data.substring(0, i1) + data.substring(i2, data.length)
- }
-
- // 去除 namespace 域外 // 类型的注释
- // 如果换行格式是\r\n, 去除\r, 统一成\n格式
- while (data.indexOf("\r") >= 0) {
- data = data.replace("\r", "")
- }
- while (data.indexOf("//") >= 0) {
- let i1 = data.indexOf("//")
- let i2 = data.indexOf("\n")
- let end = data.indexOf("declare namespace ")
- while (i2 < end && i1 < end) {
- while (i1 > i2) {
- data = data.substring(0, i2) + data.substring(i2 + 2, data.length)
- i2 = data.indexOf("\n")
- i1 = data.indexOf("//")
- }
- data = data.substring(0, i1) + data.substring(i2 + 1, data.length)
- i1 = data.indexOf("//")
- i2 = data.indexOf("\n")
- end = data.indexOf("declare namespace ")
- }
- if (i2 > end || i1 > end) {
- break;
- }
- }
-
- return data
-}
-
-function getLicense(data) {
- while (data.indexOf("/*") >= 0) {
- let i1 = data.indexOf("/*")
- let i2 = data.indexOf("*/") + 2
- let licenseData = data.substring(i1, i2)
- if (licenseData.search("Copyright") !== -1) {
- return licenseData
- } else {
- return null
- }
- }
-}
-
-function removeEmptyLine(data) {
- while (data.indexOf("\r") >= 0) {
- data = data.replace("\r", "")
- }
- while (data.indexOf("\t") >= 0) {
- data = data.replace("\t", "")
- }
- while (data.indexOf(" \n") >= 0) {
- data = data.replace(" \n", "\n")
- }
- while (data.indexOf("\n ") >= 0) {
- data = data.replace("\n ", "\n")
- }
- while (data.indexOf("\n\n") >= 0) {
- data = data.replace("\n\n", "\n")
- }
- while (data.indexOf("\n") === 0) {
- data = data.substring(1, data.length)
- }
- while (data.indexOf(" ") === 0) {
- data = data.substring(1, data.length)
- }
- return data
-}
-
-function replaceTab(data) {
- while (data.indexOf("\t") >= 0) {
- data = data.replace("\t", " ")
- }
- return data
-}
-
-function removeEmptyLine2(data) {
- while (data.indexOf(" \n"))
- data = data.replace(" \n", "\n")
- while (data.indexOf("\n\n\n"))
- data = data.replace("\n\n\n", "\n\n")
- return data
-}
-
-function replaceAll(s, sfrom, sto) {
- while (s.indexOf(sfrom) >= 0) {
- s = s.replace(sfrom, sto)
- }
- return s;
-}
-
-/**
- * 比较两个方法是否完全相同
- * @param func1 方法1
- * @param func2 方法2
- * @returns 方法名称与形参是否完全相同
- */
- function isSameFunc(func1, func2) {
- if (func1.name !== func2.name) { // 判断方法名称是否相同
- return false;
- }
-
- let func1ParamCount = func1.value.length
- if (func1ParamCount !== func2.value.length) { // 判断方法形参个数是否一样
- return false;
- }
-
- for (let i in func1.value) { // 判断方法每个形参数据类型是否相同
- if (func1.value[i].type !== func2.value[i].type) {
- if (!(func1.value[i].type.indexOf("NUMBER_TYPE_") >= 0 &&
- func2.value[i].type.indexOf("NUMBER_TYPE_") >= 0)) {
- return false;
- }
- }
- }
-
- // 以上全部相同,判定为相同方法
- return true;
-}
-
-/**
- * 将方法对象插入列表(重复的方法对象不插入)
- * @param obj 待插入的方法对象
- * @param list 目标列表
- * @returns 是否成功插入列表
- */
- function addUniqFunc2List(obj, list) {
- for (let i in list) {
- if (isSameFunc(obj, list[i])) {
- return false
- }
- }
- list.push(obj)
- return true
-}
-
-/**
- * 找到子类中重写父类的方法并将它设置为override
- * @param parentFunc 父类被重写的方法名
- * @param childFunclist 子类全部方法列表
- * @returns void
- */
- function setOverrideFunc(parentFunc, childFunclist) {
- for (let i in childFunclist) {
- if (isSameFunc(parentFunc, childFunclist[i])) {
- childFunclist[i].isOverride = true
- return
- }
- }
-}
-
-/**
- * 将对象插入列表(名称重复的属性对象不插入)
- * @param obj 待插入的对象
- * @param list 目标列表
- * @returns void
- */
- function addUniqObj2List(obj, list) {
- for (let i in list) {
- if (list[i].name === obj.name) {
- return
- }
- }
- list.push(obj)
-}
-
-/**
- * 如果方法所在的类为基类,生成的c++函数定义为虚函数
- * @param data 方法所在的类信息
- * @param funcInfo 方法信息
- * return tabStr 缩进,staticStr 静态函数关键词,virtualStr 虚函数关键词, overrideStr 重写关键词
- */
- function getPrefix(data, funcInfo) {
- let isStatic = funcInfo.isStatic
- let tabStr = ""
- let virtualStr = ""
- let staticStr = isStatic ? "static " : ""
- if (data.childList) {
- tabStr = " " // 类中的方法增加一个缩进
- virtualStr = (data.childList.length > 0 && !isStatic) ? "virtual " : "" //如果是基类中的非静态方法,定义为虚函数
- }
- let overrideStr = funcInfo.isOverride ? " override" : "" // 重写了父类方法,需要加上override关键字,否则触发c++门禁告警
- return [tabStr, staticStr, virtualStr, overrideStr]
-}
-
-function getConstNum(num) {
- return NUM_CONST_MAP.get(parseInt(num));
-}
-
-module.exports = {
- checkOutBody,
- removeExplains,
- removeEmptyLine,
- removeEmptyLine2,
- replaceAll,
- print,
- getLicense,
- replaceTab,
- addUniqObj2List,
- addUniqFunc2List,
- getPrefix,
- getConstNum,
- setOverrideFunc
-}
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md b/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md
deleted file mode 100644
index aa0e939ae95168f9a882cbd9d5da839660d597e8..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/README_zh.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# ASSIST工具IntelliJ插件说明
-
-## 简介
-
-ASSIST统一入口工具,可以将各北向工具统一起来,用户只需下载统一入口工具,在统一入口工具中按需下载北向工具,实现对工具链的使用。目前工具支持IntelliJ插件一种入口,本文主要介绍IntelliJ插件使用说明。
-
-## 目录
-
-
-```
-├── assist
-│ ├── ... # 其它文件
-│ ├── assist_tools_IntelliJ_plugin # IntelliJ插件代码
-│ │ ├── docs # IntelliJ插件说明
-│ │ ├── resources # IntelliJ插件说明
-│ │ ├── src # IntelliJ插件源码
-│ │ └── README_zh # IntelliJ插件说明
-```
-
-## 约束
-
-系统:建议Windows 10
-
-依赖版本:JDK 11
-
-开发工具:DevEco stdio、IDEA Community 2021.3.3
-
-## 使用方法
-
-### 工具使用
-
-插件下载路径如下,点击download下载。
-
-[下载链接](https://plugins.jetbrains.com/plugin/21430-assist-tools/edit/versions)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md)
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md)
-
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md b/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md
deleted file mode 100644
index 8a64b83f8a2d8f3a7685f4ff067960b3b53cc8dc..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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项目文件夹。
-
-
-
-3.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,Language level也选择版本11,选择或者新建complier output目录为项目文件下的out目录。
-
-
-4.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。
-
-
-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。
-
-
-6.Content root选择~/napi_generator/napi_IntelliJ_plugin文件夹,module name填写generator。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。
-
-
-7.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。
-
-
-8.在SDKs->IntelliJ IDEA Community 2021.3.3->Classpath下导入程序需要的依赖:napi_generator.jar包和ts_generator.jar包
-
-
-
-9.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择generator,点击ok,等待安装完成。
-
-
-
-
-
-10.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。
-
-
-
-11.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。
-
-
-
-
-
-
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md b/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index d03a228a0e73af6e3badc97ec785610a29b0e1d5..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# ASSIST_TOOLS工具IntelliJ插件使用说明
-
-## 简介
-
-Assist_tools工具目前支持一种入口,即IntelliJ插件,本文主要介绍IntelliJ插件使用说明。IntelliJ插件下载路径如下,点击download下载。
-
-[下载链接](https://plugins.jetbrains.com/plugin/21430-assist-tools/edit/versions)
-
-## IntelliJ插件使用方法
-
-### 依赖
-
-系统:建议Windows 10
-
-开发工具:DevEco Studio
-
-### 使用指导
-
-1.新建或打开项目工程,以下以新建项目工程为例。
-
-File->New->Create Project。
-
-
-
-Ability Template选择Empty Ability,单击Next。
-
-
-
-填写Project name、Save location,其它选项可不修改,单击Finish,新的工程就创建好了。
-
-
-
-2.安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的generator.jar,安装成功之后重启IDE。
-
-
-
-
-
-3.点击Tools->Assist Tools,工具弹出统一入口窗口
-
-
-
-
-
-4.点击NAPI,然后点击Next,工具弹出Generate Napi Frame弹窗。接口文件文本框填写.d.ts文件路径;生成框架路径文本框填写生成框架存放路径;编译脚本路径填写生成CMakeList.txt文件输出路径;number目的类型此处选择char;启用import功能不选择(待转换.d.ts文件未引用其它文件);点击ok,执行结束后将会在输出路径下生成napi框架文件。
-
-
-
-
-
-
-
-5.点击H2Ts,若不启用工具链,则直接点击Next,工具弹出Generate Ts Frame弹窗。文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击ok,执行结束后将会在输出路径下生成ts框架文件。
-
-
-
-
-
-若启用工具链,点击启用工具链按钮,选择启用工具链所需的工具,至少选择两个工具,点击Next,将会弹出Generate Ts Farme弹窗;文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击Next,将会生成.d.ts文件;接着会弹出Generate Napi Frame弹窗,弹窗中自动填入.h文件生成的.d.ts文件路径,点击ok,执行结束后将会在输出路径下生成napi框架文件。
-
-
-
-
-
-
-
-
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/META-INF/plugin.xml b/hdc/assist/assist_tools_IntelliJ_plugin/resources/META-INF/plugin.xml
deleted file mode 100755
index 717bb176f0dff8c69c578c60fafc0c4737e01057..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
- com.kh.tools.ng
- Assist Tools
- 1.0
- 深圳开鸿数字产业发展有限公司
-
-
-
- com.intellij.modules.lang
- com.sk.ng
- com.sk.ts
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/close.png b/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/close.png
deleted file mode 100755
index 32edfa363b1a1f764fade91a3a80fc7f626a0315..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/close.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/cloudic_manager.png b/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/cloudic_manager.png
deleted file mode 100755
index 5764627e6afb5383806b62f945bc47a1459d4ddc..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/cloudic_manager.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/h2ts.png b/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/h2ts.png
deleted file mode 100644
index 1b4acbe9c4839288088c763afb906497c4d34621..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/h2ts.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/napi.png b/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/napi.png
deleted file mode 100755
index 81d5e40a6e854c85d789eb33f75f7fec3213b62a..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/napi.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/search.png b/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/search.png
deleted file mode 100755
index b27fc24d3502eed6f9ac7315d85f01c364009338..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/search.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/tools_center.png b/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/tools_center.png
deleted file mode 100755
index e17aac374806516f7d253811de4096544fd5ce85..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_IntelliJ_plugin/resources/images/tools_center.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterDialog.java b/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterDialog.java
deleted file mode 100755
index 1065d73c8e72ab0c3f1aee1a532f4af6fb0ca2af..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterDialog.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.tools.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.kh.tools.utils.PluginUtils;
-import com.sk.dialog.GenerateDialog;
-import com.sk.ts.dialog.TsGenerateDialog;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JOptionPane;
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * 自定义确认对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-10
- */
-public class ToolCenterDialog extends DialogWrapper {
- private static final Logger LOG = Logger.getInstance(ToolCenterDialog.class);
-
- private final ToolCenterPanel toolCenterPanel;
- private Project project;
-
- /**
- * 构造函数
- * @param project Project
- */
- public ToolCenterDialog(Project project) {
- super(true);
- this.project = project;
- toolCenterPanel = new ToolCenterPanel();
- setTitle(PluginUtils.TITLE);
- init();
- }
-
- @Override
- @Nullable
- protected JComponent createCenterPanel() {
- return toolCenterPanel.getContentPanel();
- }
-
- /**
- * ok/cancel按钮
- *
- * @return Action[] buttos list
- */
- @NotNull
- @Override
- protected Action[] createActions() {
- DialogWrapperExitAction exitAction = new DialogWrapperExitAction("Cancel", CANCEL_EXIT_CODE);
- ToolCenterDialog.CustomOKAction okAction = new ToolCenterDialog.CustomOKAction();
- okAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
- return new Action[]{exitAction, okAction};
- }
-
- @NotNull
- @Override
- protected Action[] createLeftSideActions() {
- ToolCenterDialog.CustomHelpAction helpAction = new ToolCenterDialog.CustomHelpAction();
- return new Action[]{helpAction};
- }
-
- /**
- * 自定义 next Action
- */
- protected class CustomOKAction extends DialogWrapperAction {
-
- protected CustomOKAction() {
- super("Next");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- if (toolCenterPanel.isSelectButton().equals("Napi")) {
- GenerateDialog generateDialog = new GenerateDialog(project, "", "", "");
- generateDialog.showAndGet();
- }
- else if (toolCenterPanel.isSelectButton().equals("H2Ts")) {
- if (toolCenterPanel.getSelectToolChain()) {
- if (toolCenterPanel.getSelectNapiCheckBox() && toolCenterPanel.getSelectH2tsCheckBox()) {
- TsGenerateDialog tsGenerateDialog = new TsGenerateDialog(project, "", "", "", true);
- tsGenerateDialog.showAndGet();
- } else {
- JOptionPane.showMessageDialog(null, "启用工具链应至少选择两个工具!",
- "提示", JOptionPane.INFORMATION_MESSAGE);
- }
- } else {
- TsGenerateDialog tsGenerateDialog = new TsGenerateDialog(project, "", "", "", false);
- tsGenerateDialog.showAndGet();
- }
- }
- else {
- LOG.error("action is not exit");
- }
- }
- }
-
- /**
- * 自定义 help Action
- */
- protected class CustomHelpAction extends DialogWrapperAction {
-
- protected CustomHelpAction() {
- super("Help");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- try {
- Desktop.getDesktop().browse(new URI(PluginUtils.URL));
- } catch (URISyntaxException | IOException e) {
- LOG.error("Open help error:" + e);
- }
- }
- }
-}
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterPanel.form b/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterPanel.form
deleted file mode 100755
index ce8099244142611bb523f91b23906f87e83dfbbb..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterPanel.form
+++ /dev/null
@@ -1,341 +0,0 @@
-
-
-
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterPanel.java b/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterPanel.java
deleted file mode 100755
index 1b33f2b55001215625b622072a3ca1e9b3abee9e..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/dialog/ToolCenterPanel.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.tools.dialog;
-
-import com.kh.tools.utils.PluginUtils;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextField;
-import javax.swing.KeyStroke;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.JRadioButton;
-import javax.swing.JCheckBox;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.util.HashMap;
-
-/**
- * 插件中心
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-16
- */
-public class ToolCenterPanel extends JDialog {
- private JPanel contentPane;
- private JPanel searchPanel;
- private JTextField searchTextField;
- private JTabbedPane tabbedPane;
- private JLabel toolSecondNameLabel;
- private JLabel toolDescLabel;
- private JButton buttonNapi;
- private JButton buttonNapiName;
- private JButton tsButton;
- private JButton buttonTs;
- private JButton buttonClose;
- private JPanel napiPanel;
- private JPanel servicePanel;
- private String isSelectButton = "Napi";
- private JRadioButton selectToolchain;
- private JCheckBox checkNAPI;
- private JCheckBox checkH2Ts;
- private JLabel selectToolchainLabel;
-
- /**
- * 构造函数
- */
- public ToolCenterPanel() {
- tabbedPane.removeTabAt(1);
- setContentPane(contentPane);
- setModal(true);
- contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- searchTextField.addFocusListener(new FocusListener() {
- @Override
- public void focusGained(FocusEvent focusEvent) {
- searchPanel.setBorder(PluginUtils.BORDER_FOCUS_GAINED);
- if (searchTextField.getText().equals("search")) {
- searchTextField.setText("");
- }
- }
-
- @Override
- public void focusLost(FocusEvent focusEvent) {
- searchPanel.setBorder(PluginUtils.BORDER_FOCUS_LOST_SEARCH);
- if (searchTextField.getText().trim().length() < 1) {
- searchTextField.setText("search");
- }
- }
- });
- setSelectToolChainVisible(false);
- setNapiCheckBoxVisible(false);
- setH2tsCheckBoxVisible(false);
- searchTextField.setForeground(Color.white);
- searchTextField.setBackground(Color.decode("#3c3f41"));
- searchTextField.setBorder(new EmptyBorder(0, 0, 0, 0));
- searchTextField.setCaretColor(Color.white);
- searchTextField.setFont(new Font(null, Font.PLAIN, 15));
- setButtonStyle();
- textFieldAction();
- buttonAction();
- }
-
- private void setButtonStyle() {
- buttonClose.setPreferredSize(new Dimension(40, 10));
- buttonClose.setContentAreaFilled(false);
- buttonClose.setBorder(new EmptyBorder(0, 0, 0, 0));
- buttonNapiName.setContentAreaFilled(false);
- buttonNapiName.setBorder(new EmptyBorder(0, 0, 0, 0));
- tsButton.setContentAreaFilled(false);
- tsButton.setBorder(new EmptyBorder(0, 0, 0, 0));
- }
-
- private void textFieldAction() {
- searchTextField.getDocument().addDocumentListener(new DocumentListener() {
- HashMap result;
-
- @Override
- public void insertUpdate(DocumentEvent documentEvent) {
- result = searchTools(searchTextField.getText().trim());
- if (result.containsKey(buttonNapi.getToolTipText())) {
- napiPanel.setVisible(true);
- } else {
- napiPanel.setVisible(false);
- }
- if (result.containsKey(buttonTs.getToolTipText())) {
- servicePanel.setVisible(true);
- } else {
- servicePanel.setVisible(false);
- }
- }
-
- @Override
- public void removeUpdate(DocumentEvent documentEvent) {
- result = searchTools(searchTextField.getText().trim());
- if (result.containsKey(buttonNapi.getToolTipText())) {
- napiPanel.setVisible(true);
- } else {
- napiPanel.setVisible(false);
- }
- if (result.containsKey(buttonTs.getToolTipText())) {
- servicePanel.setVisible(true);
- } else {
- servicePanel.setVisible(false);
- }
- }
-
- @Override
- public void changedUpdate(DocumentEvent documentEvent) {
- }
- });
- buttonClose.addActionListener(actionEvent -> searchTextField.setText("search"));
- }
-
- private void buttonAction() {
- buttonNapi.addActionListener(e -> {
- isSelectButton = "Napi";
- toolSecondNameLabel.setText(buttonNapi.getToolTipText());
- toolDescLabel.setText(PluginUtils.TOOLS.get(buttonNapi.getToolTipText()));
- setSelectToolChainVisible(false);
- setNapiCheckBoxVisible(false);
- setH2tsCheckBoxVisible(false);
- setButtonVisible(true);
- buttonNapiName.setForeground(Color.white);
- tsButton.setForeground(Color.decode("#BBBBBB"));
- });
- buttonTs.addActionListener(e -> {
- isSelectButton = "H2Ts";
- toolSecondNameLabel.setText(buttonTs.getToolTipText());
- toolDescLabel.setText(PluginUtils.TOOLS.get(buttonTs.getToolTipText()));
- setSelectToolChainVisible(true);
- if (selectToolchain.isSelected()) {
- setButtonVisible(false);
- setNapiCheckBoxVisible(true);
- setH2tsCheckBoxVisible(true);
- } else {
- tsButton.setForeground(Color.white);
- buttonNapiName.setForeground(Color.decode("#BBBBBB"));
- }
- tsButton.setForeground(Color.white);
- buttonNapiName.setForeground(Color.decode("#BBBBBB"));
- });
- selectToolchain.addActionListener(e -> {
- if (selectToolchain.isSelected()) {
- checkH2Ts.setForeground(Color.white);
- setButtonVisible(false);
- setNapiCheckBoxVisible(true);
- setH2tsCheckBoxVisible(true);
- } else {
- setNapiCheckBoxVisible(false);
- setH2tsCheckBoxVisible(false);
- setButtonVisible(true);
- }
- });
- }
-
- private void onCancel() {
- dispose();
- }
-
- @Override
- public Dimension getPreferredSize() {
- return new Dimension(1000, 600);
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-
- public String isSelectButton() {
- return isSelectButton;
- }
-
- /**
- * 功能描述 get radiobutton
- *
- * @return 是否选中
- */
- public boolean getSelectToolChain() {
- return selectToolchain.isSelected();
- }
-
- /**
- * 功能描述 set button visible or not
- *
- * @param isTrue 是否可见标志
- * @return null
- */
- public void setSelectToolChainVisible(boolean isTrue) {
- selectToolchain.setVisible(isTrue);
- selectToolchainLabel.setVisible(isTrue);
- repaint();
-
- }
-
- /**
- * 功能描述 get napi checkbox
- *
- * @return 是否选中
- */
- public boolean getSelectNapiCheckBox() {
- return checkNAPI.isSelected();
- }
-
- /**
- * 功能描述 get h2ts checkbox
- *
- * @return 是否选中
- */
- public boolean getSelectH2tsCheckBox() {
- return checkH2Ts.isSelected();
- }
-
- /**
- * 功能描述 set napi checkbox visible or not
- *
- * @param isTrue 是否可见标志
- * @return null
- */
- public void setNapiCheckBoxVisible(boolean isTrue) {
- checkNAPI.setVisible(isTrue);
- repaint();
- }
-
- /**
- * 功能描述 set h2ts checkbox visible or not
- *
- * @param isTrue 是否可见标志
- * @return null
- */
- public void setH2tsCheckBoxVisible(boolean isTrue) {
- checkH2Ts.setVisible(isTrue);
- repaint();
- }
-
- /**
- * 功能描述 set checkbox visible or not
- *
- * @param isTrue 是否可见标志
- * @return null
- */
- public void setButtonVisible(boolean isTrue) {
- buttonNapiName.setVisible(isTrue);
- tsButton.setVisible(isTrue);
- }
-
- /**
- * 搜索结果
- *
- * @param key 关键字
- * @return 搜索结果
- */
- private HashMap searchTools(String key) {
- if (key.equals("search")) {
- return PluginUtils.TOOLS;
- }
- HashMap searchResultList = new HashMap<>();
- for (HashMap.Entry entry : PluginUtils.TOOLS.entrySet()) {
- if (entry.getKey().contains(key)) {
- searchResultList.put(entry.getKey(), entry.getValue());
- }
- }
- return searchResultList;
- }
-}
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/ng/AssistCenterMenu.java b/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/ng/AssistCenterMenu.java
deleted file mode 100755
index 4c970f57195426fda00de677906f052a702ce482..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/ng/AssistCenterMenu.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.tools.ng;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import com.kh.tools.dialog.ToolCenterDialog;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * 工具菜单入口
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-19
- */
-public class AssistCenterMenu extends AnAction {
-
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
-
- if (project == null) {
- return;
- }
- ToolCenterDialog wrapper = new ToolCenterDialog(project);
- wrapper.showAndGet();
- }
-}
diff --git a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/utils/PluginUtils.java b/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/utils/PluginUtils.java
deleted file mode 100755
index 7bf1804b308557072813d10a196a35a918b720b7..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_IntelliJ_plugin/src/com/kh/tools/utils/PluginUtils.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.kh.tools.utils;
-
-import javax.swing.BorderFactory;
-import javax.swing.border.Border;
-import java.awt.Color;
-import java.util.HashMap;
-
-/**
- * 工具类
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-19
- */
-public class PluginUtils {
-
- /**
- * 项目代码路径
- */
- public static final String URL = "https://gitee.com/openharmony/napi_generator/"
- + "tree/master/hdc/assist/assist_tools_IntelliJ_plugin/README.md";
-
- /**
- * 应用名称
- */
- public static final String TITLE = "Kaihong Assist Tools";
-
- /**
- * 获取焦点色值
- */
- public static final Border BORDER_FOCUS_GAINED = BorderFactory.createLineBorder(Color.decode("#385584"), 2);
-
- /**
- * 默认色值
- */
- public static final Border BORDER_FOCUS_LOST_SEARCH = BorderFactory.createLineBorder(Color.decode("#646567"), 2);
-
- /**
- * 工具描述
- */
- public static final HashMap TOOLS = new HashMap() {
- {
- put("NAPI Generator", "NAPI tool generates NAPI framework code by typescript file.");
- put("H2Ts Generator", "H2Ts tool generates ts framework code by .h file");
- }
- };
-}
diff --git a/hdc/assist/assist_tools_vs_plugin/README_zh.md b/hdc/assist/assist_tools_vs_plugin/README_zh.md
deleted file mode 100644
index 116dff5cb6b373a7cc5948afcf0d441beb16923a..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/README_zh.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# ASSIST工具VS Code插件说明
-
-## 简介
-
-ASSIST统一入口工具,可以将各南向工具统一起来,用户只需下载统一入口工具,在统一入口工具中按需下载南向工具,实现对工具链的使用。目前工具支持IntelliJ插件和VS Code插件两种入口,本文主要介绍VS Code插件使用说明。
-
-## 目录
-
-
-```
-├── assist
-│ ├── ... # 其它文件
-│ ├── assist_tools_vs_plugin # VS Code插件代码
-│ │ ├── docs # VS Code插件说明
-│ │ ├── package.json # package.json 文件
-│ │ ├── src # VS Code插件源码
-│ │ └── README_zh # VS Code插件说明
-```
-
-## 约束
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 工具使用
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist/assist_tools_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具VS Code插件的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist/assist_tools_vs_plugin/docs/DEVELOP_ZH.md)
-
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/assist/assist_tools_vs_plugin/docs/DEVELOP_ZH.md b/hdc/assist/assist_tools_vs_plugin/docs/DEVELOP_ZH.md
deleted file mode 100644
index e2212d1b68709cdb5beac6bf9662588ba460e602..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# ASSIST_TOOLS工具VS Code插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的VS Code插件。
-
-## VS Code插件打包说明
-
-### Linux
-
-1.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npm i
-
-2.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-3.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-4.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
-之后会在当前目录下打包生成一个插件AssistTools-0.0.1.vsix。结果如下:
-
- kaihong1@ubuntu:~/napi/napi_generator_test0419/napi_generator/hdc/assist/assist_tools_vs_plugin/src$ npx vsce package
- This extension consists of 2166 files, out of which 1160 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: /home/kaihong1/napi/napi_generator_test0419/napi_generator/hdc/assist/assist_tools_vs_plugin/src/AssistTools-0.0.1.vsix (2166 files, 3MB)
-
-### Windows
-
-1.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npm i
-
-2.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-3.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-4.在napi_generator/hdc/assist/assist_tools_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
- 之后会在当前目录下打包生成一个插件AssistTools-0.0.1.vsix。结果如下:
-
- E:\napi_generator_aboutTest\zjx_gjj_napi230401\napi_generator\hdc\assist\assist_tools_vs_plugin\src>npx vsce package
- This extension consists of 2167 files, out of which 1160 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: E:\napi_generator_aboutTest\zjx_gjj_napi230401\napi_generator\hdc\assist\assist_tools_vs_plugin\src\AssistTools-0.0.1.vsix (2167 files, 3.18MB)
-
diff --git a/hdc/assist/assist_tools_vs_plugin/docs/INSTRUCTION_ZH.md b/hdc/assist/assist_tools_vs_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index 2d3d43b4c749e37f061c90b7acb824a8b114b0d6..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# ASSIST_TOOLS工具VS Code插件使用说明
-## 简介
-
-ASSIST统一入口工具,可以将南北向各工具统一起来,用户只需下载统一入口工具,在统一入口工具中按需下载各南北向工具,实现对工具链的使用。统一入口工具支持两种入口,分别是DevEco Studio使用的IntelliJ插件、VS Code插件,使用者可以根据自己的需要选择合适的工具。本文主要介绍VS Code插件使用方法。
-
-## VS Code插件使用方法
-
-### 说明
-
-visual studio code 版本需1.62.0及以上。
-
-### 步骤
-
-1、 打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-2、 在应用商店搜索assist_tools插件,再单击安装。
-
-
-
-3、 安装完成后就会在VS Code的插件管理器中能看到 Kaihong Assist Tools 这个插件了。
-
-
-
-4、 右键单击任意文件或文件夹,选择“Kaihong Assist Tools”选项。
-
-
-
-5、 工具打开 Kaihong Assist Tools 窗口,选择是否启用工具链:
-
-若不启用工具链,选择任意一个工具使用,如,使用API Scan工具,点击 API Scan 图标,再点击Ok, Kaihong Assist Tools将会下载并启动 API Scan工具,工具打开API Scan窗口,扫描项目路径框填写将要扫描项目的路径,结果输出路径框自动填写与扫描项目相同路径,使用者可以根据实际情况修改结果输出路径,然后点击ok。选择其它工具使用与选择 API Scan 工具类似。
-
-
-
-若启用工具链,用户根据需求选择工具组成工具链,Kaihong Assist Tools将会下载并启动工具链中的工具供用户使用,如:启用工具链选择“API Scan”,"GN","SERVICE","TS","NAPI"工具组成工具链,然后点击 Ok, Kaihong Assist Tools将会从插件市场下载所有选中的工具,并按照 API Scan -> GN -> SERVICE -> TS -> NAPI 顺序启用工具
-
-
-
-首先启用工具 API Scan, 填写相应参数完毕 API Scan 界面后点击Next, 扫描完成,并启动 GN 工具;
-
-
-
-进入 GN 工具填写相应参数后点击Next , 生成build_tmp文件夹,build_tmp文件夹中包含BUILD.gn文件,并启动 SERVICE 工具;
-
-
-
-进入 SERVICE 工具填写相应参数后点击Next , 生成service框架代码文件,并启动 TS 工具;
-
-
-
-进入 TS 工具填写相应参数后点击Next , 生成.d.ts文件,并启动 NAPI 工具, NAPI工具是工具链中最后一个工具,NAPI工具的输入参数可以是TS工具的输出,填写完相应参数后,点击 Ok, 生成napi框架代码。
-
-
-
-
-
-
-
diff --git a/hdc/assist/assist_tools_vs_plugin/package.json b/hdc/assist/assist_tools_vs_plugin/package.json
deleted file mode 100644
index b94e87c500f11ee8ed34cd27931f7eb438d7534d..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/package.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "name": "assist_tools",
- "version": "1.0.0",
- "description": "This is the Kaihong assistance tools unified entrance for OpenHarmony OS developer.",
- "main": "./src/extension.js",
- "directories": {
- "doc": "docs"
- },
- "dependencies": {
- "mocha": "^9.2.1",
- "node-gyp": "^8.4.1",
- "stdio": "^2.1.1",
- "typescript": "^4.5.5"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- },
- "author": "",
- "license": "ISC",
- "pkg": {
- "assets": [
- ]
- }
-}
diff --git a/hdc/assist/assist_tools_vs_plugin/src/LICENSE b/hdc/assist/assist_tools_vs_plugin/src/LICENSE
deleted file mode 100644
index 72f817fb44de8b9fd23fe71230b9dc5ccbe4ca35..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/hdc/assist/assist_tools_vs_plugin/src/README.md b/hdc/assist/assist_tools_vs_plugin/src/README.md
deleted file mode 100644
index 0c5bd55aa4d1d4287f51ca86d26ace69d9825149..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# ASSIST_TOOLS工具使用说明
-
-## 简介
-
-ASSIST南向统一入口工具,可以将各南向工具统一起来,用户只需下载统一入口工具,在统一入口工具中按需下载南向工具,实现对工具链的使用。
-
-## 约束
-
-visual studio code 版本需1.62.0及以上。
-
-## 操作简介
-
-1.安装VS Code插件。
-
-2.打开任意文件夹或文件,鼠标单击右键选择“Kaihong Assist Tools”插件。
-
-3.若不启用工具链,则直接点击某一工具等待下载并启用;若启用工具链,选择工具组成工具链使用。
-
-详细说明见[工具使用说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/assist/assist_tools_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 合作共建
-
-[联系方式](https://www.kaihong.com/)
diff --git a/hdc/assist/assist_tools_vs_plugin/src/extension.js b/hdc/assist/assist_tools_vs_plugin/src/extension.js
deleted file mode 100644
index 817e940f99b2dc13e5963a941909eeedd3c40720..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/extension.js
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// The module 'vscode' contains the VS Code extensibility API
-// Import the module and reference it with the alias vscode in your code below
-const vscode = require('vscode');
-const fs = require('fs');
-const path = require('path');
-const { readFile } = require('./util/VsPluginTool');
-
-var extensionIds = [];
-var importCheck = false;
-
-// This method is called when your extension is activated
-// Your extension is activated the very first time the command is executed
-
-/**
- * @param {vscode.ExtensionContext} context
- */
-function activate(context) {
-
- // Use the console to output diagnostic information (console.log) and errors (console.error)
- // This line of code will only be executed once when your extension is activated
- console.log('Congratulations, your extension "Kaihong Assist Tools" is now active!');
-
- // The command has been defined in the package.json file
- // Now provide the implementation of the command with registerCommand
- // The commandId parameter must match the command field in package.json
- let disposable = vscode.commands.registerCommand('assist_tools', function () {
- // The code you place here will be executed every time your command is executed
-
- globalPanel = vscode.window.createWebviewPanel(
- 'assist tools', // Identifies the type of WebView
- 'Kaihong Assist Tools', // Title of the panel displayed to the user
- vscode.ViewColumn.Two, // Display the WebView panel in the form of new columns in the editor
- {
- enableScripts: true, // Enable or disable JS, default is Enable
- retainContextWhenHidden: true, // Keep the WebView state when it is hidden to avoid being reset
- }
- );
- globalPanel.webview.html = getWebviewContent(context);
- let msg;
- globalPanel.webview.onDidReceiveMessage(message => {
- msg = message.msg;
- if (msg == "cancel") {
- globalPanel.dispose();
- } else if (msg == "startApi") {
- const extensionId = 'kaihong.ApiScan';
- installStartExtension(extensionId);
- } else if (msg == "startGn") {
- const extensionId = 'kaihong.gn-gen';
- installStartExtension(extensionId);
- } else if (msg == "startService") {
- const extensionId = 'kaihong.service-gen';
- installStartExtension(extensionId);
- } else if (msg == "startTs") {
- const extensionId = 'kaihong.ts-gen';
- installStartExtension(extensionId);
- } else if (msg == "startNapi") {
- const extensionId = 'kaihong.napi-gen';
- installStartExtension(extensionId);
- } else if (msg == "param") {
- let isSelectToolChain = installExtensions(message);
- startExtensions(isSelectToolChain);
- }
- }, undefined, context.subscriptions);
- // Display a message box to the user
- vscode.window.showInformationMessage('Welcome to use Kaihong Assist Tools!');
- });
-
- context.subscriptions.push(disposable);
-}
-
-function installExtensions(message) {
- importCheck = message.importIsCheck;
- let checkApi = message.checkApi;
- let checkGn = message.checkGn;
- let checkService = message.checkService;
- let checkTs = message.checkTs;
- let checkNapi = message.checkNapi;
- if (importCheck) {
- if (extensionIds.length != 0) {
- extensionIds.length = 0;
- }
- if (checkApi == true) {
- extensionIds.push('kaihong.ApiScan')
- }
- if (checkGn == true) {
- extensionIds.push('kaihong.gn-gen')
- }
- if (checkService == true) {
- extensionIds.push('kaihong.service-gen')
- }
- if (checkTs == true) {
- extensionIds.push('kaihong.ts-gen')
- }
- if (checkNapi == true) {
- extensionIds.push('kaihong.napi-gen')
- }
- }
- startInstallExtensions(extensionIds).catch((error) => {
- console.error(error);
- });
- return importCheck;
-}
-
-async function startInstallExtensions(extensionIds) {
- const promises = extensionIds.map(async (extensionId) => {
- const extension = vscode.extensions.getExtension(extensionId);
- if (!extension) {
- await vscode.commands.executeCommand('workbench.extensions.installExtension', extensionId);
- console.log(`扩展插件 ${extensionId} 下载完成`);
- } else {
- console.log(`扩展插件 ${extensionId} 已经下载`);
- }
- });
- await Promise.all(promises);
- console.log('所有扩展插件下载完成');
-}
-
-/**
-* 执行完毕后启动工具链中下一个插件
-*/
-function nextPluginExeCommand(nextPluginId) {
- if (nextPluginId == "kaihong.ApiScan") {
- return 'api_scan';
- } else if (nextPluginId == "kaihong.gn-gen") {
- return 'generate_gn';
- } else if (nextPluginId == "kaihong.service-gen") {
- return 'generate_service';
- } else if (nextPluginId == "kaihong.ts-gen") {
- return 'generate_ts';
- } else if (nextPluginId == "kaihong.napi-gen") {
- return 'generate_napi';
- } else {
- return null;
- }
-}
-
-
-function startExtensions(isSelectToolChain) {
- //启动工具链,根据需求启用插件
- let extensionId0 = extensionIds[0];
- //将isSelectToolChain和extensionIds数组传入其他插件
- //启动第一个插件
- let nextStartPlugin = nextPluginExeCommand(extensionId0);
- try {
- vscode.commands.executeCommand(nextStartPlugin, '', isSelectToolChain, extensionIds);
- } catch (error) {
- console.error(error);
- }
-}
-
-// 参数单位 毫秒
-function wait(ms) {
- return new Promise(resolve => setTimeout(() => resolve(), ms));
-};
-
-async function installStartExtension(extensionId) {
- const extension = vscode.extensions.getExtension(extensionId);
- if (!extension) {
- try {
- // 下载插件
- vscode.window.showInformationMessage(`Extension ${extensionId} installing...`);
- setTimeout(() => {
- const active = vscode.window.activeInformationMessage;
- if (active && active.message === `Extension ${extensionId} installing...`) {
- active.dispose();
- }
- }, 8000);
- await vscode.commands.executeCommand('workbench.extensions.installExtension', extensionId);
- vscode.window.showInformationMessage(`Extension ${extensionId} installed successfully.`);
- vscode.window.showInformationMessage(`Extension ${extensionId} activating...`);
- console.log(`Extension ${extensionId} activating...`);
- await wait(1000); // 等待下载插件初始化
- const extensionDone = vscode.extensions.getExtension(extensionId);
- if (extensionDone && extensionDone.isActive) {
- vscode.window.showInformationMessage(`Extension ${extensionId} activated successfully.`);
- console.log(`Extension ${extensionId} activated successfully.`);
- } else {
- console.log('请等待插件初始化完成')
- await wait(1000);
- }
- } catch (error) {
- console.log(`Failed to install extension ${extensionId}: ${error.message}`);
- }
- }
-
- // 启动扩展
- if (extensionId == "kaihong.ApiScan") {
- vscode.commands.executeCommand('api_scan', '', false, '');
- } else if (extensionId == "kaihong.gn-gen") {
- vscode.commands.executeCommand('generate_gn', '', false, '');
- } else if (extensionId == "kaihong.service-gen") {
- vscode.commands.executeCommand('generate_service', '', false, '');
- } else if (extensionId == "kaihong.ts-gen") {
- vscode.commands.executeCommand('generate_ts', '', false, '');
- } else if (extensionId == "kaihong.napi-gen") {
- vscode.commands.executeCommand('generate_napi', '', false, '');
- }
- else {
- console.error('the toolChain does not include this extension!')
- }
-}
-
-function getWebviewContent(context) {
- let data = readFile(__dirname + '/vs_plugin_view.html');
- data = getWebViewContent(context, '/vs_plugin_view.html');
- return data.toString();
-}
-
-function getWebViewContent(context, templatePath) {
- const resourcePath = path.join(context.extensionPath, templatePath);
- const dirPath = path.dirname(resourcePath);
- let html = fs.readFileSync(resourcePath, 'utf-8');
- html = html.replace(/( {
- if ($2.indexOf("https://") < 0) {
- return $1 + globalPanel.webview.asWebviewUri(vscode.Uri.file(path.resolve(dirPath, $2))) + '"';
- } else {
- return $1 + $2+'"';
- }
- });
- return html;
-}
-
-// This method is called when your extension is deactivated
-function deactivate() {}
-
-module.exports = {
- activate,
- deactivate
-}
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/api.png b/hdc/assist/assist_tools_vs_plugin/src/images/api.png
deleted file mode 100644
index 81d5e40a6e854c85d789eb33f75f7fec3213b62a..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/api.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/clear.png b/hdc/assist/assist_tools_vs_plugin/src/images/clear.png
deleted file mode 100644
index 32edfa363b1a1f764fade91a3a80fc7f626a0315..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/clear.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/gn.png b/hdc/assist/assist_tools_vs_plugin/src/images/gn.png
deleted file mode 100644
index 81d5e40a6e854c85d789eb33f75f7fec3213b62a..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/gn.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/h2ts.png b/hdc/assist/assist_tools_vs_plugin/src/images/h2ts.png
deleted file mode 100644
index 1b4acbe9c4839288088c763afb906497c4d34621..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/h2ts.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/napi.png b/hdc/assist/assist_tools_vs_plugin/src/images/napi.png
deleted file mode 100644
index 81d5e40a6e854c85d789eb33f75f7fec3213b62a..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/napi.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/search.png b/hdc/assist/assist_tools_vs_plugin/src/images/search.png
deleted file mode 100644
index b27fc24d3502eed6f9ac7315d85f01c364009338..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/search.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/images/service.png b/hdc/assist/assist_tools_vs_plugin/src/images/service.png
deleted file mode 100644
index 81d5e40a6e854c85d789eb33f75f7fec3213b62a..0000000000000000000000000000000000000000
Binary files a/hdc/assist/assist_tools_vs_plugin/src/images/service.png and /dev/null differ
diff --git a/hdc/assist/assist_tools_vs_plugin/src/jsconfig.json b/hdc/assist/assist_tools_vs_plugin/src/jsconfig.json
deleted file mode 100644
index 3963f9cb0a7ff783c5774c308dbae7492cae5023..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/jsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "ES2020",
- "checkJs": false, /* Typecheck .js files. */
- "lib": [
- "ES2020"
- ]
- },
- "exclude": [
- "node_modules"
- ]
-}
diff --git a/hdc/assist/assist_tools_vs_plugin/src/package.json b/hdc/assist/assist_tools_vs_plugin/src/package.json
deleted file mode 100644
index 5c62172b1eaa84c19e4311c1b694a06e95a97471..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/package.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "name": "AssistTools",
- "displayName": "Kaihong Assist Tools",
- "description": "This is the Kaihong assistance tools unified entrance for OpenHarmony OS developer.",
- "version": "0.0.1",
- "keywords": [
- "assist_tools",
- "assist"
- ],
- "engines": {
- "vscode": "^1.62.0"
- },
- "publisher": "kaihong",
- "categories": [
- "Other"
- ],
- "activationEvents": [
- "onStartupFinished"
- ],
- "main": "./extension.js",
- "contributes": {
- "commands": [
- {
- "command": "assist_tools",
- "title": "Kaihong Assist Tools"
- }
- ],
- "menus": {
- "explorer/context": [
- {
- "when": "resourceScheme == file",
- "command": "assist_tools"
- }
- ],
- "editor/context": [
- {
- "command": "assist_tools"
- }
- ]
- }
- },
- "scripts": {
- "lint": "eslint .",
- "pretest": "npm run lint",
- "test": "node ./test/runTest.js"
- },
- "devDependencies": {
- "@types/glob": "^7.1.4",
- "@types/mocha": "^9.0.0",
- "@types/node": "14.x",
- "@types/vscode": "^1.62.0",
- "@vscode/test-electron": "^1.6.2",
- "eslint": "^8.1.0",
- "glob": "^7.1.7",
- "mocha": "^9.1.3",
- "typescript": "^4.9.5"
- },
- "dependencies": {
- "vsce": "^2.15.0"
- },
- "repository": {
- "type": "gitee",
- "url": "https://gitee.com/openharmony/napi_generator/tree/master/hdc/assist"
- }
-}
diff --git a/hdc/assist/assist_tools_vs_plugin/src/util/VsPluginTool.js b/hdc/assist/assist_tools_vs_plugin/src/util/VsPluginTool.js
deleted file mode 100644
index 58250bfdc9aa7d38626ee9bebd92ead04a3f729c..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/util/VsPluginTool.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-function utf8ArrayToStr(array) {
- var res, i, length, ch;
- var ch2, ch3;
-
- res = "";
- length = array.length;
- i = 0;
- while (i < length) {
- ch = array[i++];
- let c = ch >> 4;
- switch (c) {
- // 0xxxxxxx
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- res += String.fromCharCode(ch);
- break;
- // 110x xxxx 10xx xxxx
- case 12: case 13:
- ({ ch2, i, res } = funcCase13(ch2, array, i, ch, res));
- break;
- // 1110 xxxx 10xx xxxx 10xx xxxx
- case 14:
- ({ ch2, i, ch3, res } = funcCase14(ch2, array, i, ch3, ch, res));
- break;
- }
- }
-
- return res;
- }
-
- function funcCase14(ch2, array, i, ch3, ch, res) {
- ch2 = array[i++];
- ch3 = array[i++];
- let tmp3 = (ch & 0x0F) << 12;
- let tmp4 = (ch2 & 0x3F) << 6;
- let tmp5 = (ch3 & 0x3F) << 0;
- res += String.fromCharCode(tmp3 | tmp4 | tmp5);
- return { ch2, i, ch3, res };
- }
-
- function funcCase13(ch2, array, i, ch, res) {
- ch2 = array[i++];
- let tmp = (ch & 0x1F) << 6;
- let tmp2 = ch2 & 0x3F;
- res += String.fromCharCode(tmp | tmp2);
- return { ch2, i, res };
- }
-
- function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
- }
-
-module.exports = {
- readFile
-}
\ No newline at end of file
diff --git a/hdc/assist/assist_tools_vs_plugin/src/vs_plugin_view.html b/hdc/assist/assist_tools_vs_plugin/src/vs_plugin_view.html
deleted file mode 100644
index 8e3726a2f88b457a8f1dbe81cdc7d1634ba4e0ca..0000000000000000000000000000000000000000
--- a/hdc/assist/assist_tools_vs_plugin/src/vs_plugin_view.html
+++ /dev/null
@@ -1,481 +0,0 @@
-
-
-
-
-
- Kaihong Assist Tools
-
-
-
-
-
-
-
Choose Your Tool
-
-
-
-
-
-
-
-
-
-
API Scan
-
-
-
-
GN
-
-
-
-
SERVICE
-
-
-
-
TS
-
-
-
-
NAPI
-
-
-
-
- 是否启用工具链:
-
-
-
-
-
- API Scan
- This tool can scan the Android APIs in OpenHarmony Projects
-
-
- GN Gen
- gn generate tool
-
-
- SERVICE Gen
- Generate IPC service framework code for OpenHarmony
-
-
- TS Gen
- Generate TS interface file for OpenHarmony
-
-
- NAPI Gen
- Generate NAPI definition code and framework code for OpenHarmony
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/assist/figures/DevEco_step_assist.png b/hdc/assist/figures/DevEco_step_assist.png
deleted file mode 100644
index 978d7d8ef4fa6b27f2f0551bfafa62c2d890ec8c..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_frame.png b/hdc/assist/figures/DevEco_step_assist_frame.png
deleted file mode 100644
index ee462c2287b97fbe2b206f5bee426ecfc7620041..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_frame.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_importToolChain.png b/hdc/assist/figures/DevEco_step_assist_importToolChain.png
deleted file mode 100644
index 91fe539c401d25dfb50c03dfe4e38b7fdbc8bf73..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_importToolChain.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_napiGenerate.png b/hdc/assist/figures/DevEco_step_assist_napiGenerate.png
deleted file mode 100644
index 98c01e1c738a7b317df2f527e3b104257d0010e9..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_napiGenerate.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_napiGenerateSuccess.png b/hdc/assist/figures/DevEco_step_assist_napiGenerateSuccess.png
deleted file mode 100644
index bc7c337a868ac6874249f6aab3a5dffd794c16a3..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_napiGenerateSuccess.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_tsGenerate.png b/hdc/assist/figures/DevEco_step_assist_tsGenerate.png
deleted file mode 100644
index b9021130a28ef8a0f9a84d10bab2e3f923610b57..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_tsGenerate.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_tsGenerateSuccess.png b/hdc/assist/figures/DevEco_step_assist_tsGenerateSuccess.png
deleted file mode 100644
index 4ba68ffe5012ac7bf44633ac058414d2e5a9d8cc..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_tsGenerateSuccess.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate.png b/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate.png
deleted file mode 100644
index 40c806fac6dea7b90e292373b0b364634f3c4325..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate2.png b/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate2.png
deleted file mode 100644
index ae1d1d4b82388bec6fbd4b0d6c4ac5939bf6f5f2..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_assist_tsNapiGenerate2.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_finish.png b/hdc/assist/figures/DevEco_step_finish.png
deleted file mode 100644
index b02a3bd8ab283840a1401131153e1b67d83dd772..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_finish.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_firstNext.png b/hdc/assist/figures/DevEco_step_firstNext.png
deleted file mode 100644
index 812504617e554fa1985f1bda04fa2af3b122a4a0..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_firstNext.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_napiPlugins.png b/hdc/assist/figures/DevEco_step_napiPlugins.png
deleted file mode 100644
index 6cdf8d45df6b37300a502ab916d267d182aa265a..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_napiPlugins.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_newFile.png b/hdc/assist/figures/DevEco_step_newFile.png
deleted file mode 100644
index 3b69aa21918c6a0377fad1e9dfdc6f702d046510..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_newFile.png and /dev/null differ
diff --git a/hdc/assist/figures/DevEco_step_pluginsOk.png b/hdc/assist/figures/DevEco_step_pluginsOk.png
deleted file mode 100644
index b5b783f70c60e3f60c9d3be287925da4d11d8592..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/DevEco_step_pluginsOk.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_Proj_Module.png b/hdc/assist/figures/IntelliJ_env_Proj_Module.png
deleted file mode 100644
index 5b7cd4c353f7562b238d93b169773cb5acebac19..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_Proj_Module.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_Proj_Module_New.png b/hdc/assist/figures/IntelliJ_env_Proj_Module_New.png
deleted file mode 100644
index d8c180413b38fbd8e8e5c21116612ea400671f07..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_Proj_Module_New.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_built_jar.png b/hdc/assist/figures/IntelliJ_env_built_jar.png
deleted file mode 100644
index c58a2e7c8212ca39f4fc83f8df3d5b682a2c995d..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_built_jar.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_built_jar_success.png b/hdc/assist/figures/IntelliJ_env_built_jar_success.png
deleted file mode 100644
index 8a523e27f4636bb2832b62f4e04a282879e06e92..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_built_jar_success.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_built_pro.png b/hdc/assist/figures/IntelliJ_env_built_pro.png
deleted file mode 100644
index 706d14a767e5a8a0d7d680fab8fcfd99c7b6b1ee..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_built_pro.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_config_SDKs.png b/hdc/assist/figures/IntelliJ_env_config_SDKs.png
deleted file mode 100644
index 0d88eb74c03bcf7f42a33dd3181de767317bb3b4..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_config_SDKs.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_config_SDKs_Classpath.png b/hdc/assist/figures/IntelliJ_env_config_SDKs_Classpath.png
deleted file mode 100644
index c9f0adfd43020b3235d6a10d7261cd4834caeb02..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_config_SDKs_Classpath.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_config_open_proj.png b/hdc/assist/figures/IntelliJ_env_config_open_proj.png
deleted file mode 100644
index c1fc11e0600014f206e1a651f09a1e25e8e579b6..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_config_open_proj.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_configurations.png b/hdc/assist/figures/IntelliJ_env_configurations.png
deleted file mode 100644
index b7b59e971a29f7569dc256e896aee5d303b9f917..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_configurations.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_module_root.png b/hdc/assist/figures/IntelliJ_env_module_root.png
deleted file mode 100644
index b60aba3d6b9b48ac8ca00562e8ed1bc894705ad4..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_module_root.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_proj_structure.png b/hdc/assist/figures/IntelliJ_env_proj_structure.png
deleted file mode 100644
index ce351442dd7351f68278cfb0fd630a3b86fabad5..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_proj_structure.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_run_debug.png b/hdc/assist/figures/IntelliJ_env_run_debug.png
deleted file mode 100644
index 2a66273f815c18a2c616a37d376937b640e679eb..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_run_debug.png and /dev/null differ
diff --git a/hdc/assist/figures/IntelliJ_env_select_moudles.png b/hdc/assist/figures/IntelliJ_env_select_moudles.png
deleted file mode 100644
index b1b1295736cd98f8274014b5c5764c439930fd5b..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/IntelliJ_env_select_moudles.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-assist-start.png b/hdc/assist/figures/pic-plug-in-assist-start.png
deleted file mode 100644
index 831290a2a257dc5428eb46de5c666f5422081ea6..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-assist-start.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-assist.png b/hdc/assist/figures/pic-plug-in-assist.png
deleted file mode 100644
index 9aad371a753e04ff3a5fa47145e1faeb049f6159..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-assist.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-export_toolChain.png b/hdc/assist/figures/pic-plug-in-export_toolChain.png
deleted file mode 100644
index 8b7d430127728474f0f2aaa7e9835b1e784dbfd0..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-export_toolChain.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-import-api.png b/hdc/assist/figures/pic-plug-in-import-api.png
deleted file mode 100644
index d12e153dca08d3de52c9ef17ad078788ede78651..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-import-api.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-import-gn.png b/hdc/assist/figures/pic-plug-in-import-gn.png
deleted file mode 100644
index e77a09b15a0cde7f3306c46648b7d8b764fe3129..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-import-gn.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-import-napi.png b/hdc/assist/figures/pic-plug-in-import-napi.png
deleted file mode 100644
index c0c207039f8379c90967138c51b7665ec52c66f3..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-import-napi.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-import-service.png b/hdc/assist/figures/pic-plug-in-import-service.png
deleted file mode 100644
index e0bf64c942ff10c401fd83e451a8f94cd065fcdc..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-import-service.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-import-ts.png b/hdc/assist/figures/pic-plug-in-import-ts.png
deleted file mode 100644
index a3c2f931414e84e56928b57703fd78894aeaaea1..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-import-ts.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-import_toolChain.png b/hdc/assist/figures/pic-plug-in-import_toolChain.png
deleted file mode 100644
index 604d119d05e5faddd8c6372954cc2e65f716ce03..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-import_toolChain.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-search.png b/hdc/assist/figures/pic-plug-in-search.png
deleted file mode 100644
index e37db358f625276a615fdcec2ac2267c4545d3ae..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-search.png and /dev/null differ
diff --git a/hdc/assist/figures/pic-plug-in-select.png b/hdc/assist/figures/pic-plug-in-select.png
deleted file mode 100644
index c0f1b91e22b7c78b245ce10706f6411e85089970..0000000000000000000000000000000000000000
Binary files a/hdc/assist/figures/pic-plug-in-select.png and /dev/null differ
diff --git a/hdc/gn/FAQ.md b/hdc/gn/FAQ.md
deleted file mode 100755
index 36568d396c0e03616f1e3a83129fa99aebe6feba..0000000000000000000000000000000000000000
--- a/hdc/gn/FAQ.md
+++ /dev/null
@@ -1,160 +0,0 @@
-# GN脚本转换工具 问题记录
-
-## 具体三方库转换生成gn脚本问题记录
-
-### 转换third_party/libpng库
-
-1、使用VS Code插件转换libpng库时,参数填写如图所示,点击ok之后,右下角弹出genError日志,可将日志信息全部复制到日记本等工具,详细日志显示报错: "Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)"。
-
-
-
-
-
-问题定位:libpng三方库中引用到zlib库,但转换生成gn脚本时,未指定libzlib.z.so路径及zlib三方库源码路径,导致转换失败。
-
-问题解决:OpenHarmony源码中存在zlib三方库源码,若已编译成功过镜像,则out目录下会包含libzlib.z.so镜像。因此,在使用VS Code插件转换生成gn脚本时,在编译选项中指定libzlib.z.so路径、zlib库源文件路径即可,具体命令如下:
-
- (-DM_LIBRARY=,-DZLIB_LIBRARY=/home/harmony/OpenHarmony/out/khdvk_rk3568_a/appexecfwk/bundle_framework/libzlib.z.so,-DZLIB_INCLUDE_DIR=/home/harmony/OpenHarmony/third_party/zlib)
-
-
-
-### 转换third_party/curl库
-
-1、使用VS Code插件转换curl库时,参数填写如图所示,点击ok之后,右下角弹出genError日志,可将日志信息全部复制到日记本等工具,查看日志显示: "system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)"。
-
-
-
-
-
-问题定位:curl三方库中引用到openssl三方库,但工具转换时未指定libcrypto.z.so路径以及openssl源码路径,导致转换失败。
-
-问题解决:OpenHarmony源码存在openssl库,且在out路径下包含libcrypto.z.so镜像。因此,在使用VS Code插件转换生成gn脚本时,在编译选项中指定libcrypto.z.so路径、openssl库源文件路径即可,命令如下:
-
- (-DOPENSSL_ROOT_DIR=abc,-DOPENSSL_INCLUDE_DIR=/home/harmony/OpenHarmony/third_party/boringssl/src/include,-DOPENSSL_CRYPTO_LIBRARY=/home/harmony/OpenHarmony/out/khdvk_rk3568_a/developtools/profiler/libcrypto.z.so)
-
-
-
-2、根据步骤1后发现新的错误,具体报错日志为:未设置OPENSSL_SSL_LIBRARY路径。
-
-
-
-问题定位:工具在转换时未指定libssl.z.so路径,导致转换失败。
-
-问题解决:编译转换时增加指定libssl.z.so路径,命令如下:
-
- (-DOPENSSL_ROOT_DIR=abc,-DOPENSSL_INCLUDE_DIR=/home/harmony/OpenHarmony/third_party/boringssl/src/include,-DOPENSSL_CRYPTO_LIBRARY=/home/harmony/OpenHarmony/out/khdvk_rk3568_a/developtools/profiler/libcrypto.z.so,-DOPENSSL_SSL_LIBRARY=/home/harmony/OpenHarmony/out/khdvk_rk3568_a/developtools/profiler/libssl.z.so)
-
-
-
-3、根据步骤2后再次发现新的错误,具体报错日志为:“clang未解析参数 /home/harmony/OpenHarmony/third_party/boringssl/src/include”,具体日志信息如下:
-
-
-
-问题定位:编译脚本中存在工具不支持的特殊编译选项。
-
-问题解决:在转换三方库时,可将扩展编译选项选择是,然后在扩展选项名称中填写“/home/harmony/OpenHarmony/third_party/boringssl/src/include”,具体操作如下所示:
-
-
-
-### 转换third_party/libphonenumber库
-
-1、使用VS Code插件转换libphonenumber库时,参数填写如图所示,点击ok之后,右下角弹出genError日志,可将日志信息全部复制到日记本等工具,查看日志显示: "Can't find Google C++ Testing Framework"。
-
-
-
-
-
-问题定位:工具在转换时未指定gtest路径,导致转换生成gn脚本时找不到“Google C++ Testing Framework”。
-
-问题解决:OpenHarmony源码存在gtest库,因此在使用VS Code插件转换时,在编译选项处指定gtest路径即可,具体填写如下:
-
- (-DGTEST_INCLUDE_DIR=/home/harmony/OpenHarmony/third_party/googletest/googletest/include)
-
-
-
-2、根据步骤1后发现新的错误,具体报错日志为未设置GTEST_SOURCE_DIR路径。
-
-
-
-问题定位:工具在转换时未指定GTEST_SOURCE_DIR路径,导致转换生成gn脚本时找不到gtest源文件。
-
-问题解决:在工具编译选项处增加指定GTEST_SOURCE_DIR路径,具体填写如下:
-
- (-DGTEST_INCLUDE_DIR=/home/harmony/OpenHarmony/third_party/googletest/googletest/include,-DGTEST_SOURCE_DIR=/home/harmony/OpenHarmony/third_party/googletest/googletest)
-
-
-
-如上图所示生成gn脚本成功。
-
-### 转换third_party/libcoap库
-
-1、使用可执行程序转换libcoap库时,报错如下:
-
-
-
-问题定位:该三方库引用到mbedtls三方库,但工具在转换时未指定mbedtls源码路径以及libmbedtls.z.so镜像路径,导致转换失败。
-
-问题解决:OpenHarmony源码中存在mbedtls三方库,且out目录下包含libmbedtls.z.so镜像,在转换libcoap库时增加-a参数,且指定MBEDTLS_INCLUDE_DIRS路径、MBEDTLS_LIBRARY路径即可,具体命令如下:
-
- harmony@Ubuntu-64:~/linshi/napi_generator_2/hdc/gn/gn-gen$./gn-gen-linux -o out/khdvk_rk3568_a -p /home/harmony/OpenHarmony -f third_party/libcoap/CMakeLists.txt -a "(-DM_LIBRARY=,-DMBEDTLS_INCLUDE_DIRS=/home/harmony/OpenHarmony/third_party/mbedtls,-DMBEDTLS_LIBRARY=/home/harmony/OpenHarmony/out/khdvk_rk3568_a/common/dsoftbus_standard/libmbedtls.z.so)"
-
-2、根据步骤1后发现新的错误,根据日志信息显示为“clang未解析参数 -g”。
-
-
-
-问题定位:当前工具源码不支持解析参数-g,导致转换失败。
-
-问题解决:在res/cfg.json文件的compileflag参数中添加-g,如下所示:
-
- {
- "fileSuffix": ".cpp, .cxx, .cc, .hpp",
- "compileflag": "--target=, -march=,-g"
- }
-
-3、根据步骤2后发现新的错误,根据日志信息显示为“clang未解析参数 -lMBEDX509_LIBRARY-NOTFOUND”。
-
-
-
-问题定位:当前工具源码不支持解析参数-lMBEDX509_LIBRARY-NOTFOUND,导致转换失败。
-
-问题解决:在res/cfg.json文件的compileflag参数中添加-lMBEDX509_LIBRARY-NOTFOUND,如下所示:
-
- {
- "fileSuffix": ".cpp, .cxx, .cc, .hpp",
- "compileflag": "--target=, -march=,-g,-lMBEDX509_LIBRARY-NOTFOUND"
- }
-
-4、根据步骤2后发现新的错误,根据日志信息显示为“clang未解析参数 -lMBEDCRYPTO_LIBRARY-NOTFOUND”。
-
-
-
-问题定位:当前工具源码不支持解析参数-lMBEDCRYPTO_LIBRARY-NOTFOUND,导致转换失败。
-
-问题解决:在res/cfg.json文件的compileflag参数中添加-lMBEDCRYPTO_LIBRARY-NOTFOUND,如下所示:
-
- {
- "fileSuffix": ".cpp, .cxx, .cc, .hpp",
- "compileflag": "--target=, -march=,-g,-lMBEDX509_LIBRARY-NOTFOUND,-lMBEDCRYPTO_LIBRARY-NOTFOUND"
- }
-
-### 转换third_party/mbedtls-development库
-
-1、转换生成gn脚本时,报“No module named 'jsonschema'。
-
-
-
-问题定位:当前环境中没有安装jsonschema库。
-
-问题修改:安装jsonschema库,安装命令如下:
-
- pip install jsonschema
-
-4、转换生成gn脚本时,报“No module named 'jinja2'。
-
-
-
-问题定位:当前环境中没有安装jinja2库。
-
-问题修改:安装jinja2库,安装命令如下:
-
- pip install jinja2
\ No newline at end of file
diff --git a/hdc/gn/README_ZH.md b/hdc/gn/README_ZH.md
deleted file mode 100755
index 83f81b2039a79890ef9f53a6a4a709c9ab45ee4d..0000000000000000000000000000000000000000
--- a/hdc/gn/README_ZH.md
+++ /dev/null
@@ -1,290 +0,0 @@
-# GN脚本转换工具
-
-## 简介
-
-本文主要介绍gn脚本生成工具,它可以根据三方库的CMakeLists.txt文件,编译转换生成BUILD.gn脚本文件。当前OpenHarmony源码只支持BUILD.gn文件编译,开发者无法移植CMakeLists.txt编译方式的三方库到OpenHarmony中。此时,开发者可使用GN脚本转换工具,根据CMakeLists.txt文件生成BUILD.gn脚本文件,降低移植难度,提高开发效率。目前工具支持可执行文件、VS Code插件两种入口。
-
-更多工具的架构和实现原理详情,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/docs/INSTRUCTION_ZH.md)
-
- ├── napi_generator # NAPI框架代码生成工具
- │ ├── ... # 其他文档
- │ ├── hdc
- │ │ ├── ... # 其他工具
- │ │ ├── gn # GN脚本转换工具
- │ │ | ├── gn_vs_plugin # VS Code插件源码
- │ │ | ├── gn-gen # GN工具源码
- │ │ | | ├── main.js # 工具源码入口
- │ │ | | ├── package.json # package.json文件
- │ │ | | |── src
- │ │ | | | |── analyze_cmake.js # cmake解析器
- │ │ | | | |── analyze_command.js # command解析器
- │ │ | | | |── analyze_make.js # make解析器
- │ │ | | | |── generate_gn.js # 生成器
- │ │ | | | |── logger.js # log日志
- │ │ | | | |── tool.js # 公共模块代码
-
-## 约束
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-### 使用场景
-
-1) 移植CMakeLists.txt编译方式的三方库到OpenHarmony源码中。
-
-### 工具使用
-
-工具有两种类型,分别是可执行文件、VS Code插件。其中的可执行文件可根据工具使用者的开发环境选择,支持Windows,Linux和Mac。可执行文件、VS Code插件下载路径如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库的CMakeLists.txt文件,工具会输出对应的BUILD.gn文件。为了方便使用者快速上手工具,可供测试的三方库项目目录如下:
-
-```
-harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development$ ls
-3rdparty BUGS.md ChangeLog cmake configs DartConfiguration.tcl docs include LICENSE programs scripts SUPPORT.md visualc BRANCHES.md ChangeLog.d CMakeLists.txt CONTRIBUTING.md dco.txt doxygen library Makefile README.md SECURITY.md tests
-```
-
-在linux环境下的,根据输入三方库项目的CMakeLists.txt文件,生成的输出文件,如下所示:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development$ ls
- 3rdparty BUGS.md ChangeLog cmake configs DartConfiguration.tcl docs include LICENSE programs scripts SUPPORT.md visualc BRANCHES.md build_tmp ChangeLog.d CMakeLists.txt CONTRIBUTING.md dco.txt doxygen library Makefile README.md SECURITY.md tests
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development$ cd build_tmp/
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development/build_tmp$ ls
- 3rdparty BUILD.gn cmake CMakeCache.txt CMakeFiles cmake_install.cmake CTestTestfile.cmake DartConfiguration.tcl include library Makefile ohos.toolchain.cmake programs scripts tests
-
-其中生成的BUILD.gn文件,内容如下所示:
-
-```
-import("//build/ohos.gni")
-
-group("all_targets") {
- deps = [
- #静态库
- "//third_party/mbedtls-development/build_tmp/library:mbedcrypto",
- "//third_party/mbedtls-development/build_tmp/library:mbedx509",
- "//third_party/mbedtls-development/build_tmp/library:mbedtls",
-
- #可执行程序
- "//third_party/mbedtls-development/build_tmp/programs/aes:crypt_and_hash",
- "//third_party/mbedtls-development/build_tmp/programs/cipher:cipher_aead_demo",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_x509crl",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_x509csr",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_pubkey",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_pkcs7",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_privkey",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_client",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_dtlsserver",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_dtlsclient",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_x509crt",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_server",
- "//third_party/mbedtls-development/build_tmp/programs/hash:generic_sum",
- "//third_party/mbedtls-development/build_tmp/programs/hash:hello",
- "//third_party/mbedtls-development/build_tmp/programs/hash:md_hmac_demo",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:mpi_demo",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:key_app",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_encrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:gen_key",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:ecdsa",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_encrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:dh_client",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:dh_server",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:dh_genprime",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:ecdh_curve25519",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_decrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_sign",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:key_app_writer",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_verify",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_decrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_genkey",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_sign",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_sign_pss",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_verify",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_verify_pss",
- "//third_party/mbedtls-development/build_tmp/programs/psa:key_ladder_demo",
- "//third_party/mbedtls-development/build_tmp/programs/psa:crypto_examples",
- "//third_party/mbedtls-development/build_tmp/programs/psa:aead_demo",
- "//third_party/mbedtls-development/build_tmp/programs/psa:hmac_demo",
- "//third_party/mbedtls-development/build_tmp/programs/psa:psa_constant_names",
- "//third_party/mbedtls-development/build_tmp/programs/random:gen_entropy",
- "//third_party/mbedtls-development/build_tmp/programs/random:gen_random_ctr_drbg",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_pthread_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_client1",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_client2",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:mini_client",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:dtls_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:dtls_client",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_server2",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_context_info",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_fork_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_mail_client",
- "//third_party/mbedtls-development/build_tmp/programs/test:selftest",
- "//third_party/mbedtls-development/build_tmp/programs/test:benchmark",
- "//third_party/mbedtls-development/build_tmp/programs/test:udp_proxy",
- "//third_party/mbedtls-development/build_tmp/programs/test:query_compile_time_config",
- "//third_party/mbedtls-development/build_tmp/programs/test:zeroize",
- "//third_party/mbedtls-development/build_tmp/programs/util:pem2der",
- "//third_party/mbedtls-development/build_tmp/programs/util:strerror",
- "//third_party/mbedtls-development/build_tmp/programs/x509:load_roots",
- "//third_party/mbedtls-development/build_tmp/programs/x509:cert_req",
- "//third_party/mbedtls-development/build_tmp/programs/x509:cert_write",
- "//third_party/mbedtls-development/build_tmp/programs/x509:crl_app",
- "//third_party/mbedtls-development/build_tmp/programs/x509:req_app",
- "//third_party/mbedtls-development/build_tmp/programs/x509:cert_app",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_x509write",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_x509parse",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_its",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_storage_format.current",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_timing",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ssl",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_rsa",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_entropy",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_shax",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.pr",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_dhm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecdsa",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.des",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_poly1305",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ctr_drbg",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.null",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.gcm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_storage_format.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ccm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.camellia",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_chachapoly",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_mdx",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_des",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.chacha20",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_chacha20",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aria",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_not_supported.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.padding",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.nist_kw",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.ofb",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.nopr",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.ecb",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hkdf",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.cfb",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.ccm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs5",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.aes",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.rest",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cmac",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_camellia",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecdh",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_md",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.chachapoly",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_storage_format.v0",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_asn1parse",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_asn1write",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_base64",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod_raw.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_oid",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_core.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecjpake",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_core.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod_raw",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_random",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.cbc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pk",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_version",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_se_driver_hal_mocks",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_debug",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs1_v21",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes128_de",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.aria",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes128_en",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes192_de",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.camellia",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes192_en",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes256_de",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes256_en",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.no_reseed",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_lms",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_mps",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_memory_buffer_alloc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_net",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_nist_kw",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_metadata",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkparse",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_hash",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pem",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs12",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_attributes",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.xts",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_op_fail.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs1_v15",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs7",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkwrite",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_not_supported.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_driver_wrappers",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_entropy",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_generate_key.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_init",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_op_fail.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_error",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_pake",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_lmots",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_persistent_key",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_se_driver_hal",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecp",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_slot_management",
-
- ]
-}
-
-```
-
-## 工具开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/docs/DEVELOP_ZH.md)
-
-## 版本说明
-
-[版本说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/docs/gn-gen-release-notes-0.0.2.md)
-
-## FAQ
-
- [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/FAQ.md)
-
-## 参与贡献
-
-暂无
-
-## 相关仓
-
-暂无
diff --git a/hdc/gn/docs/DEVELOP_ZH.md b/hdc/gn/docs/DEVELOP_ZH.md
deleted file mode 100755
index 5dc6bd30c68fb3c4296f48a2dd3dfb79df24c13f..0000000000000000000000000000000000000000
--- a/hdc/gn/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,99 +0,0 @@
-# GN脚本转换工具开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的可执行文件和插件。
-
-## 工具开发
-
-### 可执行文件开发说明
-
-#### 环境说明
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-#### 开发步骤
-
-##### Linux
-
-1.下载res文件夹,并放置到napi_generator/hdc/gn/gn-gen目录下,下载链接如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-2.安装typescript:在napi_generator/hdc/gn/gn-gen/src目录下执行命令:
-
- npm i typescript
-
-3.安装stdio:在napi_generator/hdc/gn/gn-gen目录下执行命令:
-
- npm i stdio
-
-4.安装pkg : 在napi_generator/hdc/gn/gn-gen目录下执行命令:
-
- sudo npm i -g pkg
-
-5.打包三个版本 : 执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/gn/gn-gen目录下生成Windows、linux、mac系统下的可执行程序:
-
- gn-gen-win.exe、gn-gen-linux、gn-gen-macos
-
-6.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o gn-gen-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o gn-gen-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o gn-gen-macos
-
-备注:参数-t为指定系统,参数-o为指定可执行文件名称。
-
-
-##### Windows
-
-1.下载res文件夹,并放置到napi_generator/hdc/gn/gn-gen目录下,下载链接如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-2.安装typescript:使用管理员身份在napi_generator/hdc/gn/gn-gen/src目录下执行命令:
-
- npm i typescript
-
-3.安装stdio:使用管理员身份在napi_generator/hdc/gn/gn-gen目录下执行命令:
-
- npm i stdio
-
-4.安装pkg : 使用管理员身份在napi_generator/hdc/gn/gn-gen目录下执行命令:
-
- npm i -g pkg
-
-5.打包三个版本 : 使用管理员身份执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/gn/gn-gen目录下生成Windows、linux、mac系统下的可执行程序:
-
- gn-gen-win.exe、gn-gen-linux、gn-gen-macos
-
-6.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o gn-gen-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o gn-gen-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o gn-gen-macos
-
-### VS插件开发说明
-
-具体的插件开发步骤,可以左键单击以下链接了解:
-
-[VS插件开发说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/gn_vs_plugin/docs/DEVELOP_ZH.md)
-
diff --git a/hdc/gn/docs/ENSEMBLE_METHOD_ZH.md b/hdc/gn/docs/ENSEMBLE_METHOD_ZH.md
deleted file mode 100644
index 5293151a3ca329cc8c67ada8bda1f63493badf7f..0000000000000000000000000000000000000000
--- a/hdc/gn/docs/ENSEMBLE_METHOD_ZH.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# 将三方库集成到OpenHarmony的方法
-
-## 场景说明
-
-为了实现移植的三方库被其它子系统或者应用调用,将需移植的三方库Cmake或make编译方式转换为BUILD.gn编译方式之后,需要将其源码编译集成到OpenHarmony系统中,使其生成动态库,供OpenHarmony应用层调用。本文介绍如何将需移植的三方库源码利用OpenHarmony编译系统生成动态库供应用层调用。
-
-## 修改生成的BUILD.gn文件(有-a参数时)
-
-1、若待转换三方库中需要引用其它三方库时,需要填写-a参数,具体填写方法可参考FAQ中三方库转换时问题解决方法,详细FAQ内容可左键单击以下链接了解:[FAQ](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/FAQ.md);在build_tmp下生成的BUILD.gn中,需要修改deps依赖,根据-a参数中填写的依赖在OpenHarmony源码third_party下所有BUILD.gn中查找依赖的库的定义,然后复制库的路径,在生成的BUILD.gn文件中的deps中修改依赖的库的路径。例如:转换curl三方库时依赖ssl和crypto库:
-
--a参数中包含的依赖:
-
-```
-(-DOPENSSL_INCLUDE_DIR=/home/kaihong1/Openharmony1207/third_party/boringssl/src/include,-DOPENSSL_CRYPTO_LIBRARY=/home/kaihong1/Openharmony1207/out/hi3516dv300/developtools/profiler/libcrypto.z.so,-DOPENSSL_SSL_LIBRARY=/home/kaihong1/Openharmony1207/out/hi3516dv300/developtools/profiler/libssl.z.so)
-```
-
-生成的BUILD.gn文件(build_tmp/lib/BUILD.gn):
-
-```
- ...
- deps = [
- "//out/hi3516dv300/developtools/profiler/libssl.z.so",
- "//out/hi3516dv300/developtools/profiler/libcrypto.z.so"
- ]
- ...
-```
-
-修改为:
-
-```
- ...
- deps = [
- "//third_party/boringssl:ssl",
- "//third_party/boringssl:crypto"
- ]
- ...
-```
-
-同理修改build_tmp/src下的BUILD.gn文件。
-
-## 通过其它子系统调用
-
-1、此处以OpenHarmony/foundation/multimodalinput组件调用mbedtls-development组件为例。在~/multimodalinput/input/BUILD.gn文件中添加mbedtls-development依赖,其中“//third_party/mbedtls-development/build_tmp”为mbedtls-development组件BUILD.gn文件所在相对路径;“all_targets”为mbedtls-development组件BUILD.gn文件中group名称。具体书写如下所示:
-
-```
-harmony@Ubuntu-64:~$ cd /home/harmony/OpenHarmony/foundation/multimodalinput/input/
- harmony@Ubuntu-64:~/OpenHarmony/foundation/multimodalinput/input$ cat BUILD.gn
- ......
- ohos_shared_library("mmi_uinject") {
- ......
- deps = [
- "//drivers/peripheral/input/hal:hdi_input",
- "//utils/native/base:utils",
- "//third_party/mbedtls-development/build_tmp:all_targets",
- ]
- ......
-```
-
-2、进入~/OpenHarmony目录下,通过ninja形式编译,编译命令及编译结果如下:
-
-```
-ninja -C out/khdvk_rk3568_a all_targets
-```
-
-
-
-3、编译成功后,会生成mbedtls-development相关动态库文件或可执行程序,生成文件及路径如下所示:
-
-
-
-## 总结
-
-根据以上操作,即可将三方库集成到OpenHarmony源码中。
diff --git a/hdc/gn/docs/INSTRUCTION_ZH.md b/hdc/gn/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index aaae8171a1e4a8f8e6ae00387e3d15e89f776bd5..0000000000000000000000000000000000000000
--- a/hdc/gn/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,144 +0,0 @@
-# GN脚本转换工具可执行程序使用说明
-## 简介
-
-gn脚本生成工具目前支持两种入口,分别是可执行程序、VS Code插件,推荐使用VSCode插件。可执行文件、VS Code插件下载路径如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-下载文件说明如下:
-
- │ │ |── res # 工具所需make文件
- │ │ |── gn-0.0.1.vsix # VS Code插件
- │ │ |── gn-gen-linux # Linux可执行程序
- │ │ |── gn-gen-win.exe # Windows可执行程序
- │ │ └── gn-gen-macos # Mac可执行程序
-
-## 工具介绍
-
-通过gn-gen生成工具,使用者可以基于OpenHarmony源码、已有编译脚本(目前支持cmake、make两种类型),生成OpenHarmony编译所需BUILD.gn脚本,实现将三方库移植到OpenHarmony上。gn-gen生成工具的软件架构如下:
-
-
-
-## 可执行程序使用方法
-
-### 环境说明
-
-1、安装cmake,安装命令如下:
-
- sudo apt-get install cmake
-
-### 生成ohos.toolchain.cmake
-
-1、Ubuntu中下载OpenHarmony源码,并编译成功一个产品的镜像包,此处以RK3568为例。源码如下所示:
-
-
-
-2、将待转换的三方库项目(路径:[三方库项目](https://gitee.com/openharmony/third_party_mbedtls))放置在third_party文件夹下,如下所示:
-
-
-
-3、将下载的可执行程序gn-gen-linux与文件夹res放置在任意同一文件夹下。并将gn-gen-linux文件与res/linux/bin下文件赋可执行权限,如下所示:
-
- harmony@Ubuntu-64:~/service/example$ ls
- gn-gen-linux res
- harmony@Ubuntu-64:~/service/example$ sudo chmod -R 777 ./*
- harmony@Ubuntu-64:~/service/example$ ll -A
- 总用量 116572
- -rwxrwxrwx 1 harmony harmony 119361984 12月 15 09:41 gn-gen-linux*
- drwxrwxrwx 5 harmony harmony 4096 12月 14 15:33 res/
-
-4、在终端中进入到可执行程序gn-gen-linux所在的目录,并运行gn-gen-linux,命令如下:
-
- harmony@Ubuntu-64:~/service/example$ ./gn-gen-linux -o out/khdvk_rk3568_a -p /home/harmony/OpenHarmony -f third_party/mbedtls-development/CMakeLists.txt -t cmake -s test_subsystem -m mbedtls-development
-
-
-
-其中,参数详情如下:
-
- -o:必填参数,ohos产品输出相对路径(例如:out/khdvk_rk3568_a);
-
- -p:必填参数,ohos项目路径(例如:/home/harmony/OpenHarmony);
-
- -f:必选参数,待转换三方库cmake文件相对路径(例如:third_party/mbedtls-development/CMakeLists.txt);
-
- -t:可选参数,默认为cmake;
-
- -s:可选参数,默认填写“test_subsystem”,使用者可根据实际情况修改子系统名称;
-
- -m:可选参数,工具默认填写“test_part”,使用者可根据实际情况修改组件名称;
-
- -d:可选参数,工具默认填写待转换三方库cmake文件所在文件夹相对路径,使用者可根据实际情况修改路径;
-
- -a:可选参数,待转换三方库中引用其它三方库时需填写该选项,具体填写方法可参考FAQ中libcoap转换时问题解决方法,详细FAQ内容可左键单击以下链接了解:[FAQ](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/FAQ.md);
-
-5、运行完成后,进入/OpenHarmony/third_party/mbedtls-development/build_tmp目录下,查看是否存在ohos.toolchain.cmake文件,如下所示:
-
- harmony@Ubuntu-64:~/service/example$ cd /home/harmony/OpenHarmony/third_party/mbedtls-development/build_tmp/
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development/build_tmp$ ll -A
- 总用量 228
- drwxrwxr-x 3 harmony harmony 4096 12月 16 11:54 3rdparty/
- -rw-rw-r-- 1 harmony harmony 14658 12月 16 11:55 BUILD.gn
- drwxrwxr-x 2 harmony harmony 4096 12月 16 11:54 cmake/
- -rw-rw-r-- 1 harmony harmony 17144 12月 16 11:54 CMakeCache.txt
- drwxrwxr-x 10 harmony harmony 4096 12月 16 11:54 CMakeFiles/
- -rw-rw-r-- 1 harmony harmony 3879 12月 16 11:54 cmake_install.cmake
- -rw-rw-r-- 1 harmony harmony 432 12月 16 11:54 CTestTestfile.cmake
- -rwxr--r-- 1 harmony harmony 110 12月 16 11:54 DartConfiguration.tcl*
- drwxrwxr-x 3 harmony harmony 4096 12月 16 11:54 include/
- drwxrwxr-x 3 harmony harmony 4096 12月 16 11:55 library/
- -rw-rw-r-- 1 harmony harmony 122917 12月 16 11:54 Makefile
- -rw-rw-r-- 1 harmony harmony 1851 12月 16 11:54 ohos.toolchain.cmake
- drwxrwxr-x 14 harmony harmony 4096 12月 16 11:54 programs/
- lrwxrwxrwx 1 harmony harmony 65 12月 16 11:54 scripts -> /home/harmony/OpenHarmony/third_party/mbedtls-development/scripts/
- drwxrwxr-x 4 harmony harmony 20480 12月 16 11:55 tests/
-
-### 运行cmake脚本
-
-1、在终端中进入ohos.toolchain.cmake所在的build_tmp目录下,运行cmake,查看cmake环境是否可以正常使用,命令如下:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development/build_tmp$ cmake .. -DCMAKE_TOOLCHAIN_FILE=ohos.toolchain.cmake
- -- The C compiler identification is Clang 10.0.1
- -- Check for working C compiler: /home/harmony/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang
- -- Check for working C compiler: /home/harmony/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang -- works
- -- Detecting C compiler ABI info
- -- Detecting C compiler ABI info - done
- -- Detecting C compile features
- -- Detecting C compile features - done
- -- Configuring done
- -- Generating done
- -- Build files have been written to: /home/harmony/OpenHarmony/third_party/mbedtls-development/build_tmp
-
-根据以上日志可发现cmake运行成功,环境正常使用。若运行cmake失败,则根据报错信息修改,直到cmake运行成功,环境正常使用为止。
-
-### 生成gn脚本
-
-1、在终端中进入到可执行程序gn-gen-linux所在的目录,并运行gn-gen-linux,命令如下:
-
- harmony@Ubuntu-64:~/service/example$ ./gn-gen-linux -o out/khdvk_rk3568_a -p /home/harmony/OpenHarmony -f third_party/mbedtls-development/CMakeLists.txt -s test_subsystem -m mbedtls-development
- INFO (1) -- The C compiler identification is Clang 10.0.1
-
- INFO (2) -- Check for working C compiler: /home/harmony/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang
-
- INFO (3) -- Check for working C compiler: /home/harmony/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang -- works
-
- ......
-
- INFO (647) -------------------generate gn ok
-
-其中,参数详情如生成ohos.toolchain.cmake中步骤4。
-
-2.运行成功后会在/OpenHarmony/third_party/mbedtls-development目录下生成build_tmp文件夹,build_tmp文件夹中包含BUILD.gn文件,如下所示:
-
-
-
-## VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[VS插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/gn_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 将三方库集成到OpenHarmony的方法
-
-具体的将三方库集成到OpenHarmony的步骤,可以左键单击以下链接了解:
-
-[将三方库集成到OpenHarmony的方法](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/docs/ENSEMBLE_METHOD_ZH.md)
diff --git a/hdc/gn/docs/gn-gen-release-notes-0.0.2.md b/hdc/gn/docs/gn-gen-release-notes-0.0.2.md
deleted file mode 100755
index 83e2fd96836441e2d78a0bc78b1f995f41ab5e2e..0000000000000000000000000000000000000000
--- a/hdc/gn/docs/gn-gen-release-notes-0.0.2.md
+++ /dev/null
@@ -1,71 +0,0 @@
-# gn-gen-release-notes-0.0.2(2023-01-06)
-
-## 版本概述
-
-发布gn-gen-0.0.2版本。
-
-## 版本特性
-**表 1** 已支持特性
-
-
-
- 脚本类型
-
- 特性
-
- 平台
-
-
-
- CMAKE
-
-以VSCode插件方式转换CMAKE脚本为GN脚本 以命令行方式转换CMAKE脚本为GN脚本
-
- Ubuntu
-
-
- MAKE
-
-以VSCode插件方式转换MAKE脚本为GN脚本 以命令行方式转换MAKE脚本为GN脚本
-
- Ubuntu
-
-
-
-
-
-**表 2**
-
-待开发特性
-
- 脚本类型
-
- 特性
-
- 平台
-
-
-
- CMAKE
-
-以VSCode插件方式转换CMAKE脚本为GN脚本 以命令行方式转换CMAKE脚本为GN脚本
-
- Windows/Mac
-
-
- MAKE
-
-以VSCode插件方式转换MAKE脚本为GN脚本 以命令行方式转换MAKE脚本为GN脚本
-
- Windows/Mac
-
-
- SCONS
-
-以VSCode插件方式转换SCONS脚本为GN脚本 以命令行方式转换SCONS脚本为GN脚本
-
- Windows/Ubuntu/Mac
-
-
-
-
\ No newline at end of file
diff --git a/hdc/gn/figures/DevEco_step_applyPlugins.png b/hdc/gn/figures/DevEco_step_applyPlugins.png
deleted file mode 100755
index 20c87ae86ab4021214418b830b92fca96911226e..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_applyPlugins.png and /dev/null differ
diff --git a/hdc/gn/figures/DevEco_step_finish.png b/hdc/gn/figures/DevEco_step_finish.png
deleted file mode 100755
index b02a3bd8ab283840a1401131153e1b67d83dd772..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_finish.png and /dev/null differ
diff --git a/hdc/gn/figures/DevEco_step_firstNext.png b/hdc/gn/figures/DevEco_step_firstNext.png
deleted file mode 100755
index 812504617e554fa1985f1bda04fa2af3b122a4a0..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_firstNext.png and /dev/null differ
diff --git a/hdc/gn/figures/DevEco_step_gn.png b/hdc/gn/figures/DevEco_step_gn.png
deleted file mode 100755
index d9da4d6543de76153573f2b71b95d7f3b073b8d0..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_gn.png and /dev/null differ
diff --git a/hdc/gn/figures/DevEco_step_gn_ok.png b/hdc/gn/figures/DevEco_step_gn_ok.png
deleted file mode 100755
index d2c49fd9779171c809b62b6e4438dc7f279461a5..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_gn_ok.png and /dev/null differ
diff --git a/hdc/gn/figures/DevEco_step_newFile.png b/hdc/gn/figures/DevEco_step_newFile.png
deleted file mode 100755
index 3b69aa21918c6a0377fad1e9dfdc6f702d046510..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_newFile.png and /dev/null differ
diff --git a/hdc/gn/figures/DevEco_step_pluginsOk.png b/hdc/gn/figures/DevEco_step_pluginsOk.png
deleted file mode 100755
index b5b783f70c60e3f60c9d3be287925da4d11d8592..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/DevEco_step_pluginsOk.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_Proj_Module.png b/hdc/gn/figures/IntelliJ_env_Proj_Module.png
deleted file mode 100755
index f1d871405c4e0467fe63eb5c514af9214d3dbdc6..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_Proj_Module.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_Proj_Module_New.png b/hdc/gn/figures/IntelliJ_env_Proj_Module_New.png
deleted file mode 100755
index d8c180413b38fbd8e8e5c21116612ea400671f07..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_Proj_Module_New.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_built_jar.png b/hdc/gn/figures/IntelliJ_env_built_jar.png
deleted file mode 100755
index d9cb546a71cb3555ef50c8a86e96cfb4b33b5a0a..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_built_jar.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_built_jar_success.png b/hdc/gn/figures/IntelliJ_env_built_jar_success.png
deleted file mode 100755
index 25d5d20e6135107bfddf37edf60342e3708e7486..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_built_jar_success.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_built_pro.png b/hdc/gn/figures/IntelliJ_env_built_pro.png
deleted file mode 100755
index 76c07b788854c44273537268936345227de5d1c2..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_built_pro.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_config_SDKs.png b/hdc/gn/figures/IntelliJ_env_config_SDKs.png
deleted file mode 100755
index 507cd4891cd4ca09edba7265551bb06bbcf70f82..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_config_SDKs.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_config_open_proj.png b/hdc/gn/figures/IntelliJ_env_config_open_proj.png
deleted file mode 100755
index c65de4e9860349467ca3426487e4a4c934c8c020..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_config_open_proj.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_configurations.png b/hdc/gn/figures/IntelliJ_env_configurations.png
deleted file mode 100755
index dacc204711d2f82c2052bbee6c8aa4b6a2831917..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_configurations.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_module_root.png b/hdc/gn/figures/IntelliJ_env_module_root.png
deleted file mode 100755
index 193b5b5ee4abb9c27762a0184f297376b7908add..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_module_root.png and /dev/null differ
diff --git a/hdc/gn/figures/IntelliJ_env_proj_structure.png b/hdc/gn/figures/IntelliJ_env_proj_structure.png
deleted file mode 100755
index 099589fd4863ae13c20c40a9818929ba7b5868c1..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/IntelliJ_env_proj_structure.png and /dev/null differ
diff --git a/hdc/gn/figures/build_file.png b/hdc/gn/figures/build_file.png
deleted file mode 100755
index 5a62bd67187c453b2fbd3084c3c6eee083bfed2c..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/build_file.png and /dev/null differ
diff --git a/hdc/gn/figures/clang_args_not_resolved.png b/hdc/gn/figures/clang_args_not_resolved.png
deleted file mode 100755
index 2a1497c13e077df8a194ced919a495959353f068..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/clang_args_not_resolved.png and /dev/null differ
diff --git a/hdc/gn/figures/cmake_args.png b/hdc/gn/figures/cmake_args.png
deleted file mode 100755
index 5ba2417089f76952cfe887da6f08b3f479f999ac..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/cmake_args.png and /dev/null differ
diff --git a/hdc/gn/figures/could_not_find_jinja2.png b/hdc/gn/figures/could_not_find_jinja2.png
deleted file mode 100644
index 4fe58402f543418740149ed886d132f722c57049..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/could_not_find_jinja2.png and /dev/null differ
diff --git a/hdc/gn/figures/could_not_find_jsonschema.png b/hdc/gn/figures/could_not_find_jsonschema.png
deleted file mode 100644
index f6c4676f50a7a19440e3e4b840649eabfb1ccac8..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/could_not_find_jsonschema.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_generate_clang.png b/hdc/gn/figures/curl_generate_clang.png
deleted file mode 100644
index d4184bc4c6de8c944890da1cf7c419e7c2de78a4..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_generate_clang.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_generate_clang_log.png b/hdc/gn/figures/curl_generate_clang_log.png
deleted file mode 100644
index 902d930e9bca709be2c8d567d9dd9e627a16eccc..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_generate_clang_log.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_generate_success.png b/hdc/gn/figures/curl_generate_success.png
deleted file mode 100644
index d74e6d343dca93696b9eb54bcd7fc2be726c1d86..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_generate_success.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_not_find_openssl.png b/hdc/gn/figures/curl_not_find_openssl.png
deleted file mode 100644
index 98b36d0e5b2c0a9614d99d2698d59a601661f53f..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_not_find_openssl.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_not_find_openssl_lib.png b/hdc/gn/figures/curl_not_find_openssl_lib.png
deleted file mode 100644
index 8ffc2e1007bf0f9b9176ece97c61af9747370acb..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_not_find_openssl_lib.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_not_find_openssl_lib_log.png b/hdc/gn/figures/curl_not_find_openssl_lib_log.png
deleted file mode 100644
index 59ccc4ce7c327396c678cd465f2c66e8bca1d4c2..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_not_find_openssl_lib_log.png and /dev/null differ
diff --git a/hdc/gn/figures/curl_not_find_openssl_log.png b/hdc/gn/figures/curl_not_find_openssl_log.png
deleted file mode 100644
index d2450bbe06cde86ec7dfa4ea99266bd843d5abc3..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/curl_not_find_openssl_log.png and /dev/null differ
diff --git a/hdc/gn/figures/generate_file.png b/hdc/gn/figures/generate_file.png
deleted file mode 100644
index 95c3fa485f7fc1b2b1dfe06da04e0f8470b4b26c..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/generate_file.png and /dev/null differ
diff --git a/hdc/gn/figures/gn_framework.png b/hdc/gn/figures/gn_framework.png
deleted file mode 100644
index b239ff2c5d1d1907928fe7c79fb8d732dd6a09a9..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/gn_framework.png and /dev/null differ
diff --git a/hdc/gn/figures/libcoap_not_analysis_g.png b/hdc/gn/figures/libcoap_not_analysis_g.png
deleted file mode 100644
index 5cbc61fa3bc74ac40002bad5560cbdc01e644f35..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libcoap_not_analysis_g.png and /dev/null differ
diff --git a/hdc/gn/figures/libcoap_not_analysis_mbedcrypto.png b/hdc/gn/figures/libcoap_not_analysis_mbedcrypto.png
deleted file mode 100644
index 464d2ffe559c98c1174f400c17208ac3f098a01e..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libcoap_not_analysis_mbedcrypto.png and /dev/null differ
diff --git a/hdc/gn/figures/libcoap_not_analysis_mbedx509.png b/hdc/gn/figures/libcoap_not_analysis_mbedx509.png
deleted file mode 100644
index 85b3c6a759c6b1c254be4cec83cd0f4dbcb019ab..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libcoap_not_analysis_mbedx509.png and /dev/null differ
diff --git a/hdc/gn/figures/libcoap_not_find_mbedtls.png b/hdc/gn/figures/libcoap_not_find_mbedtls.png
deleted file mode 100644
index 4625eff393ca41371d9c53f862ab3ef420369d0a..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libcoap_not_find_mbedtls.png and /dev/null differ
diff --git a/hdc/gn/figures/libphnum_generate_success.png b/hdc/gn/figures/libphnum_generate_success.png
deleted file mode 100644
index 1d39b4c6b4b7458273bc9c4f3eb9466c0987fcf6..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libphnum_generate_success.png and /dev/null differ
diff --git a/hdc/gn/figures/libphnum_not_find_google.png b/hdc/gn/figures/libphnum_not_find_google.png
deleted file mode 100644
index b570db0d3a11a79fb4ce424f4df9a5d0bc0b07cb..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libphnum_not_find_google.png and /dev/null differ
diff --git a/hdc/gn/figures/libphnum_not_find_google_sourcedir.png b/hdc/gn/figures/libphnum_not_find_google_sourcedir.png
deleted file mode 100644
index e9549793cccb5506d86c575eb7b828e3877d5390..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libphnum_not_find_google_sourcedir.png and /dev/null differ
diff --git a/hdc/gn/figures/libphnum_not_find_gtest.png b/hdc/gn/figures/libphnum_not_find_gtest.png
deleted file mode 100644
index 475be2cf2992a6cafc2261834f7ab7e7c427e8a8..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libphnum_not_find_gtest.png and /dev/null differ
diff --git a/hdc/gn/figures/libphnum_not_find_gtest_sour.png b/hdc/gn/figures/libphnum_not_find_gtest_sour.png
deleted file mode 100644
index c19d6e6bfa71d43293047689949d5b0b64320756..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libphnum_not_find_gtest_sour.png and /dev/null differ
diff --git a/hdc/gn/figures/libpng_generate_success.png b/hdc/gn/figures/libpng_generate_success.png
deleted file mode 100644
index e5bb8d8aacb2570b10cee77fdae0fb531dd126f5..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libpng_generate_success.png and /dev/null differ
diff --git a/hdc/gn/figures/libpng_not_find_zlib.png b/hdc/gn/figures/libpng_not_find_zlib.png
deleted file mode 100644
index 15efe43c80bd48904968460e4c133c58248f1918..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libpng_not_find_zlib.png and /dev/null differ
diff --git a/hdc/gn/figures/libpng_not_find_zlib_log.png b/hdc/gn/figures/libpng_not_find_zlib_log.png
deleted file mode 100644
index 4c68b8a626e67fa64604dcf86be2f13a0ea69c92..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/libpng_not_find_zlib_log.png and /dev/null differ
diff --git a/hdc/gn/figures/ninja_build_success.png b/hdc/gn/figures/ninja_build_success.png
deleted file mode 100644
index fefca66c6b667e93f3b4fc29073ffbc6bdfa9916..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/ninja_build_success.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-build-tmp.png b/hdc/gn/figures/pic-build-tmp.png
deleted file mode 100644
index 60d669dd43f1672f0c77f995547b77fa58c8988e..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-build-tmp.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-generate-command.png b/hdc/gn/figures/pic-generate-command.png
deleted file mode 100644
index dd932d0e1478e1d6d6a686e40fa1761557f072d6..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-generate-command.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-gn-frame.png b/hdc/gn/figures/pic-gn-frame.png
deleted file mode 100755
index e6d8720f0f27d237933b6a6f6847ace2b8e00a02..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-gn-frame.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-gn-plug-sucess.png b/hdc/gn/figures/pic-gn-plug-sucess.png
deleted file mode 100644
index 96bdc3ab3b412c76001967e0bc2ee4e3c3235d48..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-gn-plug-sucess.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-mbedtls-development.png b/hdc/gn/figures/pic-mbedtls-development.png
deleted file mode 100644
index fb279c4ccbb535cf7fbb599df637e780fae17090..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-mbedtls-development.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-openharmony.png b/hdc/gn/figures/pic-openharmony.png
deleted file mode 100644
index 65c89d8aeb054659a80a1ecc2d055d028035147c..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-openharmony.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-plug-in-gn-c++.png b/hdc/gn/figures/pic-plug-in-gn-c++.png
deleted file mode 100755
index 433caddef5b9c7544127c941b598dd079757bffb..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-plug-in-gn-c++.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-plug-in-gn.png b/hdc/gn/figures/pic-plug-in-gn.png
deleted file mode 100755
index 1d834dbd74fc6bbef74aa7c2fb805b48d73c4f50..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-plug-in-gn.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-plug-in-search.png b/hdc/gn/figures/pic-plug-in-search.png
deleted file mode 100755
index 4a19f9e2ba60de4fb3d5c096965001f6c5f1ebc1..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-plug-in-search.png and /dev/null differ
diff --git a/hdc/gn/figures/pic-plug-in-select.png b/hdc/gn/figures/pic-plug-in-select.png
deleted file mode 100755
index adceba2151ae8a4801b813447f642d95d87af8b1..0000000000000000000000000000000000000000
Binary files a/hdc/gn/figures/pic-plug-in-select.png and /dev/null differ
diff --git a/hdc/gn/gn-gen/main.js b/hdc/gn/gn-gen/main.js
deleted file mode 100755
index 8863e89c92e71ea31786c3501b46fb9fba0fc751..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/main.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require("path");
-const stdio = require("stdio");
-const { AnalyzeCMake } = require("./src/analyze_cmake");
-const { AnalyzeMake } = require("./src/analyze_make");
-const { GenerateGn } = require("./src/generate_gn");
-const { Logger } = require("./src/logger");
-const { Tool } = require("./src/tool");
-
-if (process.execPath.endsWith("node") || process.execPath.endsWith("node.exe")) {
- Tool.CURRENT_TOOL_PATH = __dirname;//工具目录,用来找到res内资源
-}
-else {
- Tool.CURRENT_TOOL_PATH = path.parse(process.execPath).dir;
-}
-
-if (Tool.MOCK_TYPE == Tool.MOCK_ENUM.MOCK_RUN) {
- GenerateGn.mockGenerate();//通过mock数据运行
-}
-
-let ops = stdio.getopt({
- 'type': { key: 't', args: 1, description: "", default: "cmake" },
- 'filename': {
- key: 'f', args: 1,
- description: "The make file's relative path \
-( third_party/opencv/CMakeLists.txt , make file can be Makefile/CMakeLists.txt)"
- },
- 'ohos_product_output': {
- key: 'o', args: 1, description: "ohos product output relative path",
- default: "out/rk3568"
- },
- 'ohos_project_path': { key: 'p', args: 1, description: "ohos project path ( /home/xxx/ohos_project )" },
- 'cmake_args': { key: 'a', args: 1, description: "like: (-DABC,-DQWE)", default: "" },
- 'subsystem_name': { key: 's', args: 1, description: "subsystem", default: "test_subsystem" },
- 'part_name': { key: 'm', args: 1, description: "part", default: "test_part" },
- 'porting_to': { key: 'd', args: 1, description: "porting to", default: "" },
-});
-
-Tool.OHOS_PROJECT_PATH = ops.ohos_project_path;
-
-Tool.OHOS_PORTING_TO = ops.porting_to;
-
-Tool.OHOS_PRODUCT_OUTPUT_PATH = ops.ohos_product_output;
-
-Tool.OHOS_SUBSYSTEM_NAME = ops.subsystem_name;
-Tool.OHOS_PART_NAME = ops.part_name;
-
-//需要对参数做一些正确性判断
-
-let compileFile = path.parse(path.join(Tool.OHOS_PROJECT_PATH, ops.filename));
-
-if (ops.type == "cmake") {//cmake
- AnalyzeCMake.analyze(compileFile, ops.cmake_args.substring(1, ops.cmake_args.length - 1));
-}
-else if (ops.type == "make") {//make
- AnalyzeMake.analyze(compileFile);
-}
-else {
- Logger.err("not support " + ops.filename);
-}
diff --git a/hdc/gn/gn-gen/package.json b/hdc/gn/gn-gen/package.json
deleted file mode 100755
index 059af3f5f47355e44e2d7dc599528f8ac3e09098..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/package.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "gn-gen",
- "version": "1.0.0",
- "description": "",
- "main": "main.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "ISC",
- "dependencies": {
- "stdio": "^2.1.1",
- "typescript": "^4.8.3"
- },
- "bin": "./main.js",
- "pkg": {
- "assets": [
- "res/**/*",
- "res/ohos.toolchain.cmake",
- "res/bin/linux/make"
- ]
- }
-}
diff --git a/hdc/gn/gn-gen/src/analyze_cmake.js b/hdc/gn/gn-gen/src/analyze_cmake.js
deleted file mode 100755
index eaeaff5d63aacfa2af77f675f6db9e4bd2eb23d3..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/src/analyze_cmake.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require("path");
-const { Logger } = require("./logger");
-const { Tool } = require("./tool");
-const childProcess = require("child_process");
-const fs = require("fs");
-const { AnalyzeMake } = require("./analyze_make");
-
-class AnalyzeCMake {
- constructor() {
-
- }
- static mkdirBuildTemp(compileFile){
- let buildTmp;
- if(Tool.OHOS_PORTING_TO==""){
- buildTmp = path.join(compileFile.dir, "build_tmp");//cmake编译的临时目录
- }
- else{
- buildTmp = path.join(Tool.OHOS_PROJECT_PATH,Tool.OHOS_PORTING_TO, "build_tmp");//cmake编译的临时目录
- }
- if (fs.existsSync(buildTmp)) {
- fs.rmSync(buildTmp, { recursive: true, force: true });//🌻
- }
- return buildTmp;
- }
-
- static analyze(compileFile, cmakeArgs) {//在工程目录创建一个buildTmp目录,执行cmake初始化工程,执行make得到命令行序列
- if (!fs.existsSync(path.join(Tool.OHOS_PROJECT_PATH, Tool.OHOS_PRODUCT_OUTPUT_PATH, "build.ninja"))) {
- Logger.err("param ohos need to looks like out/rk3568");
- return;
- }
- let buildTmp = AnalyzeCMake.mkdirBuildTemp(compileFile);
- fs.mkdirSync(buildTmp);
- Tool.pushd(buildTmp);
- let ohosToolchainCmake = Tool.getCMakeToolchain();
- let ohosToolchainCmakeData = fs.readFileSync(ohosToolchainCmake, { encoding: "utf8" });
- while (ohosToolchainCmakeData.indexOf("CC_REPLACE_OHOS_ROOT") >= 0) {
- ohosToolchainCmakeData = ohosToolchainCmakeData.replace("CC_REPLACE_OHOS_ROOT",
- Tool.swapPath(Tool.OHOS_PROJECT_PATH, true));
- }
- while (ohosToolchainCmakeData.indexOf("CC_REPLACE_OHOS_TARGET") >= 0) {
- ohosToolchainCmakeData = ohosToolchainCmakeData.replace("CC_REPLACE_OHOS_TARGET",
- Tool.OHOS_PRODUCT_OUTPUT_PATH);
- }
- ohosToolchainCmake = path.join(buildTmp, "ohos.toolchain.cmake");
- fs.writeFileSync(ohosToolchainCmake, ohosToolchainCmakeData);
- ohosToolchainCmake=Tool.swapPath(ohosToolchainCmake);
- let args = [compileFile.dir,
- "-DCMAKE_TOOLCHAIN_FILE=%s".format(ohosToolchainCmake),"-G","Unix Makefiles",
- "-DCMAKE_MAKE_PROGRAM=%s".format(Tool.swapPath(Tool.getMakeRaw())),
- ];
- if (cmakeArgs.length > 0) {
- args.push(...cmakeArgs.split(","));
- }
- let ret = childProcess.spawn(Tool.swapPath(Tool.getCMake()), args);
- ret.stdout.on('data', (data) => {
- Logger.info(data.toString());
- });
- ret.stderr.on('data', (data) => {
- Logger.err(data.toString(), true);
- });
- ret.on('close', (code) => {
- if (code == 0) {
- Logger.info("------------------------cmake ok");
- AnalyzeMake.analyze(path.join(buildTmp, "Makefile")); //调用make生成命令行
- }
- else Logger.err("cmake fail");
- })
- }
-}
-
-module.exports = {
- AnalyzeCMake
-}
\ No newline at end of file
diff --git a/hdc/gn/gn-gen/src/analyze_command.js b/hdc/gn/gn-gen/src/analyze_command.js
deleted file mode 100755
index fa78cd26b93fa250fb023f293b23cd53cde62e1e..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/src/analyze_command.js
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const { Logger } = require("./logger");
-const fs = require("fs");
-const path = require("path");
-const { Tool } = require("./tool");
-
-class AnalyzeCommand {
- constructor() {
-
- }
-
- static isCmd(cmd, name) {
- let cmdName = cmd.split(" ")[0];
- let v1 = cmdName.endsWith(name);
- let v2 = cmdName.endsWith(name + ".exe");
- return v1 || v2;
- }
-
- static COMPILE_CMDS = {
- "clang": 0,
- "ar": 1,
- "clang++": 2
- };
-
- static COLLECT_COMMANDS = [];
- static storeCommands() {
- fs.writeFileSync(path.join(Tool.CURRENT_TOOL_PATH, "cmds.txt"),
- AnalyzeCommand.COLLECT_COMMANDS.join("\n"), { encoding: "utf8" });
- }
- static getCompileCmdId(cmd) {
- let cmdName = cmd.split(" ")[0];
- for (let c in AnalyzeCommand.COMPILE_CMDS) {
- if (cmdName.endsWith(c) || cmdName.endsWith(c + ".exe")) {
- return AnalyzeCommand.COMPILE_CMDS[c];//返回命令ID
- }
- }
- return -1;
- }
- static analyze(cmd) {
- let cmds;
- if (cmd.indexOf("&&") >= 0) {
- cmds = cmd.split("&&");
- }
- else {
- cmds = [cmd];
- }
- let result = [];
- Tool.backupd(0);
- for (let c of cmds) {
- let ret = AnalyzeCommand.analyzeOneCmd(c);
- if (ret) {
- result.push(...ret);
- }
- }
- Tool.recoverd(0);
- return result;
- }
- static exAnalyzeCmake(cmd) {
- let ss = cmd.split(" ");
- if (ss.indexOf("-P") > 0) {//需要 cmake执行脚本,在这里直接执行 or 移到BUILD.gn里面执行
- const childProcess = require("child_process");
- childProcess.execSync(cmd);
- AnalyzeCommand.COLLECT_COMMANDS.push(cmd);
- return false;
- }
- let cmakeLinkScriptOffset = ss.indexOf("cmake_link_script");
- if (cmakeLinkScriptOffset >= 0) {//需要 这里可能要做一些错误判断
- let cmakeLinkScriptFile = ss[cmakeLinkScriptOffset + 1];
- let cmakeLinkScriptData = fs.readFileSync(path.join(process.cwd(), cmakeLinkScriptFile),
- { encoding: "utf8" });
- let cmds = cmakeLinkScriptData.split("\n");//link.txt中可能有多条命令链接
- let rets = []
- for (let c of cmds) {
- let r = AnalyzeCommand.analyzeOneCmd(c);
- if (r) {
- rets.push(...r);
- }
- }
- if (rets.length > 0) {
- return rets;
- }
- else {
- return false;
- }
- }
- return false;
- }
- static isCmdScriptWithVersion(cmd, cmdType) {
- let cmdName = cmd.split(" ")[0];
- let pos = cmdName.lastIndexOf("/");
- let scrType = cmdName.substring(pos + 1, cmdName.length);
- return scrType.startsWith(cmdType)
- }
-
- static analyzeOneCmd(cmd) {
- while (cmd.startsWith("\n") || cmd.startsWith(" ")) {
- cmd = cmd.substring(1);
- }
- if (cmd.length <= 0) {
- return false;
- }
- if (cmd.match("^make(\\[\\d+\\]:)|: (Entering)|(Leaving) directory")) {//跳过进出目录的log
- //需要 改变工作目录
- return false;
- }
- if (cmd.startsWith("cd ")) {
- let t = AnalyzeCommand.splitString(cmd);
- Tool.pushd(t[1]);//改变工作目录
- return false;
- }
- if (AnalyzeCommand.isCmd(cmd, "ccache")) {//去掉ccache头
- cmd = cmd.substring(cmd.indexOf("ccache") + "ccache".length);
- return AnalyzeCommand.analyzeOneCmd(cmd);
- }
- if (AnalyzeCommand.isCmd(cmd, "cmake")) {//跳过cmake的log,需要解析link命令行
- return AnalyzeCommand.exAnalyzeCmake(cmd);
- }
- if (AnalyzeCommand.isCmd(cmd, "make") ||
- AnalyzeCommand.isCmd(cmd, "ranlib")) {//跳过这些命令
- return false;
- }
- if (AnalyzeCommand.getCompileCmdId(cmd) >= 0) {//解析编译命令行
- AnalyzeCommand.COLLECT_COMMANDS.push(cmd);
- return [AnalyzeCommand.analyzeCompileCommand(cmd)];
- }
- if (AnalyzeCommand.isCmd(cmd, "perl") ||
- AnalyzeCommand.isCmd(cmd, "autoreconf") ||
- AnalyzeCommand.isCmdScriptWithVersion(cmd, "python")) {
- // 需要即时执行(可能会生成依赖源文件),如果不执行,后续编译命令可能会报错,找不到源文件
- Logger.info(cmd);
- const childProcess = require("child_process");
- childProcess.execSync(cmd);
- return false;
- }
- Logger.err("未解析的命令行:" + cmd);
- return false;
- }
-
- static resultTemplete() {//解析命令行之后的结果模板
- return {
- type: 0,//0 compile command,1 other command
- workDir: process.cwd(),
- command: "",
- inputs: [],
- target: "",
- isLink: false,//是否编译,.a/.o/可执行程序,需要生成目标
- includes: [],
- defines: [
- "_XOPEN_SOURCE=600",//ohos的编译环境缺失宏
- "FE_TONEAREST=0x00000000",
- "FE_UPWARD=0x00400000",
- "FE_DOWNWARD=0x00800000",
- "FE_TOWARDZERO=0x00c00000",
- ],
- cflags: [
- "-Wno-implicit-function-declaration",
- "-Wno-unused-function",
- "-Wno-comments",//允许注释后面有个\
- "-Wno-string-conversion",//允许char*当做bool使用
- "-Wno-header-hygiene",//不检测命名空间污染
- "-frtti",//支持typeid(xxx)
- "-fexceptions",//支持try catch
- ],//c和c++选项
- cflagsCc: [],//c++选项
- cflagsC: [],//c选项
- }
- }
-
- static splitString(s) {//按空格分割字符串
- let ret = [];
- let startp = -1;
- let isContinuChar = 0;
- for (let p = 0; p < s.length; p++) {
- if (s[p] == "\"" && s[p-1] != "\\") {
- isContinuChar = 1 - isContinuChar;
- }
- if (startp >= 0) {
- if (s[p] == ' ' && isContinuChar == 0) {
- ret.push(s.substring(startp, p));
- startp = -1;
- }
- }
- else if (s[p] != ' ') {
- startp = p;
- }
- }
- if (startp >= 0) {
- ret.push(s.substring(startp));
- }
- return ret;
- }
-
- static mockTarget(t) {
- if (t.target) {
- fs.writeFileSync(t.target, " ");
- }
- }
- static clangCheck1(e) {
- let ss = ["--sysroot=",
- "-pthread",
- "-Qunused-arguments",
- "-ffunction-sections",
- "-fdata-sections",
- "-fvisibility=hidden",
- "-fvisibility-inlines-hidden",
- "-O3",
- "-Os",
- "-fPIC",
- "-pedantic",
- "-fwrapv",
- "-shared",
- "-lm",
- "-lpthread",
- "-lz",
- "-MD",
- "-isystem"
- ];
- for (let s of ss) {
- if (e.startsWith(s) || e == "-w") {
- return true;
- }
- }
- return false;
- }
- static clangCheck2(local, e) {
- if (e.startsWith("-MT") || e.startsWith("-MF")) {
- if (e.length == 3) {
- local.p++;
- }
- return true;
- }
-
- if (e.startsWith("-s")) {
- if (e.length == 2) {
- local.p++;
- }
- return true;
- }
- return false;
- }
- static clangCheck3(local, e) {
- if (e.startsWith("-D")) {//需要记录到defines里面的参数
- //需要 是否-D开头的,全部记录到defines里面
- if (e.length == 2) {//-D xxx
- local.ret.defines.push(local.eles[local.p++]);
- }
- else {//-Dxxx
- local.ret.defines.push(e.substring(2));
- }
- return true;
- }
- return false;
- }
- static clangCheck4(local, e) {
- if (e.startsWith("-I")) {//需要记录到includes的参数
- if (e.length == 2) {//-I xxx
- local.ret.includes.push(local.eles[local.p++]);
- }
- else {//-Ixxx
- local.ret.includes.push(e.substring(2));
- }
- return true;
- }
- return false;
- }
- static validCFlag(cflag, allowedFlag) {
- for (let i = 0; i < allowedFlag.length; ++i) {
- if (cflag.startsWith(allowedFlag[i])) {
- return true;
- }
- }
- return false;
- }
- static clangCheck5(local, e) {
- if (this.validCFlag(e, Tool.getAllowedC().compileflag) || (e == "-D__clang__")) {
- local.ret.cflags.push(e); //需要记录到flags里面的参数
- return true;
- }
- return false;
- }
- static clangCheck6(local, e) {
- if (e == "-o") {
- if (e.length == 2) {//-o xxx
- local.ret.target = local.eles[local.p++];
- }
- else {//-oxxx
- local.ret.target = e.substring(2);
- }
- if (local.ret.target.endsWith(".a") ||
- local.ret.target.endsWith(".so") ||
- (!e.endsWith(".c") && !e.endsWith(".o"))) {
- local.ret.isLink = true;
- }
- return true;
- }
- return false;
- }
-
- static clangCheck7(local, e) {
- if (this.validSuffix(e, Tool.getAllowedC().fileSuffix)) {
- local.ret.inputs.push(e);
- return true;
- }
- if (e.endsWith(".rsp")) {
- console.log(Tool.CURRENT_DIR);
- let rspth = path.join(Tool.CURRENT_DIR, e.substring(1));
- let data = fs.readFileSync(rspth, { encoding: "utf8" });
- if (data.endsWith("\r\n")) {
- data = data.substring(0, data.length - 2);
- }
- let datas = data.split(" ");
- for (let d of datas) {
- for (let s of ss) {
- if (d.endsWith(s)) {
- local.ret.inputs.push(d);
- }
- }
- }
- return true;
- }
- return false;
- }
-
- static analyzeCcClang(cmd) {
- let local = {
- ret: AnalyzeCommand.resultTemplete(),
- eles: AnalyzeCommand.splitString(cmd),
- p: 0,
- }
-
- while (local.p < local.eles.length) {
- let e = local.eles[local.p++];
- if (e.endsWith("clang") || e.endsWith("clang.exe")) {
- local.ret.command = e;
- }
- else if (AnalyzeCommand.clangCheck1(e)) { }
- else if (AnalyzeCommand.clangCheck2(local, e)) { }
- else if (e.startsWith("-Wl,--dynamic-linker,") || e.startsWith("-rdynamic")) {//-----直接忽略的链接参数
- local.ret.isLink = true;
- }
- else if (AnalyzeCommand.clangCheck3(local, e)) { }
- else if (AnalyzeCommand.clangCheck4(local, e)) { }
- else if (AnalyzeCommand.clangCheck5(local, e)) { }
- else if (e.startsWith("-std=")) {
- local.ret.cflagsCc.push(e);
- }
- else if (e.startsWith("-W")) {//需要 -W开头的怎么处理,-W -Wall -Werror=return-type -Wno-unnamed-type-template-args
- if (e.startsWith("-Wno-")) {
- local.ret.cflags.push(e);
- }
- }
- else if (AnalyzeCommand.clangCheck6(local, e)) { }
- else if (e == "-c") {//编译
- local.ret.isLink = false;
- }
- else if (AnalyzeCommand.clangCheck7(local, e)) { }
- else {
- Logger.err(cmd + "\nclang未解析参数 " + e);
- process.exit();
- }
- }
- Logger.info("----clang-----" + local.ret.workDir + "\n\t" + local.ret.isLink + "," + local.ret.target)
- return local.ret;
- }
- static analyzeCcAr(cmd) {
- if (cmd.endsWith("\r")) {
- cmd = cmd.substring(0, cmd.length - 1);
- }
- let ret = AnalyzeCommand.resultTemplete();
- let eles = AnalyzeCommand.splitString(cmd);
- ret.isLink = true;
- let p = 0;
- while (p < eles.length) {
- let e = eles[p++];
- if (e.endsWith("ar") || e.endsWith("ar.exe")) {
- ret.command = e;
- }
- else if (e.endsWith(".a")) {
- ret.target = e;
- }
- else if (e.endsWith(".o")) {
- ret.inputs.push(e);
- }
- else if (e == "qc") {
- }
- else {
- Logger.err(cmd + "\nar未解析参数 " + e);
- process.exit();
- }
- }
- Logger.info("---ar----" + ret.workDir + "\n\t" + ret.isLink + "," + ret.target);
- return ret;
- }
-
- static clangxxCheck1(e) {
- let ss = ["--sysroot=",
- "-pthread",
- "-Qunused-arguments",
- "-ffunction-sections",
- "-fdata-sections",
- "-fvisibility=hidden",
- "-fvisibility-inlines-hidden",
- "-funwind-tables",
- "-fwrapv",
- "-O3",
- "-fPIC",
- "-shared",
- "-ldl",
- "-lm",
- "-lpthread",
- "-lrt",
- "-fPIE",
- "-g",
- "-ftemplate-depth=1024",
- "-pedantic-errors"
- ];
- for (let s of ss) {
- if (e.startsWith(s)) {
- return true;
- }
- }
- if (e == "-w") {//-----直接忽略的编译参数(和链接参数)
- return true;
- }
- return false;
- }
- static clangxxCheck2(local, e) {
- if (e.startsWith("-isystem")) {//需要 不清楚这个有什么用
- if (e == "-isystem") {//-isystem xxxx
- local.ret.includes.push(local.eles[local.p++]);
- }
- else {//-Ixxx
- local.ret.includes.push(e.substring(2));
- }
- return true;
- }
- return false;
- }
- static clangxxCheck3(local, e) {
- if (e.startsWith("-D")) {//需要记录到defines里面的参数
- //需要 是否-D开头的,全部记录到defines里面
- if (e.length == 2) {//-D xxx
- local.ret.defines.push(local.eles[local.p++]);
- }
- else {//-Dxxx
- local.ret.defines.push(e.substring(2));
- }
- return true;
- }
- return false;
- }
- static clangxxCheck4(local, e) {
- if (e.startsWith("-I")) {//需要记录到includes的参数
- if (e.length == 2) {//-I xxx
- local.ret.includes.push(local.eles[local.p++]);
- }
- else {//-Ixxx
- local.ret.includes.push(e.substring(2));
- }
- return true;
- }
- return false;
- }
- static clangxxCheck5(local, e) {
- if (this.validCFlag(e, Tool.getAllowedCxx().compileflag)) {
- local.ret.cflags.push(e); //需要记录到flags里面的参数
- return true;
- }
- return false;
- }
- static clangxxCheck6(local, e) {
- if (e.startsWith("-Xclang")) {//透传参数
- let v = local.eles[local.p++];
- if (v != "-emit-pch") {//需要丢弃这个选项
- local.ret.cflags.push(e);
- local.ret.cflags.push(v);
- }
- return true;
- }
- return false;
- }
- static clangxxCheck7(local, e) {
- if (e.startsWith("-W")) {//需要 -W开头的怎么处理,-W -Wall -Werror=return-type -Wno-unnamed-type-template-args
- if (e.startsWith("-Wno-")) {
- local.ret.cflags.push(e);
- }
- return true;
- }
- return false;
- }
- static clangxxCheck8(local, e) {
- if (e == "-o") {
- if (e.length == 2) {//-o xxx
- local.ret.target = local.eles[local.p++];
- }
- else {//-oxxx
- local.ret.target = e.substring(2);
- }
- if (local.ret.target.endsWith(".a") ||
- local.ret.target.endsWith(".so") ||
- (!e.endsWith(".c") && !e.endsWith(".o"))) {
- local.ret.isLink = true;
- }
- return true;
- }
- return false;
- }
- static validSuffix(filePath, allowedSuffix) {
- for (let i = 0; i < allowedSuffix.length; ++i) {
- if (filePath.endsWith(allowedSuffix[i])) {
- return true;
- }
- }
- if (filePath.search(/\.so[\d\.]*$/) > 0) {
- return true;
- }
- return false;
- }
- static clangxxCheck9(local, e) {
- if (this.validSuffix(e, Tool.getAllowedCxx().fileSuffix) || (e.indexOf(".so.") > 0)) {
- local.ret.inputs.push(e);
- return true;
- }
- if (e.endsWith(".rsp")) {
- console.log(Tool.CURRENT_DIR);
- let rspth = path.join(Tool.CURRENT_DIR, e.substring(1));
- let data = fs.readFileSync(rspth, { encoding: "utf8" });
- if (data.endsWith("\r\n")) {
- data = data.substring(0, data.length - 2);
- }
- let datas = data.split(" ");
- let pp = [".c",
- ".o",
- '.o"',
- ".a",
- ".S",
- ".so"
- ];
- for (let d of datas) {
- for (let p of pp) {
- if (d.endsWith(p)) {
- local.ret.inputs.push(d);
- }
- }
- }
- return true;
- }
- return false;
- }
- static analyzeCcClangxx(cmd) {
- if (cmd.indexOf("\"")) {
- cmd = cmd.replace(/\"/g, "");
- }
- let local = {
- ret: AnalyzeCommand.resultTemplete(),
- eles: AnalyzeCommand.splitString(cmd),
- p: 0,
- }
- while (local.p < local.eles.length) {
- let e = local.eles[local.p++];
- if (e.endsWith("clang++") || e.endsWith("clang++.exe")) {
- local.ret.command = e;
- }
- else if (AnalyzeCommand.clangxxCheck1(e)) { }
- else if (e.startsWith("-fno-rtti")) {
- local.ret.cflags.splice(local.ret.cflags.indexOf("-frtti"), 1);
- }
- else if (e.startsWith("-fno-exceptions")) {
- local.ret.cflags.splice(local.ret.cflags.indexOf("-fexceptions"), 1);
- }
- else if (AnalyzeCommand.clangxxCheck2(local, e)) { }
- else if (AnalyzeCommand.clangxxCheck3(local, e)) { }
- else if (AnalyzeCommand.clangxxCheck4(local, e)) { }
- else if (AnalyzeCommand.clangxxCheck5(local, e)) { }
- else if (AnalyzeCommand.clangxxCheck6(local, e)) { }
- else if (e.startsWith("-std=")) {
- local.ret.cflagsCc.push(e);
- }
- else if (AnalyzeCommand.clangxxCheck7(local, e)) { }
- else if (AnalyzeCommand.clangxxCheck8(local, e)) { }
- else if (e == "-c") {//编译
- local.ret.isLink = false;
- }
- else if (AnalyzeCommand.clangxxCheck9(local, e)) { }
- else {
- Logger.err(cmd + "\nclang++未解析参数 " + e);
- process.exit();
- }
- }
- Logger.info("---clang++----" + local.ret.workDir + "\n\t" + local.ret.isLink + "," + local.ret.target)
- return local.ret;
- }
-
- static analyzeCompileCommand(cmd) {
- //整理命令行
- while (cmd.indexOf("\\\n") >= 0) {//去除\换行
- cmd = cmd.replace("\\\n", "");
- }
- while (cmd.indexOf("\t") >= 0) {//所有tab换成空格
- cmd = cmd.replace("\t", " ");
- }
- while (cmd.endsWith("\n") || cmd.endsWith(" ")) {
- cmd = cmd.substring(0, cmd.length - 1);
- }
- let ret = null;
- switch (AnalyzeCommand.getCompileCmdId(cmd)) {
- case AnalyzeCommand.COMPILE_CMDS["clang"]:
- ret = AnalyzeCommand.analyzeCcClang(cmd);
- break;
- case AnalyzeCommand.COMPILE_CMDS["ar"]:
- ret = AnalyzeCommand.analyzeCcAr(cmd);
- break;
- case AnalyzeCommand.COMPILE_CMDS["clang++"]:
- ret = AnalyzeCommand.analyzeCcClangxx(cmd);
- break;
- }
- if (ret) {
- AnalyzeCommand.mockTarget(ret);//解析出的目标,touch一个出来,否则会出现不同Makefile中依赖无法找到的问题
- return ret;
- }
- Logger.err("解析编译命令行失败:" + cmd);
- return false;
- }
-}
-module.exports = {
- AnalyzeCommand
-}
\ No newline at end of file
diff --git a/hdc/gn/gn-gen/src/analyze_make.js b/hdc/gn/gn-gen/src/analyze_make.js
deleted file mode 100755
index d1eb424c927d8918b15ec2bb5d1299dedeb25d06..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/src/analyze_make.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const childProcess = require("child_process");
-const fs = require("fs")
-const path = require("path");
-const { AnalyzeCommand } = require("./analyze_command");
-const { Logger } = require("./logger");
-const { Tool } = require("./tool");
-
-class AnalyzeMake {
- constructor() {
-
- }
-
- static USE_UDP_COLLECTOR = true;
- static collectByUdp(makeProjectPath) {
- const dgram = require("dgram");
- let udpServer_ = dgram.createSocket("udp4");
- let analyzeResult = [];
- udpServer_.bind(6000);
- udpServer_.on('listening', () => {
- Tool.pushd(makeProjectPath);
- let ret = childProcess.spawn(Tool.getMake(), ["-C", makeProjectPath, "-n"]);
- ret.stdout.on('data', (data) => {//要有,不然不进入close
- });
- ret.stderr.on('data', (data) => {
- Logger.err(data.toString());
- });
- ret.on('close', (code) => {
- if (code == 0) {
- Logger.info("-----------------------------make ok");
- udpServer_.close();
- udpServer_ = null;
-
- AnalyzeCommand.storeCommands();
-
- Tool.generateTarget(makeProjectPath, analyzeResult);//生成结果目标
- }
- else Logger.err("make fail");
- });
- });
- udpServer_.on('error', (e) => {
- Logger.err("udp error");
- });
- udpServer_.on('message', (msg, rinfo) => {
- let acmd = msg.toString();
- let ret = AnalyzeCommand.analyze(acmd);//解析命令msg
- if (ret.length > 0) {
- analyzeResult.push(...ret);
- }
- udpServer_.send("ok", 0, 2, rinfo.port, rinfo.address);//反馈ok给make继续执行
- });
- }
- static analyzeBreakup() {
- let acmd = ""
- for (let l of dlist) {
- if (l.endsWith("\\")) { // 合并带有换行符的命令
- acmd += l;
- }
- else {
- acmd += l;
- if (acmd.length > 0) {
- cmdlist.push(acmd);
- let ret = AnalyzeCommand.analyze(acmd);
- if (ret.length > 0) {
- analyzeResult.push(...ret);
- }
- }
- acmd = "";
- }
- }
- }
- static analyze(makeProjectFile) {
- let makeProjectPath = path.parse(makeProjectFile);
- if (!fs.existsSync(makeProjectFile)) {
- Logger.err("Makefile not exist in " + makeProjectPath.dir);
- return;
- }
- if (AnalyzeMake.USE_UDP_COLLECTOR) {
- AnalyzeMake.collectByUdp(makeProjectPath.dir);
- return;
- }
- Tool.pushd(makeProjectPath.dir);
- let ret = childProcess.spawn("make", ["-C", makeProjectPath.dir, "-n"]);
- let cmdlist = [];
- let analyzeResult = [];
- let procData = "";
- ret.stdout.on('data', (data) => {
- procData += data.toString();
- let p = procData.lastIndexOf("\n");
- if (p < 0) {
- return;
- }
- let dlist = procData.substring(0, p).split("\n");
- procData = procData.substring(p + 1);
- AnalyzeMake.analyzeBreakup(dlist, cmdlist, analyzeResult);
- });
- ret.stderr.on('data', (data) => {
- Logger.err(data.toString());
- });
- ret.on('close', (code) => {
- if (code == 0) {
- Logger.info("-----------------------------make ok");
- Tool.generateTarget(makeProjectPath.dir, analyzeResult);//生成结果目标
- }
- else Logger.err("make fail");
- });
- }
-}
-
-module.exports = {
- AnalyzeMake
-}
\ No newline at end of file
diff --git a/hdc/gn/gn-gen/src/generate_gn.js b/hdc/gn/gn-gen/src/generate_gn.js
deleted file mode 100755
index 90cb426ed0490190667cc2734085da505bb9bb31..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/src/generate_gn.js
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require("path");
-const fs = require("fs");
-const { Logger } = require("./logger");
-const { Tool } = require("./tool");
-const { exit } = require("process");
-
-function saveMockData(projectPath, analyzeResult) {
- let ss = JSON.stringify({
- projectPath: projectPath,
- analyzeResult: analyzeResult
- }, null, 4);
- fs.writeFileSync(path.join(Tool.CURRENT_TOOL_PATH, "mock.json"), ss)
- Logger.err("save mock exit");
-}
-
-function preProcessResult(analyzeResult) {//把所有路径搞成绝对路径
- for (let r of analyzeResult) {
- if (!r.target.startsWith("/")) {
- if (!path.isAbsolute(r.target)) {
- r.target = path.join(r.workDir, r.target);
- }
- }
- for (let i = 0; i < r.inputs.length; i++) {
- if (r.inputs[i].startsWith('"') && r.inputs[i].endsWith('"')) {
- r.inputs[i] = r.inputs[i].substring(1, r.inputs[i].length - 1);
- }
- if (!r.inputs[i].startsWith("/")) {
- if (!path.isAbsolute(r.inputs[i])) {
- r.inputs[i] = path.join(r.workDir, r.inputs[i]);
- }
- }
- }
- for (let i = 0; i < r.includes.length; i++) {
- if (!r.includes[i].startsWith("/")) {
- if (!path.isAbsolute(r.includes[i])) {
- r.includes[i] = path.join(r.workDir, r.includes[i]);
- }
- }
- }
- }
-}
-
-function checkoutLibName(name) {//比如/home/libabc.so,返回["dynamic",abc]
- let pn = path.parse(name);
- let tname = pn.base;
- if (tname.endsWith(".a")) {
- tname = tname.substring(0, tname.length - 2);
- if (tname.startsWith("lib")) {
- tname = tname.substring(3);
- }
- return ["static", tname];
- }
- else if (tname.endsWith(".so") || tname.indexOf(".so.") > 0) {
- tname = tname.substring(0, tname.indexOf(".so"));
- if (tname.startsWith("lib")) {
- tname = tname.substring(3);
- }
- return ["dynamic", tname];
- }
- else {
- return ["executable", tname];
- }
-}
-
-class GenerateGn {
- constructor() {
- }
-
- static mockGenerate() {
- let ss = fs.readFileSync(path.join(Tool.CURRENT_TOOL_PATH, "mock.json"), { encoding: "utf8" });
- let ret = JSON.parse(ss);
- GenerateGn.generate(ret.projectPath, ret.analyzeResult);
- Logger.err("generate mock exit")
- }
-
- static generate(projectPath, analyzeResult) {
- if (Tool.MOCK_TYPE == Tool.MOCK_ENUM.MOCK_RECORD) {
- saveMockData(projectPath, analyzeResult);//保存mock数据
- }
-
- preProcessResult(analyzeResult);
-
- let genList = {};
- for (let ret of analyzeResult) {
- if (ret) {
- if (ret.workDir in genList) {//根据目录分类genList,每个目录生成一个BUILD.gn
- genList[ret.workDir].push(ret);
- }
- else {
- genList[ret.workDir] = [ret];
- }
- }
- }
- let num = 0;
- for (let gnPath in genList) {//genList的key即为需要生成gn的目录
- Logger.info("%d-------------------generate dir %s".format(num, gnPath));
- GenerateGn.generateGn(gnPath, genList, projectPath);
- num++;
- }
- GenerateGn.generateTargetGroup(projectPath);
- Logger.info("-------------------generate gn ok");
- }
- static COLLECT_TARGET = {
- static: [],
- dynamic: [],
- executable: []
- }
- static generateTargetGroup(projectPath) {
- let gnName = path.join(projectPath, "BUILD.gn");
- let gnStr = 'import("//build/ohos.gni")\n\n';
- if (fs.existsSync(gnName)) {
- gnStr = fs.readFileSync(gnName, { encoding: "utf8" });
- }
-
- let staticTargets = [];
- for (let t of GenerateGn.COLLECT_TARGET.static) {
- staticTargets.push(Tool.swapPath(t.path) + ":" + t.name);
- }
- let dynamicTargets = [];
- for (let t of GenerateGn.COLLECT_TARGET.dynamic) {
- dynamicTargets.push(Tool.swapPath(t.path) + ":" + t.name);
- }
- let executableTargets = [];
- for (let t of GenerateGn.COLLECT_TARGET.executable) {
- executableTargets.push(Tool.swapPath(t.path) + ":" + t.name);
- }
-
- gnStr += `
-group("all_targets") {
- deps = [`
- if (staticTargets.length > 0) {
- gnStr += `
- #静态库
- "%s",
-`.format(staticTargets.join('",\n "'));
- }
- if (dynamicTargets.length > 0) {
- gnStr += `
- #动态库
- "%s",
-`.format(dynamicTargets.join('",\n "'));
- }
- if (executableTargets.length > 0) {
- gnStr += `
- #可执行程序
- "%s",
-`.format(executableTargets.join('",\n "'));
- }
- gnStr += `
- ]
-}
-`
- while (gnStr.indexOf(Tool.OHOS_PROJECT_PATH) >= 0) {
- gnStr = gnStr.replace(Tool.OHOS_PROJECT_PATH, "/");
- }
- fs.writeFileSync(gnName, gnStr, { encoding: "utf8" });
- }
- static genTargetStr(targetName) {
- switch (targetName[0]) {
- case "static":
- return 'ohos_static_library("' + targetName[1] + '")';
- case "dynamic":
- return 'ohos_shared_library("' + targetName[1] + '")';
- case "executable":
- return 'ohos_executable("' + targetName[1] + '")';
- }
- }
- static genCollectDetail(gen, genList) {
- let collectDetails = {
- cflags: new Set(),
- cflagsCc: new Set(),
- sources: new Set(),
- includeDirs: new Set(),
- defines: new Set(),
- deps: new Set(),
- }
- for (let absDepTarget of gen.inputs) {
- GenerateGn.collectFromGList(absDepTarget, genList, collectDetails);
- }
- return collectDetails;
- }
- static genTargetStr2(collectDetails, targetStr, targetName) {
- if (collectDetails.cflags.size > 0 || collectDetails.cflagsCc.size > 0) {//放到config里面才生效
- let configDetail = "";
- let removeConfigs = "";
- if (collectDetails.cflags.size > 0) {
- configDetail += GenerateGn.genDetail("cflags", collectDetails.cflags);
- }
- if (collectDetails.cflagsCc.size > 0) {
- configDetail += GenerateGn.genDetail("cflags_cc", collectDetails.cflagsCc);
- }
- if (collectDetails.cflags.has("-frtti")) {
- removeConfigs += ` "//build/config/compiler:no_rtti",\n`
- }
- if (collectDetails.cflags.has("-fexceptions")) {
- removeConfigs += ` "//build/config/compiler:no_exceptions",\n`
- }
- targetStr = `config("%s_config") {%s}
-
-%s
-remove_configs = [
-%s ]
-configs = [ ":%s_config" ]
-`.format(targetName[1], configDetail, targetStr, removeConfigs, targetName[1]);
- }
- if (collectDetails.sources.size > 0) {
- targetStr += GenerateGn.genDetail("sources", collectDetails.sources);
- }
- if (collectDetails.includeDirs.size > 0) {
- targetStr += GenerateGn.genDetail("include_dirs", collectDetails.includeDirs);
- }
- if (collectDetails.defines.size > 0) {
- targetStr += GenerateGn.genDetail("defines", collectDetails.defines);
- }
- if (collectDetails.deps.size > 0) {
- targetStr += GenerateGn.genDetail("deps", collectDetails.deps);
- }
-
- targetStr += `
-part_name = "%s"
-subsystem_name = "%s"
-}
-
-`.format(Tool.OHOS_PART_NAME, Tool.OHOS_SUBSYSTEM_NAME);
- return targetStr;
- }
- static generateGn(gnPath, genList, projectPath) {
- if (!gnPath.startsWith(projectPath)) {
- Logger.err("target path not in project path\ntarget:%s\nproject:%s".format(gnPath, projectPath))
- }
- let gnStr = 'import("//build/ohos.gni")\n\n';
- let targetCount = 0;
- let gens = genList[gnPath];
- for (let gen of gens) {//枚举在gnPath下的目标
- if (gen.isLink) {//不是链接,不生成目标
- let targetName = checkoutLibName(gen.target);
- let targetStr = GenerateGn.genTargetStr(targetName) + '\n{';
-
- GenerateGn.COLLECT_TARGET[targetName[0]].push({
- path: gnPath,
- name: targetName[1]
- });
- let collectDetails = GenerateGn.genCollectDetail(gen, genList);
- targetStr = GenerateGn.genTargetStr2(collectDetails, targetStr, targetName);
-
- gnStr += targetStr;
- targetCount++;
- }
- }
-
- if (targetCount > 0) {
- let gnName = path.join(gnPath, "BUILD.gn");
- Logger.info("输出:" + gnName + "\n" + gnStr);
- fs.writeFileSync(gnName, gnStr, { encoding: "utf8" });
- }
- else {
- Logger.info(" no target");
- }
- }
-
- static genDetail(name, detail) {
- let ss = ""
- for (let s of detail) {
- s=Tool.swapPath(s);
- if (ss.length > 0) ss += '",\n "';
- ss += s;
- }
- let ret = `
- %s = [
- "%s"
- ]
-`.format(name, ss)
-
- while (ret.indexOf(Tool.OHOS_PROJECT_PATH) >= 0) {
- ret = ret.replace(Tool.OHOS_PROJECT_PATH, "/");
- }
- return ret;
- }
-
- static searchLib(name, genList) {
- for (let gnPath in genList) {
- let gens = genList[gnPath]
- for (let gen of gens) {
- if (gen.target == name) {
- let tt = checkoutLibName(gen.target);
- return gen.workDir + ":" + tt[1];
- }
- }
- }
- return null;
- }
-
- static collectGen2(gen, collectDetails) {
- let collectFileStat = 0;
- for (let a of gen.cflags) {
- let badd = true;
- switch (collectFileStat) {
- case 0:
- if (a == "-Xclang") {
- collectFileStat = 1;
- badd = false;
- }
- break;
- case 1:
- if (a == "-include" || a == "-include-pch") {
- collectFileStat = 2;
- badd = false;
- }
- else {
- collectDetails.cflags.add("-Xclang");
- collectFileStat = 0;
- }
- break;
- case 2:
- if (a == "-Xclang") {
- collectFileStat = 3;
- badd = false;
- }
- else {
- collectFileStat = 0;
- }
- break;
- case 3://预编译文件加入进来一起编译
- GenerateGn.collectFromGList(a, genList, collectDetails);
- collectFileStat = 0;
- badd = false;
- break;
- }
-
- if (badd) {
- collectDetails.cflags.add(a);
- }
- }
- }
- static collectGen(gen, genList, collectDetails) {
- for (let i of gen.inputs) {
- if (!(i.endsWith('.c') || i.endsWith('.cpp') || i.endsWith('.cxx') || i.endsWith('.cc'))) {
- GenerateGn.collectFromGList(i, genList, collectDetails);
- } else {
- collectDetails.sources.add(i);
- for (let a of gen.includes) {
- collectDetails.includeDirs.add(a);
- }
- for (let a of gen.defines) {
- collectDetails.defines.add(a);
- }
- GenerateGn.collectGen2(gen, collectDetails);
- console.log(gen);
- for (let a of gen.cflagsCc) {
- collectDetails.cflagsCc.add(a);
- }
- }
- }
- }
- static collectFromGList(name, genList, collectDetails) {//获取依赖
- if (name.endsWith('.a') || name.endsWith('.so') || name.indexOf('.so.') > 0) {
- let dep = GenerateGn.searchLib(name, genList);
- if (dep) {//找到依赖,设置依赖
- collectDetails.deps.add(dep);
- }
- else {//没找到,让用户判断,依赖识别
- collectDetails.deps.add(name);
- }
- return;
- }
- if (name.endsWith('.c')) {
- collectDetails.sources.add(name);
- }
- for (let gnPath in genList) {
- let gens = genList[gnPath]
- for (let gen of gens) {
- if (name.endsWith(gen.target)) {
- GenerateGn.collectGen(gen, genList, collectDetails);
- }
- }
- }
- }
-}
-
-module.exports = {
- GenerateGn
-}
diff --git a/hdc/gn/gn-gen/src/logger.js b/hdc/gn/gn-gen/src/logger.js
deleted file mode 100755
index e4a2766a420087bd67cce8d8aee968e2b8d40b55..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/src/logger.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const { Tool } = require("./tool");
-
-class Logger {
- constructor() {
-
- }
- static err(msg, dontexit) {
- if (Tool.VSCODE_INST) {
- Tool.VSCODE_INST.window.showErrorMessage(msg);
- }
-
- console.log("ERR :", msg);
- if (dontexit) {
- return false;
- }
- process.exit();
- return false;
- }
- static INFO_NUM = 1;
- static info(msg) {
- if (Tool.VSCODE_INST) {
- Tool.VSCODE_INST.window.showInformationMessage(msg);
- }
-
- console.log("INFO (%d) %s".format(Logger.INFO_NUM++, msg));
- }
-}
-
-module.exports = {
- Logger
-}
\ No newline at end of file
diff --git a/hdc/gn/gn-gen/src/tool.js b/hdc/gn/gn-gen/src/tool.js
deleted file mode 100755
index 9e28cf9d6a7ef8c2e3df09ebd65150316ecc9200..0000000000000000000000000000000000000000
--- a/hdc/gn/gn-gen/src/tool.js
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-const fs = require("fs");
-
-class Tool {
- constructor() {
-
- }
- static CURRENT_TOOL_PATH = null;//生成工具或插件所在路径,用于找到res
- static OHOS_PROJECT_PATH = "/home/xx/ohos";
- static OHOS_PORTING_TO = "third_party/opencv";
- static OHOS_PRODUCT_OUTPUT_PATH = "out/rk3568-khdvk";//输出目录
- static OHOS_SUBSYSTEM_NAME = "common";
- static OHOS_PART_NAME = "common";
- static globalJsonCfg = null; // cfg.json 配置文件
- static allowedCxx = null; // cxx编译中允许处理的文件后缀列表
- static allowedC = null; // c编译中允许处理的文件后缀列表
-
-
- static getResAbsPath(respath) {
- return path.join(Tool.CURRENT_TOOL_PATH, respath);
- }
- static getCMakeToolchain() {
- switch (process.platform) {
- case 'win32':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/win/ohos.toolchain.cmake");
- case 'linux':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/linux/ohos.toolchain.cmake");
- case 'darwin':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/mac/ohos.toolchain.cmake");
- default:
- Logger.err("不支持 %s 平台".format(process.platform));
- return "";
- }
- }
- static getMakeRaw() {
- switch (process.platform) {
- case 'win32':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/win/bin/make_raw.exe");
- case 'linux':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/linux/bin/make_raw");
- case 'darwin':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/mac/bin/make_raw");
- default:
- Logger.err("不支持 %s 平台".format(process.platform));
- return "";
- }
- }
- static getMake() {
- switch (process.platform) {
- case 'win32':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/win/bin/make.exe");
- case 'linux':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/linux/bin/make");
- case 'darwin':
- return path.join(Tool.CURRENT_TOOL_PATH, "res/mac/bin/make");
- default:
- Logger.err("不支持 %s 平台".format(process.platform));
- return "";
- }
- }
- static getCMake() {
- switch (process.platform) {
- case 'win32':
- return path.join(Tool.OHOS_PROJECT_PATH, "prebuilts/cmake/windows-x86/bin/cmake.exe");
- case 'linux':
- case 'darwin':
- return path.join(Tool.OHOS_PROJECT_PATH, "prebuilts/cmake/linux-x86/bin/cmake");
- default:
- Logger.err("不支持 %s 平台".format(process.platform));
- return "";
- }
-
- }
- static swapPath(p, swapd) {
- while (p.indexOf("\\") >= 0) {
- p = p.replace("\\", "/");
- }
- return p;
- }
-
- static DIRECTORY_STACK = [];
- static CURRENT_DIR = null;
- static pushd(path) {
- path = Tool.swapPath(path, false);
- Tool.DIRECTORY_STACK.push(process.cwd());
- process.chdir(path);
- Tool.CURRENT_DIR = path;
- }
- static popd() {
- let d = Tool.DIRECTORY_STACK.pop();
- if (d) {
- process.chdir(d);
- Tool.CURRENT_DIR = d;
- }
- }
- static BACKUP_DIRECTORY = [];
- static backupd(bkp) {
- Tool.BACKUP_DIRECTORY[bkp] = Tool.DIRECTORY_STACK.concat([process.cwd()]);
- }
- static recoverd(bkp) {
- Tool.DIRECTORY_STACK = [].concat(Tool.BACKUP_DIRECTORY[bkp])
- Tool.popd();
- }
-
- static TARGET_TYPE = {
- NONE: 0,
- MAKE: 1,
- GN: 2,
- CMAKE: 3,
- SCONS: 4,
- VS: 5,
- }
- static GENERATE_TARGET_TYPE = Tool.TARGET_TYPE.GN;
-
- static setTarget(type) {//设置生成目标
- Tool.GENERATE_TARGET_TYPE = type;
- }
- static generateTarget(projectPath, analyzeResult) {
- switch (Tool.GENERATE_TARGET_TYPE) {
- case Tool.TARGET_TYPE.NONE:
- break;
- case Tool.TARGET_TYPE.GN:
- const { GenerateGn } = require('./generate_gn');
- GenerateGn.generate(projectPath, analyzeResult);
- break;
- default:
- Logger.err("generate target not support");
- break;
- }
- }
-
- static MOCK_ENUM = {
- NO_MOCK: 1,
- MOCK_RECORD: 2,
- MOCK_RUN: 3,
- };
- static MOCK_TYPE = Tool.MOCK_ENUM.NO_MOCK;
-
- /**
- * 获取Json配置文件内容
- * @returns
- */
- static getJsonCfg() {
- if (this.globalJsonCfg == null) {
- let jsonFilePath = path.join(Tool.CURRENT_TOOL_PATH, "res/cfg.json");
- let jsonFile = fs.readFileSync(jsonFilePath, { encoding: "utf8" });
- this.globalJsonCfg = JSON.parse(jsonFile);
- this.globalJsonCfg.fileSuffix = this.globalJsonCfg.fileSuffix ? "," + this.globalJsonCfg.fileSuffix : "";
- this.globalJsonCfg.compileflag = this.globalJsonCfg.compileflag ? "," + this.globalJsonCfg.compileflag : "";
- }
-
- return this.globalJsonCfg;
- }
-
- /**
- * 获取cxx编译中允许处理的文件后缀名列表
- * @returns cxx编译中允许处理的文件后缀名列表
- */
- static getAllowedCxx() {
- if (this.allowedCxx == null) {
- this.allowedCxx = {};
- let jsonCfg = this.getJsonCfg();
- let allowedCxxSuffix = ".cpp, .cxx, .cc, .o, .z, .so, .a" + jsonCfg.fileSuffix;
- this.allowedCxx.fileSuffix =
- allowedCxxSuffix.split(",").map(item => item.trim()).filter(item => item != "");
- let allowedFlag = "--target=, -march=, -mfloat-abi=, -mfpu=, -fsigned-char, -ffast-math, -rdynamic, "
- + "-UNDEBUG, -fno-threadsafe-statics, -fno-common, -fno-strict-aliasing, -fcolor-diagnostics, "
- + "-fstrict-aliasing, -fdiagnostics-show-option" + jsonCfg.compileflag;
- this.allowedCxx.compileflag = allowedFlag.split(",").map(item => item.trim()).filter(item => item != "");
- }
- return this.allowedCxx;
- }
-
- /**
- * 获取c编译中允许处理的文件后缀名列表
- * @returns c编译中允许处理的文件后缀名列表
- */
- static getAllowedC() {
- if (this.allowedC == null) {
- this.allowedC = {};
- let jsonCfg = this.getJsonCfg();
- let allowedCSuffix = '.c, .o, .o", .a, .S, .so' + jsonCfg.fileSuffix;
- this.allowedC.fileSuffix = allowedCSuffix.split(",").map(item => item.trim()).filter(item => item != "");
- let allowedFlag = "--target=, -march=, -mfloat-abi=, -mfpu=, -fno-common, -fcolor-diagnostics, -ggdb, "
- + "-fno-strict-aliasing, -ldl, -flto, -fno-builtin, -fno-stack-protector, -fvisibility=default, "
- + "-fsigned-char, -fstack-protector-strong, -fdiagnostics-show-option"
- + jsonCfg.compileflag;
- this.allowedC.compileflag = allowedFlag.split(",").map(item => item.trim()).filter(item => item != "");
- }
- return this.allowedC;
- }
-}
-
-String.prototype.format = function (...args) {
- var result = this;
- let reg = new RegExp("%[sd]{1}")
- for (let i = 0; i < args.length; i++) {
- let p = result.search(reg)
- if (p < 0) break;
- result = result.substring(0, p) + args[i] + result.substring(p + 2, result.length)
- }
- return result;
-}
-
-try {
- Tool.VSCODE_INST = require('vscode');
-}
-catch (err) {
- Tool.VSCODE_INST = null;
-}
-
-module.exports = {
- Tool
-}
-
-const Logger = require('./logger');
\ No newline at end of file
diff --git a/hdc/gn/gn_IntelliJ_plugin/README_zh.md b/hdc/gn/gn_IntelliJ_plugin/README_zh.md
deleted file mode 100755
index 18aa88e3af695fd5e49764a164beda7c0509663f..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/README_zh.md
+++ /dev/null
@@ -1,95 +0,0 @@
-# GN脚本生成工具IntelliJ插件说明(暂不支持)
-
-## 简介
-
-GN脚本生成工具,它可以根据用户给定三方库项目的CMakeLists.txt文件,转换生成BUILD.gn文件。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口,本文主要介绍IntelliJ插件使用说明。
-
-## 目录
-
- ├── gn # GN脚本生成工具
- │ ├── ... # 其他文件
- │ ├── gn_IntelliJ_plugin # IntelliJ插件代码
- │ │ ├── docs # IntelliJ插件说明
- │ │ ├── resources # IntelliJ插件说明
- │ │ ├── src # IntelliJ插件源码
- │ │ └── README_zh # IntelliJ插件说明
-
-## 约束
-
-系统:不限
-
-依赖版本:JDK 11
-
-开发工具:DevEco stdio、IDEA Community 2021.3.3
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-1)移植CMakeLists.txt编译方式的三方库到OpenHarmony源码中。
-
-### 工具使用
-
-插件下载路径如下:
-
-[下载链接](暂无)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/gn_IntelliJ_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库的CMakeLists.txt文件,工具会输出对应的BUILD.gn文件。为了方便使用者快速上手工具,可供测试的三方库项目目录如下:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project$ ls
- CMakeLists.txt main.c
-
-CMakeLists.txt文件内容如下:
-
- CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
- PROJECT(hello)
- AUX_SOURCE_DIRECTORY(. SRC_LIST)
- ADD_EXECUTABLE(hello ${SRC_LIST})
-
-在linux环境下的,根据输入三方库项目的CMakeLists.txt文件,生成的输出文件,如下所示:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project$ ls
- build_tmp CMakeLists.txt main.c
- harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project$ cd build_tmp/
- harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project/build_tmp$ ls
- BUILD.gn CMakeCache.txt CMakeFiles cmake_install.cmake hello Makefile ohos.toolchain.cmake
-
-其中生成的BUILD.gn文件,内容如下所示:
-
-
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发:
-
-[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/gn_IntelliJ_plugin/docs/DEVELOP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/gn/gn_IntelliJ_plugin/docs/DEVELOP_ZH.md b/hdc/gn/gn_IntelliJ_plugin/docs/DEVELOP_ZH.md
deleted file mode 100755
index c83962eca85b56318b3e9a95c42c049d53141d2f..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# GN代码生成工具IntelliJ插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的IntelliJ插件。
-
-## IntelliJ插件打包说明
-
-### 环境说明
-
-系统:建议Windows 10
-
-### 开发步骤
-
-#### 环境准备
-
-1.将下载的cmds文件夹放置在napi_generator/hdc/gn_IntelliJ_plugin/resources/目录下,下载链接如下:
-
-[下载链接](暂无)
-
-2.下载并安装IDEA Community、JDK11配置好环境。IDEA Community版本可以左键单击以下链接下载。
-
-[下载链接](https://www.jetbrains.com/idea/download/)
-
-3.打开IDEA Community应用程序。
-依次点击项目File>Open 选择napi_generator/hdc/gn_IntelliJ_plugin项目文件夹。
-
-
-4.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,选择或者新建complier output目录为项目文件下的out目录。
-
-
-5.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。
-
-
-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。
-
-
-7.配置Content root.
-Content root选择napi_generator/hdc/gn_IntelliJ_plugin文件夹,module name填写gn_IntelliJ_plugin。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。
-
-
-8.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。
-
-
-9.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择gn_IntelliJ_plugin,点击ok,等待安装完成。
-
-
-
-10.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。
-
-
-
-11.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。
-
-
-
-
-
diff --git a/hdc/gn/gn_IntelliJ_plugin/docs/INSTRUCTION_ZH.md b/hdc/gn/gn_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 7555d4235618b0e94b6cc6d5d9708afe687e5453..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# GN脚本转换工具IntelliJ插件使用说明
-
-## 简介
-
-IntelliJ插件下载路径如下:
-
-[下载链接](暂无)
-
-## IntelliJ插件使用方法
-
-### 依赖
-
-系统:不限
-
-开发工具:DevEco stdio
-
-### 使用指导
-
-1、windows中下载OpenHarmony源码,并编译成功一个产品的镜像包,此处以RK3568A为例。
-
-2、将待三方库项目放置在third_party文件夹下,如下所示:
-
- E:\OpenHarmony\third_party\test_project>dir /B
- CMakeLists.txt
- main.c
-
-3、DevEco stdio新建或打开项目工程,以下以新建项目工程为例。
-
-File->New->Create Project。
-
-
-
-Ability Template选择Empty Ability,单击Next。
-
-
-
-填写Project name、Save location,其他选项可不修改,单击Finish,新的工程就创建好了。
-
-
-
-4、安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的gn_IntelliJ_plugin.jar,安装成功之后重启IDE。
-
-
-
-
-
-5、Tools->Gn Generate Frame,打开Gn Generate Frame选择框。
-
-
-
-6、Gn Generate Frame窗口中工具输出路径选择E:\OpenHarmony\out\rk3568-khdvk后,工程源码路径、输入脚本路径均自动填写为E:\OpenHarmony;输入脚本路径修改为三方库项目CMakeLists.txt的路径后,GN生成路径自动填写为CMakeLists.txt文件所在路径,使用者可根据实际情况修改路径;输入脚本类型默认为cmake,此处不做修改;子系统名称、组件名称使用者可根据具体情况修改;编译选项根据具体三方库项目选填。以上参数填写完成后,点击ok。
-
-
-
-7、执行结束后会在E:\OpenHarmony\third_party\test_project目录下生成build_tep文件夹,文件夹下内容如下所示:
-
- E:\OpenHarmony\third_party\test_project\build_tmp>dir /B
- BUILD.gn
- CMakeCache.txt
- CMakeFiles
- cmake_install.cmake
- hello
- Makefile
- ohos.toolchain.cmake
-
-
diff --git a/hdc/gn/gn_IntelliJ_plugin/resources/META-INF/plugin.xml b/hdc/gn/gn_IntelliJ_plugin/resources/META-INF/plugin.xml
deleted file mode 100755
index 44a3079da5bd7ba2f603914d5453b9480a93b21c..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
- com.sk.gn
- Gn Generate
- 1.0.1
- 深圳开鸿数字产业发展有限公司
-
- Introduction
- The current OpenHarmony 3.1Release and later versions use bundle.json to integrate subsystem code. However, some libraries are integrated as cmakelists.txt, which cannot be integrated into OpenHarmony source code. You need to compile the library to a build.gn file, and then use the generated GN script to integrate the library into OpenHarmony.
- Sources on Gitee
- ]]>
-
-
-
- com.intellij.modules.lang
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/gn/gn_IntelliJ_plugin/resources/images/openDisk.png b/hdc/gn/gn_IntelliJ_plugin/resources/images/openDisk.png
deleted file mode 100755
index 5956a0e538a400c7deaf41167ae5ea70348b8584..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_IntelliJ_plugin/resources/images/openDisk.png and /dev/null differ
diff --git a/hdc/gn/gn_IntelliJ_plugin/resources/images/step_one.png b/hdc/gn/gn_IntelliJ_plugin/resources/images/step_one.png
deleted file mode 100755
index 10638d6cf157dd83e2f0a091c637bad05f5c8e7b..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_IntelliJ_plugin/resources/images/step_one.png and /dev/null differ
diff --git a/hdc/gn/gn_IntelliJ_plugin/resources/images/step_two.png b/hdc/gn/gn_IntelliJ_plugin/resources/images/step_two.png
deleted file mode 100755
index a298764419264adfe58ece0c7dfcb72abb4804f0..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_IntelliJ_plugin/resources/images/step_two.png and /dev/null differ
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/InputScriptAction.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/InputScriptAction.java
deleted file mode 100755
index bcaf9852a789b0e1135da03670c444d2955bf630..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/InputScriptAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.action;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-/**
- * 选择脚本路径
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select script path
- * @version: v1.0.0
- * @since 2022-09-21
- */
-public class InputScriptAction implements ActionListener {
- private static final String SYS_NAME = System.getProperties().getProperty("os.name").toUpperCase();
-
- private final JButton button;
- private final JTextField textField;
- private final JComboBox comboBox;
- private final JTextField transplantTextField;
-
- public InputScriptAction(JButton button, JTextField textField, JComboBox comboBox, JTextField transplantTextField) {
- this.button = button;
- this.textField = textField;
- this.comboBox = comboBox;
- this.transplantTextField = transplantTextField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser(textField.getText());
- fcDlg.setDialogTitle("请选择输入脚本路径...");
- fcDlg.setFileSelectionMode(JFileChooser.FILES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- if (filepath.contains(File.separator)) {
- textField.setText(filepath.substring(filepath.lastIndexOf("third_party")));
- String parentFilePath = fcDlg.getSelectedFile().getParent();
- if (SYS_NAME.contains("WIN")) {
- transplantTextField.setText(parentFilePath.substring(parentFilePath.lastIndexOf("\\")));
- } else {
- transplantTextField.setText(filepath.substring(filepath.lastIndexOf("/")));
- }
- } else {
- textField.setText(filepath);
- transplantTextField.setText(filepath);
- }
- if (filepath.contains("CMake")) {
- comboBox.setSelectedIndex(1);
- } else if (filepath.contains("Make")) {
- comboBox.setSelectedIndex(0);
- } else {
- comboBox.setSelectedIndex(2);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectBankAction.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectBankAction.java
deleted file mode 100755
index ffa40a7cfcf0d90efcb2f109f496cb2ce227410f..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectBankAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-/**
- * 选择库移植的路径
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select transplant path
- * @version: v1.0.0
- * @since 2022-09-21
- */
-public class SelectBankAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
-
- public SelectBankAction(JButton button, JTextField textField) {
- this.button = button;
- this.textField = textField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser(textField.getText());
- fcDlg.setDialogTitle("请选择选择库移植的路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- if (filepath.contains(File.separator)) {
- textField.setText(filepath.substring(filepath.lastIndexOf(File.separator)));
- } else {
- textField.setText(filepath);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectOriginCodeAction.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectOriginCodeAction.java
deleted file mode 100755
index affb62760a1704d0c5c1185ccde393a0cd3a6da1..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectOriginCodeAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * 选择源码路径
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select origin code path
- * @version: v1.0.0
- * @since 2022-09-21
- */
-public class SelectOriginCodeAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
- private final JTextField opOutPathTextField;
-
- public SelectOriginCodeAction(JButton button, JTextField textField, JTextField opOutPathTextField) {
- this.button = button;
- this.textField = textField;
- this.opOutPathTextField = opOutPathTextField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser(textField.getText());
- fcDlg.setDialogTitle("请选择源码路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- textField.setText(filepath);
- }
- }
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectOutDirAction.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectOutDirAction.java
deleted file mode 100755
index 8bf5a66e3261f1957ec2f85f9cc1fbd1d778a4bd..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/action/SelectOutDirAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-/**
- * 选择输出路径
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select out path
- * @version: v1.0.0
- * @since 2022-09-21
- */
-public class SelectOutDirAction implements ActionListener {
- private static final String SYS_NAME = System.getProperties().getProperty("os.name").toUpperCase();
-
- private final JButton button;
- private final JTextField textField;
- private SelectPathInterface selectPathInterface;
-
- /**
- * 构造函数
- *
- * @param button 按钮
- * @param textField 输入框
- * @param selectPathInterface 接口
- */
- public SelectOutDirAction(JButton button, JTextField textField, SelectPathInterface selectPathInterface) {
- this.button = button;
- this.textField = textField;
- this.selectPathInterface = selectPathInterface;
- if (SYS_NAME.contains("WIN")) {
- textField.setText("out\\rk3568");
- }
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser(textField.getText());
- fcDlg.setDialogTitle("请选择输出路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- selectPathInterface.getFilePath(fcDlg.getSelectedFile());
- String fieldShowPath;
- if (filepath.contains(File.separator)) {
- String path = filepath.substring(0, filepath.lastIndexOf(File.separator));
- if (path.contains(File.separator)) {
- fieldShowPath = filepath.substring(path.lastIndexOf(File.separator) + 1);
- } else {
- fieldShowPath = filepath.substring(filepath.lastIndexOf(File.separator) + 1);
- }
- } else {
- fieldShowPath = filepath;
- }
- if (SYS_NAME.contains("WIN")) {
- textField.setText(fieldShowPath.replaceAll("/", "\""));
- } else {
- textField.setText(fieldShowPath);
- }
- }
- }
- }
-
- /**
- * 文件选择接口
- */
- public interface SelectPathInterface {
- /**
- * 选择文件路径
- *
- * @param pathFile 文件路径
- */
- void getFilePath(File pathFile);
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialog.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialog.java
deleted file mode 100755
index a880debc78579acf9aa700a05006f04f87bbe9e6..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialog.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.dialog;
-
-import com.intellij.openapi.ui.DialogWrapper;
-import org.jetbrains.annotations.Nullable;
-import javax.swing.JComponent;
-
-/**
- * 自定义确认对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ConfirmDialog extends DialogWrapper {
- private final ConfirmDialogPane confirmDiagPane;
-
- /**
- * 构造函数
- * @param message 弹出框信息内容
- */
- public ConfirmDialog(String message) {
- super(true);
- confirmDiagPane = new ConfirmDialogPane(message);
- setOKButtonText("Yes");
- setCancelButtonText("No");
- setUndecorated(true);
- setResizable(false);
- init();
- }
-
- @Override
- @Nullable
- protected JComponent createCenterPanel() {
- return confirmDiagPane.getContentPanel();
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialogPane.form b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialogPane.form
deleted file mode 100755
index 1f894207c24cbe1105b20aea248e6d7523d46d1e..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialogPane.form
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialogPane.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialogPane.java
deleted file mode 100755
index f083c554abd11715f8ebd9ba6ab5deb8b0ce7150..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ConfirmDialogPane.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.dialog;
-
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JDialog;
-import javax.swing.ImageIcon;
-
-/**
- * ConfirmDiagPane自定义确认对话框
- * 解决ShowConfirmDiag 在Deveco里面会出现界面错位问题。
- *
- * @author: zhaoxudong@kaihong.com
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ConfirmDialogPane extends JDialog {
- private JPanel contentPane;
- private JLabel msgLabel;
- private JLabel iconLabel;
-
- /**
- * 构造函数
- *
- * @param sErrorMessage 错误信息
- */
- public ConfirmDialogPane(String sErrorMessage) {
- msgLabel.setText(sErrorMessage);
- iconLabel.setIcon(new ImageIcon(""));
- }
-
-
- JPanel getContentPanel() {
- return contentPane;
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ErrorDialog.form b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ErrorDialog.form
deleted file mode 100755
index af9042f6fb805e4a9f6662c1f7e6902fa637f7d4..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ErrorDialog.form
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ErrorDialog.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ErrorDialog.java
deleted file mode 100755
index 589dfbb0a3a30de31c50c3625f1544462d9660d2..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/ErrorDialog.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-
-/**
- * ErrorDialog错误对话框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ErrorDialog extends JDialog {
- private static final Logger LOG = Logger.getInstance(ErrorDialog.class);
- private static final String URL =
- "rundll32 url.dll,FileProtocolHandler" + " https://gitee" + ".com/openharmony" + "-sig/napi_generator";
-
- private JPanel contentPane;
- private JButton buttonOK;
- private JButton buttonHelp;
- private JTextArea textAreaError;
- private String errorMessage;
-
- public ErrorDialog(String sErrorMessage) {
- errorMessage = sErrorMessage;
- }
-
- /**
- * 初始化
- */
- public void initDialog() {
- setContentPane(contentPane);
- setModal(true);
- getRootPane().setDefaultButton(buttonOK);
- setTitle("执行失败");
- textAreaError.setText(errorMessage);
- buttonOK.addActionListener(actionEvent -> onOK());
-
- buttonHelp.addActionListener(actionEvent -> onCancel());
-
- // call onCancel() when cross is clicked
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- /**
- * close dialog
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- });
-
- // call onCancel() on ESCAPE
- contentPane.registerKeyboardAction(actionEvent -> onCancel(),
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- }
-
- private void onOK() {
- dispose();
- }
-
- private void onCancel() {
- try {
- Runtime.getRuntime().exec(URL);
- } catch (IOException ioException) {
- LOG.error("exec command help error" + ioException);
- }
- dispose();
- }
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenDialogPane.form b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenDialogPane.form
deleted file mode 100755
index 8f7a5149ab58a37cfaf4a1312def64389e4105ce..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenDialogPane.form
+++ /dev/null
@@ -1,313 +0,0 @@
-
-
-
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenDialogPane.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenDialogPane.java
deleted file mode 100755
index ddf1bd5ce916aaa61006f091e3e09674b421d923..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenDialogPane.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.dialog;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.ValidationInfo;
-import com.sk.gn.action.InputScriptAction;
-import com.sk.gn.action.SelectBankAction;
-import com.sk.gn.action.SelectOriginCodeAction;
-import com.sk.gn.action.SelectOutDirAction;
-import com.sk.gn.utils.FileUtil;
-import com.sk.gn.utils.GenNotification;
-import org.apache.http.util.TextUtils;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import static com.sk.gn.utils.FileUtil.writeTmpFile;
-
-/**
- * GenerateDialogPane生成工具主界面
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select generate dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectPathInterface {
- private static final Logger LOG = Logger.getInstance(GenDialogPane.class);
- private static final String SYS_NAME = System.getProperties().getProperty("os.name").toUpperCase();
-
- private JPanel contentPane;
- private JTextField opOutPathTextField;
- private JTextField opOriginTextField;
- private JTextField transplantTextField;
- private JButton selectOPOutButton;
- private JButton selectOPOriginButton;
- private JButton selectTransplantButton;
- private JButton selectScriptButton;
- private JTextField subsystemTextField;
- private JTextField test_partTextField;
- private JTextField compileTextField;
- private JTextField inputScriptTextField;
- private JComboBox comboBox;
- private boolean generateSuccess = true;
- private String sErrorMessage = "";
-
- /**
- * 输出路径 -o
- */
- private String outputCodeDir;
-
- /**
- * 源码路径 -p
- */
- private String originCodeDir;
-
- /**
- * 输入脚本路径 -f
- */
- private String inputScriptDir;
-
- /**
- * 输入脚本类型 -t
- */
- private String scriptType;
-
- /**
- * 移植库路径/GN生成路径 -m
- */
- private String transplantDir;
-
- /**
- * 子系统名称 -s
- */
- private String subsystemName;
-
- /**
- * 组件名称 -m
- */
- private String componentName;
-
- /**
- * 编译选项 -a
- */
- private String compileOptions;
-
- private final Project project;
- private BlockingQueue blockingQueue = new LinkedBlockingQueue(100);
- private ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 64, 60L,
- TimeUnit.SECONDS, blockingQueue,
- new ThreadPoolExecutor.AbortPolicy());
-
- /**
- * 构造函数
- *
- * @param project projectId
- * @param filePath 文件路径
- */
- public GenDialogPane(Project project, String filePath) {
- this.project = project;
- // call onCancel() on ESCAPE
- contentPane.registerKeyboardAction(actionEvent -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
- selectOPOutButton.addActionListener(new SelectOutDirAction(selectOPOutButton, opOutPathTextField, this));
- selectOPOriginButton.addActionListener(new SelectOriginCodeAction(selectOPOriginButton, opOriginTextField,
- opOutPathTextField));
- selectTransplantButton.addActionListener(new SelectBankAction(selectTransplantButton, transplantTextField));
- selectScriptButton.addActionListener(new InputScriptAction(selectScriptButton, inputScriptTextField, comboBox,
- transplantTextField));
- inputScriptTextField.setText(filePath);
- }
-
- @Override
- public synchronized void addWindowListener(WindowListener windowListener) {
- super.addWindowListener(windowListener);
- new WindowAdapter() {
- /**
- * close dialog
- *
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- };
- }
-
- /**
- * 验证文本选择框是否空。是否替换已存在的内容
- *
- * @return ValidationInfo 返回不符要求的信息。
- */
- @Nullable
- public ValidationInfo validationInfo() {
- getEditText();
- ValidationInfo validationInfo = null;
- String warnMsg;
- if (TextUtils.isEmpty(outputCodeDir)) {
- warnMsg = "输出路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
- if (TextUtils.isEmpty(originCodeDir)) {
- warnMsg = "源码路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
- if (TextUtils.isEmpty(transplantDir)) {
- warnMsg = "库移植的路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
- if (TextUtils.isEmpty(inputScriptDir)) {
- warnMsg = "输入脚本路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
- if (TextUtils.isEmpty(subsystemName)) {
- warnMsg = "子系统名称不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
- if (TextUtils.isEmpty(componentName)) {
- warnMsg = "组件名称不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
- File file = new File(transplantTextField.getText() + "/build_tmp");
- if (file.exists()) {
- ConfirmDialog confirmDialog = new ConfirmDialog("是否替换已存在的生成结果?");
- if (!confirmDialog.showAndGet()) {
- validationInfo = new ValidationInfo(String.format("不替换现有生成结果:%s", file));
- return validationInfo;
- }
- }
- return validationInfo;
- }
-
- private void getEditText() {
- // 输出路径
- outputCodeDir = opOutPathTextField.getText().trim();
- // 源码路径
- originCodeDir = opOriginTextField.getText().trim();
- // 库移植的路径
- transplantDir = transplantTextField.getText().trim();
- // 输入脚本路径
- inputScriptDir = inputScriptTextField.getText().trim();
- // 输入脚本类型
- scriptType = comboBox.getSelectedItem().toString().trim();
- // 子系统名称
- subsystemName = subsystemTextField.getText().trim();
- // 组件名称
- componentName = test_partTextField.getText().trim();
- // 编译选项
- compileOptions = compileTextField.getText().trim();
- }
-
- private void onCancel() {
- dispose();
- }
-
- private void warningMessage(String title) {
- String notifyContent = "带*号均为必填项";
- GenNotification.notifyMessage(this.project, notifyContent, title, NotificationType.WARNING);
- }
-
- /**
- * 执行主程序入口
- *
- * @return 执行状态
- */
- public boolean runFun() {
- createCopyResMakeFile();
- createCopyResMakeRawFile();
- createCopyResToolChainFile();
- GenNotification.notifyMessage(this.project, "", "正在生成", NotificationType.INFORMATION);
- String command;
- command = genCommand();
- try {
- if (!TextUtils.isEmpty(command) && callExtProcess(command)) {
- GenNotification.notifyMessage(project, opOriginTextField.getText(), "提示",
- NotificationType.INFORMATION, true);
- return true;
- }
- } catch (IOException | InterruptedException ex) {
- GenNotification.notifyMessage(project, opOriginTextField.getText(), "Command exec error",
- NotificationType.ERROR);
- LOG.error(ex);
- }
- return false;
- }
-
- /**
- * 生成命令行指令
- *
- * @return 返回命令行执行内容
- */
- private String genCommand() {
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- String execFn;
- if (SYS_NAME.contains("WIN")) {
- execFn = "cmds/win/gn-gen-win.exe";
- tmpDirFile += "/gn-gen-win.exe";
- } else if (SYS_NAME.contains("LINUX")) {
- execFn = "cmds/linux/gn-gen-linux";
- tmpDirFile += "/gn-gen-linux";
- } else {
- execFn = "cmds/mac/gn-gen-macos";
- tmpDirFile += "/gn-gen-macos";
- }
- File file = new File(tmpDirFile);
- writeTmpFile(tmpDirFile, execFn, project);
- if (SYS_NAME.contains("LINUX") || SYS_NAME.contains("MAC OS")) {
- try {
- executable(tmpDirFile);
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + execFn,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
- String command = file.toString();
- command += " -o " + outputCodeDir + " -p " + originCodeDir + " -f " + inputScriptDir + " -t " + scriptType
- + " -s " + subsystemName + " -m " + componentName + " -d " + transplantDir;
- if (!TextUtils.isEmpty(compileTextField.getText().trim())) {
- command += " -a " + "\"" + compileOptions + "\"";
- }
- if (SYS_NAME.contains("WIN")) {
- return command.replaceAll("\\\\", "/");
- }
- return command;
- }
-
- private void createCopyResMakeFile() {
- String makeFilePath = "cmds/res/linux/bin/make";
- if (SYS_NAME.contains("WIN")) {
- makeFilePath = "cmds/res/win/bin/make.exe";
- }
- String tmpDirFile = System.getProperty("java.io.tmpdir") + "/res/linux/bin/";
- File file = new File(tmpDirFile);
- if (file.mkdirs()) {
- LOG.info("create dir success");
- }
- String tmp = SYS_NAME.contains("WIN") ? file.getPath() + "/make.exe" : file.getPath() + "/make";
- writeTmpFile(tmp, makeFilePath, project);
- if (SYS_NAME.contains("LINUX") || SYS_NAME.contains("MAC OS")) {
- try {
- executable(tmp);
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + makeFilePath,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
- }
-
- private void createCopyResMakeRawFile() {
- String makeFilePath = "cmds/res/linux/bin/make_raw";
- if (SYS_NAME.contains("WIN")) {
- makeFilePath = "cmds/res/win/bin/make_raw.exe";
- }
- String tmpDirFile = System.getProperty("java.io.tmpdir") + "/res/linux/bin/";
- File file = new File(tmpDirFile);
- if (file.mkdirs()) {
- LOG.info("create dir success");
- }
- String tmp = SYS_NAME.contains("WIN") ? file.getPath() + "/make_raw.exe" : file.getPath() + "/make_raw";
- writeTmpFile(tmp, makeFilePath, project);
- if (SYS_NAME.contains("LINUX") || SYS_NAME.contains("MAC OS")) {
- try {
- executable(tmp);
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + makeFilePath,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
- }
-
- private void createCopyResToolChainFile() {
- String toolchainFileDir = "cmds/res/linux/ohos.toolchain.cmake";
- if (SYS_NAME.contains("WIN")) {
- toolchainFileDir = "cmds/res/win/ohos.toolchain.cmake";
- }
- String tmpDirFile = System.getProperty("java.io.tmpdir") + "/res/linux/";
- File file = new File(tmpDirFile);
- if (file.mkdirs()) {
- LOG.info("create dir success");
- }
- String tmp = file.getPath() + "/ohos.toolchain.cmake";
- writeTmpFile(tmp, toolchainFileDir, project);
- if (SYS_NAME.contains("LINUX") || SYS_NAME.contains("MAC OS")) {
- try {
- executable(tmp);
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + toolchainFileDir,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
- }
-
- private boolean callExtProcess(String command) throws IOException, InterruptedException {
- if (TextUtils.isEmpty(command)) {
- GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
- return false;
- }
- final Process process = Runtime.getRuntime().exec(command);
- threadPool.execute(new BlockThread(process));
- StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
- StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
- errConsumer.start();
- outputConsumer.start();
- if (generateSuccess) {
- GenNotification.notifyMessage(project, "执行成功", "提示", NotificationType.INFORMATION);
- } else {
- GenNotification.notifyMessage(project, sErrorMessage, "提示", NotificationType.ERROR);
- return false;
- }
- errConsumer.join();
- outputConsumer.join();
- process.destroy();
- return true;
- }
-
- /**
- * 赋值可执行文件权限。
- *
- * @param execFn 可执行命令
- * @throws IOException 打开文件异常
- * @throws InterruptedException 中断异常
- */
- private void executable(String execFn) throws IOException, InterruptedException {
- callExtProcess("chmod a+x " + execFn);
- }
-
- /**
- * 获取生成成功结果文件。
- *
- * @param process 进程ID
- */
- private void genResultLog(Process process) {
- BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
- BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String sErr;
- String sOut;
- sErr = getErrorResult(stdError);
- if (TextUtils.isEmpty(sErr)) {
- sOut = genInputLog(stdInput);
- if (!generateIsSuccess(sOut)) {
- sErrorMessage = sOut;
- }
- return;
- }
- generateSuccess = false;
- sErrorMessage = sErr;
- }
-
- /**
- * 获取生成失败结果文件。
- *
- * @param stdError error buff
- * @return ErrorResult
- */
- private String getErrorResult(BufferedReader stdError) {
- StringBuilder sErr = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdError.readLine()) == null) {
- break;
- }
- sErr.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sErr.toString();
- }
-
- private boolean generateIsSuccess(String sOut) {
- generateSuccess = sOut.contains("success") || TextUtils.isEmpty(sOut);
- return generateSuccess;
- }
-
- /**
- * 获取生成文本内容。
- *
- * @param stdInput input buff
- * @return 返回当前输入框内容
- */
- private String genInputLog(BufferedReader stdInput) {
- StringBuilder sOut = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdInput.readLine()) == null) {
- break;
- }
- sOut.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sOut.toString();
- }
-
- @Override
- public void getFilePath(File pathFile) {
- if (pathFile.getParentFile() != null && pathFile.getParentFile().getParent() != null) {
- opOriginTextField.setText(pathFile.getParentFile().getParent());
- inputScriptTextField.setText(pathFile.getParentFile().getParent());
- }
- }
-
- static class StreamConsumer extends Thread {
- InputStream is;
-
- StreamConsumer(InputStream is) {
- super.setName("StreamConsumer");
- this.is = is;
- }
-
- @Override
- public void run() {
- try {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- while ((line = br.readLine()) != null) {
- LOG.error("StreamConsumer" + line);
- }
- } catch (IOException ioException) {
- LOG.error("StreamConsumer io error" + ioException);
- }
- }
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-
- class BlockThread extends Thread {
- Process process;
-
- BlockThread(Process process) {
- super.setName("BlockThread");
- this.process = process;
- }
-
- @Override
- public void run() {
- BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
- genResultLog(process);
- try {
- while (br.readLine() != null) {
- LOG.info(" callExtProcess ");
- }
- } catch (IOException ioException) {
- LOG.error(" callExtProcess error" + ioException);
- }
- }
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenGenerateDialog.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenGenerateDialog.java
deleted file mode 100755
index 0429418b43b8a50339614ade10c241f232091f67..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenGenerateDialog.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.ValidationInfo;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * 主界面对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-27
- */
-public class GenGenerateDialog extends DialogWrapper {
- private static final Logger LOG = Logger.getInstance(GenGenerateDialog.class);
- private static final String TITLE = "Gn Generate Frame";
- private static final String URL = "https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn-gen";
-
- private final GenDialogPane genDiag;
-
- /**
- * 构造函数
- *
- * @param project projectId
- * @param filePath 文件路径
- */
- public GenGenerateDialog(Project project, String filePath) {
- super(true);
- this.setResizable(false);
- setTitle(TITLE);
- setModal(true);
- genDiag = new GenDialogPane(project, filePath);
- init();
- }
-
- /**
- * 创建视图
- *
- * @return 组件内容
- */
- @Nullable
- @Override
- protected JComponent createCenterPanel() {
- return genDiag.getContentPanel();
- }
-
-
- /**
- * 校验数据
- *
- * @return 检测文本框架是否有目录。
- */
- @Nullable
- @Override
- protected ValidationInfo doValidate() {
- return genDiag.validationInfo();
- }
-
- /**
- * ok/cancel按钮
- *
- * @return Action[] buttos list
- */
- @NotNull
- @Override
- protected Action[] createActions() {
- DialogWrapperExitAction exitAction = new DialogWrapperExitAction("Cancel", CANCEL_EXIT_CODE);
- CustomOKAction okAction = new CustomOKAction();
-
- // 设置默认的焦点按钮
- okAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
- return new Action[]{exitAction, okAction};
- }
-
- @NotNull
- @Override
- protected Action[] createLeftSideActions() {
- CustomHelpAction helpAction = new CustomHelpAction();
- return new Action[]{helpAction};
- }
-
- /**
- * 自定义 ok Action
- */
- protected class CustomOKAction extends DialogWrapperAction {
-
- protected CustomOKAction() {
- super("OK");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
-
-
- ValidationInfo validationInfo = doValidate();
- if (validationInfo != null) {
- LOG.info(validationInfo.message);
- } else {
- if (genDiag.runFun()) {
- close(CANCEL_EXIT_CODE);
- }
- }
- }
- }
-
- /**
- * 自定义 help Action
- */
- protected class CustomHelpAction extends DialogWrapperAction {
-
- protected CustomHelpAction() {
- super("Help");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- try {
- Desktop.getDesktop().browse(new URI(URL));
- } catch (URISyntaxException | IOException e) {
- LOG.error("Open help error:" + e);
- }
- }
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenResultDialog.form b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenResultDialog.form
deleted file mode 100755
index e699fec7484412b6ce692537415de424f3d3ad17..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenResultDialog.form
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenResultDialog.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenResultDialog.java
deleted file mode 100755
index 42f8eecb01853b25772a25ed238698e6d1f8a93b..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/dialog/GenResultDialog.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * GenResultDialog结果生成框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: generate success dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class GenResultDialog extends JDialog {
- private static final Logger LOG = Logger.getInstance(GenResultDialog.class);
-
- private JPanel contentPane;
- private JButton buttonOK;
- private JList resultList;
- private String path;
-
- public GenResultDialog(String directoryPath) {
- path = directoryPath;
- }
-
- /**
- * 初始化
- */
- public void initResultDialog() {
- setContentPane(contentPane);
- setModal(true);
- getRootPane().setDefaultButton(buttonOK);
- setTitle("执行成功");
- buttonOK.addActionListener(actionEvent -> onOK());
- List fileList = getDirFileName(path);
- resultList.setListData(fileList.toArray(new String[fileList.size()]));
- }
-
- private void onOK() {
- dispose();
- }
-
- private List getDirFileName(String path) {
- List files = new ArrayList<>();
- File file = new File(path);
- if (!file.exists()) {
- LOG.info("getDirFileName f not exist");
- return files;
- }
- File[] fileArray = file.listFiles();
- for (int i = 0; i < fileArray.length; i++) {
- File fs = fileArray[i];
- if (!fs.isDirectory()) {
- files.add(fs.getPath());
- } else {
- LOG.info("getDirFileName this file is dir");
- }
- }
- return files;
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/ng/GnDTS.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/ng/GnDTS.java
deleted file mode 100755
index ebd170b247acd673f87531f0ccec05ace83941e9..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/ng/GnDTS.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.ng;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.sk.gn.dialog.GenGenerateDialog;
-import com.sk.gn.utils.FileUtil;
-import com.sk.gn.utils.GenNotification;
-
-/**
- * 项目文件入口
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-21
- */
-public class GnDTS extends AnAction {
-
- @Override
- public void actionPerformed(AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
- VirtualFile file = anActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE);
- if (file == null) {
- GenNotification.notifyMessage(project, "", "file is not exist", NotificationType.ERROR);
- return;
- }
- if (project == null) {
- return;
- }
- String filePath = file.getPath();
- GenGenerateDialog wrapper = new GenGenerateDialog(project, filePath);
- wrapper.showAndGet();
- }
-
-
- @Override
- public void update(AnActionEvent event) {
- // 根据所选文件名,判断是否显示生成菜单项
- VirtualFile file = event.getData(PlatformDataKeys.VIRTUAL_FILE);
- if (file == null) {
- event.getPresentation().setEnabledAndVisible(false);
- } else {
- event.getPresentation().setEnabledAndVisible(FileUtil.patternFileName(file.getName()));
- }
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/ng/GnMenuDTS.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/ng/GnMenuDTS.java
deleted file mode 100755
index 9e609d8f7dbe80e8dc9b3bacadd2664269ce5830..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/ng/GnMenuDTS.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.ng;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import com.sk.gn.dialog.GenGenerateDialog;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * 工具菜单入口
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-27
- */
-public class GnMenuDTS extends AnAction {
-
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
-
- if (project == null) {
- return;
- }
- GenGenerateDialog wrapper = new GenGenerateDialog(project, "");
- wrapper.showAndGet();
- }
-
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/utils/FileUtil.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/utils/FileUtil.java
deleted file mode 100755
index 8f771c19c1f6cc40df8331dc748218c08226683a..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/utils/FileUtil.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.utils;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.apache.http.util.TextUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-/**
- * 文本文件工具
- *
- * @author: zhaoxudong@kaihong.com
- * @see: file utils
- * @version: v1.0.0
- * @since 2022-09-21
- */
-public class FileUtil {
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private static final int COMPILE_SDK_VERSION = 5;
-
- /**
- * 将错误信息输入到txt中
- *
- * @param path 路径
- * @param content 内容
- */
- public void writeErrorToTxt(String path, String content) {
- File file = new File(path);
- try (FileWriter fw = new FileWriter(file, true)) {
- fw.write(content + FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error("writeErrorToTxt io error" + ioException);
- }
- }
-
- /**
- * 创建文件
- *
- * @param path 文件路径
- * @return 文件路径
- */
- public String makeFile(String path) {
- File file = new File(path);
- if (!file.exists()) {
- try {
- boolean isCreateFile = file.createNewFile();
- if (isCreateFile) {
- LOG.info(String.format("makeFile %s success", path));
- }
- } catch (IOException ioException) {
- LOG.error(String.format("makeFile %s error:%s", path, ioException));
- return "";
- }
- }
- return file.getPath();
- }
-
- /**
- * 获取换行符
- *
- * @return 换行符
- */
- public static String getNewline() {
- return System.getProperty("line.separator");
- }
-
- /**
- * 正则匹配所选文件名是否符合规范
- *
- * @param fileName 文件名
- * @return boolean 是否匹配
- */
- public static boolean patternFileName(String fileName) {
- String pattern = "([.a-z_A-Z0-9]+).(am|txt)";
- return Pattern.matches(pattern, fileName);
- }
-
- /**
- * check project SDK
- *
- * @param project project
- * @param baseFile project root file
- * @return boolean
- */
- public static boolean checkProjectSDK(Project project, String baseFile) {
-
- String gradlePath = "";
- File baseDir = new File(baseFile);
- if (baseDir.isDirectory()) {
- File[] childFile = baseDir.listFiles();
- assert childFile != null;
- for (File file : childFile) {
- if (file.getName().equals("build.gradle") || file.getName().equals("build-profile.json5")) {
- gradlePath = file.getPath();
- }
- }
- }
-
- Properties properties = new Properties();
- if (TextUtils.isBlank(gradlePath)) {
- GenNotification.notifyMessage(project, "项目结构中没有grandle配置文件。", "当前项目结构不支持",
- NotificationType.WARNING);
- return true;
- }
- try {
- properties.load(new FileInputStream(gradlePath));
- } catch (IOException e) {
- GenNotification.notifyMessage(project, e.getMessage(), "提示", NotificationType.ERROR);
- LOG.error(String.format("Can not load file :%s . %s", gradlePath, e));
- return true;
- }
- String ohosSDK = properties.getProperty("compileSdkVersion");
-
- if (ohosSDK != null && Integer.parseInt(ohosSDK) < COMPILE_SDK_VERSION) {
- GenNotification.notifyMessage(project, "SKD版本过低,NAPI仅支持5.0及以上版本", "提示",
- NotificationType.WARNING);
- return true;
- }
- return false;
- }
-
- /**
- * 拷贝可执行文件到临时文件夹
- *
- * @param path 目标文件路径
- * @param oldPath 原文件路径
- * @param project project
- * @throws IOException exception
- */
- public static void writeTmpFile(String path, String oldPath, Project project) {
- File file = new File(path);
- try (InputStream inputStream = FileUtil.class.getClassLoader().getResourceAsStream(oldPath)) {
- if (inputStream == null) {
- throw new IOException("exec File InputStream is Null");
- }
- byte[] bs = inputStream.readAllBytes();
- file.setWritable(true);
- boolean isNewFile = file.createNewFile();
- if (!isNewFile) {
- LOG.info("writeTmpFile createNewFile error");
- }
- FileOutputStream fw = new FileOutputStream(file);
- fw.write(bs, 0, bs.length);
- fw.close();
- } catch (IOException e) {
- GenNotification.notifyMessage(project, e.getMessage(), "Can not Find File:" + oldPath,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
-}
diff --git a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/utils/GenNotification.java b/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/utils/GenNotification.java
deleted file mode 100755
index 5281519de0fb19ddb55d442fe861f4ff5ec9390d..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_IntelliJ_plugin/src/com/sk/gn/utils/GenNotification.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.gn.utils;
-
-import com.intellij.ide.actions.OpenFileAction;
-import com.intellij.notification.Notification;
-import com.intellij.notification.NotificationAction;
-import com.intellij.notification.NotificationType;
-import com.intellij.notification.Notifications;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-/**
- * 通知框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-09-27
- */
-public class GenNotification {
-
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private GenNotification() {
- }
-
- /**
- * 无action 通知
- *
- * @param project projectid
- * @param content 提示内容
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- */
- public static void notifyMessage(@javax.annotation.Nullable Project project, String content, String title,
- NotificationType type) {
- notifyMessage(project, content, title, type, false);
- }
-
- /**
- * 消息通知
- *
- * @param project projectid
- * @param content 提示内容
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- * @param addAct 是否添加action
- */
- public static void notifyMessage(@javax.annotation.Nullable Project project, String content, String title,
- NotificationType type, boolean addAct) {
-
- Notification notification = new Notification("Generate.Result.Group", "Notes Message", content, type);
- notification.setTitle(title);
- notification.setContent(content);
-
- if (NotificationType.ERROR.equals(type)) {
- LOG.error(content);
- } else if (NotificationType.WARNING.equals(type)) {
- LOG.warn(content);
- } else {
- LOG.info(content);
- }
-
- if (addAct) {
- notification.setContent(null);
- addAction(project, content, notification);
- }
- Notifications.Bus.notify(notification, project);
-
- }
-
- private static void addAction(Project project, String dirPath, Notification notification) {
- File genResultPath = new File(dirPath);
- if (!genResultPath.exists()) {
- LOG.info(String.format("%s not exist", genResultPath.getPath()));
- }
- LOG.info("generated file list log:");
-
- File[] fa = genResultPath.listFiles();
- for (int i = 0; i < fa.length; i++) {
- File fs = fa[i];
- String fileName = fs.getName();
- boolean dissFile = !fileName.endsWith(".log") || !fileName.endsWith(".txt") || !fileName.endsWith(".ts");
- if (!fs.isDirectory() && dissFile) {
- String filePath = fs.getPath();
- NotificationAction action = new NotificationAction(filePath) {
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent,
- @NotNull Notification notification) {
- OpenFileAction.openFile(filePath, project);
- }
- };
- notification.addAction(action);
- } else {
- LOG.info(String.format("%s is Directory", fs.getPath()));
- }
- }
- }
-}
diff --git a/hdc/gn/gn_vs_plugin/README_zh.md b/hdc/gn/gn_vs_plugin/README_zh.md
deleted file mode 100755
index 90fe921ad85b0db17692ad17a3900eb18ce3af15..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/README_zh.md
+++ /dev/null
@@ -1,274 +0,0 @@
-# GN脚本生成工具VS code插件说明
-
-## 简介
-
-GN脚本生成工具,它可以根据用户给定三方库项目的CMakeLists.txt文件,转换生成BUILD.gn文件。目前工具支持可执行文件、VS Code插件两种入口,本文主要介绍VS Code插件使用说明。
-
-## 目录
-
- ├── gn # GN脚本生成工具
- │ ├── ... # 其他文件
- │ ├── gn_vs_plugin # VS Code插件代码
- │ │ ├── docs # VS Code插件说明
- │ │ ├── src # VS Code插件源码
- │ │ └── README_zh # VS Code插件说明
-
-## 约束
-
-系统:不限
-
-依赖版本:JDK 11
-
-开发工具:DevEco stdio、IDEA Community 2021.3.3
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-1)移植CMakeLists.txt编译方式的三方库到OpenHarmony源码中。
-
-### 工具使用
-
-插件下载路径如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/gn_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库的CMakeLists.txt文件,工具会输出对应的BUILD.gn文件。为了方便使用者快速上手工具,可供测试的三方库项目目录如下:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development$ ls
- 3rdparty BUGS.md ChangeLog cmake configs DartConfiguration.tcl docs include LICENSE programs scripts SUPPORT.md visualc BRANCHES.md ChangeLog.d CMakeLists.txt CONTRIBUTING.md dco.txt doxygen library Makefile README.md SECURITY.md tests
-
-在linux环境下的,根据输入三方库项目的CMakeLists.txt文件,生成的输出文件,如下所示:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development$ ls
- 3rdparty BUGS.md ChangeLog cmake configs DartConfiguration.tcl docs include LICENSE programs scripts SUPPORT.md visualc BRANCHES.md build_tmp ChangeLog.d CMakeLists.txt CONTRIBUTING.md dco.txt doxygen library Makefile README.md SECURITY.md tests
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development$ cd build_tmp/
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development/build_tmp$ ls
- 3rdparty BUILD.gn cmake CMakeCache.txt CMakeFiles cmake_install.cmake CTestTestfile.cmake DartConfiguration.tcl include library Makefile ohos.toolchain.cmake programs scripts tests
-
-其中生成的BUILD.gn文件,内容如下所示:
-
-```
-import("//build/ohos.gni")
-
-group("all_targets") {
- deps = [
- #静态库
- "//third_party/mbedtls-development/build_tmp/library:mbedcrypto",
- "//third_party/mbedtls-development/build_tmp/library:mbedx509",
- "//third_party/mbedtls-development/build_tmp/library:mbedtls",
-
- #可执行程序
- "//third_party/mbedtls-development/build_tmp/programs/aes:crypt_and_hash",
- "//third_party/mbedtls-development/build_tmp/programs/cipher:cipher_aead_demo",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_x509crl",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_x509csr",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_pubkey",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_pkcs7",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_privkey",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_client",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_dtlsserver",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_dtlsclient",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_x509crt",
- "//third_party/mbedtls-development/build_tmp/programs/fuzz:fuzz_server",
- "//third_party/mbedtls-development/build_tmp/programs/hash:generic_sum",
- "//third_party/mbedtls-development/build_tmp/programs/hash:hello",
- "//third_party/mbedtls-development/build_tmp/programs/hash:md_hmac_demo",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:mpi_demo",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:key_app",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_encrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:gen_key",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:ecdsa",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_encrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:dh_client",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:dh_server",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:dh_genprime",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:ecdh_curve25519",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_decrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_sign",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:key_app_writer",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:pk_verify",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_decrypt",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_genkey",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_sign",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_sign_pss",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_verify",
- "//third_party/mbedtls-development/build_tmp/programs/pkey:rsa_verify_pss",
- "//third_party/mbedtls-development/build_tmp/programs/psa:key_ladder_demo",
- "//third_party/mbedtls-development/build_tmp/programs/psa:crypto_examples",
- "//third_party/mbedtls-development/build_tmp/programs/psa:aead_demo",
- "//third_party/mbedtls-development/build_tmp/programs/psa:hmac_demo",
- "//third_party/mbedtls-development/build_tmp/programs/psa:psa_constant_names",
- "//third_party/mbedtls-development/build_tmp/programs/random:gen_entropy",
- "//third_party/mbedtls-development/build_tmp/programs/random:gen_random_ctr_drbg",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_pthread_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_client1",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_client2",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:mini_client",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:dtls_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:dtls_client",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_server2",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_context_info",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_fork_server",
- "//third_party/mbedtls-development/build_tmp/programs/ssl:ssl_mail_client",
- "//third_party/mbedtls-development/build_tmp/programs/test:selftest",
- "//third_party/mbedtls-development/build_tmp/programs/test:benchmark",
- "//third_party/mbedtls-development/build_tmp/programs/test:udp_proxy",
- "//third_party/mbedtls-development/build_tmp/programs/test:query_compile_time_config",
- "//third_party/mbedtls-development/build_tmp/programs/test:zeroize",
- "//third_party/mbedtls-development/build_tmp/programs/util:pem2der",
- "//third_party/mbedtls-development/build_tmp/programs/util:strerror",
- "//third_party/mbedtls-development/build_tmp/programs/x509:load_roots",
- "//third_party/mbedtls-development/build_tmp/programs/x509:cert_req",
- "//third_party/mbedtls-development/build_tmp/programs/x509:cert_write",
- "//third_party/mbedtls-development/build_tmp/programs/x509:crl_app",
- "//third_party/mbedtls-development/build_tmp/programs/x509:req_app",
- "//third_party/mbedtls-development/build_tmp/programs/x509:cert_app",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_x509write",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_x509parse",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_its",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_storage_format.current",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_timing",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ssl",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_rsa",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_entropy",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_shax",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.pr",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_dhm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecdsa",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.des",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_poly1305",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ctr_drbg",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.null",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.gcm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_storage_format.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ccm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.camellia",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_chachapoly",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_mdx",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_des",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.chacha20",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_chacha20",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aria",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_not_supported.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.padding",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.nist_kw",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.ofb",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.nopr",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.ecb",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hkdf",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.cfb",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.ccm",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs5",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.aes",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.rest",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cmac",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_camellia",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecdh",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_md",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.chachapoly",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_storage_format.v0",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_asn1parse",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_asn1write",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_base64",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod_raw.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_oid",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_core.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecjpake",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_core.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod_raw",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_random",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.cbc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pk",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_version",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_se_driver_hal_mocks",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_bignum_mod.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_debug",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs1_v21",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes128_de",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_cipher.aria",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes128_en",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes192_de",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.camellia",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes192_en",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes256_de",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.aes256_en",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_gcm.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_hmac_drbg.no_reseed",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_lms",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_mps",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_memory_buffer_alloc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_net",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_nist_kw",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_metadata",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkparse",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_hash",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pem",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs12",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_attributes",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_aes.xts",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_op_fail.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs1_v15",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkcs7",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_pkwrite",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_not_supported.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_driver_wrappers",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_entropy",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_generate_key.generated",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_init",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_op_fail.misc",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_error",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_pake",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_lmots",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_persistent_key",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_se_driver_hal",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_ecp",
- "//third_party/mbedtls-development/build_tmp/tests:test_suite_psa_crypto_slot_management",
-
- ]
-}
-```
-
-
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具VSCode插件的开发:
-
-[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/gn_vs_plugin/docs/DEVELOP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/docs/DEVELOP_ZH.md b/hdc/gn/gn_vs_plugin/docs/DEVELOP_ZH.md
deleted file mode 100755
index 7c69ea54c95ccc2c26c1f1a730c42258a426505b..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# GN脚本转换工具VSCode插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的VS Code插件。
-
-## VS Code插件打包说明
-
-### Linux
-
-1.将下载的gn-gen-linux可执行程序、res文件夹放置到napi_generator/hdc/gn/gn_vs_plugin/src/目录下,下载链接如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-2.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
- 每个选项都选择y,然后回车,最终会在当前目录下打包生成一个插件gn-0.0.1.vsix。结果如下:
-
- kaihong1@ubuntu:~/napi_generator_gjj/hdc/gn/gn_vs_plugin/src$ npx vsce package
- WARNING A 'repository' field is missing from the 'package.json' manifest file.
- Do you want to continue? [y/N] y
- WARNING Using '*' activation is usually a bad idea as it impacts performance.
- More info: https://code.visualstudio.com/api/references/activation-events#Start-up
- Do you want to continue? [y/N] y
- WARNING LICENSE.md, LICENSE.txt or LICENSE not found
- Do you want to continue? [y/N] y
- This extension consists of 3290 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: /home/kaihong1/napi_generator_gjj/hdc/gn/gn_vs_plugin/src/gn-0.0.1.vsix (3290 files, 38.93MB)
-
-### Windows
-
-1.将下载的gn-gen-win.exe可执行程序、res文件夹放置到napi_generator/hdc/gn/gn_vs_plugin/src/目录下,下载链接如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-2.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/gn/gn_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
- 每个选项都选择y,然后回车,最终会在当前目录下打包生成一个插件gn-0.0.1.vsix。结果如下:
-
- C:\napi_generator_GJJ\hdc\gn\gn_vs_plugin\src>npx vsce package
- WARNING A 'repository' field is missing from the 'package.json' manifest file.
- Do you want to continue? [y/N] y
- WARNING Using '*' activation is usually a bad idea as it impacts performance.
- More info: https://code.visualstudio.com/api/references/activation-events#Start-up
- Do you want to continue? [y/N] y
- WARNING LICENSE.md, LICENSE.txt or LICENSE not found
- Do you want to continue? [y/N] y
- This extension consists of 3290 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: C:\napi_generator_GJJ\hdc\gn\gn_vs_plugin\src\gn-0.0.1.vsix (3290 files, 36.01MB)
-
diff --git a/hdc/gn/gn_vs_plugin/docs/INSTRUCTION_ZH.md b/hdc/gn/gn_vs_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 803c3ccca2c52ad05e2ea6b969c2517aecfcd741..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,146 +0,0 @@
-# GN脚本转换工具使用说明
-
-## 简介
-
-gn脚本生成工具目前支持两种入口,分别是可执行程序、VS Code插件,推荐使用VS Code插件。可执行文件、VS Code插件下载路径如下:
-
-[下载链接](http://ftpkaihongdigi.i234.me:5000/fsdownload/1OjtRhtGf/gn-gen-0.0.1)
-
-下载文件说明如下:
-
- │ │ |── res # 工具所需make文件
- │ │ |── gn-0.0.1.vsix # VS Code插件
- │ │ |── gn-gen-linux # Linux可执行程序
- │ │ |── gn-gen-win.exe # Windows可执行程序
- │ │ └── gn-gen-macos # Mac可执行程序
-
-## 工具介绍
-
-通过gn-gen生成工具,使用者可以基于OpenHarmony源码、已有编译脚本(目前支持cmake、make两种类型),生成OpenHarmony编译所需BUILD.gn脚本,实现将三方库移植到OpenHarmony上。gn-gen生成工具的软件架构如下:
-
-
-
-## 使用工具生成gn脚本
-
-### VS Code插件使用方法
-
-#### 环境说明
-
-1、安装cmake,安装命令如下:
-
- sudo apt-get install cmake
-
-#### 生成ohos.toolchain.cmake
-
-1、Ubuntu中下载OpenHarmony源码,并编译成功一个产品的镜像包,此处以RK3568为例。源码如下所示:
-
-
-
-2、将待转换的三方库项目(路径:[三方库项目](https://gitee.com/openharmony/third_party_mbedtls))放置在third_party文件夹下,如下所示:
-
-
-
-3、打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-4、 在应用商店搜索gn-gen插件,再单击安装。
-
-
-
-5、 安装完成后就会在VS Code的插件管理器中能看到gn这个插件了。
-
-
-
-6、 选中任意文件或文件夹,点击右键,选择“Gn Generate Frame”选项。
-
-
-
-7、 Gn Generate Frame中参数填写完成之后,点击ok,如下所示:
-
-
-
-参数详情如下:
-
-工程输出路径:必填参数,ohos产品输出相对路径(例如:out/khdvk_rk3568_a);
-
-工程源码路径:必填参数,ohos项目路径(例如:/home/harmony/OpenHarmony);
-
-输入脚本路径:必选参数,待转换三方库cmake文件相对路径(例如:third_party/mbedtls-development/CMakeLists.txt);
-
-输入脚本类型: 可选参数,默认为cmake;
-
-GN生成路径: 可选参数,工具默认填写待转换三方库cmake文件所在文件夹相对路径,使用者可根据实际情况修改路径;
-
-子系统名称: 可选参数,默认填写“test_subsystem”,使用者可根据实际情况修改名称;
-
-组件名称:可选参数,工具默认填写“test_part”,使用者可根据实际情况修改名称;
-
-编译选项:可选参数,待转换三方库中引用其它三方库时需填写该选项,具体填写方法可参考FAQ中libpng转换时问题解决方法,详细FAQ内容可左键单击以下链接了解:[FAQ](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/FAQ.md);
-
-扩展文件类型:默认为否,部分三方库编译脚本需要支持的特殊文件类型,具体填写方法可参考FAQ中libpng转换时问题解决方法,详细FAQ内容可左键单击以下链接了解:[FAQ](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/FAQ.md);
-
-扩展编译选项:默认为否,部分三方库编译脚本需要支持的特殊编译选项,具体填写方法可参考FAQ中curl转换时步骤3解决方法,详细FAQ内容可左键单击以下链接了解:[FAQ](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/FAQ.md);
-
-8.运行完成后,进入/OpenHarmony/third_party/mbedtls-development/build_tmp目录下,查看是否存在ohos.toolchain.cmake文件,如下所示:
-
- harmony@Ubuntu-64:~/service/example$ cd /home/harmony/OpenHarmony/third_party/mbedtls-development/build_tmp/
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development/build_tmp$ ll -A
- 总用量 228
- drwxrwxr-x 3 harmony harmony 4096 12月 16 11:54 3rdparty/
- -rw-rw-r-- 1 harmony harmony 14658 12月 16 11:55 BUILD.gn
- drwxrwxr-x 2 harmony harmony 4096 12月 16 11:54 cmake/
- -rw-rw-r-- 1 harmony harmony 17144 12月 16 11:54 CMakeCache.txt
- drwxrwxr-x 10 harmony harmony 4096 12月 16 11:54 CMakeFiles/
- -rw-rw-r-- 1 harmony harmony 3879 12月 16 11:54 cmake_install.cmake
- -rw-rw-r-- 1 harmony harmony 432 12月 16 11:54 CTestTestfile.cmake
- -rwxr--r-- 1 harmony harmony 110 12月 16 11:54 DartConfiguration.tcl*
- drwxrwxr-x 3 harmony harmony 4096 12月 16 11:54 include/
- drwxrwxr-x 3 harmony harmony 4096 12月 16 11:55 library/
- -rw-rw-r-- 1 harmony harmony 122917 12月 16 11:54 Makefile
- -rw-rw-r-- 1 harmony harmony 1851 12月 16 11:54 ohos.toolchain.cmake
- drwxrwxr-x 14 harmony harmony 4096 12月 16 11:54 programs/
- lrwxrwxrwx 1 harmony harmony 65 12月 16 11:54 scripts -> /home/harmony/OpenHarmony/third_party/mbedtls-development/scripts/
- drwxrwxr-x 4 harmony harmony 20480 12月 16 11:55 tests/
-
-#### 运行make脚本
-
-1、若build_tmp下存在ohos.toolchain.cmake文件,在终端中进入build_tmp目录下,运行make,查看cmake环境是否可以正常使用,命令如下:
-
- harmony@Ubuntu-64:~/OpenHarmony/third_party/mbedtls-development/build_tmp$ cmake .. -DCMAKE_TOOLCHAIN_FILE=ohos.toolchain.cmake
- -- The C compiler identification is Clang 10.0.1
- -- Check for working C compiler: /home/harmony/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang
- -- Check for working C compiler: /home/harmony/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang -- works
- -- Detecting C compiler ABI info
- -- Detecting C compiler ABI info - done
- -- Detecting C compile features
- -- Detecting C compile features - done
- -- Configuring done
- -- Generating done
- -- Build files have been written to: /home/harmony/OpenHarmony/third_party/mbedtls-development/build_tmp
-
-根据以上日志可发现make运行成功,环境正常使用。若运行make失败,则根据报错信息修改,直到make运行成功,环境正常使用为止。
-
-#### 生成gn脚本
-
-1、 Gn Generate Frame中参数填写如下:
-
-
-
-具体参数填写参考生成ohos.toolchain.cmake中步骤7。
-
-2.运行成功后会在/OpenHarmony/third_party/mbedtls-development目录下生成build_tmp文件夹,build_tmp文件夹中包含BUILD.gn文件,如下所示:
-
-
-
-### 可执行程序使用方法
-
-具体可执行程序使用步骤,可以左键单击以下链接了解:
-
-[可执行程序使用说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/docs/INSTRUCTION_ZH.md)
-
-## 将三方库集成到OpenHarmony的方法
-
-具体的将三方库集成到OpenHarmony的步骤,可以左键单击以下链接了解:
-
-[将三方库集成到OpenHarmony的方法](https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn/docs/ENSEMBLE_METHOD_ZH.md)
diff --git a/hdc/gn/gn_vs_plugin/package.json b/hdc/gn/gn_vs_plugin/package.json
deleted file mode 100755
index 240c914a24592db83851c00f618f3ed909b6ea83..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/package.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "gn_vs_plugin",
- "version": "1.0.0",
- "description": "This tool can convert other compiled scripts (such as cmake, make, etc.) into gn scripts in the OpenHarmony project, or reverse the conversion.",
- "main": "index.js",
- "directories": {
- "doc": "docs"
- },
- "dependencies": {
- "mocha": "^9.2.1",
- "node-gyp": "^8.4.1",
- "stdio": "^2.1.1",
- "typescript": "^4.5.5"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git@gitee.com:joeysun001/napi_generator.git"
- },
- "author": "",
- "license": "ISC",
- "pkg": {
- "assets": [
- "src/node_modules/typescript/**/*"
- ]
- }
-}
diff --git a/hdc/gn/gn_vs_plugin/src/LICENSE b/hdc/gn/gn_vs_plugin/src/LICENSE
deleted file mode 100644
index 72f817fb44de8b9fd23fe71230b9dc5ccbe4ca35..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/src/README.md b/hdc/gn/gn_vs_plugin/src/README.md
deleted file mode 100644
index bd446472bff523f38bb6975230f36422689139af..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# gn-gen生成工具使用说明
-
-## 简介
-
-GN脚本生成工具,它可以根据用户给定三方库项目的CMakeLists.txt文件,转换生成BUILD.gn文件。
-
-## 约束
-
-visual studio code 版本需1.62.0及以上。
-
-## 操作简介
-
-1.安装VS Code插件。
-
-2.打开任意文件夹或文件,鼠标单击右键选择“Gn Generate Frame”插件。
-
-3.在窗口中填写相应参数。
-
-详细说明见[工具使用说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/gn/gn_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 合作共建
-
-[联系方式](https://www.kaihong.com/)
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/src/extension.js b/hdc/gn/gn_vs_plugin/src/extension.js
deleted file mode 100755
index 12c84ee9be7e26a97445f8893c08d6a1a7bb3830..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/extension.js
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// The module 'vscode' contains the VS Code extensibility API
-// Import the module and reference it with the alias vscode in your code below
-const vscode = require('vscode');
-const fs = require('fs');
-const re = require("./gen/tools/VsPluginRe");
-const { VsPluginLog } = require("./gen/tools/VsPluginLog");
-const { detectPlatform, readFile, writeFile } = require('./gen/tools/VsPluginTool');
-const path = require('path');
-const os = require('os');
-var exeFilePath = null;
-var flag = "";
-var isTrue = false;
-var globalPanel = null;
-
-var importToolChain = false;
-var extensionIds = [];
-var nextPluginId = null;
-// this method is called when your extension is activated
-// your extension is activated the very first time the command is executed
-
-/**
- * @param {vscode.ExtensionContext} context
- */
-function activate(context) {
- // Use the console to output diagnostic information (console.log) and errors (console.error)
- // This line of code will only be executed once when your extension is activated
- console.log('Congratulations, your extension "gn-gen" is now active!');
- let disposable = register(context, 'generate_gn');
- let disposableMenu = register(context, 'generate_gn_menu');
- context.subscriptions.push(disposable);
- context.subscriptions.push(disposableMenu);
- var platform = detectPlatform();
- if (platform == 'win') {
- exeFilePath = __dirname + "/gn-gen-win.exe";
- } else if (platform == 'mac') {
- exeFilePath = __dirname + "/gn-gen-macos";
- } else if (platform == 'Linux') {
- exeFilePath = __dirname + "/gn-gen-linux";
- }
- vscode.window.onDidChangeActiveColorTheme(colorTheme => {
- var result = {
- msg: "colorThemeChanged"
- }
- globalPanel.webview.postMessage(result);
- });
-}
-
-function gnexecutor(outputCodeDir, originCodeDir, inputScriptDir, scriptType, transplantDir,
- subsystemName, componentName, compileOptions) {
- var exec = require('child_process').exec;
- exec(genGnCommand(outputCodeDir, originCodeDir, inputScriptDir, scriptType, transplantDir,
- subsystemName, componentName, compileOptions),
- {
- maxBuffer: 1024 * 1024 * 20
- },
- function (error, stdout, stderr) {
- VsPluginLog.logInfo('VsPlugin: stdout =' + stdout + ", stderr =" + stderr);
- if (error || stdout.indexOf("generate gn ok") < 0) {
- console.log(error)
- vscode.window.showErrorMessage("genError:" + (error != null ? error : "") + stdout);
- return VsPluginLog.logError("VsPlugin:" + error + stdout);
- }
- vscode.window.showInformationMessage("Generated successfully");
- });
-}
-
-function genGnCommand(outputCodeDir, originCodeDir, inputScriptDir, scriptType,
- transplantDir, subsystemName, componentName, compileOptions) {
- var command = exeFilePath + " -o " + outputCodeDir + " -p " + originCodeDir + " -f " + inputScriptDir
- + " -t " + scriptType + " -s " + subsystemName + " -m " + componentName + " -d " + transplantDir;
- if (compileOptions != "") {
- command += " -a " + "\"" + compileOptions + "\"";
- }
-
- command = re.replaceAll(command, '\\\\', '/');
-
- console.log("command = " + command)
- return command;
-}
-
-/**
- * 将插件界面读取的扩展配置更新到cfg.json文件中
- * @param extFile 用户自定义的支持文件类型
- * @param extFlag 用户自定义的支持编译选项
- */
-function refreshJsonCfg(extFile, extFlag) {
- let cfgFilePath = __dirname + '/res/cfg.json';
- let jsonCfg = readFile(cfgFilePath);
- let cfgObj = JSON.parse(jsonCfg.toString());
- cfgObj.fileSuffix = extFile;
- cfgObj.compileflag = extFlag;
- let cfgStr = JSON.stringify(cfgObj);
- writeFile(cfgFilePath, cfgStr);
-}
-
-function exeFileExit() {
- if (fs.existsSync(exeFilePath)) {
- return true;
- }
- return false;
-}
-
-function register(context, command) {
- let disposable = vscode.commands.registerCommand(command, function (uri, boolValue, items) {
- // The code you place here will be executed every time your command is executed
- // Display a message box to the user
- globalPanel = vscode.window.createWebviewPanel(
- 'generate', // Identifies the type of WebView
- 'Gn Generate Frame', // Title of the panel displayed to the user
- vscode.ViewColumn.Two, // Display the WebView panel in the form of new columns in the editor
- {
- enableScripts: true, // Enable or disable JS, default is Enable
- retainContextWhenHidden: true, // Keep the WebView state when it is hidden to avoid being reset
- }
- );
- if (typeof(boolValue) == 'boolean' && Array.isArray(items)) {
- if (boolValue == true) {
- //遍历数组item,查看当前插件id是数组的第几个元素,并拿出下一个元素,并判断当前id是否是最后一个元素并做相应处理
- let myExtensionId = 'kaihong.gn-gen';
- for (let i = 0; i < items.length; i++) {
- if (myExtensionId == items[i] && (i == items.length - 1)) {
- importToolChain = false;
- } else if (myExtensionId == items[i] && (i != items.length - 1)) {
- importToolChain = boolValue;
- nextPluginId = items[i + 1];
- }
- extensionIds.push(items[i]);
- }
- }
- }
- globalPanel.webview.html = getWebviewContent(context, importToolChain);
- let msg;
- globalPanel.webview.onDidReceiveMessage(message => {
- msg = message.msg;
- if (msg == "cancel") {
- globalPanel.dispose();
- } else if(msg == "gn") {
- checkReceiveMsg(message);
- } else {
- selectPath(globalPanel, message);
- }
- }, undefined, context.subscriptions);
- // 路径有效性判断
- if (uri.fsPath !== undefined) {
- let fn = re.getFileInPath(uri.fsPath);
- let tt = re.match("([a-zA-Z_0-9]+.[a-zA-Z_0-9])", fn);
- var result = {
- msg: "selectinputScriptDir",
- path: tt ? uri.fsPath : ""
- }
- globalPanel.webview.postMessage(result);
- }
- });
- return disposable;
-}
-
-function checkReceiveMsg(message) {
- let outputCodeDir = message.outputCodeDir;
- let originCodeDir = message.originCodeDir;
- let inputScriptDir = message.inputScriptDir;
- let scriptType = message.scriptType;
- let transplantDir = message.transplantDir;
- let subsystemName = message.subsystemName;
- let componentName = message.componentName;
- let compileOptions = message.compileOptions;
- let buttonName = message.buttonName;
-
- refreshJsonCfg(message.extFile, message.extFlag);
- checkMode(outputCodeDir, originCodeDir, inputScriptDir, scriptType,
- transplantDir, subsystemName, componentName, compileOptions);
-
- if (buttonName == 'Next') {
- startNextPlugin();
- }
-}
-
-/**
-* 获取插件执行命令
-*/
-function nextPluginExeCommand(nextPluginId) {
- if (nextPluginId == "kaihong.ApiScan") {
- return 'api_scan';
- } else if (nextPluginId == "kaihong.gn-gen") {
- return 'generate_gn';
- } else if (nextPluginId == "kaihong.service-gen") {
- return 'generate_service';
- } else if (nextPluginId == "kaihong.ts-gen") {
- return 'generate_ts';
- } else if (nextPluginId == "kaihong.napi-gen") {
- return 'generate_napi';
- } else {
- return null;
- }
-}
-
-/**
-* 执行完毕后开启工具链中下一个插件
-*/
-function startNextPlugin() {
- const extension = vscode.extensions.getExtension(nextPluginId);
- if (extension) {
- let startNextPlugin = nextPluginExeCommand(nextPluginId);
- try {
- vscode.commands.executeCommand(startNextPlugin, '', importToolChain, extensionIds);
- } catch (error) {
- console.error(error);
- }
- }
-}
-
-/**
-* 选择本地目录/文件夹
-*/
- function selectPath(panel, message) {
- let mode = 1;
- if (message.mode != undefined) {
- mode = message.mode;
- }
- flag = flag == "" ? '' : flag;
- const options = {
- canSelectMany: false,//是否可以选择多个
- canSelectFiles: mode == 0 ? true : false,//是否选择文件
- canSelectFolders: mode == 0 ? false : true,//是否选择文件夹
- defaultUri:vscode.Uri.file(flag),//默认打开本地路径
- filters: {
- 'All files': ['*']
- }
- };
-
- return vscode.window.showOpenDialog(options).then(fileUri => {
- if (fileUri && fileUri[0]) {
- console.log('Selected file: ' + fileUri[0].fsPath);
- var filePath = "";
- filePath = fileUri[0].fsPath.concat(',');
- filePath = re.replaceAll(filePath, '\\\\', '/');
- if (filePath.substring(1,2) == ":") {
- let filePathTemp = filePath.substring(0,1).toUpperCase()
- filePath = filePathTemp + filePath.substring(1,filePath.length)
- }
- var result = {
- msg: message.msg,
- path: filePath.length > 0 ? filePath.substring(0, filePath.length - 1) : filePath
- }
- console.log('message.msg: ' + message.msg);
- if (!isTrue && message.msg == "selectoutputCodeDir"){
- flag = filePath.substring(0, filePath.length - 1);
- let fileTempName = "out";
- let pos = flag.indexOf(fileTempName);
- flag = flag.substr(0,pos-1);
- isTrue = true;
- }
- panel.webview.postMessage(result);
- return fileUri[0].fsPath
- }
- });
-}
-
-function checkMode(outputCodeDir, originCodeDir, inputScriptDir, scriptType,
- transplantDir, subsystemName, componentName, compileOptions) {
- outputCodeDir = re.replaceAll(outputCodeDir, " ", "");
- if ("" == outputCodeDir) {
- vscode.window.showErrorMessage("Please enter the outputCodeDir path!");
- return;
- }
- originCodeDir = re.replaceAll(originCodeDir, " ", "");
- if ("" == originCodeDir) {
- vscode.window.showErrorMessage("Please enter the originCodeDir path!");
- return;
- }
- inputScriptDir = re.replaceAll(inputScriptDir, " ", "");
- if ("" == inputScriptDir) {
- vscode.window.showErrorMessage("Please enter the inputScriptDir path!");
- return;
- }
- if (inputScriptDir.indexOf(".") < 0) {
- vscode.window.showErrorMessage("Please enter the correct file path!");
- return;
- }
- transplantDir = re.replaceAll(transplantDir, " ", "");
- if ("" == transplantDir) {
- vscode.window.showErrorMessage("Please enter the transplantDir path!");
- return;
- }
- subsystemName = re.replaceAll(subsystemName, " ", "");
- if ("" == subsystemName) {
- vscode.window.showErrorMessage("Please enter the subsystemName!");
- return;
- }
- componentName = re.replaceAll(componentName, " ", "");
- if ("" == componentName) {
- vscode.window.showErrorMessage("Please enter the componentName!");
- return;
- }
- if (exeFileExit()) {
- gnexecutor(outputCodeDir, originCodeDir, inputScriptDir, scriptType,
- transplantDir, subsystemName, componentName, compileOptions);
- } else {
- vscode.window.showInformationMessage("Copy executable program to " + __dirname);
- }
-}
-
-// this method is called when your extension is deactivated
-function deactivate() { }
-
-function getWebviewContent(context, importToolChain) {
- let data = readFile(__dirname + '/vs_plugin_view.html');
- data = getWebViewContent(context, '/vs_plugin_view.html');
- let content = data.toString();
- if (importToolChain) {
- content = content.replace('Ok', 'Next');
- }
- return content;
-}
-
-function getWebViewContent(context, templatePath) {
- const reoriginCodeDir = path.join(context.extensionPath, templatePath);
- const dirPath = path.dirname(reoriginCodeDir);
- let html = fs.readFileSync(reoriginCodeDir, 'utf-8');
- html = html.replace(/( {
- if ($2.indexOf("https://") < 0) {
- return $1 + globalPanel.webview.asWebviewUri(vscode.Uri.file(path.resolve(dirPath, $2))) + '"';
- } else {
- return $1 + $2+'"';
- }
- });
- return html;
-}
-
-module.exports = {
- activate,
- deactivate
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginLog.js b/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginLog.js
deleted file mode 100755
index 6ce4e7e3b09ec80708e81e93c2ffd3261a60f2a4..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginLog.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-
-class VsPluginLog {
- constructor() {
- }
-}
-VsPluginLog.LEV_NONE = 0;
-VsPluginLog.LEV_ERROR = 1;
-VsPluginLog.LEV_DEBUG = 2;
-VsPluginLog.LEV_INFO = 3;
-
-const LEV_STR = ["[NON]", "[ERR]", "[DBG]", "[INF]"]
-var logLevel = VsPluginLog.LEV_ERROR;
-var logFileName = null;
-var logResultMessage = [true, ""]
-
-function getDateString() {
- let nowDate = new Date();
- return nowDate.toLocaleString();
-}
-
-function saveLog(dateStr, levStr, detail) {
- if (logFileName) {
- let logStr = dateStr + " " + levStr + " " + detail + "\n";
- fs.appendFileSync(logFileName, logStr);
- }
-}
-
-VsPluginLog.init = function (level, fileName) {
- logLevel = level in [VsPluginLog.LEV_NONE, VsPluginLog.LEV_ERROR, VsPluginLog.LEV_DEBUG, VsPluginLog.LEV_INFO]
- ? level : VsPluginLog.LEV_ERROR;
- logFileName = fileName ? fileName : "napi_generator.log";
-}
-
-function recordLog(lev, ...args) {
- let dataStr = getDateString();
- let detail = args.join(" ");
- saveLog(dataStr, LEV_STR[lev], detail);
- if (lev == VsPluginLog.LEV_ERROR) {
- logResultMessage = [false, detail];
- }
- if (logLevel < lev) return;
- VsPluginLog.logInfo(dataStr + LEV_STR[lev] + detail);
-}
-
-VsPluginLog.logError = function (...args) {
- recordLog(VsPluginLog.LEV_ERROR, args);
-}
-
-VsPluginLog.logDebug = function (...args) {
- recordLog(VsPluginLog.LEV_DEBUG, args);
-}
-
-VsPluginLog.logInfo = function (...args) {
- recordLog(VsPluginLog.LEV_INFO, args);
-}
-
-VsPluginLog.getResult = function () {
- return logResultMessage;
-}
-
-module.exports = {
- VsPluginLog
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginRe.js b/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginRe.js
deleted file mode 100755
index 909d7d54ea6331ab45c2fd58ea20f2444b66f254..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginRe.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-
-function search(ss, data) {
- ss = replaceAll(ss, "\\.", "\\.")
- let reg = new RegExp(ss);
- let tt = reg.exec(data);
- if (tt == null) return null;
- let ret = { "regs": [] }
- for (let i = 0; i < tt.length; i++) {
- let p = data.indexOf(tt[i]);
- if (tt[i] == null) {
- ret["regs"].push([-1, -1])
- }
- else {
- ret["regs"].push([p, p + tt[i].length])
- }
- }
-
- return ret;
-}
-
-function match(ss, data) {
- let tt = search(ss, data)
- if (tt != null && tt.regs[0][0] == 0) return tt;
- return null;
-}
-
-function getFileInPath(tpath) {
- return path.parse(tpath).base;
-}
-
-function getPathInPath(tpath) {
- return path.parse(tpath).dir;
-}
-
-function all(sfrom) {
- return new RegExp(sfrom, "g");
-}
-
-function replaceAll(ss, sfrom, sto) {
- return ss.replace(all(sfrom), sto)
-}
-
-module.exports = {
- search,
- match,
- getFileInPath,
- getPathInPath,
- replaceAll,
- all
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginTool.js b/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginTool.js
deleted file mode 100755
index 9ef3631e195e0a916011004960b07e5a7bd6d11a..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/gen/tools/VsPluginTool.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const os = require('os');
-const tsc = require("../../node_modules/typescript");
-const fs = require('fs');
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-function replaceAll(s, sfrom, sto) {
- while (s.indexOf(sfrom) >= 0) {
- s = s.replace(sfrom, sto)
- }
- return s;
-}
-
-function detectPlatform() {
- if (os.type() == 'Windows_NT') {
- return 'win';
- } else if (os.type() == 'Darwin') {
- return 'mac';
- } else if (os.type() == 'Linux') {
- return 'Linux';
- }
-}
-
-function checkFileError(ifname) {
- let program = tsc.createProgram([ifname], {})
- let emitResult = program.emit();
- let allDiagnostics = tsc.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
-
- let errorMsg = ''
- allDiagnostics.forEach(diagnostic => {
- if (diagnostic.file) {
- let { line, character } = tsc.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
- let message = tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
- errorMsg += `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}\n`;
- } else {
- errorMsg += tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + "\n";
- }
- });
-
- if (allDiagnostics.length > 0) {
- return [false, errorMsg];
- }
- return [true, ""];
-}
-
-function utf8ArrayToStr(array) {
- var out, i, len, c;
- var char2, char3;
-
- out = "";
- len = array.length;
- i = 0;
- while (i < len) {
- c = array[i++];
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- out += String.fromCharCode(c);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- char2 = array[i++];
- out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- char2 = array[i++];
- char3 = array[i++];
- out += String.fromCharCode(((c & 0x0F) << 12) |
- ((char2 & 0x3F) << 6) |
- ((char3 & 0x3F) << 0));
- break;
- }
- }
-
- return out;
- }
-
- function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
- }
-
- function writeFile(fn, content) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- fs.writeFileSync(fn, content);
- }
-
-module.exports = {
- replaceAll,
- detectPlatform,
- checkFileError,
- readFile,
- writeFile
-}
\ No newline at end of file
diff --git a/hdc/gn/gn_vs_plugin/src/images/file.png b/hdc/gn/gn_vs_plugin/src/images/file.png
deleted file mode 100755
index f5c365a02e99414acb29c643fc2d64d150cff9f0..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_vs_plugin/src/images/file.png and /dev/null differ
diff --git a/hdc/gn/gn_vs_plugin/src/images/file_black.png b/hdc/gn/gn_vs_plugin/src/images/file_black.png
deleted file mode 100644
index fd54e8a66190cee967d71270a1375952c59c4ccb..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_vs_plugin/src/images/file_black.png and /dev/null differ
diff --git a/hdc/gn/gn_vs_plugin/src/images/gn.png b/hdc/gn/gn_vs_plugin/src/images/gn.png
deleted file mode 100644
index f6de4ec07083b9c62d7ac27caaf68b0ef159a56e..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_vs_plugin/src/images/gn.png and /dev/null differ
diff --git a/hdc/gn/gn_vs_plugin/src/images/path.png b/hdc/gn/gn_vs_plugin/src/images/path.png
deleted file mode 100755
index 56f408a584f243956fab1916d9152f34364cdf78..0000000000000000000000000000000000000000
Binary files a/hdc/gn/gn_vs_plugin/src/images/path.png and /dev/null differ
diff --git a/hdc/gn/gn_vs_plugin/src/jsconfig.json b/hdc/gn/gn_vs_plugin/src/jsconfig.json
deleted file mode 100755
index 53b981c57b79a7a2dac9995ee4ce04b8c94e0b17..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/jsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "ES2020",
- "checkJs": true, /* Typecheck .js files. */
- "lib": [
- "ES2020"
- ]
- },
- "exclude": [
- "node_modules"
- ]
-}
diff --git a/hdc/gn/gn_vs_plugin/src/package.json b/hdc/gn/gn_vs_plugin/src/package.json
deleted file mode 100755
index e235f9a061ffca601b5c4e1c71ee148260602982..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/package.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "name": "gn-gen",
- "displayName": "gn-gen",
- "description": "gn generate tool",
- "version": "0.0.2",
- "keywords": [
- "gn",
- "gn-gen"
- ],
- "icon": "images/gn.png",
- "engines": {
- "vscode": "^1.62.0"
- },
- "categories": [
- "Other"
- ],
- "activationEvents": [
- "onStartupFinished"
- ],
- "main": "./extension.js",
- "publisher": "kaihong",
- "contributes": {
- "commands": [
- {
- "command": "generate_gn",
- "title": "Gn Generate Frame"
- },
- {
- "command": "generate_gn_menu",
- "title": "Gn Generate Frame"
- }
- ],
- "menus": {
- "explorer/context": [
- {
- "when": "resourceScheme == file",
- "command": "generate_gn"
- }
- ],
- "editor/context": [
- {
- "command": "generate_gn_menu"
- }
- ]
- }
- },
- "scripts": {
- "lint": "eslint .",
- "pretest": "npm run lint",
- "test": "node ./test/runTest.js"
- },
- "devDependencies": {
- "@types/glob": "^7.1.4",
- "@types/mocha": "^9.0.0",
- "@types/node": "14.x",
- "@types/vscode": "^1.62.0",
- "@vscode/test-electron": "^1.6.2",
- "eslint": "^8.1.0",
- "glob": "^7.1.7",
- "mocha": "^9.1.3",
- "webpack": "^5.64.4",
- "webpack-cli": "^4.9.1"
- },
- "dependencies": {
- "compressing": "^1.5.1",
- "node-gyp": "^9.0.0",
- "stdio": "^2.1.1",
- "typescript": "^4.8.4",
- "vsce": "^2.11.0"
- },
- "repository": {
- "type": "gitee",
- "url": "https://gitee.com/openharmony/napi_generator/tree/master/hdc/gn"
- }
-}
diff --git a/hdc/gn/gn_vs_plugin/src/vs_plugin_view.html b/hdc/gn/gn_vs_plugin/src/vs_plugin_view.html
deleted file mode 100755
index fb81998960d18c96e6dd1037a315bd64e732572d..0000000000000000000000000000000000000000
--- a/hdc/gn/gn_vs_plugin/src/vs_plugin_view.html
+++ /dev/null
@@ -1,448 +0,0 @@
-
-
-
-
-
- Napi
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/invalid_docs/api/README_ZH.md b/hdc/invalid_docs/api/README_ZH.md
deleted file mode 100644
index 0b9d1b1baac87842d3814fdd44862c56847c805d..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/api/README_ZH.md
+++ /dev/null
@@ -1,93 +0,0 @@
-# API扫描工具
-
-## 简介
-
-本文主要介绍API扫描工具,它可以扫描三方库中包含OpenHarmony源码不包含的接口,并输出result.xlsx文档。开发者移植三方库到OpenHarmony源码中,若三方库中包含一些OpenHarmony中不存在的接口,便会增加移植难度。此时可使用API扫描工具,提前预知风险接口,降低移植难度,提高开发效率。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口。
-
-更多工具的架构和实现原理详情,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/docs/INSTRUCTION_ZH.md)
-
- ├── napi_generator # NAPI框架代码生成工具
- │ ├── ... # 其他文档
- │ ├── hdc
- │ │ ├── ... # 其他工具
- │ │ ├── api # api扫描工具
- │ │ | ├── api_scan_vs_plugin # VS Code插件源码
- │ │ | ├── api_scan_IntelliJ_plugin # Intellij插件源码
- │ │ | ├── src # 工具源码
- │ │ | | ├── scan.js # 工具源码入口
- │ │ | | ├── package.json # package.json文件
-
-## 约束
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-移植三方库到OpenHarmony前预知风险接口。
-
-### 工具使用
-
-工具有三种类型,分别是可执行文件、VS Code插件、IntelliJ插件。其中的可执行文件可根据工具使用者的开发环境选择,支持Windows,Linux和Mac。可执行文件、IntelliJ插件、VS Code插件下载路径如下:
-
-待增加链接
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库项目源码,工具会输出风险接口。为了方便使用者快速上手工具,此处使用opencv项目为例,项目目录如下:
-
-
-
-在window环境下的,根据输入三方库项目,生成的输出文件result.xlsx,如下所示:
-
-
-
-其中生成的result.xlsx文件,风险接口如下所示:
-
-
-
-
-
-## 工具开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/docs/DEVELOP_ZH.md)
-
-## 版本说明
-
-暂无
-
-## FAQ
-
- [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/FAQ.md)
-
-## 参与贡献
-
-暂无
-
-## 相关仓
-
-暂无
diff --git a/hdc/invalid_docs/api/docs/DEVELOP_ZH.md b/hdc/invalid_docs/api/docs/DEVELOP_ZH.md
deleted file mode 100644
index 204033ffd698efddcc12decc55414fbcab77ecd2..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/api/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# API扫描工具开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的可执行文件和插件。
-
-## 工具开发
-
-### 可执行文件开发说明
-
-#### 环境说明
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-#### 开发步骤
-
-##### Linux
-1.下载Andr_N_Games_api.xlsx文件,并放置在napi_generator/hdc/api/src文件夹下,下载链接如下:
-
-待增加链接
-
-2.安装typescript:在napi_generator/hdc/api/src目录下执行命令:
-
- npm i typescript
-
-3.安装stdio:在napi_generator/hdc/api/src目录下执行命令:
-
- npm i stdio
-
-4.安装pkg : 在napi_generator/hdc/api/src目录下执行命令:
-
- sudo npm i -g pkg
-
-5.打包三个版本 : 在napi_generator/hdc/api/src目录下执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/api/src目录下生成Windows、linux、mac系统下的可执行程序:
-
- search-win.exe、search-linux、search-macos
-
-6.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o search-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o search-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o search-macos
-
-备注:参数-t为指定系统,参数-o为指定可执行文件名称。
-
-
-##### Windows
-
-1.下载Andr_N_Games_api.xlsx文件,并放置在napi_generator/hdc/api/src文件夹下,下载链接如下:
-
-待增加链接
-
-2.使用管理员身份进入终端:
-
-
-
-3.安装typescript:使用管理员身份在napi_generator/hdc/api/src目录下执行命令:
-
- npm i typescript
-
-4.安装stdio:使用管理员身份在napi_generator/hdc/api/src目录下执行命令:
-
- npm i stdio
-
-5.安装pkg : 使用管理员身份在napi_generator/hdc/api/src目录下执行命令:
-
- npm i -g pkg
-
-6.打包三个版本 : 使用管理员身份在napi_generator/hdc/api/src目录下执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/api目录下生成Windows、linux、mac系统下的可执行程序:
-
- search-win.exe、search-linux、search-macos
-
-7.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o search-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o search-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o search-macos
-
-### VS插件开发说明
-
-具体的插件开发步骤,可以左键单击以下链接了解:
-
-[VS插件开发说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/api/api_scan_vs_plugin/docs/DEVELOP_ZH.md)
-
-### IntelliJ插件开发说明
-
-具体的插件开发步骤,可以左键单击以下链接了解:
-
-[IntelliJ插件开发说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/api/api_scan_IntelliJ_plugin/docs/DEVELOP_ZH.md)
-
diff --git a/hdc/invalid_docs/api/docs/INSTRUCTION_ZH.md b/hdc/invalid_docs/api/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index 6c4206d5043c3016de285b7ebe0567324644d5cf..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/api/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# API扫描工具使用说明
-## 简介
-
-API扫描工具支持三种入口,分别是可执行程序、VS Code插件、IntelliJ插件,使用者可以根据自己的需要选择合适的工具。可执行文件、IntelliJ插件、VS Code插件下载路径如下:
-
-待增加链接
-
-下载文件说明如下:
-
- │ │ |── api_scan_IntelliJ_plugin.jar # IntelliJ插件
- │ │ |── ApiScan-0.0.1.vsix # VS Code插件
- │ │ |── Andr_N_Games_api.xlsx # 风险接口
- │ │ |── search-linux # Linux可执行程序
- │ │ |── search-win.exe # Windows可执行程序
- │ │ └── search-macos # Mac可执行程序
-
-## 工具介绍
-
-通过API扫描工具,开发者可以扫描输出三方库中存在,而OpenHarmony源码中不存在的风险接口,移植之前预知风险,降低移植难度,提高开发效率。
-
-
-
-## 生成result文件
-
-### 可执行程序使用方法
-
-#### Linux
-1、Ubuntu中存在将要扫描的三方库源码,如下所示:
-
- harmony@Ubuntu-64:~/service$ ls /home/harmony/linshi/
- opencv
-
-2、将下载的search-linux可执行程序放置任意路径下,如下所示:
-
- harmony@Ubuntu-64:~/service$ ls
- search-linux
-
-3、进入到search-linux可执行程序路径下,并执行可执行程序,执行命令如下:
-
- harmony@Ubuntu-64:~/service$ ./search-linux -d /home/harmony/linshi/opencv/ -o ./
- {
- function: Set(70) {
- 'AndroidBitmap_getInfo',
- ......
- 'ANativeWindow_release'
- },
- include: Set(3) { 'bitmap.h', 'input.h', 'log.h' }
- }
- output: result.xlsx
- harmony@Ubuntu-64:~/service/napi_generator_8/hdc/api/API-Scan/example$
-
-其中,参数详情如下:
- -d, 被扫描项目的路径;
- -o, 可选参数,默认为当前路径下,输出结果存放路径。
-
-4、运行成功后会在当前目录下生成result.xlsx文件,如下所示:
-
- harmony@Ubuntu-64:~/service$ ls
- result.xlsx search-linux
-
-#### Windows
-
-1、E:\workspace\杂七杂八\service\目录下存在将要扫描的项目opencv。
-
-2、将下载的search-win.exe可执行程序放置任意路径下,如下所示:
-
- E:\demo\api>dir /B
- search-win.exe
-
-3、进入search-win.exe可执行程序路径下,并执行可执行程序,执行过程如下:
-
- E:\demo\api>search-win.exe -d E:\workspace\杂七杂八\service\opencv -o ./
- {
- function: Set(70) {
- 'AndroidBitmap_getInfo',
- ......
- 'ANativeWindow_release'
- },
- include: Set(3) { 'bitmap.h', 'input.h', 'log.h' }
- }
- output: result.xlsx
-
-其中,参数详情如下:
- -d, 被扫描项目的路径
- -o, 可选参数,默认为当前路径下,输出结果存放路径。
-
-4、运行成功后会在当前目录下生成result.xlsx文件,如下所示:
-
- E:\demo\api>dir /B
- result.xlsx
- search-win.exe
-
-#### Mac
-
-方法步骤参考windows、Linux的使用方法。
-
-### VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[VS插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### IntelliJ插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[IntelliJ插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_IntelliJ_plugin/docs/INSTRUCTION_ZH.md)
-
diff --git a/hdc/invalid_docs/api/vs/README_zh.md b/hdc/invalid_docs/api/vs/README_zh.md
deleted file mode 100644
index b0546948484c55aa4dfc4eabee5bc18dd75cbdaa..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/api/vs/README_zh.md
+++ /dev/null
@@ -1,85 +0,0 @@
-# API扫描工具VS code插件说明
-
-## 简介
-
-API扫描工具,它可以根据用户给定三方库项目扫描输出风险接口以及.h头文件。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口,本文主要介绍VS Code插件使用说明。
-
-## 目录
-
- ├── api # API扫描工具
- │ ├── ... # 其他文件
- │ ├── api_scan_vs_plugin # VS Code插件代码
- │ │ ├── docs # VS Code插件说明
- │ │ ├── src # VS Code插件源码
- │ │ ├── package.json # package.json 文件
- │ │ └── README_zh.md # VS Code插件说明
-
-## 约束
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-1)移植三方库到OpenHarmony前预知风险接口或.h头文件。
-
-### 工具使用
-
-插件下载路径如下:
-
-待增加链接
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定三方库项目源码,工具会输出风险接口、.h头文件。为了方便使用者快速上手工具,此处使用opencv项目为例,项目目录如下:
-
-
-
-在window环境下的,根据输入三方库项目,生成的输出文件result.xlsx,如下所示:
-
-
-
-其中生成的result.xlsx文件,sheet1为风险接口,如下所示:
-
-
-
-sheet2为风险.h头文件,如下所示:
-
-
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具VS Code插件的开发:
-
-[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/api_scan_vs_plugin/docs/DEVELOP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/api/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/invalid_docs/api/vs/docs/DEVELOP_ZH.md b/hdc/invalid_docs/api/vs/docs/DEVELOP_ZH.md
deleted file mode 100644
index 79c41e5bcf0ebba9a36eb737a213ef77cdacb03d..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/api/vs/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# API扫描工具VSCode插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的VS Code插件。
-
-## VS Code插件打包说明
-
-### Linux
-
-1.下载search-linux可执行程序,并放置在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下,下载链接如下:
-
-待增加链接
-
-2.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npx vsce package
-
- 每个选项都选择y,然后回车,最终会在当前目录下打包生成一个插件ApiScan-0.0.1.vsix。结果如下:
-
- kaihong1@ubuntu:~/napi_generator_gjj/hdc/api/api_scan_vs_plugin/src$ npx vsce package
- WARNING A 'repository' field is missing from the 'package.json' manifest file.
- Do you want to continue? [y/N] y
- WARNING Using '*' activation is usually a bad idea as it impacts performance.
- More info: https://code.visualstudio.com/api/references/activation-events#Start-up
- Do you want to continue? [y/N] y
- WARNING LICENSE.md, LICENSE.txt or LICENSE not found
- Do you want to continue? [y/N] y
- This extension consists of 3282 files, out of which 1547 are JavaScript files. For performance reasons, you shoude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: /home/kaihong1/napi_generator_gjj/hdc/api/api_scan_vs_plugin/src/ApiScan-0.0.1.vsix (3282 files, 50.34MB)
-
-
-### Windows
-
-1.下载search-win.exe可执行程序,并放置在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下,下载链接如下:
-
-待增加链接
-
-2.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/api/api_scan_vs_plugin/src/目录下执行命令:
-
- npx vsce package
-
- 每个选项都选择y,然后回车,最终会在当前目录下打包生成一个插件ApiScan-0.0.1.vsix。结果如下:
-
- C:\napi_generator_GJJ\hdc\api\api_scan_vs_plugin\src>npx vsce package
- WARNING A 'repository' field is missing from the 'package.json' manifest file.
- Do you want to continue? [y/N] y
- WARNING Using '*' activation is usually a bad idea as it impacts performance.
- More info: https://code.visualstudio.com/api/references/activation-events#Start-up
- Do you want to continue? [y/N] y
- WARNING LICENSE.md, LICENSE.txt or LICENSE not found
- Do you want to continue? [y/N] y
- This extension consists of 3282 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: C:\napi_generator_GJJ\hdc\api\api_scan_vs_plugin\src\ApiScan-0.0.1.vsix (3282 files, 47.42MB)
-
diff --git a/hdc/invalid_docs/api/vs/docs/INSTRUCTION_ZH.md b/hdc/invalid_docs/api/vs/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index 22a9c3a5011407cc59bcb12fedd695948db690b8..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/api/vs/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# API扫描工具VSCode插件使用说明
-## 简介
-
-API扫描工具目前支持三种入口,分别是可执行程序、IntelliJ插件、VS Code插件,本文主要介绍VS Code插件使用说明。VS Code插件下载路径如下:
-
-待增加链接
-
-## VS Code插件使用方法
-
-### 说明
-
-visual studio code 版本需1.62.0及以上。
-
-### 步骤
-
-1、 打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-2、 在应用商店搜索api_scan插件,再单击安装。
-
-
-
-3、 安装完成后就会在VS Code的插件管理器中能看到API Scan这个插件了。
-
-
-
-4、 选中任意文件或文件夹,单击右键,选择API Scan选项。
-
-
-
-5、 工具打开API Scan窗口,扫描项目路径框填写将要扫描项目的绝对路径,结果输出路径框自动填写与扫描项目相同路径,使用者可以根据实际情况修改结果输出路径,然后点击ok。
-
-
-
-6、执行结束后会在结果输出路径下生成result.xlsx文件。
diff --git a/hdc/invalid_docs/service/README_ZH.md b/hdc/invalid_docs/service/README_ZH.md
deleted file mode 100644
index 02bbe17441614b2a1e6212589f6d53280bc286e1..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/service/README_ZH.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# SERVICE框架生成工具
-
-## 简介
-
-当开发者为OpenHarmony系统框架开发某些功能时,有时需要将这个功能包装成一个独立的服务进程运行在系统中,为了其它应用进程能够调用此服务,开发人员需要基于系统IPC通信框架编写一套远程接口调用实现。实现Service远程调用接口需要开发人员熟悉IPC通信框架,了解proxy/stub的继承与实现方式,掌握C++类型转为MessageParcel数据包的各种API方法,有一定的学习成本。而Service代码生成工具能够帮助使用者生成框架代码,提升开发效率。用户只需提供一个定义远程方法的.h头文件,工具会自动生成整个Service框架的代码,包含Ability注册、proxy/stub类实现、MessageParcel数据包构造、Service子系统编译及开机自启动相关配置文件。目前工具支持可执行文件、VS Code插件两种入口。
-
-更多工具的架构和实现原理详情,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/docs/INSTRUCTION_ZH.md)
-
- ├── napi_generator # NAPI框架代码生成工具
- │ ├── ... # 其他文档
- │ ├── hdc
- │ │ ├── ... # 其他工具
- │ │ ├── service # service框架代码生成工具
- │ │ | ├── service_vs_plugin # VS Code插件源码
- │ │ | ├── service-gen
- │ │ | | ├── src
- │ │ | | | ├── gen
- │ │ | | | | ├── analyze.js # 解析json文件
- │ │ | | | | ├── fileTemplate.js # service框架代码文件模板
- │ │ | | | | ├── generate.js # 生成service框架
- │ │ | | | | ├── header_parser.py # 解析.h文件并输出jscon文件
- │ │ | | | | ├── main.js # 工具入口
- │ │ | | | ├── tools
- │ │ | | | | ├── FileRW.js # 读写文件
- │ │ | | | | ├── NapiLog.js # 日志
- │ │ | | | | ├── common.js # 工具支持数据类型
- │ │ | | | | ├── re.js # 正则表达式转换
- │ │ | | | | ├── tool.js # 消息体校验
-
-## 约束
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-1) 开发者为OpenHarmony系统框架开发某些功能,并将该功能包装成一个独立的服务进程运行在系统中。
-
-### 工具使用
-
-工具有两种类型,分别是可执行文件、VS Code插件。其中的可执行文件可根据工具使用者的开发环境选择,支持Windows,Linux和Mac。可执行文件、VS Code插件下载路径如下:
-
-待增加链接
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定的.h头文件,工具会输出SERVICE框架代码。为了方便使用者快速上手工具,可供测试的.h文件如下所示:
-
-[test.h](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/examples/test.h)
-
-注意:.h文件中待生成的主class必须加注释:@brief service服务,提供IPC调用接口 ,如下所示:
-
-```
-/**
- * @brief service服务,提供IPC调用接口
- * @ServiceClass
- */
-```
-
-在window环境下的,根据输入.h文件生成的输出文件,如下所示:
-
-
-
-## 工具开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/docs/DEVELOP_ZH.md)
-
-## 版本说明
-
-[已支持特性](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/Service-1.0.md)
-
-[待开发特性](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ROADMAP_ZH.md)
-
-## FAQ
-
- [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/FAQ.md)
-
-## 参与贡献
-
-暂无
-
-## 相关仓
-
-暂无
diff --git a/hdc/invalid_docs/service/docs/DEVELOP_ZH.md b/hdc/invalid_docs/service/docs/DEVELOP_ZH.md
deleted file mode 100644
index 09f9815f15e5cf3bc9dd4d81264bd015206f7be6..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/service/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,158 +0,0 @@
-# SERVICE框架生成工具开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的可执行文件和插件。
-
-## 工具开发
-
-### 可执行文件开发说明
-
-#### 环境说明
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-#### 开发步骤
-
-##### Linux
-
-1.安装typescript:在napi_generator/hdc/service/service-gen/src目录下执行命令:
-
- npm i typescript
-
-2.安装stdio:在napi_generator/hdc/service/service-gen目录下执行命令:
-
- npm i stdio
-
-3.安装pkg : 在napi_generator/hdc/service/service-gen目录下执行命令:
-
- sudo npm i -g pkg
-
-4.打包三个版本 : 执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/service/service-gen目录下生成Windows、linux、mac系统下的可执行程序:
-
- service-gen-win.exe、service-gen-linux、service-gen-macos
-
-5.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o service-gen-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o service-gen-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o service-gen-macos
-
-备注:参数-t为指定系统,参数-o为指定可执行文件名称。
-
-6.编译生成 header_parser.exe
-
-6.1 安装python库 CppHeaderParser,在header_parser/src_code中下载CppHeaderParser.zip,解压后替换本地Python文件夹中CppHeaderParser(如 /usr/local/lib/python3.8/dist-packages/CppHeaderParser)目录下的全部文件
-
-```
-sudo pip install CppHeaderParser
-```
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-6.2 安装pyinstaller
-
-```
-sudo pip install pyinstaller
-```
-
-6.3 将python脚本打包成独立可执行文件
-
-进入 ./src/tsGen 目录后执行如下命令:
-
-```
-pyinstaller -F header_parser.py
-```
-
-打包后的可执行文件在dist目录中
-
-```
-./src/tsGen/dist/header_parser.exe
-```
-
-
-##### Windows
-
-1.安装typescript:使用管理员身份在napi_generator/hdc/service/service-gen/src目录下执行命令:
-
- npm i typescript
-
-2.安装stdio:使用管理员身份在napi_generator/hdc/service/service-gen目录下执行命令:
-
- npm i stdio
-
-3.安装pkg : 使用管理员身份在napi_generator/hdc/service/service-gen目录下执行命令:
-
- npm i -g pkg
-
-4.打包三个版本 : 使用管理员身份执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/service/service-gen目录下生成Windows、linux、mac系统下的可执行程序:
-
- service-gen-win.exe、service-gen-linux、service-gen-macos
-
-5.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o service-gen-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o service-gen-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o service-gen-macos
-
-6.编译生成 header_parser.exe
-
-6.1 安装python库 CppHeaderParser,在header_parser/src_code中下载CppHeaderParser.zip,解压后替换本地Python文件夹中CppHeaderParser(如 C:\Python310\Lib\site-packages\CppHeaderParser)目录下的全部文件
-
-```
-pip install CppHeaderParser
-```
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-6.2 安装pyinstaller
-
-```
-pip install pyinstaller
-```
-
-6.3 将python脚本打包成独立可执行文件
-
-进入 ./src/tsGen 目录后执行如下命令:
-
-```
-pyinstaller -F header_parser.py
-```
-
-打包后的可执行文件在dist目录中
-
-```
-./src/tsGen/dist/header_parser.exe
-```
-
-### VS插件开发说明
-
-具体的插件开发步骤,可以左键单击以下链接了解:
-
-[VS插件开发说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/service_vs_plugin/docs/DEVELOP_ZH.md)
diff --git a/hdc/invalid_docs/service/docs/INSTRUCTION_ZH.md b/hdc/invalid_docs/service/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index 06aa3892b3ca7118d7b1b71e23c0f1dc04f0f7ef..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/service/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,99 +0,0 @@
-# SERVICE框架生成工具使用说明
-## 简介
-
-SERVICE框架生成工具支持三种入口,分别是可执行程序、VS Code插件,使用者可以根据自己的需要选择合适的工具。可执行文件、VS Code插件下载路径如下:
-
-待增加链接
-
-下载文件说明如下:
-
- │ │ |── service-gen-0.0.1.vsix # VS Code插件
- │ │ |── header_parser.exe # python脚本独立程序
- │ │ |── header_parser # python脚本独立程序
- │ │ |── service-gen-linux # Linux可执行程序
- │ │ |── service-gen-win.exe # Windows可执行程序
- │ │ └── service-gen-macos # Mac可执行程序
-
-## 工具介绍
-
-通过SERVICE框架生成工具,使用者只需提供一个定义远程方法的.h头文件,一键生成SERVICE框架代码,主要包含Ability注册、proxy/stub类实现、MessageParcel数据包构造、Service子系统编译及开机自启动相关配置文件。
-
-
-
-## 生成框架
-
-### 可执行程序使用方法
-#### Linux
-
-1.下载python脚本可执行程序header_parser与linux可执行程序service-gen-linux,下载链接如下:
-
-待增加链接
-
-2.将待转换的.h文件放到任意目录下,建议放到可执行程序service-gen-linux与header_parser同级目录下,如下所示:
-
- harmony@Ubuntu-64:~/service/napi_generator_8/hdc/service-gen/examples$ ls
- test.h header_parser service-gen-linux
-
-3.在终端中进入到可执行程序service-gen-linux所在的目录,并运行service-gen-linux,命令如下:
-
- harmony@Ubuntu-64:~/service/napi_generator_8/hdc/service-gen/examples$ ./service-gen-linux -f test.h -o ./ -s 9016
-
-其中,参数详情如下:
- -f,定义远程服务的.h文件;
- -l, 日志级别(0-3),默认为1;
- -o, 生成框架代码输入到指定路径下;
- -s, 指定serviceID。
-
-4.运行成功后会在当前目录下生成对应的文件,如下所示:
-
- harmony@Ubuntu-64:~/service/napi_generator_8/hdc/service-gen/examples$ ls
- test.h header_parser napi_gen.log service-gen-linux testservice
-
-#### Windows
-
-1.下载python脚本可执行程序header_parser.exe与windows可执行程序service-gen-win.exe,下载链接如下:
-
-待增加链接
-
-2.将要转换的.h文件放到任意目录下,建议放到可执行程序service-gen-win.exe与header_parser.exe同级目录下,如下所示:
-
- E:\demo\service>dir /B
- test.h
- header_parser.exe
- service-gen-win.exe
-
-3.在终端中进入到可执行程序service-gen-win.exe所在的目录,并运行service-gen-win.exe,命令如下:
-
- E:\demo\service>service-gen-win.exe -f test.h -o ./ -s 9016
-
-其中,参数详情如下:
- -f,定义远程服务的.h文件;
- -l, 日志级别(0-3),默认为1;
- -o,生成框架代码输入到指定路径下;
- -s,指定serviceID。
-
-4.运行成功后会在当前目录下生成对应的文件,如下所示:
-
- E:\demo\service>dir /B
- test.h
- header_parser.exe
- napi_gen.log
- service-gen-win.exe
- testservice
-
-#### Mac
-
-方法步骤参考windows、Linux的使用方法。
-
-### VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[VS插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 集成
-
-Service框架代码生成后,系统框架开发者进行二次开发后,即可集成到OpenHarmony编译系统,生成对应的库文件,供应用开发者调用接口。工具集成到OpenHarmony的具体操作步骤可以左键单击以下链接了解:
-
- [工具集成](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ENSEMBLE_METHOD_ZH.md)
-
diff --git a/hdc/invalid_docs/service/vs/README_zh.md b/hdc/invalid_docs/service/vs/README_zh.md
deleted file mode 100644
index 0c7b0ee336571627e5f0a1666a10363c01511077..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/service/vs/README_zh.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# SERVICE框架生成工具VS code插件说明
-
-## 简介
-
-SERVICE框架生成工具,根据用户提供的.h头文件,工具会自动生成整个Service框架的代码。目前工具支持可执行文件、VS Code插件两种入口,本文主要介绍VS Code插件使用说明。
-
-## 目录
-
- ├── service # SERVICE框架生成工具
- │ ├── ... # 其他文件
- │ ├── service_vs_plugin # VS Code插件代码
- │ │ ├── docs # VS Code插件说明
- │ │ ├── src # VS Code插件源码
- │ │ ├── package.json # package.json 文件
- │ │ └── README_zh.md # VS Code插件说明
-
-## 约束
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-开发者为OpenHarmony系统框架开发某些功能,并将该功能包装成一个独立的服务进程运行在系统中。
-
-### 工具使用
-
-插件下载路径如下:
-
-待增加链接
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定的.h头文件,工具会输出SERVICE框架代码。为了方便使用者快速上手工具,可供测试的.h文件如下所示:
-
-[test.h](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/examples/test.h)
-
-注意:.h文件中待生成的主class必须加注释:@brief service服务,提供IPC调用接口 ,如下所示:
-
-```
-/**
- * @brief service服务,提供IPC调用接口
- * @ServiceClass
- */
-```
-
-在window环境下的,根据输入.h文件生成的输出文件,如下所示:
-
-
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具VS Code插件的开发:
-
-[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_vs_plugin/docs/DEVELOP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/invalid_docs/service/vs/docs/DEVELOP_ZH.md b/hdc/invalid_docs/service/vs/docs/DEVELOP_ZH.md
deleted file mode 100644
index 3095061f557568c89df239ca7ef499892b170413..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/service/vs/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# SERVICE框架生成工具VSCode插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的VS Code插件。
-
-## VS Code插件打包说明
-
-### Linux
-
-1.下载service-gen-linux可执行程序与header_parser可执行程序,并放置到到napi_generator/hdc/service/service_vs_plugin/src/目录下,下载链接如下:
-
-待增加链接
-
-2.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
- 每个选项都选择y,然后回车,最终会在当前目录下打包生成一个插件service-gen-0.0.1.vsix。结果如下:
-
- kaihong1@ubuntu:~/napi_generator_gjj/hdc/service/service_vs_plugin/src$ npx vsce package
- This extension consists of 3282 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: /home/kaihong1/napi_generator_gjj/hdc/service/service_vs_plugin/src/service-gen-0.0.1.vsix (3282 files, 60.4MB)
-
-### Windows
-
-1.下载service-gen-win.exe可执行程序与header_parser.exe可执行程序,并放置到到napi_generator/hdc/service/service_vs_plugin/src/目录下,下载链接如下:
-
-待增加链接
-
-2.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/service/service_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
- 每个选项都选择y,然后回车,最终会在当前目录下打包生成一个插件service-gen-0.0.1.vsix。结果如下:
-
- C:\napi_generator_GJJ\hdc\service\service_vs_plugin\src>npx vsce package
- This extension consists of 3281 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: C:\napi_generator_GJJ\hdc\service\service_vs_plugin\src\service-gen-0.0.1.vsix (3281 files, 39.92MB)
-
diff --git a/hdc/invalid_docs/service/vs/docs/INSTRUCTION_ZH.md b/hdc/invalid_docs/service/vs/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index 1b78ea3b532db2ef76688b58d300984ae7668cd8..0000000000000000000000000000000000000000
--- a/hdc/invalid_docs/service/vs/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# SERVICE框架生成工具VSCode插件使用说明
-## 简介
-
-VS Code插件下载路径如下:
-
-待增加链接
-
-## VS Code插件使用方法
-
-### 说明
-
-visual studio code 版本需1.62.0及以上。
-
-### 步骤
-
-1、 打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-2、 在应用商店搜索service-gen插件,再单击安装。
-
-
-
-3、 安装完成后就会在VS Code的插件管理器中能看到service-gen这个插件了。
-
-
-
-4、 在VS Code中找到需要转换的.h文件,如下:
-
-
-
-5、 右键单击.h文件,选择“ Service Generate Frame”选项。
-
-
-
-6、 工具打开 Service Generate Frame窗口,.h文件选择框默认填写被操作的.h文件的绝对路径;输出路径选择框默认填写.h文件所在文件夹路径,可修改为任意路径;serviceID范围是1-16777215之间的整数,超出范围会提示错误,填入正确的serviceID,然后点击ok。
-
-
-
-7、 转换成功后,在输出路径下生成service框架代码文件。
-
-## 集成
-
-Service框架代码生成后,系统框架开发者进行二次开发后,即可集成到OpenHarmony编译系统,生成对应的库文件,供应用开发者调用接口。工具集成到OpenHarmony的具体操作步骤可以左键单击以下链接了解:
-
- [工具集成](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ENSEMBLE_METHOD_ZH.md)
-
diff --git a/hdc/service/FAQ.md b/hdc/service/FAQ.md
deleted file mode 100755
index 3e0dfeb15dd5ae394b7280fb8c26dc214649e9a1..0000000000000000000000000000000000000000
--- a/hdc/service/FAQ.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# SERVICE生成工具 问题反馈
-
-## 问题反馈
-
-1、使用工具生成service框架代码时,报错“ EEXIST: file already exists, mkdir 'out\examservice'”。
-
-
-
-问题定位:在使用工具生成service框架代码之前,指定目录下已存在.h文件中class对应的框架代码文件,因此生成失败。
-
-问题解决:修改.h文件中class名称,或删除对应框架代码都可以解决该问题。
-
diff --git a/hdc/service/README_ZH.md b/hdc/service/README_ZH.md
deleted file mode 100755
index 5315f1efb7cf13327027a91af78c88023493f973..0000000000000000000000000000000000000000
--- a/hdc/service/README_ZH.md
+++ /dev/null
@@ -1,92 +0,0 @@
-# SERVICE框架生成工具
-
-## 简介
-
-当开发者为OpenHarmony系统框架开发某些功能时,有时需要将这个功能包装成一个独立的服务进程运行在系统中,为了其它应用进程能够调用此服务,开发人员需要基于系统IPC通信框架编写一套远程接口调用实现。实现Service远程调用接口需要开发人员熟悉IPC通信框架,了解proxy/stub的继承与实现方式,掌握C++类型转为MessageParcel数据包的各种API方法,有一定的学习成本。而Service代码生成工具能够帮助使用者生成框架代码,提升开发效率。用户只需提供一个定义远程方法的.h头文件,工具会自动生成整个Service框架的代码,包含Ability注册、proxy/stub类实现、MessageParcel数据包构造、Service子系统编译及开机自启动相关配置文件。目前工具支持VS Code插件一种入口。
-
-更多工具的架构和实现原理详情,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/docs/INSTRUCTION_ZH.md)
-
- ├── napi_generator # NAPI框架代码生成工具
- │ ├── ... # 其他文档
- │ ├── hdc
- │ │ ├── ... # 其他工具
- │ │ ├── service # service框架代码生成工具
- │ │ | ├── service_vs_plugin # VS Code插件源码
- │ │ | ├── ...
-
-## 约束
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-### 使用场景
-
-1) 开发者为OpenHarmony系统框架开发某些功能,并将该功能包装成一个独立的服务进程运行在系统中。
-
-### 工具使用
-
-#### VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定的.h头文件,工具会输出SERVICE框架代码。为了方便使用者快速上手工具,可供测试的.h文件如下所示:
-
-[test.h](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/examples/test.h)
-
-注意:.h文件中待生成的主class必须加注释:@brief service服务,提供IPC调用接口 ,如下所示:
-
-```
-/**
- * @brief service服务,提供IPC调用接口
- * @ServiceClass
- */
-```
-
-在window环境下的,根据输入.h文件生成的输出文件,如下所示:
-
-
-
-## 工具开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/docs/DEVELOP_ZH.md)
-
-## 版本说明
-
-[已支持特性](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/Service-1.0.md)
-
-[待开发特性](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ROADMAP_ZH.md)
-
-## FAQ
-
- [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/FAQ.md)
-
-## 参与贡献
-
-暂无
-
-## 相关仓
-
-暂无
diff --git a/hdc/service/docs/DEVELOP_ZH.md b/hdc/service/docs/DEVELOP_ZH.md
deleted file mode 100755
index 81440cd6f86f650d7305f2c1806f2deaa7c8671a..0000000000000000000000000000000000000000
--- a/hdc/service/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,152 +0,0 @@
-# SERVICE框架生成工具开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的可执行文件和插件。
-
-## 工具开发
-
-### 可执行文件开发说明
-
-#### 环境说明
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-#### 开发步骤
-
-##### Linux
-
-1.安装typescript:在napi_generator/hdc/service/service-gen/src目录下执行命令:
-
- npm i typescript
-
-2.安装stdio:在napi_generator/hdc/service/service-gen目录下执行命令:
-
- npm i stdio
-
-3.安装pkg : 在napi_generator/hdc/service/service-gen目录下执行命令:
-
- sudo npm i -g pkg
-
-4.打包三个版本 : 执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/service/service-gen目录下生成Windows、linux、mac系统下的可执行程序:
-
- service-gen-win.exe、service-gen-linux、service-gen-macos
-
-5.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o service-gen-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o service-gen-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o service-gen-macos
-
-备注:参数-t为指定系统,参数-o为指定可执行文件名称。
-
-6.编译生成 header_parser.exe
-
-6.1 安装python库 CppHeaderParser,在header_parser/src_code中下载CppHeaderParser.zip,解压后替换本地Python文件夹中CppHeaderParser(如 /usr/local/lib/python3.8/dist-packages/CppHeaderParser)目录下的全部文件(由于网络原因,可能会导致有的下载链接失效,因此提供了以下三个下载链接)
-
-```
-sudo pip install CppHeaderParser
-```
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-6.2 安装pyinstaller
-
-```
-sudo pip install pyinstaller
-```
-
-6.3 将python脚本打包成独立可执行文件
-
-进入 ./src/tsGen 目录后执行如下命令:
-
-```
-pyinstaller -F header_parser.py
-```
-
-打包后的可执行文件在dist目录中
-
-```
-./src/tsGen/dist/header_parser.exe
-```
-
-
-##### Windows
-
-1.安装typescript:使用管理员身份在napi_generator/hdc/service/service-gen/src目录下执行命令:
-
- npm i typescript
-
-2.安装stdio:使用管理员身份在napi_generator/hdc/service/service-gen目录下执行命令:
-
- npm i stdio
-
-3.安装pkg : 使用管理员身份在napi_generator/hdc/service/service-gen目录下执行命令:
-
- npm i -g pkg
-
-4.打包三个版本 : 使用管理员身份执行命令:
-
- pkg .
-
-执行以上步骤后,即可在napi_generator/hdc/service/service-gen目录下生成Windows、linux、mac系统下的可执行程序:
-
- service-gen-win.exe、service-gen-linux、service-gen-macos
-
-5.根据需求打包指定系统下的可执行文件。若想只打包windows系统下可执行文件,可执行命令:
-
- pkg -t node14-win . -o service-gen-win.exe
-
-若想只打包linux系统下可执行文件,可执行命令:
-
- pkg -t node14-linux . -o service-gen-linux
-
-若想只打包macos系统下可执行文件,可执行命令:
-
- pkg -t node14-macos . -o service-gen-macos
-
-6.编译生成 header_parser.exe
-
-6.1 安装python库 CppHeaderParser,在header_parser/src_code中下载CppHeaderParser.zip,解压后替换本地Python文件夹中CppHeaderParser(如 C:\Python310\Lib\site-packages\CppHeaderParser)目录下的全部文件(由于网络原因,可能会导致有的下载链接失效,因此提供了以下三个下载链接)
-
-```
-pip install CppHeaderParser
-```
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-6.2 安装pyinstaller
-
-```
-pip install pyinstaller
-```
-
-6.3 将python脚本打包成独立可执行文件
-
-进入 ./src/tsGen 目录后执行如下命令:
-
-```
-pyinstaller -F header_parser.py
-```
-
-打包后的可执行文件在dist目录中
-
-```
-./src/tsGen/dist/header_parser.exe
-```
diff --git a/hdc/service/docs/ENSEMBLE_METHOD_ZH.md b/hdc/service/docs/ENSEMBLE_METHOD_ZH.md
deleted file mode 100644
index a0a787e4b4c48d03793c9a3bedbe6e56758a5f10..0000000000000000000000000000000000000000
--- a/hdc/service/docs/ENSEMBLE_METHOD_ZH.md
+++ /dev/null
@@ -1,326 +0,0 @@
-# Service框架生成代码集成到OpenHarmony的方法
-
-## 场景说明
-
-为了实现工具生成的接口被其它子系统或者应用调用,需将生成的代码经系统框架开发者二次开发后编译集成到OpenHarmony系统中,使其生成动态库,供OpenHarmony应用层调用。本文介绍如何将工具生成的源码利用OpenHarmony编译系统生成动态库供应用层调用。
-
-## 编译
-
-将生成的整个testservice目录复制到OpenHarmony源码根目录下(与base、foundation目录平级)
-
-### OpenHarmony 3.1 release
-
-#### 修改系统公共文件
-
-1. 服务配置
- foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h增加以下两行(ID说明: TEST_SERVICE_ID值与用户指定的ID一致;TEST_SERVICE_ID宏值定义必须为这个,因为代码中使用的就是这个)
-
- ```
- TEST_SERVICE_ID = 9016,
- {TEST_SERVICE_ID, "testservice" },
- ```
-
-2. 子系统配置
- build/subsystem_config.json
- 增加以下内容
-
- ```
- "testservice": {
- "path":"testservice",
- "name": "testservice"
- }
- ```
-
-3. 产品配置,如Hi3516DV300
- productdefine/common/products/Hi3516DV300.json
-
-```
- "testservice:testservice_part":{}
-```
-
-### OpenHarmony 3.2 release
-
-#### 修改编译文件
-
-1. 修改testservice/BUILD.gn文件,将utils/native 改为 commonlibrary/c_utils,将samgr_standard改为samgr。修改后的BUILD.gn文件内容如下所示:
-
- ```
- import("//build/ohos.gni")
-
- ohos_shared_library("testservice") {
- sources = [
- "//testservice/src/i_test_service.cpp",
- "//testservice/src/test_service_stub.cpp",
- "//testservice/src/test_service.cpp"
- ]
- include_dirs = [
- "//testservice/include",
- "//testservice/interface",
- "//commonlibrary/c_utils/base/include"
- ]
-
- deps = [
- "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara",
- "//commonlibrary/c_utils/base:utils",
- ]
-
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr:samgr_proxy",
- "startup_l2:syspara",
- ]
-
- part_name = "testservice_part"
- subsystem_name = "testservice"
- }
-
- ohos_executable("testclient") {
- sources = [
- "//testservice/src/i_test_service.cpp",
- "//testservice/src/test_service_proxy.cpp",
- "//testservice/src/test_client.cpp"
- ]
-
- include_dirs = [
- "//testservice/include",
- "//testservice/interface",
- "//commonlibrary/c_utils/base/include"
- ]
-
- deps = [
- "//commonlibrary/c_utils/base:utils",
- ]
-
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "samgr:samgr_proxy",
- ]
-
- part_name = "testservice_part"
- subsystem_name = "testservice"
- }
-
- ```
-
-2. 修改testservice/bundle.json文件,将"name": "@ohos/testservice"修改为 "name": "@ohos/testservice_part";将"samgr_standard"改为"samgr","utils_base"修改为"c_utils";修改后的bundle.json文件内容如下所示:
-
- ```
- {
- "name": "@ohos/testservice_part",
- "description": "system ability framework test",
- "homePage": "https://gitee.com/",
- "version": "3.1",
- "license": "Apache License 2.0",
- "repository": "",
- "publishAs": "code-segment",
- "segment": {
- "destPath": "testservice"
- },
- "dirs": {},
- "scripts": {},
- "component": {
- "name": "testservice_part",
- "subsystem": "testservice",
- "adapted_system_type": [
- "standard"
- ],
- "rom": "2048KB",
- "ram": "~4096KB",
- "deps": {
- "components": [
- "hiviewdfx_hilog_native",
- "ipc",
- "samgr",
- "c_utils",
- "safwk",
- "startup_l2"
- ],
- "third_party": [ "libxml2" ]
- },
- "build": {
- "sub_component": [
- "//testservice:testservice",
- "//testservice/sa_profile:testservice_sa_profile",
- "//testservice:testclient",
- "//testservice/etc:test_service_init"
- ],
- "inner_kits": [
- ],
- "test": [
- ]
- }
- }
- }
- ```
-
-#### 修改系统公共文件
-
-##### 基础配置
-
-1. 服务配置
-
- foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h增加以下两行(ID说明: TEST_SERVICE_ID值与用户指定的ID一致;TEST_SERVICE_ID宏值定义必须为这个,因为代码中使用的就是这个)
-
- ```
- TEST_SERVICE_ID = 9016,
- {TEST_SERVICE_ID, "testservice" },
- ```
-
-2. 子系统配置
-
- build/subsystem_config.json
-
- 增加以下内容
-
- ```
- "testservice": {
- "path":"testservice",
- "name": "testservice"
- }
- ```
-
-3. 产品配置,如rk3568
-
- vendor/hihope/rk3568/config.json
-
- 若用户不需要配置selinux,则将"build_selinux"属性改为false
-
- ```
- "build_selinux": false,
- ```
-
- 增加以下内容
-
- ```
- {
- "subsystem": "testservice",
- "components": [
- {
- "component": "testservice_part",
- "features": []
- }
- ]
- }
- ```
-
- 注意:若用户需要配置selinux相关配置,则将开关改为true,再根据自身需求进行相关配置
-
-4. 权限配置
-
- 在相应产品目录下
-
- vendor/hihope/rk3568/security_config/high_privilege_process_list.json
-
- 增加以下内容
-
- ```
- {
- "name": "testservice",
- "uid": "system",
- "gid": ["root", "system"]
- }
- ```
-
-##### selinux权限配置
-
-若要配置selinux权限,首先应将vendor/hihope/rk3568/config.json中"build_selinux"属性改为true,然后修改以下文件:
-
-1. testservice/etc/sample_service.cfg
-
- ```
- "secon" : "u:r:testservice:s0"
- ```
-
-2. base/security/selinux/sepolicy/base/public/service_contexts
-
- ```
- 9016 u:object_r:sa_testservice:s0
- ```
-
-3. base/security/selinux/sepolicy/base/public/service.te
-
- ```
- type sa_testservice, sa_service_attr;
- ```
-
-4. base/security/selinux/sepolicy/base/te/init.te
-
- ```
- allow init testservice:process { getattr rlimitinh siginh transition };
- ```
-
-5. base/security/selinux/sepolicy/base/public/type.te
-
- ```
- type testservice, sadomain, domain;
- ```
-
-6. /base/security/selinux/sepolicy/base/te目录下增加新service的te文件,新增文件名即为服务名,例如:testservice
-
- ```
- allow testservice init_param:file { map open read };
- allow testservice sa_testservice:samgr_class { add get };
- ```
-
-### 补充 服务端/客户端 业务逻辑实现
-
-**服务端**
-test_service.cpp
-在testservice/src/test_service.cpp注释“// TODO: Invoke the business implementation”处添加各个接口的服务端实现代码,当前版本生成服务端代码需要用户先初始化,给int ret值赋初值0,如下所示:
-
-
-
-远程方法的参数包装已在生成代码test_service_stub.cpp中统一处理,开发人员无需关注
-
-**客户端**
-test_client.cpp 为自动生成的客户端样例代码。编译烧录后,会在/system/bin/目录下生成可执行程序test_client
-在testservice/src/test_client.cpp的main函数中使用proxy对象进行远程方法调用,参考注释示例。如下图:
-
-
-
-远程方法的参数包装已在生成代码test_service_proxy.cpp中统一处理,开发人员无需关注
-
-编码完成后,执行镜像编译命令
-
-```
-./build.sh --product-name 产品名
-```
-
-如:若编译Hi3516DV300开发板,则执行
-
-```
-./build.sh --product-name Hi3516DV300
-```
-
-若编译rk3568开发板,则执行
-
-```
-./build.sh --product-name rk3568
-```
-
-## 运行
-
-将编译好的镜像烧录到开发板后,使用hdc_std shell登录开发板。
-查看服务端进程是否已正常启动
-
-```
-ps -ef | grep testservice
-system 288 1 0 00:02:13 ? 00:00:00 testservice_sa --- 服务进程已正常运行
-```
-
-如下图所示:
-
-
-
-运行客户端
-
-```
-/system/bin/testclient
-```
-
-
- (客户端具体执行哪些远程调用方法请在test_client.cpp的main方法中实现)
-
diff --git a/hdc/service/docs/INSTRUCTION_ZH.md b/hdc/service/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 49a6ca94e386e73e7c9c58d925f209c6aff72bde..0000000000000000000000000000000000000000
--- a/hdc/service/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# SERVICE框架生成工具使用说明
-## 简介
-
-SERVICE框架生成工具支持一种入口,即VS Code插件,使用者可以根据自己的需要下载工具使用。
-
-## 工具介绍
-
-通过SERVICE框架生成工具,使用者只需提供一个定义远程方法的.h头文件,一键生成SERVICE框架代码,主要包含Ability注册、proxy/stub类实现、MessageParcel数据包构造、Service子系统编译及开机自启动相关配置文件。
-
-
-
-## 生成框架
-
-### VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[VS插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 集成
-
-Service框架代码生成后,系统框架开发者进行二次开发后,即可集成到OpenHarmony编译系统,生成对应的库文件,供应用开发者调用接口。工具集成到OpenHarmony的具体操作步骤可以左键单击以下链接了解:
-
- [工具集成](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ENSEMBLE_METHOD_ZH.md)
-
diff --git a/hdc/service/docs/ROADMAP_ZH.md b/hdc/service/docs/ROADMAP_ZH.md
deleted file mode 100644
index b3df09db27d0d61dbaeac8a9441e14ff469c3d21..0000000000000000000000000000000000000000
--- a/hdc/service/docs/ROADMAP_ZH.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Service生成工具
-
-## 版本规划
-
-2023.08.30提供1.1版本 基本完善工具C++支持能力,具体特性见表1。
-
-**表 1** 2023.08.30待支持特性
-
-
-
- 类别
-
- 待开发特性
-
- 入口平台
-
-
-
- 变量/返回值
-
-支持C++语言中enum复合类型变量/函数入参自动生成为对应service架构的变量/函数 支持C++语言中std::map生成为对应service架构的std::map<> 支持C++语言中std::any生成为对应service架构中的std::any
-
-可执行文件-Windows/Ubuntu/Mac IntelliJ插件-Windows VSCode插件-Windows/Ubuntu/Mac
-
-
-
-
-
-
-
-
-
-
-## 相关链接
-
-无
-
diff --git a/hdc/service/docs/Service-1.0.md b/hdc/service/docs/Service-1.0.md
deleted file mode 100644
index 4d420ba196e9be4f1be5fd110802e64757a5091e..0000000000000000000000000000000000000000
--- a/hdc/service/docs/Service-1.0.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Service-1.0(2023-03-30)
-
-## 版本概述
-
-发布Service-1.0。
-
-## 版本特性
-
-**表 1** 已支持特性
-
-
-
- 类别
-
- 支持特性
-
- 入口平台
-
-
-
- 变量/返回值
-
-支持C++语言中string、std::string、char、char *、wchar_t、char16_t、char32_t、unsigned char、unsigned short、unsigned int、unsigned long、short、int、int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、double_t、float_t、size_t、long、long long、float、double、long double、bool基础类型的变量/函数入参自动转换为对应service架构中变量/入参 支持C++语言中string、std::string、char、char *、wchar_t、char16_t、char32_t、unsigned char、unsigned short、unsigned int、unsigned long、short、int、int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、double_t、float_t、size_t、long、long long、float、double、long double、bool数组类型的变量/函数入参自动转换为对应service架构中变量/入参,数组书写方式为std::vector<> 支持C++语言string、std::string、char、char *、wchar_t、char16_t、char32_t、unsigned char、unsigned short、unsigned int、unsigned long、short、int、int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、double_t、float_t、size_t、long、long long、float、double、long double、bool基础类型的返回值自动转换为对应service架构中返回值
-
-可执行文件-Windows/Ubuntu/Mac VS Code插件-Windows/Ubuntu/Mac
-
-
- namespace
-
-支持.h文件中namespace域class生成为对应service架构中的class
-
-可执行文件-Windows/Ubuntu/Mac VS Code插件-Windows/Ubuntu/Mac
-
-
- 文件
-
-支持C++文件名格式A.h的文件生成为service架构
-
-可执行文件-Windows/Ubuntu/Mac VS Code插件-Windows/Ubuntu/Mac
-
-
-
-
-
-**表 2**
-
-[待开发特性](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ROADMAP_ZH.md)
\ No newline at end of file
diff --git a/hdc/service/examples/sample.h b/hdc/service/examples/sample.h
deleted file mode 100755
index 9bb5b1e33aeb18ce710eda314e022a50ab8a8d67..0000000000000000000000000000000000000000
--- a/hdc/service/examples/sample.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef EXAM_H
-#define EXAM_H
-
-#include
-#include
-#include
-#include
-
-using std::string;
-
-namespace OHOS {
-namespace Example {
-class Basic {
-public:
- std::string basicName;
-
- int getBasicId()
- {
- return this->basicId;
- }
- void setBasicId (int id)
- {
- this->basicId = id;
- }
-
-private:
- int basicId;
-};
-
-class Human : public Basic {
-public:
- bool getOpFlag()
- {
- return this->opFlag;
- };
- void setOpFlag (bool flag)
- {
- this->opFlag = flag;
- };
- std::string getOpDesc()
- {
- return this->opDesc;
- };
- void setOpDesc(std::string desc)
- {
- this->opDesc = desc;
- };
- int getOpSeqId()
- {
- return this->opSeqId;
- };
- void setOpSeqId(int id)
- {
- opSeqId = id;
- };
-
- std::string opName;
- int age = 0;
-private:
- bool opFlag;
- std::string opDesc;
- int opSeqId;
-}
-
-struct Book {
- int getCc()
- {
- return this->cc;
- };
- void setCc(int cc)
- {
- this->cc = cc;
- };
- Basic getBasicObj()
- {
- return this->basicObj;
- };
- void setBasicObj(Basic obj)
- {
- this->basicObj = obj;
- };
-public:
- int aa;
- bool bb;
- Basic direcObj;
-private:
- int cc;
- Basic basicObj;
-}
-
-/**
- * @brief service服务,提供IPC调用接口
- * @ServiceClass
- */
-class Exam2 {
-public:
- Book getBook(Basic& basic);
- int fun1 (Book v1);
- int fun2 (Basic& basic, Human& human);
-};
-} // namespace Example
-} // namespace OHOS
-#endif // EXAM_H
diff --git a/hdc/service/examples/test.h b/hdc/service/examples/test.h
deleted file mode 100644
index 2244c4ac5bf34261a811478a0e7ae796c0b08b13..0000000000000000000000000000000000000000
--- a/hdc/service/examples/test.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef TEST_H
-#define TEST_H
-
-namespace OHOS {
- namespace Example {
- /**
- * @brief service服务,提供IPC调用接口
- * @ServiceClass
- */
- class test {
- public:
- int testFunc(int v1, int v2, bool v3);
- };
- } // namespace Example
-} // namespace OHOS
-#endif // TEST_H
diff --git a/hdc/service/figures/DevEco_step_applyPlugins.png b/hdc/service/figures/DevEco_step_applyPlugins.png
deleted file mode 100755
index 8831858a64020049ccad7715358c7f4253659369..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_applyPlugins.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_finish.png b/hdc/service/figures/DevEco_step_finish.png
deleted file mode 100755
index b02a3bd8ab283840a1401131153e1b67d83dd772..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_finish.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_firstNext.png b/hdc/service/figures/DevEco_step_firstNext.png
deleted file mode 100755
index 812504617e554fa1985f1bda04fa2af3b122a4a0..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_firstNext.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_newFile.png b/hdc/service/figures/DevEco_step_newFile.png
deleted file mode 100755
index 3b69aa21918c6a0377fad1e9dfdc6f702d046510..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_newFile.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_pluginsOk.png b/hdc/service/figures/DevEco_step_pluginsOk.png
deleted file mode 100755
index b5b783f70c60e3f60c9d3be287925da4d11d8592..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_pluginsOk.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_project.png b/hdc/service/figures/DevEco_step_project.png
deleted file mode 100755
index 1376085535222a681660e1ec1805aec629b5926e..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_project.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_service.png b/hdc/service/figures/DevEco_step_service.png
deleted file mode 100755
index 4f5e7e3032b5869f9f95182b0179c3eb3ea4de15..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_service.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_serviceSuccess.png b/hdc/service/figures/DevEco_step_serviceSuccess.png
deleted file mode 100755
index 48b2ddf78da47197234a3a48ef76d7c01bbf2b08..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_serviceSuccess.png and /dev/null differ
diff --git a/hdc/service/figures/DevEco_step_service_ok.png b/hdc/service/figures/DevEco_step_service_ok.png
deleted file mode 100755
index 2dddb54f5025805b1becbfe5bd3f4e3dff0df328..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/DevEco_step_service_ok.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_Proj_Module.png b/hdc/service/figures/IntelliJ_env_Proj_Module.png
deleted file mode 100755
index f3709b1f07c3f0d1a7f9950f5d1a8fd805316898..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_Proj_Module.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_Proj_Module_New.png b/hdc/service/figures/IntelliJ_env_Proj_Module_New.png
deleted file mode 100755
index d8c180413b38fbd8e8e5c21116612ea400671f07..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_Proj_Module_New.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_built_jar.png b/hdc/service/figures/IntelliJ_env_built_jar.png
deleted file mode 100755
index 37525de56b5abe99aa5a5955d11ced252aa984c5..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_built_jar.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_built_jar_success.png b/hdc/service/figures/IntelliJ_env_built_jar_success.png
deleted file mode 100755
index f241fd08285a2366ac3d53f49661a0c74f88eec6..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_built_jar_success.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_built_pro.png b/hdc/service/figures/IntelliJ_env_built_pro.png
deleted file mode 100755
index f75207567e91b960c616a0531bf1431ba7316e7a..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_built_pro.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_config_SDKs.png b/hdc/service/figures/IntelliJ_env_config_SDKs.png
deleted file mode 100755
index ed1e6161906f3fcbfbb0328064149a4bab89c935..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_config_SDKs.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_config_open_proj.png b/hdc/service/figures/IntelliJ_env_config_open_proj.png
deleted file mode 100755
index e303f248a7672d05f7151153aae7c251f567f064..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_config_open_proj.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_configurations.png b/hdc/service/figures/IntelliJ_env_configurations.png
deleted file mode 100755
index b82235fe436652ad3c11a7bea4b7a2ab3d0316a3..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_configurations.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_module_root.png b/hdc/service/figures/IntelliJ_env_module_root.png
deleted file mode 100755
index 1dedf3c396d94cd9f39b15a1a9a61366447d242c..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_module_root.png and /dev/null differ
diff --git a/hdc/service/figures/IntelliJ_env_proj_structure.png b/hdc/service/figures/IntelliJ_env_proj_structure.png
deleted file mode 100755
index 7902b79660156334e6e82803363d06c5777dc62a..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/IntelliJ_env_proj_structure.png and /dev/null differ
diff --git a/hdc/service/figures/file_already_exists.png b/hdc/service/figures/file_already_exists.png
deleted file mode 100755
index 71e4b3608cbbfe63f0ac530ae75eb214e82226d2..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/file_already_exists.png and /dev/null differ
diff --git a/hdc/service/figures/pic-plug-in-gen-c++.png b/hdc/service/figures/pic-plug-in-gen-c++.png
deleted file mode 100755
index a10a3c909274b38e36aefb11d1a1b76e227dee94..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-plug-in-gen-c++.png and /dev/null differ
diff --git a/hdc/service/figures/pic-plug-in-search.png b/hdc/service/figures/pic-plug-in-search.png
deleted file mode 100755
index e07f4d60a8af69af2f72582ca74b3e6bdba8d1b8..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-plug-in-search.png and /dev/null differ
diff --git a/hdc/service/figures/pic-plug-in-select-h.png b/hdc/service/figures/pic-plug-in-select-h.png
deleted file mode 100755
index 92a28c1d8723d660c3c3d3dd1de34d67a3103a60..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-plug-in-select-h.png and /dev/null differ
diff --git a/hdc/service/figures/pic-plug-in-select.png b/hdc/service/figures/pic-plug-in-select.png
deleted file mode 100755
index 9d4da020f1ec0e73e19518659d44f646e239ebad..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-plug-in-select.png and /dev/null differ
diff --git a/hdc/service/figures/pic-plug-in-service.png b/hdc/service/figures/pic-plug-in-service.png
deleted file mode 100755
index 3cbe6bda719297033e09992f422d5ef6d0666ec3..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-plug-in-service.png and /dev/null differ
diff --git a/hdc/service/figures/pic-service-frame.png b/hdc/service/figures/pic-service-frame.png
deleted file mode 100755
index e2ff8eae4223585451a51fbdc36e697496b82a7b..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-service-frame.png and /dev/null differ
diff --git a/hdc/service/figures/pic-service-frm.png b/hdc/service/figures/pic-service-frm.png
deleted file mode 100644
index 3b01210c3403f11e6f8ee3d6c370502fdd2028f6..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/pic-service-frm.png and /dev/null differ
diff --git a/hdc/service/figures/service_client_proxy_example.png b/hdc/service/figures/service_client_proxy_example.png
deleted file mode 100644
index 247886479d4bec2584a5005f19ca25be865b1c8a..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/service_client_proxy_example.png and /dev/null differ
diff --git a/hdc/service/figures/service_framework.png b/hdc/service/figures/service_framework.png
deleted file mode 100755
index 36d6fe75ff45a2abbfb143ea3479c745bb41476d..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/service_framework.png and /dev/null differ
diff --git a/hdc/service/figures/service_init_example.png b/hdc/service/figures/service_init_example.png
deleted file mode 100644
index e87d776a1ad4bd54be1ea98f51db96de3538cb71..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/service_init_example.png and /dev/null differ
diff --git a/hdc/service/figures/service_init_success.png b/hdc/service/figures/service_init_success.png
deleted file mode 100644
index 4214fc5de8603c86c5ce73856c390257454355f9..0000000000000000000000000000000000000000
Binary files a/hdc/service/figures/service_init_success.png and /dev/null differ
diff --git a/hdc/service/service-gen/package.json b/hdc/service/service-gen/package.json
deleted file mode 100755
index c040319ce62b462fdabb86aeb20036279bf73703..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "service-gen",
- "version": "1.0.0",
- "description": "",
- "main": "main.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "ISC",
- "dependencies": {
- "stdio": "^2.1.1",
- "typescript": "^4.8.3"
- },
- "bin": "./src/gen/main.js",
- "pkg": {
- "assets": []
- }
-}
diff --git a/hdc/service/service-gen/src/gen/analyze.js b/hdc/service/service-gen/src/gen/analyze.js
deleted file mode 100755
index b1bea151c5a4e700c3f1a44429a475d71d28c85b..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/gen/analyze.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const { NapiLog } = require("../tools/NapiLog");
-const fs = require("fs");
-const os = require("os");
-const { AllParseFileList } = require("../tools/common");
-const path = require('path');
-
-function parseFileAll(hFilePath) {
- let execSync = require("child_process").execSync;
- let cmd = "";
- if(fs.existsSync("./hdc/service/service-gen/src/gen/header_parser.py")) {
- // call python file (for debug test)
- cmd = "python ./hdc/service/service-gen/src/gen/header_parser.py " + hFilePath;
- } else {
- // call exe file (for real runtime)
- let sysInfo = os.platform();
- let execPath = path.dirname(process.execPath);
- let exeFile = sysInfo === 'win32' ? path.join(execPath, "header_parser.exe") :
- path.join(execPath, "header_parser");
- cmd = exeFile + " " + hFilePath;
- }
-
- let parseResult = null;
- let stdout = execSync(cmd);
- parseResult = JSON.parse(stdout.toString()).result;
- parseResult.rawContent = fs.readFileSync(hFilePath, 'UTF-8');
- return parseResult;
-}
-
-function analyzeNameSpace(rootInfo, parseResult) {
- if (parseResult.namespaces.length == 0) {
- return;
- }
- let lastNameSpace = parseResult.namespaces[parseResult.namespaces.length - 1];
- rootInfo.nameSpace = lastNameSpace.split('::');
-}
-
-function createParam(parseParamInfo) {
- let param = {};
- param.name = parseParamInfo.name;
- param.type = parseParamInfo.reference ? parseParamInfo.type.replace("&", "").trim(): parseParamInfo.type
- param.rawType = parseParamInfo.raw_type;
- param.isPointer = (parseParamInfo.pointer == 1);
- param.isReference = (parseParamInfo.reference == 1);
- param.isArray = (parseParamInfo.array == 1);
- param.isConstant = (parseParamInfo.constant == 1);
- return param;
-}
-
-function createFuncInfo(parseFuncInfo) {
- let funcInfo = {
- "name": "", // 方法名
- "params": [], // 参数列表
- "retType": "", // 返回值
- "rawStr": "" // 方法原始代码
- }
- funcInfo.name = parseFuncInfo.name;
-
- let parseParams = parseFuncInfo.parameters;
- for(var i = 0; i < parseParams.length; ++i) {
- let param = createParam(parseParams[i]);
- funcInfo.params.push(param);
- }
-
- funcInfo.retType = parseFuncInfo.returns === '' ? parseFuncInfo.rtnType : parseFuncInfo.returns;
- funcInfo.rawStr = parseFuncInfo.debug;
- return funcInfo;
-}
-
-function createClassFunctions(parseFuncs) {
- let funcList = [];
- for(var i = 0; i < parseFuncs.length; ++i) {
- if (!(parseFuncs[i].constructor || parseFuncs[i].destructor)) { // 构造和析构方法不需要生成remote接口代码
- let funcInfo = createFuncInfo(parseFuncs[i]);
- funcList.push(funcInfo);
- }
- }
- return funcList;
-}
-
-function createClassInfo(parseClassInfo) {
- let classInfo = {
- "name": "",
- "namespace": [],
- "properties": [],
- "functions": [],
- "extends":[]
- }
- classInfo.name = parseClassInfo.name;
- classInfo.namespace = parseClassInfo.namespace.split('::');
- classInfo.functions = createClassFunctions(parseClassInfo.methods.public);
-
- return classInfo;
-}
-
-function analyzeClasses(rootInfo, parseClasses) {
- if (parseClasses.length == 0) {
- NapiLog.logError("Can not find any class.");
- return;
- }
-
- let firstClassName = null; // JSON集合中第一个class名称
- let serviceClassName = null;// JSON集合中带“@ServiceClass”注解的class名称
- let i = 0;
- for(var className in parseClasses) {
- if (++i == 1) {
- firstClassName = className;
- }
-
- let doxygen = parseClasses[className].doxygen;
- if (doxygen && doxygen.includes("@ServiceClass")) {
- serviceClassName = className;
- break;
- }
- }
-
- if (parseClasses.length == 1) {
- // h文件中只有唯一的一个类,基于该类的接口定义生成service
- rootInfo.serviceName = firstClassName;
- let classInfo = createClassInfo(parseClasses[firstClassName]);
- rootInfo.class.push(classInfo);
- } else {
- // h文件中有多个类,基于带@ServiceClass注解的类生成service
- if (serviceClassName == null) {
- NapiLog.logError("There must be one class that contains @ServiceClass annotations.");
- return;
- }
- rootInfo.serviceName = serviceClassName;
- let classInfo = createClassInfo(parseClasses[serviceClassName]);
- rootInfo.class.push(classInfo);
- }
-}
-
-function doAnalyze(hFilePath, cmdParam) {
- let parseResult = parseFileAll(hFilePath);
- parseResult.isInclude = false;
- AllParseFileList.push(parseResult);
- let rootInfo = {
- "serviceName": "",
- "nameSpace": [],
- "class": [],
- "includes": [],
- "using": [],
- "serviceId": cmdParam.serviceId == null ? "9002" : cmdParam.serviceId,
- "rawContent": parseResult.rawContent
- }
-
- analyzeNameSpace(rootInfo, parseResult);
- analyzeClasses(rootInfo, parseResult.classes);
- rootInfo.includes = parseResult.includes;
- rootInfo.using = parseResult.using;
- return rootInfo;
-}
-
-module.exports = {
- doAnalyze
-}
diff --git a/hdc/service/service-gen/src/gen/fileTemplate.js b/hdc/service/service-gen/src/gen/fileTemplate.js
deleted file mode 100755
index 62ae92debfd4fee9f94349188870a83795dba379..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/gen/fileTemplate.js
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-let iServiceHTemplate = `#ifndef I_[marcoName]_SERVICE_H
-#define I_[marcoName]_SERVICE_H
-
-[includes]
-#include "iremote_broker.h"
-#include "iremote_proxy.h"
-[using]
-
-namespace OHOS {
-namespace [serviceName] {
-[dependClasses]
-class I[className]Service : public OHOS::IRemoteBroker {
-public:
- enum {
- [funcEnum]
- };
-
- DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.[serviceName].I[className]Service");
-public:
- [functions]
-};
-[marshallFunctions]
-} // namespace [serviceName]
-} // namespace OHOS
-#endif // I_[marcoName]_SERVICE_H
-`;
-let proxyHTemplate = `#ifndef [marcoName]_PROXY_H
-#define [marcoName]_PROXY_H
-#include "message_parcel.h"
-#include "parcel.h"
-#include "iremote_broker.h"
-#include "iremote_proxy.h"
-#include "[iServiceHInclude]"
-
-namespace OHOS {
-namespace [serviceName] {
-class [className]Proxy : public IRemoteProxy {
-public:
- explicit [className]Proxy(const sptr &impl);
- ~[className]Proxy() = default;
- [functions]
-private:
- static inline BrokerDelegator<[className]Proxy> delegator_;
-};
-
-class [className]DeathRecipient : public IRemoteObject::DeathRecipient {
-public:
- virtual void OnRemoteDied(const wptr &remote) override;
- [className]DeathRecipient();
- virtual ~[className]DeathRecipient();
-};
-} // namespace [serviceName]
-} // namespace OHOS
-#endif // [marcoName]_PROXY_H
-`;
-
-let stubHTemplate = `#ifndef [marcoName]_STUB_H
-#define [marcoName]_STUB_H
-#include "iremote_stub.h"
-#include "message_parcel.h"
-#include "parcel.h"
-#include "[iServiceHInclude]"
-
-namespace OHOS {
-namespace [serviceName] {
-class [className]Stub : public IRemoteStub {
-public:
- [className]Stub();
- virtual ~[className]Stub();
- int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
- MessageOption &option) override;
-private:
- using [className]InnerFunc = ErrCode ([className]Stub::*)(MessageParcel &data, MessageParcel &reply);
- [innerFuncDef]
- std::unordered_map innerFuncs_;
-};
-} // namespace [serviceName]
-} // namespace OHOS
-#endif // [marcoName]_STUB_H`;
-
-let serviceHTemplate = `#ifndef [marcoName]_SERVICE_H
-#define [marcoName]_SERVICE_H
-#include "ipc_skeleton.h"
-#include "system_ability.h"
-#include "[stubHInclude]"
-
-namespace OHOS {
-namespace [serviceName] {
-// Business implementation
-class [className]Service : public SystemAbility, public [className]Stub {
-public:
- DECLARE_SYSTEM_ABILITY([className]Service);
- DISALLOW_COPY_AND_MOVE([className]Service);
- explicit [className]Service(int32_t systemAbilityId, bool runOnCreate = true);
- ~[className]Service() override;
-
- // Business implementation
- [functions]
-
- // implement SystemAbility methods
- void OnStart() override;
- void OnStop() override;
-};
-}
-}
-#endif // [marcoName]_SERVICE_H`;
-
-let proxyCppTemplate = `#include "[proxyHInclude]"
-using namespace std;
-
-namespace OHOS {
-namespace [serviceName] {
-[className]Proxy::[className]Proxy(const sptr &impl) : IRemoteProxy(impl){}
-
-[remoteFuncImpl]
-/**
- * @brief Notify that a remote object died.
- * It's called when the linked remote object died.
- *
- * @param remote The died IRemoteObject handler of the remote object
- */
-void [className]DeathRecipient::OnRemoteDied(const wptr &remote)
-{
-
-}
-
-[className]DeathRecipient::[className]DeathRecipient()
-{
-}
-
-[className]DeathRecipient::~[className]DeathRecipient()
-{
-}
-
-} // namespace [serviceName]
-} // namespace OHOS
-`;
-let proxyFuncTemplate = `[retType] [className]Proxy::[funcName]([params])
-{
- int retCode;
- MessageParcel data, reply;
- MessageOption option;
- data.WriteInterfaceToken(GetDescriptor());
- [writeData]
- retCode = Remote()->SendRequest([funcEnum], data, reply, option);
- retCode = reply.ReadInt32();
- if (retCode != ERR_OK) {
-
- }
-
- [readReply]
-}\n\n`;
-
-let stubCppTemplate = `#include "[stubHInclude]"
-using namespace std;
-
-namespace OHOS {
-namespace [serviceName] {
-
-[className]Stub::[className]Stub()
-{
- [innerFuncMap]
-}
-
-[className]Stub::~[className]Stub()
-{
- innerFuncs_.clear();
-}
-
-int [className]Stub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
- MessageOption &option)
-{
- std::u16string descriptor = [className]Stub::GetDescriptor();
- std::u16string remoteDescriptor = data.ReadInterfaceToken();
- if (descriptor != remoteDescriptor) {
- return OBJECT_NULL;
- }
- auto itFunc = innerFuncs_.find(code);
- if (itFunc != innerFuncs_.end()) {
- auto memberFunc = itFunc->second;
- if (memberFunc != nullptr) {
- return (this->*memberFunc)(data, reply);
- }
- }
- return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
-}
-
-[innerFuncImpl]
-
-} // namespace [serviceName]
-} // namespace OHOS
-`;
-
-let stubInnerFuncTemplate = `ErrCode [className]Stub::[funcName]Inner(MessageParcel &data, MessageParcel &reply)
-{
- int retCode = ERR_OK;
- [readData]
- [writeReply]
- return retCode;
-}
-`;
-
-let serviceCppTemplate = `#include "[serviceHInclude]"
-#include "system_ability_definition.h"
-using namespace std;
-
-namespace OHOS {
-namespace [serviceName] {
-// [marcoName]_SERVICE_ID should be defined in system_ability_definition.h
-REGISTER_SYSTEM_ABILITY_BY_ID([className]Service, [marcoName]_SERVICE_ID, true)
-
-[className]Service::[className]Service(int32_t systemAbilityId, bool runOnCreate)
- :SystemAbility(systemAbilityId, runOnCreate)
-{
-
-}
-
-[className]Service::~[className]Service(){
-
-}
-
-void [className]Service::OnStart()
-{
- // Publish(): Register service by method ISystemAbilityManager->AddSystemAbility()
- bool isPublished = Publish(this);
- if (!isPublished) {
- // Log: Failed to publish the service
- }
- return;
-}
-
-void [className]Service::OnStop()
-{
-
-}
-
-[serviceFuncImpl]
-}
-}`;
-
-let serviceFuncImplTemplate = `[retType] [className]Service::[funcName]([params])
-{
- [retType] ret;
- // TODO: Invoke the business implementation
- return ret;
-}
-`;
-let clientCppTemplate = `#include "[proxyHInclude]"
-#include "ipc_skeleton.h"
-#include "system_ability_definition.h"
-#include "iservice_registry.h"
-
-using namespace std;
-using namespace OHOS;
-using namespace OHOS::[serviceName];
-
-sptr getRemoteProxy()
-{
- auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
- if (saMgr == nullptr) {
- return nullptr;
- }
-
- // [marcoName]_SERVICE_ID should be defined in system_ability_definition.h
- sptr object = saMgr->GetSystemAbility([marcoName]_SERVICE_ID);
- sptr proxy = nullptr;
- if (object != nullptr) {
- sptr death(new [className]DeathRecipient());
- object->AddDeathRecipient(death.GetRefPtr());
- proxy = iface_cast(object);
- }
-
- if (proxy == nullptr) {
- return nullptr;
- }
-
- return proxy;
-}
-
-int main(int argc, char *argv[])
-{
- auto proxy = getRemoteProxy();
- // TODO: Invoke remote method by proxy
- [clientFuncInvoke]
-
- IPCSkeleton::JoinWorkThread();
- return 0;
-}`;
-
-let buildGnTemplate = `import("//build/ohos.gni")
-
-ohos_shared_library("[lowServiceName]service") {
- sources = [
- "//[lowServiceName]service/src/[iServiceCppFile]",
- "//[lowServiceName]service/src/[stubCppFile]",
- "//[lowServiceName]service/src/[serviceCppFile]"
- ]
- include_dirs = [
- "//[lowServiceName]service/include",
- "//[lowServiceName]service/interface",
- "//utils/native/base/include"
- ]
-
- deps = [
- "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara",
- "//utils/native/base:utils",
- ]
-
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr_standard:samgr_proxy",
- "startup_l2:syspara",
- ]
-
- part_name = "[lowServiceName]service_part"
- subsystem_name = "[lowServiceName]service"
-}
-
-ohos_executable("[lowServiceName]client") {
- sources = [
- "//[lowServiceName]service/src/[iServiceCppFile]",
- "//[lowServiceName]service/src/[proxyCppFile]",
- "//[lowServiceName]service/src/[clientCppFile]"
- ]
-
- include_dirs = [
- "//[lowServiceName]service/include",
- "//[lowServiceName]service/interface",
- "//utils/native/base/include"
- ]
-
- deps = [
- "//utils/native/base:utils",
- ]
-
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "samgr_standard:samgr_proxy",
- ]
-
- part_name = "[lowServiceName]service_part"
- subsystem_name = "[lowServiceName]service"
-}
-`;
-
-let bundleJsonTemplate = `{
- "name": "@ohos/[lowServiceName]service",
- "description": "system ability framework test",
- "homePage": "https://gitee.com/",
- "version": "3.1",
- "license": "Apache License 2.0",
- "repository": "",
- "publishAs": "code-segment",
- "segment": {
- "destPath": "[lowServiceName]service"
- },
- "dirs": {},
- "scripts": {},
- "component": {
- "name": "[lowServiceName]service_part",
- "subsystem": "[lowServiceName]service",
- "adapted_system_type": [
- "standard"
- ],
- "rom": "2048KB",
- "ram": "~4096KB",
- "deps": {
- "components": [
- "hiviewdfx_hilog_native",
- "ipc",
- "samgr_standard",
- "utils_base",
- "safwk",
- "startup_l2"
- ],
- "third_party": [ "libxml2" ]
- },
- "build": {
- "sub_component": [
- "//[lowServiceName]service:[lowServiceName]service",
- "//[lowServiceName]service/sa_profile:[lowServiceName]service_sa_profile",
- "//[lowServiceName]service:[lowServiceName]client",
- "//[lowServiceName]service/etc:[lowServiceName]_service_init"
- ],
- "inner_kits": [
- ],
- "test": [
- ]
- }
- }
-}`;
-
-let profileGnTemplate = `import("//build/ohos.gni")
-import("//build/ohos/sa_profile/sa_profile.gni")
-
-ohos_sa_profile("[lowServiceName]service_sa_profile") {
- sources = [ "[serviceId].xml" ]
-
- part_name = "[lowServiceName]service_part"
-}
-`;
-
-let profileXmlTemplate = `
-
- [lowServiceName]service_sa
-
- [serviceId]
- lib[lowServiceName]service.z.so
- true
- false
- 1
-
-
-`;
-
-let serviceCfgTemplate = `{
- "services" : [{
- "name" : "[lowServiceName]service",
- "path" : ["/system/bin/sa_main", "/system/profile/[lowServiceName]service_sa.xml"],
- "uid" : "system",
- "gid" : ["system", "shell"]
- }
- ]
-}
-`;
-
-let serviceCfgGnTemplate = `import("//build/ohos.gni")
-
-ohos_prebuilt_etc("[lowServiceName]_service_init") {
- source = "[lowServiceName]_service.cfg"
- relative_install_dir = "init"
- part_name = "[lowServiceName]service_part"
- subsystem_name = "[lowServiceName]service"
-}
-`;
-
-let iServiceCppTemplate = `#include "[iServiceHInclude]"
-`;
-
-module.exports = {
- iServiceHTemplate,
- proxyHTemplate,
- stubHTemplate,
- serviceHTemplate,
- proxyCppTemplate,
- proxyFuncTemplate,
- stubCppTemplate,
- stubInnerFuncTemplate,
- serviceCppTemplate,
- serviceFuncImplTemplate,
- clientCppTemplate,
- buildGnTemplate,
- bundleJsonTemplate,
- profileGnTemplate,
- profileXmlTemplate,
- serviceCfgTemplate,
- serviceCfgGnTemplate,
- iServiceCppTemplate
-}
\ No newline at end of file
diff --git a/hdc/service/service-gen/src/gen/generate.js b/hdc/service/service-gen/src/gen/generate.js
deleted file mode 100755
index 945adeef1d8791d96a356957cd2013e339b5b115..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/gen/generate.js
+++ /dev/null
@@ -1,726 +0,0 @@
-
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const { NapiLog } = require("../tools/NapiLog");
-const { replaceAll, getTab } = require("../tools/tool");
-const re = require("../tools/re");
-const { iServiceHTemplate, proxyHTemplate, stubHTemplate, serviceHTemplate, proxyCppTemplate,
- proxyFuncTemplate, stubCppTemplate, stubInnerFuncTemplate, serviceCppTemplate, serviceFuncImplTemplate,
- clientCppTemplate, buildGnTemplate, bundleJsonTemplate, profileGnTemplate, profileXmlTemplate, serviceCfgTemplate,
- serviceCfgGnTemplate, iServiceCppTemplate } = require("./fileTemplate");
-const { DATA_W_MAP, DATA_R_MAP, VECTOR_W_MAP, VECTOR_R_MAP, getParcelType, AllParseFileList, MarshallInfo,
- ProcessingClassList} = require("../tools/common");
-
-let rootHFileSrc = ""; // .h文件的源码
-let dependSrcList = []; //在.h文件中定义并被接口使用到的class/struct类定义源码集合(接口没用到的class定义就不需要了)
-let marshallFuncList = []; // class类的消息序列化方法代码集合
-
-let fileContent = {
- "iServiceHFile": {},
- "proxyHFile": {},
- "stubHFile": {},
- "serviceHFile": {},
- "proxyCppFile": {},
- "stubCppFile": {},
- "serviceCppFile": {},
- "clientCppFile": {},
- "buildGnFile": {},
- "bundleJsonFile": {},
- "profileGnFile": {},
- "profileXmlFile": {},
- "serviceCfgFile": {},
- "serviceCfgGnFile": {},
- "iServiceCppFile": {},
-};
-
-function getIncludeStr(includeList) {
- let includeStr = "";
- for (let i = 0; i < includeList.length; ++i) {
- includeStr += "#include " + includeList[i] + "\n";
- }
- return includeStr;
-}
-
-function getUsingStr(usingList) {
- let usingStr = "";
- for (usingName in usingList) {
- usingStr += "\nusing " + usingList[usingName].raw_type + ";";
- }
- return usingStr;
-}
-
-function getFuncParamStr(params) {
- let paramStr = "";
- for (let i = 0; i < params.length; ++i) {
- paramStr += (i == 0) ? "" : ", ";
- paramStr += params[i].type + " " + params[i].name;
- }
- return paramStr;
-}
-
-/**
- * 获取class类型在原始.h文件中的定义源码段
- * @param className 待查找的class名称(可以是struct)
- * @param rawContent .h文件源码
- * @returns class类型在原始.h文件中的定义源码段
- */
- function getClassSrc(className, rawContent) {
- let beginPos = rawContent.indexOf(className);
- if( beginPos < 0) {
- NapiLog.logError("Warning: Can not find definition of " + className);
- return null;
- }
-
- let firstBracesPos = rawContent.indexOf("{", beginPos); // class后面第一个{的位置
- let firstSemiPos = rawContent.indexOf(";", beginPos); // class后面第一个分号的位置
- if ( (firstBracesPos < 0) || (firstSemiPos < firstBracesPos)) {
- // class定义后面找不到{},或先找到了结束符分号,视为该class没有相关的实现代码
- NapiLog.logError("Warning: Can not find implementation of " + className);
- return null;
- }
-
- let endPos = firstBracesPos + 1;
- let bracesCount = 1;
- for (; (endPos < rawContent.length) && (bracesCount != 0); ++endPos) {
- if (rawContent.charAt(endPos) == "{") {
- ++bracesCount;
- }
- if (rawContent.charAt(endPos) == "}") {
- --bracesCount;
- }
- }
-
- if (bracesCount != 0) {
- // 左右括号不匹配
- NapiLog.logError("Warning: The braces of %s do not match.".format(className));
- return null;
- }
-
- let classSrc = rawContent.substring(beginPos, endPos);
- return classSrc;
-}
-
-/**
- * 查看变量类型是否为class/struct类型,是否已生成指定的打包函数
- * @param vType 变量类型
- * @returns [class对应的打包函数(没有为null), class结构信息(没找到为null)]
- */
-function findClassGenInfo(vType) {
- let marshallInfo = null;
- for (let i = 0; i < marshallFuncList.length; ++i) {
- if (marshallFuncList[i].className == vType) {
- marshallInfo = marshallFuncList[i].marshallFuncs;
- }
- }
-
- if (marshallInfo) {
- // 该class已经有生成好的包装代码,就不用再到原始代码结构体AllParseFileList中去查找了。
- return [marshallInfo, null];
- }
- let classInfo = AllParseFileList.findClassByName(vType);
- return [null, classInfo];
-}
-
-function findGetSet(propName, classInfo) {
- let upperName = propName.replace(propName[0], propName[0].toUpperCase());
- let getName = "get" + upperName;
- let setName = "set" + upperName;
- let findGet = false;
- let findSet = false;
- let result = null;
- for (let i = 0; i < classInfo.methods.public.length; ++i) {
- if (getName == classInfo.methods.public[i].name) {
- findGet = true;
- }
- if (setName == classInfo.methods.public[i].name) {
- findSet = true;
- }
- }
- if (findGet && findSet) {
- // get和set方法必须同时具备,成员对象属性才能序列化/反序列化,缺一不可。
- result = {"name": propName, "getName": getName, "setName": setName};
- }
- return result;
-}
-
-function privatePropMashall(parcelName, objName, classInfo, marshallInfo) {
- let properties = classInfo.properties.protected.concat(classInfo.properties.private);
- let propFuncs = []; // 保存成员属性对应的get/set方法
- for (let i = 0; i < properties.length; ++i) {
- let getSetInfo = findGetSet(properties[i].name, classInfo);
- if (getSetInfo != null) {
- getSetInfo.type = properties[i].type;
- propFuncs.push(getSetInfo);
- } else {
- NapiLog.logError(
- "Warning: Can not find get/set method of %s.%s, the property will be ignored in remote request."
- .format(classInfo.name, properties[i].name));
- }
- }
- let writePropStr = "";
- let readPropStr = "";
- let tab = getTab(1);
- for (let i = 0; i < propFuncs.length; ++i) {
- writePropStr += "\n" + tab;
- writePropStr += genWrite(objName + "." + propFuncs[i].getName + "()", parcelName, propFuncs[i].type);
-
- readPropStr += "\n" + tab;
- let destObj = {
- "name": objName + "." + propFuncs[i].name,
- "setFunc": objName + "." + propFuncs[i].setName,
- "type": propFuncs[i].type
- };
- readPropStr += genRead(parcelName, destObj);
- }
- marshallInfo.marshallFuncH = marshallInfo.marshallFuncH.replace("[privateMarshall]", writePropStr);
- marshallInfo.unmarshallFuncH = marshallInfo.unmarshallFuncH.replace("[privateUnmarshall]", readPropStr);
-}
-
-function publicPropMashall(parcelName, objName, classInfo, marshallInfo) {
- let properties = classInfo.properties.public;
- let writePropStr = "";
- let readPropStr = "";
- let tab = getTab(1);
- for (let i = 0; i < properties.length; ++i) {
- writePropStr += "\n" + tab;
- writePropStr += genWrite(objName + "." + properties[i].name, parcelName, properties[i].type);
-
- readPropStr += "\n" + tab;
- let destObj = {
- "name": objName + "." + properties[i].name,
- "setFunc": null,
- "type": properties[i].type
- };
- readPropStr += genRead(parcelName, destObj);
- }
- marshallInfo.marshallFuncH = marshallInfo.marshallFuncH.replace("[publicMarshall]", writePropStr);
- marshallInfo.unmarshallFuncH = marshallInfo.unmarshallFuncH.replace("[publicUnmarshall]", readPropStr);
-}
-
-/**
- * 保存远程接口用到的相关class/struct定义代码,以便后面写入到生成的iservice.h接口文件中
- * @param classInfo 接口使用到的class信息
- */
-function saveClassSrc(classInfo) {
- if (classInfo.isInclude) {
- // 只有service class所在的主.h文件中定义的class/struct需要保存其源码
- // 定义在其它include文件中的类,不需要保存定义源码。
- return;
- }
- for (let i = 0; i < dependSrcList.length; ++i) {
- if (dependSrcList[i].name == classInfo.name){
- // 该class的定义源码已经保存过了。
- return;
- }
- }
-
- let srcObj = {};
- srcObj.name = classInfo.name;
- let className = classInfo.declaration_method + " " + classInfo.name;
-
- // 从.h源码中获取该class定义的源码段
- srcObj.srcCode = getClassSrc(className, rootHFileSrc);
- if (srcObj.srcCode != null) {
- dependSrcList.push(srcObj);
- }
-}
-
-/**
- * 创建class对象序列化/反序列化代码数据结构
- * @param classInfo class类信息
- */
-function createMarshallInfo(classInfo) {
- saveClassSrc(classInfo);
- let newMarshall = new MarshallInfo(classInfo.name);
- let objName = classInfo.name.toLowerCase();
- newMarshall.marshallFuncName = "marshalling" + classInfo.name;
- newMarshall.unmarshallFuncName = "unmarshalling" + classInfo.name;
- // 为了marshall方法的入参能同时支持左值引用marshall(xx.obj)和右值引用marshall(xx.getObj()),这里采用万能引用模板来实现
- newMarshall.marshallFuncH = replaceAll(
- "\ntemplate // T should be [className]& or [className]&&", "[className]", classInfo.name);
- newMarshall.marshallFuncH +=
- "\n%s bool %s(MessageParcel& data, T&& %s) {[publicMarshall][privateMarshall]\n return true;\n}\n"
- .format("__attribute__((unused)) static", newMarshall.marshallFuncName, objName);
- newMarshall.unmarshallFuncH =
- "\n%s bool %s(MessageParcel& data, %s& %s) {[publicUnmarshall][privateUnmarshall]\n return true;\n}\n"
- .format("__attribute__((unused)) static", newMarshall.unmarshallFuncName, classInfo.name, objName);
-
- let marshallInfo = {
- "className": classInfo.name,
- "marshallFuncs": newMarshall
- }
- // 这里必须先将class放入处理列表中,以免后续的属性代码生成过程中再次遇到该class类型造成无限循环嵌套。
- ProcessingClassList.push(marshallInfo);
-
- // 继续生成属性代码
- publicPropMashall("data", objName, classInfo, newMarshall);
- privatePropMashall("data", objName, classInfo, newMarshall);
-
- marshallFuncList.push(marshallInfo);
- return newMarshall;
-}
-
-/**
- * 生成class对象转换remote消息buffer(parcel data)的代码段
- * @param objName 待写入的class对象名
- * @param parcelName 写入目标(parcel data)变量的名称
- * @param marshallInfo class对应的打包函数(没有为null)
- * @param classInfo class结构信息
- */
-function genClassWriteString(objName, parcelName, marshallInfo, classInfo) {
- let marshall = marshallInfo;
- if (!marshall) {
- // class的序列化代码还未生成,查看是否已在待处理列表中
- let ProcessingClass = ProcessingClassList.findByName(classInfo.name);
- if (ProcessingClass == null) {
- // 待处理列表中没有,则创建该class的读写代码数据。
- marshall = createMarshallInfo(classInfo);
- } else {
- // 待处理列表中存在(说明该class已经在递归生成代码的执行路径中),直接使用即将生成的marshalling方法名
- marshall = ProcessingClass.marshallFuncs;
- }
- }
- return "%s(%s, %s);".format(marshall.marshallFuncName, parcelName, objName);
-}
-
-/**
- * 生成从remote消息buffer(parcel data)中读取class对象的代码段
- * @param destObj 待读取的class对象信息
- * @param parcelName 待读取的(parcel data)变量的名称
- * @param marshallInfo class对应的打包函数(没有为null)
- * @param classInfo class结构信息
- */
- function genClassReadString(destObj, parcelName, marshallInfo, classInfo) {
- let marshall = marshallInfo;
- if (!marshall) {
- marshall = createMarshallInfo(classInfo);
- }
- let readStr = "";
- if (destObj.setFunc) { // 有set方法的是私有成员,需要生成set代码
- let className = destObj.type;
- readStr = "%s tmp%s;\n %s(%s, tmp%s);\n %s(tmp%s);".format(className, className,
- marshall.unmarshallFuncName, parcelName, className, destObj.setFunc, className);
- } else {
- readStr = "%s(%s, %s);".format(marshall.unmarshallFuncName, parcelName, destObj.name);
- }
- return readStr;
-}
-
-/**
- * 生成vector集合写入remote消息buffer(parcel data)的代码段
- *
- * @param vectorName 待写入的vector变量名
- * @param parcelName 写入目标(parcel data)变量的名称
- * @param vecType vector变量类型
- * @param matchs vector类型的正则匹配结果
- * @returns 生成的vector变量序列化打包代码段
- */
- function genVectorWrite(vectorName, parcelName, vecType, matchs) {
- let rawType = re.getReg(vecType, matchs.regs[2]);
- let parcelType = getParcelType(rawType);
- let wFunc = VECTOR_W_MAP.get(parcelType);
- if (!wFunc) {
- NapiLog.logError("Unsupport writing with type: " + vecType);
- return "";
- }
- return "%s.%s(%s);".format(parcelName, wFunc, vectorName);
-}
-
-/**
- * 生成c参数写入remote消息buffer(parcel data)的代码段
- * @param srcName 待写入的c变量名
- * @param parcelName 写入目标(parcel data)变量的名称
- * @param vType c变量类型
- * @returns 生成的代码段
- */
-function genWrite(srcName, parcelName, vType) {
- let matchs = re.match("(std::)?vector<([\x21-\x7e]+)[ ]?>", vType);
- if (matchs) {
- // vector类型变量包装成parcel data
- return genVectorWrite(srcName, parcelName, vType, matchs);
- }
-
- let parcelType = getParcelType(vType);
- let wFunc = DATA_W_MAP.get(parcelType);
- if (!wFunc) {
- let result = findClassGenInfo(vType);
- if (!result[0] && !result[1]) {
- NapiLog.logError("Unsupport writing with type: " + vType);
- return "";
- }
-
- // class与struct类型变量包装成parcel data
- return genClassWriteString(srcName, parcelName, result[0], result[1]);
- }
-
- // 基本类型变量包装成parcel data
- return "%s.%s(%s);".format(parcelName, wFunc, srcName);
-}
-
-/**
- * 生成从remote消息buffer(parcel data)中读取vector集合的代码段
- *
- * @param parcelName 待读取的消息buffer(parcel data)变量的名称
- * @param vectorName 待写入的vector变量名
- * @param vecType vector变量类型
- * @param matchs vector类型的正则匹配结果
- * @returns 生成的vector变量反序列化读取码段
- */
- function genVectorRead(parcelName, vectorName, vecType, matchs) {
- let rawType = re.getReg(vecType, matchs.regs[2]);
- let parcelType = getParcelType(rawType);
- let rFunc = VECTOR_R_MAP.get(parcelType);
- if (!rFunc) {
- NapiLog.logError("Unsupport reading with type: " + vecType);
- return "";
- }
- return "%s.%s(&(%s));".format(parcelName, rFunc, vectorName);
-}
-
-/**
- * 生成从remote消息buffer(parcel data)读取c参数的代码段
- * @param parcelName 待读取的parcel data变量名称
- * @param destObj 读取出的内容写入的c变量信息
- * @returns 生成的代码段
- */
-function genRead(parcelName, destObj) {
- let matchs = re.match("(std::)?vector<([\x21-\x7e]+)[ ]?>", destObj.type);
- if (matchs) {
- // 从parcel data中读取vector类型变量
- return genVectorRead(parcelName, destObj.name, destObj.type, matchs);
- }
-
- let parcelType = getParcelType(destObj.type);
- let rFunc = DATA_R_MAP.get(parcelType);
- if (!rFunc) {
- let result = findClassGenInfo(destObj.type);
- if (!result[0] && !result[1]) {
- NapiLog.logError("Unsupport reading with type: " + destObj.type);
- return "";
- }
-
- // 从parcel data中读取class与struct类型变量
- return genClassReadString(destObj, parcelName, result[0], result[1]);
- }
-
- // 从parcel data中读取基本类型变量
- let result = destObj.setFunc ? "%s(%s.%s());".format(destObj.setFunc, parcelName, rFunc)
- : "%s = %s.%s();".format(destObj.name, parcelName, rFunc) ;
- return result;
-}
-
-function genProxyFunc(funcInfo, className, paramStr) {
- let proxyFunc = replaceAll(proxyFuncTemplate, "[className]", className);
- proxyFunc = replaceAll(proxyFunc, "[funcName]", funcInfo.name);
- proxyFunc = replaceAll(proxyFunc, "[params]", paramStr);
- proxyFunc = replaceAll(proxyFunc, "[retType]", funcInfo.retType);
- proxyFunc = replaceAll(proxyFunc, "[funcEnum]", funcInfo.funcEnum);
-
- // 入参处理
- let writeDataStr = "";
- let tab = getTab(1);
- for (let i = 0; i < funcInfo.params.length; ++i) {
- let param = funcInfo.params[i];
- writeDataStr += (i == 0) ? "" : "\n" + tab;
- writeDataStr += genWrite(param.name, "data", param.type);
- }
- proxyFunc = replaceAll(proxyFunc, "[writeData]", writeDataStr);
-
- // 返回值处理
- let readReplyStr = "";
- if (funcInfo.retType != "void") {
- readReplyStr = "%s result;".format(funcInfo.retType);
- let destObj = {
- "name": "result",
- "setFunc": null,
- "type": funcInfo.retType
- };
- readReplyStr += "\n" + tab + genRead("reply", destObj);
- readReplyStr += "\n" + tab + "return result;";
- }
- proxyFunc = replaceAll(proxyFunc, "[readReply]", readReplyStr);
-
- return proxyFunc;
-}
-
-function genStubInnerFunc(funcInfo, className) {
- let innerFunc = replaceAll(stubInnerFuncTemplate, "[className]", className);
- innerFunc = replaceAll(innerFunc, "[funcName]", funcInfo.name);
-
- // 入参处理
- let readDataStr = ""; // 生成服务端读取客户端传参的代码段
- let tab = getTab(1);
- let innerParamStr = ""; // 调用业务方法时传入的入参列表
- for (let i = 0; i < funcInfo.params.length; ++i) {
- let param = funcInfo.params[i];
- let innerParamName = param.name + "Val";
- if (i > 0) {
- readDataStr += "\n" + tab;
- innerParamStr += " ,";
- }
-
- //将remote请求中的参数值读取到内部参数变量中
- readDataStr += "%s %s;".format(param.type, innerParamName); // 定义内部参数变量
- let destObj = {
- "name": param.name + "Val",
- "setFunc": null,
- "type": param.type
- };
- readDataStr += "\n" + tab + genRead("data", destObj);
- innerParamStr += innerParamName;
- }
- innerFunc = replaceAll(innerFunc, "[readData]", readDataStr);
-
- // 调用service的实际业务逻辑实现方法
- let writeReplyStr = ""; // 生成调用服务端实现并返回结果的代码段
- if (funcInfo.retType === "void") {
- writeReplyStr += "%s(%s); // call business implementation".format(funcInfo.name, innerParamStr);
- writeReplyStr += "\n" + tab + "reply.WriteInt32(retCode);";
- } else {
- writeReplyStr += "%s retVal = %s(%s); // call business implementation".format(
- funcInfo.retType, funcInfo.name, innerParamStr);
- writeReplyStr += "\n" + tab + "reply.WriteInt32(retCode);";
- writeReplyStr += "\n" + tab + genWrite("retVal", "reply", funcInfo.retType);
- }
- innerFunc = replaceAll(innerFunc, "[writeReply]", writeReplyStr);
- return innerFunc;
-}
-
-function genServiceFunc(funcInfo, className, paramStr) {
- let serviceFunc = replaceAll(serviceFuncImplTemplate, "[retType]", funcInfo.retType);
- serviceFunc = replaceAll(serviceFunc, "[className]", className);
- serviceFunc = replaceAll(serviceFunc, "[funcName]", funcInfo.name);
- serviceFunc = replaceAll(serviceFunc, "[params]", paramStr);
- return serviceFunc;
-}
-
-function genFunctions(classInfo, files) {
- let res = genFunctionCode(classInfo);
- files.iServiceH = replaceAll(files.iServiceH, "[funcEnum]", res.funcEnumStr);
- files.iServiceH = replaceAll(files.iServiceH, "[functions]", res.iServiceFuncH);
- files.proxyH = replaceAll(files.proxyH, "[functions]", res.proxyFuncH);
- files.stubH = replaceAll(files.stubH, "[innerFuncDef]", res.stubInnerFuncH);
- files.serviceH = replaceAll(files.serviceH, "[functions]", res.proxyFuncH);
- files.proxyCpp = replaceAll(files.proxyCpp, "[remoteFuncImpl]", res.proxyFuncCpp);
- files.stubCpp = replaceAll(files.stubCpp, "[innerFuncMap]", res.stubInnerFuncMap);
- files.stubCpp = replaceAll(files.stubCpp, "[innerFuncImpl]", res.stubInnerFuncCpp);
- files.serviceCpp = replaceAll(files.serviceCpp, "[serviceFuncImpl]", res.serviceFuncCpp);
- files.clientCpp = replaceAll(files.clientCpp, "[clientFuncInvoke]", res.clientFuncCpp);
-}
-
-function genFilesByTemplate(upperServiceName, lowServiceName, rootInfo) {
- let files = {};
- // 按模板生成.h和.cpp文件内容框架
- files.iServiceH = replaceAll(iServiceHTemplate, "[marcoName]", upperServiceName);
- files.proxyH = replaceAll(proxyHTemplate, "[marcoName]", upperServiceName);
- files.stubH = replaceAll(stubHTemplate, "[marcoName]", upperServiceName);
- files.serviceH = replaceAll(serviceHTemplate, "[marcoName]", upperServiceName);
- files.proxyCpp = proxyCppTemplate;
- files.stubCpp = stubCppTemplate;
- files.serviceCpp = replaceAll(serviceCppTemplate, "[marcoName]", upperServiceName);
- files.clientCpp = replaceAll(clientCppTemplate, "[marcoName]", upperServiceName);
- files.iServiceCpp = iServiceCppTemplate;
-
- // 按模板生成资源配置文件内容框架
- files.buildGn = replaceAll(buildGnTemplate, "[lowServiceName]", lowServiceName);
- files.buildGn = replaceAll(files.buildGn, "[stubCppFile]", fileContent.stubCppFile.name);
- files.buildGn = replaceAll(files.buildGn, "[serviceCppFile]", fileContent.serviceCppFile.name);
- files.buildGn = replaceAll(files.buildGn, "[proxyCppFile]", fileContent.proxyCppFile.name);
- files.buildGn = replaceAll(files.buildGn, "[clientCppFile]", fileContent.clientCppFile.name);
- files.buildGn = replaceAll(files.buildGn, "[iServiceCppFile]", fileContent.iServiceCppFile.name);
- files.bundleJson = replaceAll(bundleJsonTemplate, "[lowServiceName]", lowServiceName);
- files.profileGn = replaceAll(profileGnTemplate, "[lowServiceName]", lowServiceName);
- files.profileGn = replaceAll(files.profileGn, "[serviceId]", rootInfo.serviceId);
- files.profileXml = replaceAll(profileXmlTemplate, "[lowServiceName]", lowServiceName);
- files.profileXml = replaceAll(files.profileXml, "[serviceId]", rootInfo.serviceId);
- files.serviceCfg = replaceAll(serviceCfgTemplate, "[lowServiceName]", lowServiceName);
- files.serviceGnCfg = replaceAll(serviceCfgGnTemplate, "[lowServiceName]", lowServiceName);
- return files;
-}
-
-function replaceClassName(files, classInfo) {
- files.iServiceH = replaceAll(files.iServiceH, "[className]", classInfo.name);
- files.proxyH = replaceAll(files.proxyH, "[className]", classInfo.name);
- files.stubH = replaceAll(files.stubH, "[className]", classInfo.name);
- files.serviceH = replaceAll(files.serviceH, "[className]", classInfo.name);
- files.proxyCpp = replaceAll(files.proxyCpp, "[className]", classInfo.name);
- files.stubCpp = replaceAll(files.stubCpp, "[className]", classInfo.name);
- files.serviceCpp = replaceAll(files.serviceCpp, "[className]", classInfo.name);
- files.clientCpp = replaceAll(files.clientCpp, "[className]", classInfo.name);
-}
-
-function replaceServiceName(files, rootInfo) {
- files.iServiceH = replaceAll(files.iServiceH, "[serviceName]", rootInfo.serviceName);
- files.proxyH = replaceAll(files.proxyH, "[serviceName]", rootInfo.serviceName);
- files.stubH = replaceAll(files.stubH, "[serviceName]", rootInfo.serviceName);
- files.serviceH = replaceAll(files.serviceH, "[serviceName]", rootInfo.serviceName);
- files.proxyCpp = replaceAll(files.proxyCpp, "[serviceName]", rootInfo.serviceName);
- files.stubCpp = replaceAll(files.stubCpp, "[serviceName]", rootInfo.serviceName);
- files.serviceCpp = replaceAll(files.serviceCpp, "[serviceName]", rootInfo.serviceName);
- files.clientCpp = replaceAll(files.clientCpp, "[serviceName]", rootInfo.serviceName);
-}
-
-function replaceIncludes(files, rootInfo) {
- files.iServiceH = replaceAll(files.iServiceH, "[includes]", getIncludeStr(rootInfo.includes));
- files.proxyH = replaceAll(files.proxyH, "[iServiceHInclude]", fileContent.iServiceHFile.name);
- files.stubH = replaceAll(files.stubH, "[iServiceHInclude]", fileContent.iServiceHFile.name);
- files.serviceH = replaceAll(files.serviceH, "[stubHInclude]", fileContent.stubHFile.name);
- files.proxyCpp = replaceAll(files.proxyCpp, "[proxyHInclude]", fileContent.proxyHFile.name);
- files.stubCpp = replaceAll(files.stubCpp, "[stubHInclude]", fileContent.stubHFile.name);
- files.serviceCpp = replaceAll(files.serviceCpp, "[serviceHInclude]", fileContent.serviceHFile.name);
- files.clientCpp = replaceAll(files.clientCpp, "[proxyHInclude]", fileContent.proxyHFile.name);
- files.iServiceCpp = replaceAll(files.iServiceCpp, "[iServiceHInclude]", fileContent.iServiceHFile.name);
-}
-
-function replaceUsing(files, rootInfo) {
- files.iServiceH = replaceAll(files.iServiceH, "[using]", getUsingStr(rootInfo.using));
-}
-
-function genFileNames(lowServiceName, rootInfo) {
- fileContent.iServiceHFile.name = "i_%s_service.h".format(lowServiceName);
- fileContent.proxyHFile.name = "%s_service_proxy.h".format(lowServiceName);
- fileContent.stubHFile.name = "%s_service_stub.h".format(lowServiceName);
- fileContent.serviceHFile.name = "%s_service.h".format(lowServiceName);
- fileContent.proxyCppFile.name = "%s_service_proxy.cpp".format(lowServiceName);
- fileContent.stubCppFile.name = "%s_service_stub.cpp".format(lowServiceName);
- fileContent.serviceCppFile.name = "%s_service.cpp".format(lowServiceName);
- fileContent.clientCppFile.name = "%s_client.cpp".format(lowServiceName);
- fileContent.buildGnFile.name = "BUILD.gn";
- fileContent.bundleJsonFile.name = "bundle.json";
- fileContent.profileGnFile.name = "BUILD.gn";
- fileContent.profileXmlFile.name = rootInfo.serviceId + ".xml";
- fileContent.serviceCfgFile.name = "%s_service.cfg".format(lowServiceName);
- fileContent.serviceCfgGnFile.name = "BUILD.gn";
- fileContent.iServiceCppFile.name = "i_%s_service.cpp".format(lowServiceName);
-}
-
-function genFunctionCode(classInfo) {
- let funcList = classInfo.functions;
- let genResult = {}
- genResult.funcEnumStr = "";
- genResult.iServiceFuncH = ""; //i_service.h 方法定义
- genResult.proxyFuncH = ""; //proxy.h 方法定义
- genResult.stubInnerFuncH = ""; // stub.h 的inner方法定义
- genResult.proxyFuncCpp = ""; //proxy.cpp 方法实现
- genResult.stubInnerFuncMap = ""; // stub.cpp 的inner方法映射表
- genResult.stubInnerFuncCpp = ""; // stub.cpp 的inner方法实现
- genResult.serviceFuncCpp = ""; // service.cpp的方法实现
- genResult.clientFuncCpp = ""; // client.cpp 的inner方法定义
-
- let enumTab = getTab(2);
- let funcTab = getTab(1);
- for (var i = 0; i < funcList.length; ++i) {
- funcList[i].funcEnum = funcList[i].name.toUpperCase(); // remote方法的枚举值
- genResult.funcEnumStr += (i == 0) ? "" : ",\n" + enumTab;
- genResult.funcEnumStr += funcList[i].funcEnum;
-
- let paramStr = getFuncParamStr(funcList[i].params);
- genResult.iServiceFuncH += (i == 0) ? "" : "\n" + funcTab;
- genResult.iServiceFuncH += "virtual %s %s(%s) = 0;".format(funcList[i].retType, funcList[i].name, paramStr);
-
- genResult.proxyFuncH += (i == 0) ? "" : "\n" + funcTab;
- genResult.proxyFuncH += "%s %s(%s) override;".format(funcList[i].retType, funcList[i].name, paramStr);
-
- genResult.stubInnerFuncH += (i == 0) ? "" : "\n" + funcTab;
- genResult.stubInnerFuncH +=
- "ErrCode %sInner(MessageParcel &data, MessageParcel &reply);".format(funcList[i].name);
-
- genResult.proxyFuncCpp += genProxyFunc(funcList[i], classInfo.name, paramStr);
-
- genResult.stubInnerFuncMap += (i == 0) ? "" : "\n" + funcTab;
- genResult.stubInnerFuncMap += "innerFuncs_[%s] = &%sStub::%sInner;".format(
- funcList[i].funcEnum, classInfo.name, funcList[i].name);
-
- genResult.stubInnerFuncCpp += genStubInnerFunc(funcList[i], classInfo.name);
- genResult.serviceFuncCpp += genServiceFunc(funcList[i], classInfo.name, paramStr);
-
- genResult.clientFuncCpp += (i == 0) ? "" : "\n" + funcTab;
- genResult.clientFuncCpp += "// proxy->%s(%s);".format(funcList[i].name, paramStr);
- }
- return genResult;
-}
-
-function genMarshallFuncs(files) {
- let marshallFuncH = "";
- for (let i = 0; i < marshallFuncList.length; ++i) {
- marshallFuncH += marshallFuncList[i].marshallFuncs.marshallFuncH;
- marshallFuncH += marshallFuncList[i].marshallFuncs.unmarshallFuncH;
- }
- files.iServiceH = files.iServiceH.replace("[marshallFunctions]", marshallFuncH);
-}
-
-function genDependClasses(files) {
- let dependSrc = "";
- for (let i = 0; i < dependSrcList.length; ++i) {
- dependSrc += dependSrcList[i].srcCode + ";\n\n";
- }
- files.iServiceH = files.iServiceH.replace("[dependClasses]", dependSrc);
-}
-
-function doGenerate(rootInfo) {
- rootHFileSrc = rootInfo.rawContent;
- let lowServiceName = rootInfo.serviceName.toLowerCase();
- let upperServiceName = rootInfo.serviceName.toUpperCase();
-
- // 生成文件名
- genFileNames(lowServiceName, rootInfo);
-
- // 按模板生成.h和.cpp文件内容框架
- let files = genFilesByTemplate(upperServiceName, lowServiceName, rootInfo);
-
- // 替换文件includes
- replaceIncludes(files, rootInfo);
-
- // 替换文件using
- replaceUsing(files, rootInfo);
-
- // 替换namespace
- replaceServiceName(files, rootInfo);
-
- // 替换类名
- let classInfo = rootInfo.class[0]
- replaceClassName(files, classInfo);
-
- // 生成函数定义与实现
- genFunctions(classInfo, files);
-
- // 生成复合对象的序列化反序列化方法
- genMarshallFuncs(files);
-
- // 生成依赖的class定义代码
- genDependClasses(files);
-
- // 文件内容汇总
- fileContent.iServiceHFile.content = files.iServiceH;
- fileContent.proxyHFile.content = files.proxyH;
- fileContent.stubHFile.content = files.stubH;
- fileContent.serviceHFile.content = files.serviceH;
- fileContent.proxyCppFile.content = files.proxyCpp;
- fileContent.stubCppFile.content = files.stubCpp;
- fileContent.serviceCppFile.content = files.serviceCpp;
- fileContent.clientCppFile.content = files.clientCpp;
- fileContent.buildGnFile.content = files.buildGn;
- fileContent.bundleJsonFile.content = files.bundleJson;
- fileContent.profileGnFile.content = files.profileGn;
- fileContent.profileXmlFile.content = files.profileXml;
- fileContent.serviceCfgFile.content = files.serviceCfg;
- fileContent.serviceCfgGnFile.content = files.serviceGnCfg;
- fileContent.iServiceCppFile.content = files.iServiceCpp;
- return fileContent;
-}
-
-module.exports = {
- doGenerate
-}
diff --git a/hdc/service/service-gen/src/gen/header_parser.py b/hdc/service/service-gen/src/gen/header_parser.py
deleted file mode 100755
index 4cd66f6a11140f1b585bb76b785678a6b8492d93..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/gen/header_parser.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#
-# Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-import json
-import sys
-import CppHeaderParser
-
-if __name__ == "__main__":
- fileName = sys.argv[1];
- try:
- hjson = json.loads(CppHeaderParser.CppHeader(fileName).toJSON())
- print(json.dumps({
- "result": hjson
- }))
- except CppHeaderParser.CppParseError:
- print(CppHeaderParser.CppParseError)
- finally:
- pass
\ No newline at end of file
diff --git a/hdc/service/service-gen/src/gen/main.js b/hdc/service/service-gen/src/gen/main.js
deleted file mode 100755
index 25a1e24bb1056b34c0935b39b0a67be8eaea39a8..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/gen/main.js
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require("path");
-const stdio = require("stdio");
-const fs = require('fs');
-const re = require("../tools/re");
-
-const { NapiLog } = require("../tools/NapiLog");
-const { print } = require("../tools/tool");
-const analyze = require("./analyze");
-const gen = require("./generate");
-const { writeFile, createFolder } = require("../tools/FileRW");
-
-let ops = stdio.getopt({
- 'filename': { key: 'f', args: 1, description: ".h file", default: "" },
- 'out': { key: 'o', args: 1, description: "output directory", default: "." },
- 'loglevel': { key: 'l', args: 1, description: "Log Level: 0~3", default: "1" },
- 'serviceId': { key: 's', args: 1, description: "service register id: 9000~16777214", default: "9000" }
-});
-
-NapiLog.init(ops.loglevel, path.join("" + ops.out, "napi_gen.log"));
-
-let fileNames = ops.filename;
-var pathDir = ops.directory;
-if (fileNames == null && pathDir == null) {
- NapiLog.logInfo("fileNames and pathDir both cannot be empty at the same time");
-} else if (pathDir && pathDir != '') {
- readDirFiles();
-} else if (fileNames && fileNames != '') {
- readFiles();
-}
-
-function readFiles() {
- fileNames = fileNames.replace(/(^\s*)|(\s*$)/g, ''); // trim before and after espace
- let regex = ',';
- let filenameArray = fileNames.toString().split(regex);
-
- let n = filenameArray.length;
- for (let i = 0; i < n; i++) {
- let fileName = filenameArray[i];
- if (fileName !== ' ') {
- fileName = fileName.replace(/(^\s*)|(\s*$)/g, '');
- checkGenerate(fileName);
- }
- }
-}
-
-function readDirFiles() {
- fs.readdir(pathDir + '', function (err, files) {
- if (err) {
- NapiLog.logError('readdir file error' + err);
- return;
- }
- (function iterator(i) {
- if (i === files.length) {
- return;
- }
- fs.stat(path.join(pathDir + '', files[i]), function (err, data) {
- if (err) {
- NapiLog.logError('read file error' + err);
- return;
- }
- if (data.isFile()) {
- let fileName = files[i];
- checkGenerate(pathDir + '/' + fileName);
- }
- iterator(i + 1);
- });
- })(0);
- });
-}
-
-function wirte2Disk(fileInfo, destDir) {
- let filePath = re.pathJoin(destDir, fileInfo.name);
- writeFile(filePath, fileInfo.content);
-}
-
-function genServiceFile(fileName) {
- // 1. h文件解析保存为结构体
- let rootInfo = analyze.doAnalyze(fileName, ops);
-
- // 2. 根据结构体生成代码
- let fileContent = gen.doGenerate(rootInfo);
-
- // 3. 创建service工程目录
- let servicePath = re.pathJoin(ops.out, rootInfo.serviceName.toLowerCase() + "service");
- let etcPath = re.pathJoin(servicePath, "etc");
- let includePath = re.pathJoin(servicePath, "include");
- let interfacePath = re.pathJoin(servicePath, "interface");
- let profilePath = re.pathJoin(servicePath, "sa_profile");
- let srcPath = re.pathJoin(servicePath, "src");
- createFolder(servicePath);
- createFolder(etcPath);
- createFolder(includePath);
- createFolder(interfacePath);
- createFolder(profilePath);
- createFolder(srcPath);
-
- // 4. 生成代码保存为文件
- wirte2Disk(fileContent.serviceCfgFile, etcPath);
- wirte2Disk(fileContent.serviceCfgGnFile, etcPath);
- wirte2Disk(fileContent.proxyHFile, includePath);
- wirte2Disk(fileContent.stubHFile, includePath);
- wirte2Disk(fileContent.serviceHFile, includePath);
- wirte2Disk(fileContent.iServiceHFile, interfacePath);
- wirte2Disk(fileContent.profileGnFile, profilePath);
- wirte2Disk(fileContent.profileXmlFile, profilePath);
- wirte2Disk(fileContent.proxyCppFile, srcPath);
- wirte2Disk(fileContent.stubCppFile, srcPath);
- wirte2Disk(fileContent.serviceCppFile, srcPath);
- wirte2Disk(fileContent.clientCppFile, srcPath);
- wirte2Disk(fileContent.iServiceCppFile, srcPath);
- wirte2Disk(fileContent.buildGnFile, servicePath);
- wirte2Disk(fileContent.bundleJsonFile, servicePath);
-}
-
-function checkGenerate(fileName) {
- NapiLog.logInfo("check file []".format(fileName));
- let suffix = fileName.split('.').pop().toLowerCase();
- if (suffix === 'h') {
- NapiLog.logInfo("Generating service code from file " + fileName);
- genServiceFile(fileName);
- } else {
- NapiLog.logError('Only .h file is supported.');
- }
-}
-
-let ret = NapiLog.getResult();
-if (ret[0]) {
- print('success');
- NapiLog.logInfo('success');
-}
-else {
- print('Finish with error: ' + ret[1]);
- NapiLog.logInfo('Finish with error: ' + ret[1]);
-}
diff --git a/hdc/service/service-gen/src/tools/FileRW.js b/hdc/service/service-gen/src/tools/FileRW.js
deleted file mode 100755
index 97dcdf1c3457bd12cc6aaaa2d7c61bb1d09cac17..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/tools/FileRW.js
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-
-function utf8ArrayToStr(array) {
- var out, i, len, c;
- var char2, char3;
-
- out = "";
- len = array.length;
- i = 0;
- while (i < len) {
- c = array[i++];
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- out += String.fromCharCode(c);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- char2 = array[i++];
- out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- char2 = array[i++];
- char3 = array[i++];
- out += String.fromCharCode(((c & 0x0F) << 12) |
- ((char2 & 0x3F) << 6) |
- ((char3 & 0x3F) << 0));
- break;
- }
- }
-
- return out;
-}
-
-function stringToUint8Array(string, options = { stream: false }) {
- if (options.stream) {
- throw new Error(`Failed to encode: the 'stream' option is unsupported.`);
- }
- let pos = 0;
- const len = string.length;
- let at = 0; // output position
- let tlen = Math.max(32, len + (len >> 1) + 7); // 1.5x size
- let target = new Uint8Array((tlen >> 3) << 3); // ... but at 8 byte offset
-
- while (pos < len) {
- let value = string.charCodeAt(pos++);
- let isContinue = false;
- if (value >= 0xd800 && value <= 0xdbff) {
- if (pos < len) {// high surrogate
- const extra = string.charCodeAt(pos);
- if ((extra & 0xfc00) === 0xdc00) {
- ++pos;
- value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;
- }
- }
- if (value >= 0xd800 && value <= 0xdbff) {
- isContinue = true; // drop lone surrogate
- }
- }
-
- if (!isContinue) {
- // expand the buffer if we couldn't write 4 bytes
- if (at + 4 > target.length) {
- tlen += 8; // minimum extra
- tlen *= (1.0 + (pos / string.length) * 2); // take 2x the remaining
- tlen = (tlen >> 3) << 3; // 8 byte offset
-
- target = uint8Array(tlen, target);
- }
-
- let calculateResult = calculate(value, target, at)
- isContinue = calculateResult[0]
- target = calculateResult[1]
- at = calculateResult[2]
- }
- }
- return target.slice(0, at);
-}
-
-function calculate(value, target, at) {
- let isContinue = false
- if ((value & 0xffffff80) === 0) { // 1-byte
- target[at++] = value; // ASCII
- isContinue = true;
- } else if ((value & 0xfffff800) === 0) { // 2-byte
- target[at++] = ((value >> 6) & 0x1f) | 0xc0;
- } else if ((value & 0xffff0000) === 0) { // 3-byte
- target[at++] = ((value >> 12) & 0x0f) | 0xe0;
- target[at++] = ((value >> 6) & 0x3f) | 0x80;
- } else if ((value & 0xffe00000) === 0) { // 4-byte
- target[at++] = ((value >> 18) & 0x07) | 0xf0;
- target[at++] = ((value >> 12) & 0x3f) | 0x80;
- target[at++] = ((value >> 6) & 0x3f) | 0x80;
- } else {
- isContinue = true;
- }
- if (!isContinue) {
- target[at++] = (value & 0x3f) | 0x80;
- }
- return [isContinue, target, at]
-}
-
-function uint8Array(tlen, target) {
- const update = new Uint8Array(tlen);
- update.set(target);
- return update
-}
-
-function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
-}
-function writeFile(fn, str) {
- let data = stringToUint8Array(str);
- fs.writeFileSync(fn, data);
-}
-
-function createFolder(path) {
- if (fs.existsSync(path)) {
- return;
- }
- fs.mkdirSync(path)
-}
-
-module.exports = {
- readFile,
- writeFile,
- createFolder
-}
\ No newline at end of file
diff --git a/hdc/service/service-gen/src/tools/NapiLog.js b/hdc/service/service-gen/src/tools/NapiLog.js
deleted file mode 100755
index 6da323d91dc6931a190444c35631a2493968f92a..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/tools/NapiLog.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-const path = require("path");
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-class NapiLog {
- constructor() {
- }
-}
-NapiLog.LEV_NONE = 0;
-NapiLog.LEV_ERROR = 1;
-NapiLog.LEV_DEBUG = 2;
-NapiLog.LEV_INFO = 3;
-
-const LEV_STR = ["[NON]", "[ERR]", "[DBG]", "[INF]"]
-var logLevel = NapiLog.LEV_ERROR;
-var logFileName = null;
-var logResultMessage = [true, ""]
-
-function getDateString() {
- let nowDate = new Date();
- return nowDate.toLocaleString();
-}
-
-function saveLog(dateStr, levStr, detail) {
- if (logFileName) {
- let logStr = dateStr + " " + levStr + " " + detail + "\n";
- fs.appendFileSync(logFileName, logStr);
- }
-}
-
-NapiLog.init = function (level, fileName) {
- logLevel = level in [NapiLog.LEV_NONE, NapiLog.LEV_ERROR, NapiLog.LEV_DEBUG, NapiLog.LEV_INFO]
- ? level : NapiLog.LEV_ERROR;
- logFileName = fileName ? fileName : "napi_generator.log";
-}
-
-function getCallPath() {
- let callPath = ""
- let stackArray = new Error().stack.split('\n');
- for (let i = stackArray.length -1; i >=0 ; --i) {
- if (stackArray[i].indexOf("NapiLog.log") > 0 || stackArray[i].indexOf("Function.log") > 0) {
- let stackMsg = stackArray[i+1].trim()
- let leftIndex = stackMsg.indexOf("(")
- let rightIndex = stackMsg.indexOf(")")
-
- if (leftIndex > 0 && rightIndex > 0) {
- let funInfo = stackMsg.substring(0, leftIndex);
- let srcPath = stackMsg.substring(leftIndex + 1, rightIndex)
- let colNumIndex = srcPath.lastIndexOf(":")
- let colNum = srcPath.substring(colNumIndex + 1, srcPath.length)
- let lineNumIndex = srcPath.lastIndexOf(":", colNumIndex - 1)
- let lineNum = srcPath.substring(lineNumIndex + 1, colNumIndex)
- let filePath = srcPath.substring(0, lineNumIndex)
-
- callPath = "%s[%s(%s:%s)]".format(funInfo,filePath,lineNum,colNum)
- }
- break;
- }
- }
-
- return callPath;
-}
-
-function print(...args) {
- if (vscode) {
- vscode.window.showInformationMessage(...args);
- }
- console.log(args + "");
-}
-
-function recordLog(lev, ...args) {
- let origMsgInfo = args;
- let callPath = getCallPath();
- let dataStr = getDateString();
- let detail = args.join(" ");
- saveLog(dataStr + " " + callPath, LEV_STR[lev], detail);
- if (lev == NapiLog.LEV_ERROR) {
- logResultMessage = [false, detail];
- }
- let logStr = callPath + " " + detail;
- if (logLevel <= lev) return logStr;
- NapiLog.logInfo(origMsgInfo[0]);
- return logStr;
-}
-
-NapiLog.logError = function (...args) {
- let logInfo = recordLog(NapiLog.LEV_ERROR, args);
- print(logInfo);
-}
-
-NapiLog.logDebug = function (...args) {
- recordLog(NapiLog.LEV_DEBUG, args);
-}
-
-NapiLog.logInfo = function (...args) {
- recordLog(NapiLog.LEV_INFO, args);
-}
-
-NapiLog.getResult = function () {
- return logResultMessage;
-}
-
-module.exports = {
- NapiLog
-}
\ No newline at end of file
diff --git a/hdc/service/service-gen/src/tools/common.js b/hdc/service/service-gen/src/tools/common.js
deleted file mode 100755
index d241e6b221cfdb1f5e07ce6797ba0e12b05a317a..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/tools/common.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-// remote消息中变量类型名(key)与对应的写parcel方法名(value)的映射(参考parcel.h)
-const DATA_W_MAP = new Map(
- [["bool", "WriteBoolUnaligned"], ["int8_t", "WriteInt8"], ["uint8_t", "ReadUint8"],
- ["int16_t", "WriteInt16"], ["uint16_t", "WriteUint16"],
- ["int32_t", "WriteInt32"], ["uint32_t", "WriteUint32"], ["int64_t", "WriteInt64"], ["uint64_t", "WriteUint64"],
- ["float", "WriteFloat"], ["double", "WriteDouble"], ["char *", "WriteCString"], ["std::string", "WriteString"],
- ["string", "WriteString"]
-]);
-
-// remote消息中变量类型名(key)与对应的读parcel方法名(value)的映射(参考parcel.h)
-const DATA_R_MAP = new Map(
- [["bool", "ReadBoolUnaligned"], ["int8_t", "ReadInt8"], ["uint8_t", "ReadUint8"],
- ["int16_t", "ReadInt16"], ["uint16_t", "ReadUint16"],
- ["int32_t", "ReadInt32"], ["uint32_t", "ReadUint32"], ["int64_t", "ReadInt64"], ["uint64_t", "ReadUint64"],
- ["float", "ReadFloat"], ["double", "ReadDouble"], ["char *", "ReadCString"], ["std::string", "ReadString"],
- ["string", "ReadString"]
-]);
-
-// 常用类型转换表, 将C语言常见类型(key)转换为remote data读写函数使用的类型(value)
-// 例如 ErrCode 类型在框架中的系统原型为int类型,这里映射成int32_t,
-// 因为int32_t类型在 DATA_W_MAP/DATA_R_MAP 表中有对应的读写数据方法(WriteInt32/ReadInt32)
-const TYPE_DEF_MAP = new Map(
- [["ErrCode", "int32_t"], ["char", "int8_t"], ["short", "int16_t"], ["int", "int32_t"], ["long", "int64_t"],
- ["unsigned char", "uint8_t"], ["unsigned short", "uint16_t"], ["unsigned int", "uint32_t"],
- ["unsigned long", "uint64_t"], ["double_t", "double"], ["float_t", "float"], ["size_t", "double"],
- ["long long", "double"], ["long double", "double"]
-]);
-
-// remote消息中vector变量类型名(key)与对应的写parcel方法名(value)的映射(参考parcel.h)
-const VECTOR_W_MAP = new Map(
- [["bool", "WriteBoolVector"], ["int8_t", "WriteInt8Vector"], ["uint8_t", "WriteUInt8Vector"],
- ["int16_t", "WriteInt16Vector"], ["uint16_t", "WriteUInt16Vector"], ["int32_t", "WriteInt32Vector"],
- ["uint32_t", "WriteUInt32Vector"], ["int64_t", "WriteInt64Vector"], ["uint64_t", "WriteUInt64Vector"],
- ["float", "WriteFloatVector"], ["double", "WriteDoubleVector"], ["u16string", "WriteString16Vector"],
- ["std::string", "WriteStringVector"], ["string", "WriteStringVector"]
-]);
-
-// remote消息中vector变量类型名(key)与对应的读parcel方法名(value)的映射(参考parcel.h)
-const VECTOR_R_MAP = new Map(
- [["bool", "ReadBoolVector"], ["int8_t", "ReadInt8Vector"], ["uint8_t", "ReadUInt8Vector"],
- ["int16_t", "ReadInt16Vector"], ["uint16_t", "ReadUInt16Vector"], ["int32_t", "ReadInt32Vector"],
- ["uint32_t", "ReadUInt32Vector"], ["int64_t", "ReadInt64Vector"], ["uint64_t", "ReadUInt64Vector"],
- ["float", "ReadFloatVector"], ["double", "ReadDoubleVector"], ["u16string", "ReadString16Vector"],
- ["std::string", "ReadStringVector"], ["string", "ReadStringVector"]
-]);
-
-function getParcelType(srcType) {
- let parcelType = TYPE_DEF_MAP.get(srcType);
- return parcelType === undefined ? srcType : parcelType;
-}
-
-class MarshallInfo {
- constructor(className) {
- this.className = className;
- this.marshallFuncName = "";
- this.marshallFuncStr = "";
- this.unmarshallFuncName = "";
- this.unmarshallFuncStr = "";
- }
-}
-
-class AllParseFileList { }
-AllParseFileList.parseFile_ = [];
-AllParseFileList.push = function (ifs) {
- AllParseFileList.parseFile_.push(ifs)
-}
-AllParseFileList.pop = function () {
- AllParseFileList.parseFile_.pop()
-}
-AllParseFileList.clearAll = function () {
- AllParseFileList.parseFile_.splice(0, AllParseFileList.parseFile_.length)
-}
-AllParseFileList.findClassByName = function (destClassName) {
- for (let i = 0; i < AllParseFileList.parseFile_.length; ++i) {
- let classes = AllParseFileList.parseFile_[i].classes;
- for (let className in classes) {
- if (className == destClassName) {
- classes[className].isInclude = AllParseFileList.parseFile_[i].isInclude;
- return classes[className];
- }
- }
- }
- return null;
-}
-
-
-/**
- * 记录正在生成序列化代码的类名,防止嵌套循环
- */
-class ProcessingClassList { }
-ProcessingClassList.classes_ = [];
-ProcessingClassList.push = function (classObj) {
- if (this.findByName(classObj.className) != null) {
- // 已存在的class不重复添加
- return;
- }
- ProcessingClassList.classes_.push(classObj)
-}
-ProcessingClassList.clearAll = function () {
- ProcessingClassList.classes_.splice(0, ProcessingClassList.classes_.length)
-}
-ProcessingClassList.findByName = function (className) {
- for (let i = 0; i < ProcessingClassList.classes_.length; ++i) {
- if (ProcessingClassList.classes_[i].className == className) {
- return ProcessingClassList.classes_[i];
- }
- }
- return null;
-}
-
-module.exports = {
- DATA_W_MAP, DATA_R_MAP, VECTOR_W_MAP, VECTOR_R_MAP, getParcelType, AllParseFileList, MarshallInfo,
- ProcessingClassList
-}
-
diff --git a/hdc/service/service-gen/src/tools/re.js b/hdc/service/service-gen/src/tools/re.js
deleted file mode 100755
index 4b81144f2c3b91d556c2d7e9b594bc6ca3061ede..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/tools/re.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-
-function search(ss, data) {
- ss = replaceAll(ss, "\\.", "\\.")
- let reg = new RegExp(ss);
- let tt = reg.exec(data);
- if (tt == null) return null;
- let ret = { "regs": [] }
- for (let i = 0; i < tt.length; i++) {
- let p = data.indexOf(tt[i]);
- if (tt[i] == null) {
- ret["regs"].push([-1, -1]);
- }
- else {
- ret["regs"].push([p, p + tt[i].length]);
- }
- }
-
- return ret;
-}
-
-function match(ss, data) {
- let tt = search(ss, data)
- if (tt != null && tt.regs[0][0] == 0) return tt;
- return null;
-}
-
-function removeReg(data, reg) {
- return data.substring(0, reg[0]) + data.substring(reg[1], data.length);
-}
-
-function getReg(data, reg) {
- return data.substring(reg[0], reg[1]);
-}
-
-function getFileInPath(tpath) {
- return path.parse(tpath).base;
-}
-
-function getPathInPath(tpath) {
- return path.parse(tpath).dir;
-}
-
-function all(sfrom) {
- return new RegExp(sfrom, "g");
-}
-
-function replaceAll(ss, sfrom, sto) {
- return ss.replace(all(sfrom), sto);
-}
-
-function pathJoin(...args) {
- return path.join(...args);
-}
-
-module.exports = {
- search,
- match,
- removeReg,
- getReg,
- getFileInPath,
- getPathInPath,
- pathJoin,
- replaceAll,
- all
-}
\ No newline at end of file
diff --git a/hdc/service/service-gen/src/tools/tool.js b/hdc/service/service-gen/src/tools/tool.js
deleted file mode 100755
index c22d0785ad017bf4f673ef5916563f6d8c0e5847..0000000000000000000000000000000000000000
--- a/hdc/service/service-gen/src/tools/tool.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-function print(...args) {
- if (vscode) {
- vscode.window.showInformationMessage(...args);
- }
- console.log(...args);
-}
-
-String.prototype.format = function (...args) {
- var result = this;
- let reg = new RegExp("%[sd]{1}")
- for (let i = 0; i < args.length; i++) {
- let p = result.search(reg);
- if (p < 0) break;
- result = result.substring(0, p) + args[i] + result.substring(p + 2, result.length);
- }
- return result;
-}
-
-String.prototype.replaceAll = function (...args) {
- let result = this;
- while (result.indexOf(args[0]) >= 0) {
- result = result.replace(args[0], args[1]);
- }
- return result;
-}
-
-function replaceAll(s, sfrom, sto) {
- while (s.indexOf(sfrom) >= 0) {
- s = s.replace(sfrom, sto);
- }
- return s;
-}
-
-function getTab(tabLv) {
- let tab = "";
- for(var i = 0; i < tabLv; ++i) {
- tab += " ";
- }
- return tab;
-}
-
-module.exports = {
- replaceAll,
- print,
- getTab
-}
diff --git a/hdc/service/service_IntelliJ_plugin/README_zh.md b/hdc/service/service_IntelliJ_plugin/README_zh.md
deleted file mode 100755
index 018916b5c3699c00793d5b332c436186efe8049b..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/README_zh.md
+++ /dev/null
@@ -1,95 +0,0 @@
-# SERVICE框架生成工具IntelliJ插件说明(暂不支持)
-
-## 简介
-
-SERVICE框架生成工具,根据用户提供的.h头文件,工具会自动生成整个Service框架的代码。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口,本文主要介绍IntelliJ插件使用说明。
-
-## 目录
-
- ├── service # SERVICE框架生成工具
- │ ├── ... # 其他文件
- │ ├── service_IntelliJ_plugin # IntelliJ插件代码
- │ │ ├── docs # IntelliJ插件说明
- │ │ ├── resources # IntelliJ插件说明
- │ │ ├── src # IntelliJ插件源码
- │ │ └── README_zh # IntelliJ插件说明
-
-## 约束
-
-系统:不限
-
-依赖版本:JDK 11
-
-开发工具:DevEco stdio、IDEA Community 2021.3.3
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-1)移植CMakeLists.txt编译方式的三方库到OpenHarmony源码中。
-
-### 工具使用
-
-插件下载路径如下:
-
-[下载链接](暂无)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_IntelliJ_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定的.h头文件,工具会输出SERVICE框架代码。为了方便使用者快速上手工具,可供测试的.h文件内容如下所示:
-
-```
-
- #ifndef EXAM_H
- #define EXAM_H
- using namespace std;
-
- namespace OHOS{
- namespace Example{
- class Exam{
- public:
- std::string getServName();
- int32_t doSum(int32_t num1, int32_t num2);
- };
- }
- }
- #endif
-```
-
-在window环境下的,根据输入.h文件生成的输出文件,如下所示:
-
-
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发:
-
-[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_IntelliJ_plugin/docs/DEVELOP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/service/service_IntelliJ_plugin/docs/DEVELOP_ZH.md b/hdc/service/service_IntelliJ_plugin/docs/DEVELOP_ZH.md
deleted file mode 100755
index bd3d0625f294e2385a52066dd527687d9b1de742..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Service代码生成工具IntelliJ插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的IntelliJ插件。
-
-## IntelliJ插件打包说明
-
-### 环境说明
-
-系统:建议Windows 10
-
-### 开发步骤
-
-#### 环境准备
-
-1.将下载的cmds文件夹放置在napi_generator/hdc/gn_IntelliJ_plugin/resources/目录下,下载链接如下:
-
-[下载链接]()
-
-2.下载并安装IDEA Community、JDK11配置好环境。IDEA Community版本可以左键单击以下链接下载。
-
-[下载链接](https://www.jetbrains.com/idea/download/)
-
-3.打开IDEA Community应用程序。
-依次点击项目File>Open 选择napi_generator/hdc/service_IntelliJ_plugin项目文件夹。
-
-
-4.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,选择或者新建complier output目录为项目文件下的out目录。
-
-
-5.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。
-
-
-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。
-
-
-7.配置Content root.
-Content root选择napi_generator/hdc/service_IntelliJ_plugin文件夹,module name填写service_IntelliJ_plugin。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。
-
-
-8.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。
-
-
-9.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择service_IntelliJ_plugin,点击ok,等待安装完成。
-
-
-
-10.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。
-
-
-
-11.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。
-
-
-
-
-
diff --git a/hdc/service/service_IntelliJ_plugin/docs/INSTRUCTION_ZH.md b/hdc/service/service_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 8c17da41a1ef0d0fc56f15b0e454d959ef9e5a88..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# SERVICE框架生成工具IntelliJ插件使用说明
-
-## 简介
-
-IntelliJ插件下载路径如下:
-
-[下载链接](暂无)
-
-## IntelliJ插件使用方法
-
-### 依赖
-
-系统:不限
-
-开发工具:DevEco stdio
-
-### 使用指导
-
-1、新建或打开项目工程,以下以新建项目工程为例。
-
-File->New->Create Project。
-
-
-
-Ability Template选择Empty Ability,单击Next。
-
-
-
-填写Project name、Save location,其他选项可不修改,单击Finish,新的工程就创建好了。
-
-
-
-2、安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的service_IntelliJ_plugin.jar,安装成功之后重启IDE。
-
-
-
-
-
-3、把需要转换的.h文件放在DevEco stdio新建项目的src目录下。
-
-
-
-4、选择.h文件,右键选择 Generate Service Frame选项。
-
-
-
-5、工具打开 Generate Service Frame窗口,.h文件选择框默认填写被操作的.h文件的绝对路径;输出路径选择框默认填写.h文件所在文件夹路径,可修改为任意路径;serviceID默认填写9000,可修改为其他id,然后点击ok。
-
-
-
-6、执行结束后会在目录下生成对应的文件。
-
-
-
diff --git a/hdc/service/service_IntelliJ_plugin/resources/META-INF/plugin.xml b/hdc/service/service_IntelliJ_plugin/resources/META-INF/plugin.xml
deleted file mode 100755
index 6aa6d3e07b29bc40c771401e9d43e9beb4e48188..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
- com.sk.service.ng
- Service Generator
- 1.0.0
- 深圳开鸿数字产业发展有限公司
-
-
-
-
- com.intellij.modules.lang
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/service/service_IntelliJ_plugin/resources/images/openDisk.png b/hdc/service/service_IntelliJ_plugin/resources/images/openDisk.png
deleted file mode 100755
index 5956a0e538a400c7deaf41167ae5ea70348b8584..0000000000000000000000000000000000000000
Binary files a/hdc/service/service_IntelliJ_plugin/resources/images/openDisk.png and /dev/null differ
diff --git a/hdc/service/service_IntelliJ_plugin/resources/images/text.png b/hdc/service/service_IntelliJ_plugin/resources/images/text.png
deleted file mode 100755
index f42534169aa41dd830a7cb09792fe1428c2f34f7..0000000000000000000000000000000000000000
Binary files a/hdc/service/service_IntelliJ_plugin/resources/images/text.png and /dev/null differ
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/action/BrowseAction.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/action/BrowseAction.java
deleted file mode 100755
index ae423e34203e3af587c08fe270d199426e71e660..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/action/BrowseAction.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.action;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.project.Project;
-import com.sk.service.utils.FileUtil;
-import com.sk.service.utils.GenNotification;
-import org.apache.http.util.TextUtils;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.util.prefs.Preferences;
-
-/**
- * 接口文件选择框。
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select file
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class BrowseAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
- private final JTextField textFieldOutPath;
- private final Project project;
-
-
- public BrowseAction(Project project, JButton button, JTextField textField, JTextField textFieldOutPath) {
- this.project = project;
- this.button = button;
- this.textField = textField;
- this.textFieldOutPath = textFieldOutPath;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- Preferences preferences = Preferences.userRoot();
- JFileChooser fcDlg = new JFileChooser();
- String pathRecord = preferences.get("interPathRecord", "");
- if (!pathRecord.equals("")) {
- fcDlg = new JFileChooser(pathRecord);
- }
- fcDlg.setDialogTitle("请选择接口文件...");
- fcDlg.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- FileNameExtensionFilter filter = new FileNameExtensionFilter("文本文件(*.h)", "h");
- fcDlg.setMultiSelectionEnabled(true);
- fcDlg.setFileFilter(filter);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String upPath = fcDlg.getSelectedFile().getParent();
- File[] files = fcDlg.getSelectedFiles();
- String interFile = setSelectFile(files);
- if (TextUtils.isBlank(interFile)) {
- return;
- }
- // 设置默认打开路径;
- preferences.put("interPathRecord", upPath);
- textField.setText(interFile.substring(0, interFile.length() - 1));
- textFieldOutPath.setText(upPath);
- }
- }
- }
-
- private String setSelectFile(File[] files) {
- StringBuilder interFile = new StringBuilder();
- boolean existFile = false;
- boolean existDir = false;
- for (File file : files) {
- if (file.isDirectory()) {
- if (!existDir) {
- existDir = true;
- interFile.append(file.getPath()).append(",");
- } else {
- GenNotification.notifyMessage(project, "目前只支持单个文件夹转换", "选择不符合要求",
- NotificationType.WARNING);
- textFieldOutPath.setText("");
- return "";
- }
- } else {
- if (!FileUtil.patternFileName(file.getName())) {
- GenNotification.notifyMessage(project, file.getPath(), file.getName() + "文件名不符合",
- NotificationType.WARNING);
- return "";
- }
- existFile = true;
- interFile.append(file.getPath()).append(",");
- }
- }
- if (existDir && existFile) {
- GenNotification.notifyMessage(project, "不能同时转换文件和文件夹", "选择不符合要求",
- NotificationType.WARNING);
- textFieldOutPath.setText("");
- return "";
- }
- return interFile.toString();
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/action/OutPathSelectAction.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/action/OutPathSelectAction.java
deleted file mode 100755
index 4cc7a4ad6992322bc49ec8f0977eedeae1dccf60..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/action/OutPathSelectAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * Service生成路径文件夹选择框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select generator file path
- * @version: v1.0.0
- * @since 2022-10-08
- */
-public class OutPathSelectAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
-
- public OutPathSelectAction(JButton button, JTextField textField) {
- this.button = button;
- this.textField = textField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser();
- fcDlg.setDialogTitle("请选择生成框架路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- textField.setText(filepath);
- }
- }
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDiagPane.form b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDiagPane.form
deleted file mode 100755
index 8efbf235e5a2571823db56459a811fbb7a2bcd2d..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDiagPane.form
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDiagPane.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDiagPane.java
deleted file mode 100755
index e8c30005733baf8fa5f599668606586c86d35932..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDiagPane.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.dialog;
-
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JDialog;
-import javax.swing.ImageIcon;
-
-/**
- * ConfirmDiagPane自定义确认对话框
- * 解决ShowConfirmDiag 在Deveco里面会出现界面错位问题。
- *
- * @author: zhaoxudong@kaihong.com
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ConfirmDiagPane extends JDialog {
- private JPanel contentPane;
- private JLabel msgLabel;
- private JLabel iconLabel;
-
- /**
- * 构造函数
- *
- * @param sErrorMessage 错误信息
- */
- public ConfirmDiagPane(String sErrorMessage) {
- msgLabel.setText(sErrorMessage);
- iconLabel.setIcon(new ImageIcon(""));
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDialog.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDialog.java
deleted file mode 100755
index 2e28ee24042d0a72227d72dbaaf3a8a5eb7dfffc..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ConfirmDialog.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.dialog;
-
-import com.intellij.openapi.ui.DialogWrapper;
-import org.jetbrains.annotations.Nullable;
-import javax.swing.JComponent;
-
-/**
- * 自定义确认对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ConfirmDialog extends DialogWrapper {
- private final ConfirmDiagPane confirmDiagPane;
-
- /**
- * 构造函数
- * @param message 弹出框信息内容
- */
- public ConfirmDialog(String message) {
- super(true);
- confirmDiagPane = new ConfirmDiagPane(message);
- setOKButtonText("Yes");
- setCancelButtonText("No");
- setUndecorated(true);
- setResizable(false);
- init();
- }
-
- @Override
- @Nullable
- protected JComponent createCenterPanel() {
- return confirmDiagPane.getContentPanel();
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ErrorDialog.form b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ErrorDialog.form
deleted file mode 100755
index 0225c79a4dcf3603640bd1194c6058012fcdd29d..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ErrorDialog.form
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ErrorDialog.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ErrorDialog.java
deleted file mode 100755
index 129bcacc3f7ee78277351e8fee67aff9f9e3576e..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ErrorDialog.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-
-/**
- * ErrorDialog错误对话框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ErrorDialog extends JDialog {
- private static final Logger LOG = Logger.getInstance(ErrorDialog.class);
- private static final String URL =
- "rundll32 url.dll,FileProtocolHandler" + " https://gitee" + ".com/openharmony" + "-sig/napi_generator";
-
- private JPanel contentPane;
- private JButton buttonOK;
- private JButton buttonHelp;
- private JTextArea textAreaError;
- private String errorMessage;
-
- public ErrorDialog(String sErrorMessage) {
- errorMessage = sErrorMessage;
- }
-
- /**
- * 初始化
- */
- public void initDialog() {
- setContentPane(contentPane);
- setModal(true);
- getRootPane().setDefaultButton(buttonOK);
- setTitle("执行失败");
- textAreaError.setText(errorMessage);
- buttonOK.addActionListener(actionEvent -> onOK());
-
- buttonHelp.addActionListener(actionEvent -> onCancel());
-
- // call onCancel() when cross is clicked
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- /**
- * close dialog
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- });
-
- // call onCancel() on ESCAPE
- contentPane.registerKeyboardAction(actionEvent -> onCancel(),
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- }
-
- private void onOK() {
- dispose();
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-
- private void onCancel() {
- try {
- Runtime.getRuntime().exec(URL);
- } catch (IOException ioException) {
- LOG.error("exec command help error" + ioException);
- }
- dispose();
- }
-}
\ No newline at end of file
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialog.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialog.java
deleted file mode 100755
index ec22b30235423489f2cb686e04cb90e59d8c3fa1..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialog.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.ValidationInfo;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * 主界面对话框Wrapper
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-05-27
- */
-public class ServiceGenerateDialog extends DialogWrapper {
- private static final Logger LOG = Logger.getInstance(ServiceGenerateDialog.class);
- private static final String TITLE = "Generate Service Frame";
- private static final String URL = "https://gitee.com/openharmony/napi_generator/tree/master/hdc/service-gen";
-
- private final ServiceGenerateDialogPane genDiag;
-
- /**
- * 构造函数
- *
- * @param project projectId
- * @param filePath 目录文件
- * @param dirPath 文件夹目录
- */
- public ServiceGenerateDialog(Project project, String filePath, String dirPath) {
- super(true);
- this.setResizable(false);
- setTitle(TITLE);
- setModal(true);
- genDiag = new ServiceGenerateDialogPane(project, filePath, dirPath);
- init();
- }
-
- /**
- * 创建视图
- *
- * @return 组件内容
- */
- @Nullable
- @Override
- protected JComponent createCenterPanel() {
- return genDiag.getContentPanel();
- }
-
- /**
- * 校验数据
- *
- * @return 检测文本框架是否有目录。
- */
- @Nullable
- @Override
- protected ValidationInfo doValidate() {
- return genDiag.validationInfo();
- }
-
- /**
- * ok/cancel按钮
- *
- * @return Action[] buttos list
- */
- @NotNull
- @Override
- protected Action[] createActions() {
- DialogWrapperExitAction exitAction = new DialogWrapperExitAction("Cancel", CANCEL_EXIT_CODE);
- CustomOKAction okAction = new CustomOKAction();
- // 设置默认的焦点按钮
- okAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
- return new Action[]{exitAction, okAction};
- }
-
- @NotNull
- @Override
- protected Action[] createLeftSideActions() {
- CustomHelpAction helpAction = new CustomHelpAction();
- return new Action[]{helpAction};
- }
-
- /**
- * 自定义 ok Action
- */
- protected class CustomOKAction extends DialogWrapperAction {
-
- protected CustomOKAction() {
- super("OK");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- ValidationInfo validationInfo = doValidate();
- if (validationInfo != null) {
- LOG.info(validationInfo.message);
- } else {
- if (genDiag.runServiceFun()) {
- close(CANCEL_EXIT_CODE);
- }
- }
- }
- }
-
- /**
- * 自定义 help Action
- */
- protected class CustomHelpAction extends DialogWrapperAction {
-
- protected CustomHelpAction() {
- super("Help");
- }
-
- @Override
- protected void doAction(ActionEvent actionEvent) {
- try {
- Desktop.getDesktop().browse(new URI(URL));
- } catch (URISyntaxException | IOException e) {
- LOG.error("Open help error:" + e);
- }
- }
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialogPane.form b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialogPane.form
deleted file mode 100755
index a15111c05dd94991d027cf5ce2e6a6eb0c1f1463..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialogPane.form
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialogPane.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialogPane.java
deleted file mode 100755
index 39b0931ceb7bcf639df7559a0f4d5205dbdd5b45..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/dialog/ServiceGenerateDialogPane.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.dialog;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.ValidationInfo;
-import com.sk.service.action.BrowseAction;
-import com.sk.service.action.OutPathSelectAction;
-import com.sk.service.utils.FileUtil;
-import com.sk.service.utils.GenNotification;
-import org.apache.http.util.TextUtils;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-/**
- * 生成工具主界面
- *
- * @author: zhaoxudong@kaihong.com
- * @see: select generate dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ServiceGenerateDialogPane extends JDialog {
- private static final Logger LOG = Logger.getInstance(ServiceGenerateDialogPane.class);
-
- private final Project project;
-
- private JPanel contentPane;
- private JTextField textFieldH;
- private JTextField textFieldOutPath;
- private JButton buttonOutPath;
- private JButton buttonSelectH;
- private JTextField textFieldServiceId;
- private boolean generateSuccess = true;
- private String sErrorMessage = "";
- private String dirPath;
-
- /**
- * 构造函数
- *
- * @param project projectId
- * @param filePath .h文件
- * @param dirPath 生成框架文件路径
- */
- public ServiceGenerateDialogPane(Project project, String filePath, String dirPath) {
- this.project = project;
- this.dirPath = dirPath;
- textFieldH.setText(filePath);
- textFieldOutPath.setText(dirPath);
- contentPane.registerKeyboardAction(actionEvent -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- buttonOutPath.addActionListener(new OutPathSelectAction(buttonOutPath, textFieldOutPath));
- buttonSelectH.addActionListener(new BrowseAction(project, buttonSelectH, textFieldH, textFieldOutPath));
- }
-
- @Override
- public synchronized void addWindowListener(WindowListener windowListener) {
- super.addWindowListener(windowListener);
- new WindowAdapter() {
- /**
- * close dialog
- *
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- };
- }
-
- /**
- * 验证文本选择框是否空。是否替换已存在的内容
- *
- * @return ValidationInfo 返回不符要求的信息。
- */
- @Nullable
- public ValidationInfo validationInfo() {
- String fileH = textFieldH.getText();
- String outDir = textFieldOutPath.getText();
- boolean isEmptyFile = TextUtils.isEmpty(fileH) || TextUtils.isEmpty(outDir);
- ValidationInfo validationInfo = null;
- if (isEmptyFile) {
- String warnMsg = ".h文件、输出路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
-
- File file = new File(textFieldOutPath.getText() + "/examservice");
- if (file.exists()) {
- ConfirmDialog confirmDialog = new ConfirmDialog("是否替换已存在的结果?");
- if (!confirmDialog.showAndGet()) {
- validationInfo = new ValidationInfo(String.format("不替换现有结果:%s", file));
- return validationInfo;
- }
- }
- return validationInfo;
- }
-
- private void onCancel() {
- dispose();
- }
-
- private void warningMessage(String title) {
- String notiContent = "请选择.h文件,输出结果路径";
- GenNotification.notifyMessage(this.project, notiContent, title, NotificationType.WARNING);
- }
-
- /**
- * 执行主程序入口
- *
- * @return 执行状态
- */
- public boolean runServiceFun() {
- GenNotification.notifyMessage(this.project, "", "正在生成", NotificationType.INFORMATION);
- String command;
- command = genCommandService();
- copyServiceHeader();
- try {
- if (!TextUtils.isEmpty(command) && callExtProcess(command)) {
- GenNotification.notifyMessage(project, "执行成功", "提示", NotificationType.INFORMATION);
- return true;
- }
- } catch (IOException | InterruptedException ex) {
- GenNotification.notifyMessage(project, textFieldH.getText(), "Command exec error", NotificationType.ERROR);
- LOG.error(ex);
- }
- return false;
- }
-
- /**
- * 生成命令行指令
- *
- * @return 返回命令行执行内容
- */
- private String genCommandService() {
- String sysName = System.getProperties().getProperty("os.name").toUpperCase();
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- String execFn;
- if (sysName.contains("WIN")) {
- execFn = "cmds/win/service-gen-win.exe";
- tmpDirFile += "service-gen-win.exe";
- } else if (sysName.contains("LINUX")) {
- execFn = "cmds/linux/service-gen-linux";
- tmpDirFile += "service-gen-linux";
- } else {
- execFn = "cmds/mac/service-gen-macos";
- tmpDirFile += "service-gen-macos";
- }
- File file = new File(tmpDirFile);
- if (!file.exists()) {
- try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(execFn)) {
- if (inputStream == null) {
- throw new IOException("exec File InputStream is Null");
- }
- byte[] bs = inputStream.readAllBytes();
- writeTmpFile(tmpDirFile, bs);
- if (sysName.contains("LINUX") || sysName.contains("MAC OS")) {
- executable(tmpDirFile);
- }
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + execFn,
- NotificationType.ERROR);
- LOG.error(e);
-
- return "";
- }
- }
- String command = file.toString();
- String hFile = textFieldH.getText();
- String outPath = textFieldOutPath.getText();
- String serviceId = textFieldServiceId.getText();
- command += " -f " + hFile + " -o " + outPath + (TextUtils.isEmpty(serviceId) ? " -s 9001" : " -s " + serviceId);
- return command;
- }
-
- private void copyServiceHeader() {
- String sysName = System.getProperties().getProperty("os.name").toUpperCase();
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- String execFn;
- if (sysName.contains("WIN")) {
- execFn = "cmds/win/header_parser.exe";
- tmpDirFile += "header_parser.exe";
- } else if (sysName.contains("LINUX")) {
- execFn = "cmds/linux/service-gen-linux";
- tmpDirFile += "service-gen-linux";
- } else {
- execFn = "cmds/mac/service-gen-macos";
- tmpDirFile += "service-gen-macos";
- }
- try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(execFn)) {
- if (inputStream == null) {
- throw new IOException("exec File InputStream is Null");
- }
- byte[] bs = inputStream.readAllBytes();
- writeTmpFile(tmpDirFile, bs);
- if (sysName.contains("LINUX") || sysName.contains("MAC OS")) {
- executable(tmpDirFile);
- }
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + execFn,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
-
- private boolean callExtProcess(String command) throws IOException, InterruptedException {
-
- if (TextUtils.isEmpty(command)) {
- GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
- return false;
- }
- Process process = Runtime.getRuntime().exec(command);
- genResultLog(process);
- StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
- StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
- errConsumer.start();
- outputConsumer.start();
- if (generateSuccess) {
- GenNotification.notifyMessage(project, "执行成功", "提示", NotificationType.INFORMATION);
- } else {
- GenNotification.notifyMessage(project, sErrorMessage, "提示", NotificationType.ERROR);
- return false;
- }
- errConsumer.join();
- outputConsumer.join();
- return true;
- }
-
- /**
- * 赋值可执行文件权限。
- *
- * @param execFn 可执行命令
- * @throws IOException 打开文件异常
- * @throws InterruptedException 中断异常
- */
- private void executable(String execFn) throws IOException, InterruptedException {
- callExtProcess("chmod a+x " + execFn);
- }
-
- /**
- * 拷贝可执行文件到临时文件夹
- *
- * @param path 目标文件路径
- * @param bs 字节内容
- * @throws IOException exception
- */
- private void writeTmpFile(String path, byte[] bs) throws IOException {
- File file = new File(path);
- if (!file.exists()) {
- boolean isNewFile = file.createNewFile();
- if (!isNewFile) {
- LOG.info("writeTmpFile createNewFile error");
- }
- }
- FileOutputStream fw = new FileOutputStream(file);
- fw.write(bs, 0, bs.length);
- fw.close();
- }
-
- /**
- * 获取生成成功结果文件。
- *
- * @param process 进程ID
- */
- private void genResultLog(Process process) {
- BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
- BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String sErr;
- String sOut;
- sErr = getErrorResult(stdError);
- if (TextUtils.isEmpty(sErr)) {
- sOut = genInputLog(stdInput);
- if (!generateIsSuccess(sOut)) {
- sErrorMessage = sOut;
- }
- return;
- }
- generateSuccess = false;
- sErrorMessage = sErr;
- }
-
- /**
- * 获取生成失败结果文件。
- *
- * @param stdError error buff
- * @return ErrorResult
- */
- private String getErrorResult(BufferedReader stdError) {
- StringBuilder sErr = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdError.readLine()) == null) {
- break;
- }
- sErr.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sErr.toString();
- }
-
- private boolean generateIsSuccess(String sOut) {
- generateSuccess = sOut.contains("success") || TextUtils.isEmpty(sOut);
- return generateSuccess;
- }
-
- /**
- * 获取生成文本内容。
- *
- * @param stdInput input buff
- * @return 返回当前输入框内容
- */
- private String genInputLog(BufferedReader stdInput) {
- StringBuilder sOut = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdInput.readLine()) == null) {
- break;
- }
- sOut.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sOut.toString();
- }
-
- static class StreamConsumer extends Thread {
- InputStream is;
-
- StreamConsumer(InputStream is) {
- super.setName("StreamConsumer");
- this.is = is;
- }
-
- @Override
- public void run() {
- try {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- while ((line = br.readLine()) != null) {
- LOG.error("StreamConsumer" + line);
- }
- } catch (IOException ioException) {
- LOG.error("StreamConsumer io error" + ioException);
- }
- }
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/ng/GenMenuService.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/ng/GenMenuService.java
deleted file mode 100755
index 9d1fa0e5b760026b75460f8523c9d18959c4c5db..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/ng/GenMenuService.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.ng;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-import com.sk.service.dialog.ServiceGenerateDialog;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * 工具菜单入口
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-05-27
- */
-public class GenMenuService extends AnAction {
-
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
-
- if (project == null) {
- return;
- }
- ServiceGenerateDialog wrapper = new ServiceGenerateDialog(project, "", "");
- wrapper.showAndGet();
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/ng/GenService.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/ng/GenService.java
deleted file mode 100755
index b5cce8a1c603c4341e83f0c13de4c61a39b4df93..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/ng/GenService.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.ng;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.sk.service.dialog.ServiceGenerateDialog;
-import com.sk.service.utils.FileUtil;
-import com.sk.service.utils.GenNotification;
-
-/**
- * 项目文件入口
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class GenService extends AnAction {
-
- @Override
- public void actionPerformed(AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
- // 获取需要处理的.h文件绝对路径
- VirtualFile file = anActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE);
- if (file == null) {
- GenNotification.notifyMessage(project, "", "file is not exist", NotificationType.ERROR);
- return;
- }
- if (project == null) {
- return;
- }
- String filePath = file.getPath();
- String dirPath = file.getParent().getPath();
- ServiceGenerateDialog wrapper = new ServiceGenerateDialog(project, filePath, dirPath);
- wrapper.showAndGet();
- }
-
-
- @Override
- public void update(AnActionEvent event) {
- // 根据所选文件名,判断是否显示生成菜单项
- VirtualFile file = event.getData(PlatformDataKeys.VIRTUAL_FILE);
- if (file == null) {
- event.getPresentation().setEnabledAndVisible(false);
- } else {
- event.getPresentation().setEnabledAndVisible(FileUtil.patternFileName(file.getName()));
- }
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/utils/FileUtil.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/utils/FileUtil.java
deleted file mode 100755
index 0ae6ce4c97bd67cc6b964f9fc72d5449a17d1c73..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/utils/FileUtil.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.utils;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.apache.http.util.TextUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-/**
- * 文本文件工具
- *
- * @author: zhaoxudong@kaihong.com
- * @see: file utils
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class FileUtil {
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private static final int COMPILE_SDK_VERSION = 5;
-
- /**
- * 获取换行符
- *
- * @return 换行符
- */
- public static String getNewline() {
- return System.getProperty("line.separator");
- }
-
- /**
- * 正则匹配所选文件名是否符合规范
- *
- * @param fileName 文件名
- * @return boolean 是否匹配
- */
- public static boolean patternFileName(String fileName) {
- String pattern = "([.a-z_A-Z0-9]+).h";
- return Pattern.matches(pattern, fileName);
- }
-
- /**
- * check project SDK
- *
- * @param project projectid
- * @param baseFile project root file
- * @return boolean
- */
- public static boolean checkProjectSDK(Project project, String baseFile) {
-
- String gradlePath = "";
- File baseDir = new File(baseFile);
- if (baseDir.isDirectory()) {
- File[] childFile = baseDir.listFiles();
- assert childFile != null;
- for (File file : childFile) {
- if (file.getName().equals("build.gradle") || file.getName().equals("build-profile.json5")) {
- gradlePath = file.getPath();
- }
- }
- }
-
- Properties properties = new Properties();
- if (TextUtils.isBlank(gradlePath)) {
- GenNotification.notifyMessage(project, "项目结构中没有grandle配置文件。", "当前项目结构不支持",
- NotificationType.WARNING);
- return true;
- }
- try {
- properties.load(new FileInputStream(gradlePath));
- } catch (IOException e) {
- GenNotification.notifyMessage(project, e.getMessage(), "提示", NotificationType.ERROR);
- LOG.error(String.format("Can not load file :%s . %s", gradlePath, e));
- return true;
- }
- String ohosSDK = properties.getProperty("compileSdkVersion");
-
- if (ohosSDK != null && Integer.parseInt(ohosSDK) < COMPILE_SDK_VERSION) {
- GenNotification.notifyMessage(project, "SKD版本过低,NAPI仅支持5.0及以上版本", "提示",
- NotificationType.WARNING);
- return true;
- }
- return false;
- }
-}
diff --git a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/utils/GenNotification.java b/hdc/service/service_IntelliJ_plugin/src/com/sk/service/utils/GenNotification.java
deleted file mode 100755
index 3f15e4d403e90341b57842a9fc5f540d961c691e..0000000000000000000000000000000000000000
--- a/hdc/service/service_IntelliJ_plugin/src/com/sk/service/utils/GenNotification.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.service.utils;
-
-import com.intellij.ide.actions.OpenFileAction;
-import com.intellij.notification.Notification;
-import com.intellij.notification.NotificationAction;
-import com.intellij.notification.NotificationType;
-import com.intellij.notification.Notifications;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-/**
- * 通知框
- *
- * @author: zhaoxudong@kaihong.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-05-27
- */
-public class GenNotification {
-
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private GenNotification() {
- }
-
- /**
- * 无action 通知
- *
- * @param project projectid
- * @param content 提示内容
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- */
- public static void notifyMessage(@javax.annotation.Nullable Project project, String content, String title,
- NotificationType type) {
- notifyMessage(project, content, title, type, false);
- }
-
- /**
- * 消息通知
- *
- * @param project projectid
- * @param content 提示内容
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- * @param addAct 是否添加action
- */
- public static void notifyMessage(@javax.annotation.Nullable Project project, String content, String title,
- NotificationType type, boolean addAct) {
-
- Notification notification = new Notification("Generate.Result.Group", "Notes Message", content, type);
- notification.setTitle(title);
- notification.setContent(content);
-
- if (NotificationType.ERROR.equals(type)) {
- LOG.error(content);
- } else if (NotificationType.WARNING.equals(type)) {
- LOG.warn(content);
- } else {
- LOG.info(content);
- }
-
- if (addAct) {
- notification.setContent(null);
- addAction(project, content, notification);
- }
- Notifications.Bus.notify(notification, project);
-
- }
-
- private static void addAction(Project project, String dirPath, Notification notification) {
- File genResultPath = new File(dirPath);
- if (!genResultPath.exists()) {
- LOG.info(String.format("%s not exist", genResultPath.getPath()));
- }
- LOG.info("generated file list log:");
-
- File[] fa = genResultPath.listFiles();
- for (int i = 0; i < fa.length; i++) {
- File fs = fa[i];
- String fileName = fs.getName();
- boolean dissFile = !fileName.endsWith(".log") || !fileName.endsWith(".txt") || !fileName.endsWith(".ts");
- if (!fs.isDirectory() && dissFile) {
- String filePath = fs.getPath();
- NotificationAction action = new NotificationAction(filePath) {
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent,
- @NotNull Notification notification) {
- OpenFileAction.openFile(filePath, project);
- }
- };
- notification.addAction(action);
- } else {
- LOG.info(String.format("%s is Directory", fs.getPath()));
- }
- }
- }
-}
diff --git a/hdc/service/service_vs_plugin/README_zh.md b/hdc/service/service_vs_plugin/README_zh.md
deleted file mode 100755
index 24d23d85097d484d3535cb2d074ccfa55aa79223..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/README_zh.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# SERVICE框架生成工具VS code插件说明
-
-## 简介
-
-SERVICE框架生成工具,根据用户提供的.h头文件,工具会自动生成整个Service框架的代码。目前工具支持VS Code插件一种入口,本文主要介绍VS Code插件说明。
-
-## 目录
-
- ├── service # SERVICE框架生成工具
- │ ├── ... # 其他文件
- │ ├── service_vs_plugin # VS Code插件代码
- │ │ ├── docs # VS Code插件说明
- │ │ ├── src # VS Code插件源码
- │ │ ├── package.json # package.json 文件
- │ │ └── README_zh.md # VS Code插件说明
-
-## 约束
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者
-
-### 使用场景
-
-开发者为OpenHarmony系统框架开发某些功能,并将该功能包装成一个独立的服务进程运行在系统中。
-
-### 工具使用
-
-#### VS Code插件使用方法
-
-具体的插件使用步骤,可以左键单击以下链接了解:
-
-[VS插件使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-### 工具输出
-
-根据使用者指定的.h头文件,工具会输出SERVICE框架代码。为了方便使用者快速上手工具,可供测试的.h文件如下所示:
-
-[test.h](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/examples/test.h)
-
-注意:.h文件中待生成的主class必须加注释:@brief service服务,提供IPC调用接口 ,如下所示:
-
-```
-/**
- * @brief service服务,提供IPC调用接口
- * @ServiceClass
- */
-```
-
-在window环境下的,根据输入.h文件生成的输出文件,如下所示:
-
-
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
-[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/hdc/service/FAQ.md)
-
-## 相关仓
-
-暂无
\ No newline at end of file
diff --git a/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md b/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100755
index 04025822fb099a1aace0aeed64b2f15417a326cd..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# SERVICE框架生成工具VSCode插件使用说明
-## 简介
-
-SERVICE框架生成工具支持一种入口,即VS Code插件,使用者可以根据自己的需要下载工具使用。本文主要介绍VS Code插件使用方法。
-
-## VS Code插件使用方法
-
-### 说明
-
-visual studio code 版本需1.62.0及以上。
-
-### 步骤
-
-1、 打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-2、 在应用商店搜索service-gen插件,再单击安装。
-
-
-
-3、 安装完成后就会在VS Code的插件管理器中能看到service-gen这个插件了。
-
-
-
-4、 在VS Code中找到需要转换的.h文件,如下:
-
-
-
-5、 右键单击.h文件,选择“ Service Generate Frame”选项。
-
-
-
-6、 工具打开 Service Generate Frame窗口,.h文件选择框默认填写被操作的.h文件的绝对路径;输出路径选择框默认填写.h文件所在文件夹路径,可修改为任意路径;serviceID范围是1-16777215之间的整数,超出范围会提示错误,填入正确的serviceID,然后点击ok。
-
-
-
-7、 转换成功后,在输出路径下生成service框架代码文件。
-
-## 集成
-
-Service框架代码生成后,系统框架开发者进行二次开发后,即可集成到OpenHarmony编译系统,生成对应的库文件,供应用开发者调用接口。工具集成到OpenHarmony的具体操作步骤可以左键单击以下链接了解:
-
- [工具集成](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/docs/ENSEMBLE_METHOD_ZH.md)
-
diff --git a/hdc/service/service_vs_plugin/package.json b/hdc/service/service_vs_plugin/package.json
deleted file mode 100755
index aa26870b698f4b31e39532a44f7da5fd961f1451..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/package.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "service_vs_plugin",
- "version": "1.0.0",
- "description": "this tool ",
- "main": "index.js",
- "directories": {
- "doc": "docs"
- },
- "dependencies": {
- "mocha": "^9.2.1",
- "node-gyp": "^8.4.1",
- "stdio": "^2.1.1",
- "typescript": "^4.5.5"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git@gitee.com:joeysun001/napi_generator.git"
- },
- "author": "",
- "license": "ISC",
- "pkg": {
- "assets": [
- "src/node_modules/typescript/**/*"
- ]
- }
-}
diff --git a/hdc/service/service_vs_plugin/src/LICENSE b/hdc/service/service_vs_plugin/src/LICENSE
deleted file mode 100644
index 72f817fb44de8b9fd23fe71230b9dc5ccbe4ca35..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/hdc/service/service_vs_plugin/src/README.md b/hdc/service/service_vs_plugin/src/README.md
deleted file mode 100644
index be7c33c2abad9458eb89fe6ffeb81ba201aabf1e..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Service生成工具使用说明
-
-## 简介
-
-Service代码生成工具,它可以能够帮助使用者生成IPC通信框架代码,提升开发效率。
-
-## 约束
-
-visual studio code 版本需1.62.0及以上。
-
-## 操作简介
-
-1.安装VS Code插件。
-
-2.打开任意文件夹或文件,鼠标单击右键选择“Generate Service Frame”插件。
-
-3.在窗口中填写相应参数。
-
-详细说明见[工具使用说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/service/service_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 合作共建
-
-[联系方式](https://www.kaihong.com/)
diff --git a/hdc/service/service_vs_plugin/src/extension.js b/hdc/service/service_vs_plugin/src/extension.js
deleted file mode 100755
index 49fec87ab81baacbb90f70cbaeaf4070547e6401..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/extension.js
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// The module 'vscode' contains the VS Code extensibility API
-// Import the module and reference it with the alias vscode in your code below
-const vscode = require('vscode');
-const fs = require('fs');
-const re = require("./gen/tools/VsPluginRe");
-const { VsPluginLog } = require("./gen/tools/VsPluginLog");
-const { detectPlatform, readFile } = require('./gen/tools/VsPluginTool');
-const path = require('path');
-var exeFilePath = null;
-var globalPanel = null;
-
-var importToolChain = false;
-var extensionIds = [];
-var nextPluginId = null;
-// this method is called when your extension is activated
-// your extension is activated the very first time the command is executed
-
-/**
- * @param {vscode.ExtensionContext} context
- */
-function activate(context) {
- // Use the console to output diagnostic information (console.log) and errors (console.error)
- // This line of code will only be executed once when your extension is activated
- console.log('Congratulations, your extension "service-gen" is now active!');
- let disposable = register(context, 'generate_service');
- let disposableMenu = register(context, 'generate_service_menu');
- context.subscriptions.push(disposable);
- context.subscriptions.push(disposableMenu);
- var platform = detectPlatform();
- if (platform == 'win') {
- exeFilePath = __dirname + "/service-gen-win.exe";
- } else if (platform == 'mac') {
- exeFilePath = __dirname + "/service-gen-macos";
- } else if (platform == 'Linux') {
- exeFilePath = __dirname + "/service-gen-linux";
- }
- vscode.window.onDidChangeActiveColorTheme(colorTheme => {
- var result = {
- msg: "colorThemeChanged"
- }
- globalPanel.webview.postMessage(result);
- });
-}
-
-function executorService(name, genDir, serviceId) {
- var command = exeFilePath + " -f " + name + " -o " + genDir + " -s " + serviceId;
- var exec = require('child_process').exec;
- exec(command, function (error, stdout, stderr) {
- VsPluginLog.logInfo('VsPlugin: stdout =' + stdout + ", stderr =" + stderr);
- if (error || stdout.indexOf("success") < 0) {
- vscode.window.showErrorMessage("genError:" + (error != null ? error : "") + stdout);
- return VsPluginLog.logError("VsPlugin:" + error + stdout);
- }
- vscode.window.showInformationMessage("Generated successfully");
- });
-}
-
-function exeFileExit() {
- if (fs.existsSync(exeFilePath)) {
- return true;
- }
- return false;
-}
-
-function register(context, command) {
- let disposable = vscode.commands.registerCommand(command, function (uri, boolValue, items) {
- // The code you place here will be executed every time your command is executed
- // Display a message box to the user
- globalPanel = vscode.window.createWebviewPanel(
- 'generate', // Identifies the type of WebView
- 'Service Generate Frame', // Title of the panel displayed to the user
- vscode.ViewColumn.Two, // Display the WebView panel in the form of new columns in the editor
- {
- enableScripts: true, // Enable or disable JS, default is Enable
- retainContextWhenHidden: true, // Keep the WebView state when it is hidden to avoid being reset
- }
- );
- if (typeof(boolValue) == 'boolean' && Array.isArray(items)) {
- if (boolValue == true) {
- //遍历数组item,查看当前插件id是数组的第几个元素,并拿出下一个元素,并判断当前id是否是最后一个元素并做相应处理
- let myExtensionId = 'kaihong.service-gen';
- for (let i = 0; i < items.length; i++) {
- if (myExtensionId == items[i] && (i == items.length - 1)) {
- importToolChain = false;
- } else if (myExtensionId == items[i] && (i != items.length - 1)) {
- importToolChain = boolValue;
- nextPluginId = items[i + 1];
- }
- extensionIds.push(items[i]);
- }
- }
- }
- globalPanel.webview.html = getWebviewContent(context, importToolChain);
- let msg;
- globalPanel.webview.onDidReceiveMessage(message => {
- msg = message.msg;
- if (msg == "cancel") {
- globalPanel.dispose();
- } else if(msg == "param") {
- checkReceiveMsg(message);
- } else {
- selectPath(globalPanel, message);
- }
- }, undefined, context.subscriptions);
- // 路径有效性判断
- if (uri.fsPath !== undefined) {
- let fn = re.getFileInPath(uri.fsPath);
- let tt = re.match("([a-zA-Z_0-9]+.h)", fn);
- var result = {
- msg: "selectHFilePath",
- path: tt ? uri.fsPath : ""
- }
- globalPanel.webview.postMessage(result);
- }
- });
- return disposable;
-}
-
-function checkReceiveMsg(message) {
- let name = message.fileNames;
- let genDir = message.genDir;
- let serviceId = message.serviceId;
- let buttonName = message.buttonName;
- name = re.replaceAll(name, " ", "");
- if ("" == name) {
- vscode.window.showErrorMessage("Please enter the path!");
- return;
- }
- if (exeFileExit()) {
- executorService(name, genDir, serviceId);
- if (buttonName == 'Next') {
- startNextPlugin();
- }
- } else {
- vscode.window.showInformationMessage("Copy executable program to " + __dirname);
- }
-}
-
-/**
-* 获取插件执行命令
-*/
-function nextPluginExeCommand(nextPluginId) {
- if (nextPluginId == "kaihong.ApiScan") {
- return 'api_scan';
- } else if (nextPluginId == "kaihong.gn-gen") {
- return 'generate_gn';
- } else if (nextPluginId == "kaihong.service-gen") {
- return 'generate_service';
- } else if (nextPluginId == "kaihong.ts-gen") {
- return 'generate_ts';
- } else if (nextPluginId == "kaihong.napi-gen") {
- return 'generate_napi';
- } else {
- return null;
- }
-}
-
-/**
-* 执行完毕后开启工具链中下一个插件
-*/
-function startNextPlugin() {
- const extension = vscode.extensions.getExtension(nextPluginId);
- if (extension) {
- let startNextPlugin = nextPluginExeCommand(nextPluginId);
- try {
- vscode.commands.executeCommand(startNextPlugin, '', importToolChain, extensionIds);
- } catch (error) {
- console.error(error);
- }
- }
-}
-
-
-/**
-* 选择本地目录/文件夹
-*/
- function selectPath(panel, message) {
- let mode = 1;
- if (message.mode != undefined) {
- mode = message.mode;
- }
- const options = {
- canSelectFiles: mode == 0 ? true : false,//是否选择文件
- canSelectFolders: mode == 0 ? false : true,//是否选择文件夹
- defaultUri:vscode.Uri.file(message.filePath),//默认打开本地路径
- filters: mode == 0 ? {
- 'All files': ['h']
- } : {}
- };
-
- return vscode.window.showOpenDialog(options).then(fileUri => {
- if (fileUri && fileUri[0]) {
- console.log('Selected file: ' + fileUri[0].fsPath);
- let filePath = "";
- for (let index = 0; index < fileUri.length; index++) {
- filePath += fileUri[index].fsPath.concat(",");
- }
- var result = {
- msg: message.msg,
- path: filePath.length > 0 ? filePath.substring(0, filePath.length - 1) : filePath
- }
- panel.webview.postMessage(result);
- return fileUri[0].fsPath
- }
- });
-}
-
-// this method is called when your extension is deactivated
-function deactivate() { }
-
-function getWebviewContent(context, importToolChain) {
- let data = readFile(__dirname + '/vs_plugin_view.html');
- data = getWebViewContent(context, '/vs_plugin_view.html');
- let content = data.toString();
- if (importToolChain) {
- content = content.replace('Ok', 'Next');
- }
- return content;
-}
-
-function getWebViewContent(context, templatePath) {
- const resourcePath = path.join(context.extensionPath, templatePath);
- const dirPath = path.dirname(resourcePath);
- let html = fs.readFileSync(resourcePath, 'utf-8');
- html = html.replace(/( {
- if($2.indexOf("https://")<0) {
- return $1 + globalPanel.webview.asWebviewUri(vscode.Uri.file(path.resolve(dirPath, $2))) + '"';
- } else {
- return $1 + $2+'"';
- }
- });
- return html;
-}
-
-module.exports = {
- activate,
- deactivate
-}
\ No newline at end of file
diff --git a/hdc/service/service_vs_plugin/src/gen/tools/VsPluginLog.js b/hdc/service/service_vs_plugin/src/gen/tools/VsPluginLog.js
deleted file mode 100755
index 6ce4e7e3b09ec80708e81e93c2ffd3261a60f2a4..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/gen/tools/VsPluginLog.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-
-class VsPluginLog {
- constructor() {
- }
-}
-VsPluginLog.LEV_NONE = 0;
-VsPluginLog.LEV_ERROR = 1;
-VsPluginLog.LEV_DEBUG = 2;
-VsPluginLog.LEV_INFO = 3;
-
-const LEV_STR = ["[NON]", "[ERR]", "[DBG]", "[INF]"]
-var logLevel = VsPluginLog.LEV_ERROR;
-var logFileName = null;
-var logResultMessage = [true, ""]
-
-function getDateString() {
- let nowDate = new Date();
- return nowDate.toLocaleString();
-}
-
-function saveLog(dateStr, levStr, detail) {
- if (logFileName) {
- let logStr = dateStr + " " + levStr + " " + detail + "\n";
- fs.appendFileSync(logFileName, logStr);
- }
-}
-
-VsPluginLog.init = function (level, fileName) {
- logLevel = level in [VsPluginLog.LEV_NONE, VsPluginLog.LEV_ERROR, VsPluginLog.LEV_DEBUG, VsPluginLog.LEV_INFO]
- ? level : VsPluginLog.LEV_ERROR;
- logFileName = fileName ? fileName : "napi_generator.log";
-}
-
-function recordLog(lev, ...args) {
- let dataStr = getDateString();
- let detail = args.join(" ");
- saveLog(dataStr, LEV_STR[lev], detail);
- if (lev == VsPluginLog.LEV_ERROR) {
- logResultMessage = [false, detail];
- }
- if (logLevel < lev) return;
- VsPluginLog.logInfo(dataStr + LEV_STR[lev] + detail);
-}
-
-VsPluginLog.logError = function (...args) {
- recordLog(VsPluginLog.LEV_ERROR, args);
-}
-
-VsPluginLog.logDebug = function (...args) {
- recordLog(VsPluginLog.LEV_DEBUG, args);
-}
-
-VsPluginLog.logInfo = function (...args) {
- recordLog(VsPluginLog.LEV_INFO, args);
-}
-
-VsPluginLog.getResult = function () {
- return logResultMessage;
-}
-
-module.exports = {
- VsPluginLog
-}
\ No newline at end of file
diff --git a/hdc/service/service_vs_plugin/src/gen/tools/VsPluginRe.js b/hdc/service/service_vs_plugin/src/gen/tools/VsPluginRe.js
deleted file mode 100755
index 909d7d54ea6331ab45c2fd58ea20f2444b66f254..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/gen/tools/VsPluginRe.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-
-function search(ss, data) {
- ss = replaceAll(ss, "\\.", "\\.")
- let reg = new RegExp(ss);
- let tt = reg.exec(data);
- if (tt == null) return null;
- let ret = { "regs": [] }
- for (let i = 0; i < tt.length; i++) {
- let p = data.indexOf(tt[i]);
- if (tt[i] == null) {
- ret["regs"].push([-1, -1])
- }
- else {
- ret["regs"].push([p, p + tt[i].length])
- }
- }
-
- return ret;
-}
-
-function match(ss, data) {
- let tt = search(ss, data)
- if (tt != null && tt.regs[0][0] == 0) return tt;
- return null;
-}
-
-function getFileInPath(tpath) {
- return path.parse(tpath).base;
-}
-
-function getPathInPath(tpath) {
- return path.parse(tpath).dir;
-}
-
-function all(sfrom) {
- return new RegExp(sfrom, "g");
-}
-
-function replaceAll(ss, sfrom, sto) {
- return ss.replace(all(sfrom), sto)
-}
-
-module.exports = {
- search,
- match,
- getFileInPath,
- getPathInPath,
- replaceAll,
- all
-}
\ No newline at end of file
diff --git a/hdc/service/service_vs_plugin/src/gen/tools/VsPluginTool.js b/hdc/service/service_vs_plugin/src/gen/tools/VsPluginTool.js
deleted file mode 100755
index ddfdb220ebb64227418954eb4450460006bb79c6..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/gen/tools/VsPluginTool.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const os = require('os');
-const tsc = require("../../node_modules/typescript");
-const fs = require('fs');
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-function replaceAll(s, sfrom, sto) {
- while (s.indexOf(sfrom) >= 0) {
- s = s.replace(sfrom, sto)
- }
- return s;
-}
-
-function detectPlatform() {
- if (os.type() == 'Windows_NT') {
- return 'win';
- } else if (os.type() == 'Darwin') {
- return 'mac';
- } else if (os.type() == 'Linux') {
- return 'Linux';
- }
-}
-
-function checkFileError(ifname) {
- let program = tsc.createProgram([ifname], {})
- let emitResult = program.emit();
- let allDiagnostics = tsc.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
-
- let errorMsg = ''
- allDiagnostics.forEach(diagnostic => {
- if (diagnostic.file) {
- let { line, character } = tsc.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
- let message = tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
- errorMsg += `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}\n`;
- } else {
- errorMsg += tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + "\n";
- }
- });
-
- if (allDiagnostics.length > 0) {
- return [false, errorMsg];
- }
- return [true, ""];
-}
-
-function utf8ArrayToStr(array) {
- var res, i, length, ch;
- var ch2, ch3;
-
- res = "";
- length = array.length;
- i = 0;
- while (i < length) {
- ch = array[i++];
- let c = ch >> 4;
- switch (c) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- res += String.fromCharCode(ch);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- ch2 = array[i++];
- let tmp = (ch & 0x1F) << 6;
- let tmp2 = ch2 & 0x3F;
- res += String.fromCharCode(tmp | tmp2);
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- ch2 = array[i++];
- ch3 = array[i++];
- let tmp3 = (ch & 0x0F) << 12;
- let tmp4 = (ch2 & 0x3F) << 6;
- let tmp5 = (ch3 & 0x3F) << 0;
- res += String.fromCharCode(tmp3 | tmp4 | tmp5);
- break;
- }
- }
-
- return res;
- }
-
- function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
- }
-
-module.exports = {
- replaceAll,
- detectPlatform,
- checkFileError,
- readFile
-}
\ No newline at end of file
diff --git a/hdc/service/service_vs_plugin/src/images/file.png b/hdc/service/service_vs_plugin/src/images/file.png
deleted file mode 100755
index f5c365a02e99414acb29c643fc2d64d150cff9f0..0000000000000000000000000000000000000000
Binary files a/hdc/service/service_vs_plugin/src/images/file.png and /dev/null differ
diff --git a/hdc/service/service_vs_plugin/src/images/file_black.png b/hdc/service/service_vs_plugin/src/images/file_black.png
deleted file mode 100644
index fd54e8a66190cee967d71270a1375952c59c4ccb..0000000000000000000000000000000000000000
Binary files a/hdc/service/service_vs_plugin/src/images/file_black.png and /dev/null differ
diff --git a/hdc/service/service_vs_plugin/src/images/path.png b/hdc/service/service_vs_plugin/src/images/path.png
deleted file mode 100755
index 56f408a584f243956fab1916d9152f34364cdf78..0000000000000000000000000000000000000000
Binary files a/hdc/service/service_vs_plugin/src/images/path.png and /dev/null differ
diff --git a/hdc/service/service_vs_plugin/src/images/service.png b/hdc/service/service_vs_plugin/src/images/service.png
deleted file mode 100644
index 170d094f65402ae674bb746ccbba8a1d57e3ce09..0000000000000000000000000000000000000000
Binary files a/hdc/service/service_vs_plugin/src/images/service.png and /dev/null differ
diff --git a/hdc/service/service_vs_plugin/src/jsconfig.json b/hdc/service/service_vs_plugin/src/jsconfig.json
deleted file mode 100755
index 53b981c57b79a7a2dac9995ee4ce04b8c94e0b17..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/jsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "ES2020",
- "checkJs": true, /* Typecheck .js files. */
- "lib": [
- "ES2020"
- ]
- },
- "exclude": [
- "node_modules"
- ]
-}
diff --git a/hdc/service/service_vs_plugin/src/package.json b/hdc/service/service_vs_plugin/src/package.json
deleted file mode 100755
index 108394d67171930c8396fe3ab7343623fb69c41b..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/package.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "name": "service-gen",
- "displayName": "service-gen",
- "description": "Generate IPC service framework code for OpenHarmony",
- "version": "0.0.1",
- "keywords": [
- "service",
- "service-gen"
- ],
- "icon": "images/service.png",
- "engines": {
- "vscode": "^1.62.0"
- },
- "categories": [
- "Other"
- ],
- "activationEvents": [
- "onStartupFinished"
- ],
- "main": "./extension.js",
- "publisher": "kaihong",
- "contributes": {
- "commands": [
- {
- "command": "generate_service",
- "title": "Service Generate Frame"
- },
- {
- "command": "generate_service_menu",
- "title": "Service Generate Frame"
- }
- ],
- "menus": {
- "explorer/context": [
- {
- "when": "resourceExtname == .h",
- "command": "generate_service"
- }
- ],
- "editor/context": [
- {
- "command": "generate_service_menu"
- }
- ]
- }
- },
- "scripts": {
- "lint": "eslint .",
- "pretest": "npm run lint",
- "test": "node ./test/runTest.js"
- },
- "devDependencies": {
- "@types/glob": "^7.1.4",
- "@types/mocha": "^9.0.0",
- "@types/node": "14.x",
- "@types/vscode": "^1.62.0",
- "@vscode/test-electron": "^1.6.2",
- "eslint": "^8.1.0",
- "glob": "^7.1.7",
- "mocha": "^9.1.3",
- "webpack": "^5.64.4",
- "webpack-cli": "^4.9.1"
- },
- "dependencies": {
- "compressing": "^1.5.1",
- "node-gyp": "^9.0.0",
- "stdio": "^2.1.1",
- "typescript": "^4.8.4",
- "vsce": "^2.11.0"
- },
- "repository": {
- "type": "gitee",
- "url": "https://gitee.com/openharmony/napi_generator/tree/master/hdc/service"
- }
-}
diff --git a/hdc/service/service_vs_plugin/src/vs_plugin_view.html b/hdc/service/service_vs_plugin/src/vs_plugin_view.html
deleted file mode 100755
index b8b5fb23d144188d2e4f07160c2dea4263afd174..0000000000000000000000000000000000000000
--- a/hdc/service/service_vs_plugin/src/vs_plugin_view.html
+++ /dev/null
@@ -1,270 +0,0 @@
-
-
-
-
-
- Napi
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/ts/examples/TsGenTest.h b/hdc/ts/examples/TsGenTest.h
deleted file mode 100755
index 8af86d1c4dcef03d3a806d46f94f24e9decf5c13..0000000000000000000000000000000000000000
--- a/hdc/ts/examples/TsGenTest.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef TSGENTEST_H
-#define TSGENTEST_H
-
-#include
-#include
-#include
-
-namespace OHOS {
-class TsGenTest {
-public:
- std::string getServName();
- std::string getServTime();
- int32_t doSum(int32_t num1, int32_t num2);
- double addCount(double newNum);
-};
-}
-#endif
diff --git a/hdc/ts/figures/DevEco_step_finish.png b/hdc/ts/figures/DevEco_step_finish.png
deleted file mode 100644
index b02a3bd8ab283840a1401131153e1b67d83dd772..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_finish.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_firstNext.png b/hdc/ts/figures/DevEco_step_firstNext.png
deleted file mode 100644
index 812504617e554fa1985f1bda04fa2af3b122a4a0..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_firstNext.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_napiPlugins.png b/hdc/ts/figures/DevEco_step_napiPlugins.png
deleted file mode 100644
index 6cdf8d45df6b37300a502ab916d267d182aa265a..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_napiPlugins.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_newFile.png b/hdc/ts/figures/DevEco_step_newFile.png
deleted file mode 100644
index 3b69aa21918c6a0377fad1e9dfdc6f702d046510..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_newFile.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_pluginsOk.png b/hdc/ts/figures/DevEco_step_pluginsOk.png
deleted file mode 100644
index b5b783f70c60e3f60c9d3be287925da4d11d8592..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_pluginsOk.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_ts.png b/hdc/ts/figures/DevEco_step_ts.png
deleted file mode 100644
index 7d0cc5cd29a97a31b4135b2d83d8d4420672a263..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_ts.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_tsGenerate.png b/hdc/ts/figures/DevEco_step_tsGenerate.png
deleted file mode 100644
index bcdc65b45d1d062c619e696fd7057a62407f0460..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_tsGenerate.png and /dev/null differ
diff --git a/hdc/ts/figures/DevEco_step_ts_ok.png b/hdc/ts/figures/DevEco_step_ts_ok.png
deleted file mode 100644
index 5354e619b1571274c52127fa81bd6b2b12a68bdb..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/DevEco_step_ts_ok.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_Proj_Module.png b/hdc/ts/figures/IntelliJ_env_Proj_Module.png
deleted file mode 100644
index 5b7cd4c353f7562b238d93b169773cb5acebac19..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_Proj_Module.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_Proj_Module_New.png b/hdc/ts/figures/IntelliJ_env_Proj_Module_New.png
deleted file mode 100644
index d8c180413b38fbd8e8e5c21116612ea400671f07..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_Proj_Module_New.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_built_jar.png b/hdc/ts/figures/IntelliJ_env_built_jar.png
deleted file mode 100644
index c58a2e7c8212ca39f4fc83f8df3d5b682a2c995d..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_built_jar.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_built_jar_success.png b/hdc/ts/figures/IntelliJ_env_built_jar_success.png
deleted file mode 100644
index 8a523e27f4636bb2832b62f4e04a282879e06e92..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_built_jar_success.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_built_pro.png b/hdc/ts/figures/IntelliJ_env_built_pro.png
deleted file mode 100644
index 706d14a767e5a8a0d7d680fab8fcfd99c7b6b1ee..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_built_pro.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_config_SDKs.png b/hdc/ts/figures/IntelliJ_env_config_SDKs.png
deleted file mode 100644
index 0d88eb74c03bcf7f42a33dd3181de767317bb3b4..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_config_SDKs.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_config_SDKs_Classpath.png b/hdc/ts/figures/IntelliJ_env_config_SDKs_Classpath.png
deleted file mode 100644
index 0c9ec0f0dc6374b4851f9cae0e84a5a23f5fe00a..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_config_SDKs_Classpath.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_config_open_proj.png b/hdc/ts/figures/IntelliJ_env_config_open_proj.png
deleted file mode 100644
index 85dec13c8a697ad394a3096b491e1712f6af5f21..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_config_open_proj.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_configurations.png b/hdc/ts/figures/IntelliJ_env_configurations.png
deleted file mode 100644
index b7b59e971a29f7569dc256e896aee5d303b9f917..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_configurations.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_module_root.png b/hdc/ts/figures/IntelliJ_env_module_root.png
deleted file mode 100644
index 82ef14d0c78f6272477c23e85f8213091cf8fc83..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_module_root.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_proj_structure.png b/hdc/ts/figures/IntelliJ_env_proj_structure.png
deleted file mode 100644
index ce351442dd7351f68278cfb0fd630a3b86fabad5..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_proj_structure.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_run_debug.png b/hdc/ts/figures/IntelliJ_env_run_debug.png
deleted file mode 100644
index 2a66273f815c18a2c616a37d376937b640e679eb..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_run_debug.png and /dev/null differ
diff --git a/hdc/ts/figures/IntelliJ_env_select_moudles.png b/hdc/ts/figures/IntelliJ_env_select_moudles.png
deleted file mode 100644
index b1b1295736cd98f8274014b5c5764c439930fd5b..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/IntelliJ_env_select_moudles.png and /dev/null differ
diff --git a/hdc/ts/figures/h-2-ts-succ.png b/hdc/ts/figures/h-2-ts-succ.png
deleted file mode 100644
index ea4e1cf01a015de67e7ad551d9b79c2ea81e0441..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/h-2-ts-succ.png and /dev/null differ
diff --git a/hdc/ts/figures/header_parser_not_exist.png b/hdc/ts/figures/header_parser_not_exist.png
deleted file mode 100644
index 708eb95318b2b287903daa2fd0c8867aa0f87ffa..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/header_parser_not_exist.png and /dev/null differ
diff --git a/hdc/ts/figures/pic-plug-in-h-c++.png b/hdc/ts/figures/pic-plug-in-h-c++.png
deleted file mode 100644
index 5308191745d38cdbf494b9390cc2711daef97167..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/pic-plug-in-h-c++.png and /dev/null differ
diff --git a/hdc/ts/figures/pic-plug-in-h.png b/hdc/ts/figures/pic-plug-in-h.png
deleted file mode 100644
index 1e9d0658cc40d2899dc2b5d9d1929c3df119ce1f..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/pic-plug-in-h.png and /dev/null differ
diff --git a/hdc/ts/figures/pic-plug-in-search.png b/hdc/ts/figures/pic-plug-in-search.png
deleted file mode 100644
index e37db358f625276a615fdcec2ac2267c4545d3ae..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/pic-plug-in-search.png and /dev/null differ
diff --git a/hdc/ts/figures/pic-plug-in-select.png b/hdc/ts/figures/pic-plug-in-select.png
deleted file mode 100644
index 0f96701dfa950dd0565b1ccaadd515499c601958..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/pic-plug-in-select.png and /dev/null differ
diff --git a/hdc/ts/figures/pic-plug-in-ts-gen.png b/hdc/ts/figures/pic-plug-in-ts-gen.png
deleted file mode 100644
index 2fa74c228b913f34dedbc8f7f7310ea2f2f0234d..0000000000000000000000000000000000000000
Binary files a/hdc/ts/figures/pic-plug-in-ts-gen.png and /dev/null differ
diff --git a/hdc/ts/ts_IntelliJ_plugin/README_zh.md b/hdc/ts/ts_IntelliJ_plugin/README_zh.md
deleted file mode 100644
index 1794c81b23cabc7c7cccb52e877e4d1aed534c15..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/README_zh.md
+++ /dev/null
@@ -1,127 +0,0 @@
-# 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应用层接口。
-
-### 工具使用
-
-插件下载路径如下,点击download下载。
-
-[下载链接](https://plugins.jetbrains.com/plugin/21420-ts-generator/edit/versions)
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](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,生成的输出文件,如下所示:
-
-其中生成的"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/guide/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/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md b/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md
deleted file mode 100644
index f28d2d08ef3e02d482e744a8caf99bfaa4b98673..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# TS工具IntelliJ插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的IntelliJ插件。
-
-## IntelliJ插件打包说明
-
-### 环境说明
-
-系统:建议Windows 10
-
-### 开发步骤
-
-#### 环境准备
-
-1.下载napi_generator-win.exe可执行程序与header_parser.exe可执行程序,放置在napi_generator/napi_IntelliJ_plugin/resources/cmds/win目录下。其中header_parser.exe在header_parser/windows/下,下载地址如下(由于网络原因,可能会导致有的下载链接失效,因此提供了以下三个下载链接):
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-2.下载并安装IDEA Community、JDK11配置好环境。IDEA Community版本可以左键单击以下链接下载。
-
-[下载链接](https://www.jetbrains.com/idea/download/)
-
-3.打开IDEA Community应用程序。
-依次点击项目File>Open 选择napi_generator/hdc/ts/ts_IntelliJ_plugin项目文件夹。
-
-
-
-4.项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,Language level也选择版本11,选择或者新建complier output目录为项目文件下的out目录。
-
-
-5.Project Settings > Modules 新建Modules。点击上方“-”删除原有的Modules,然后点击“+”选择 New Module。
-
-
-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。
-
-
-7.Content root选择~/napi_generator/hdc/ts/ts_IntelliJ_plugin文件夹,module name填写generator。点击Finish,若出现提示已存在是否覆盖的提示,请点“Yes”完成配置。
-
-
-8.Modules配置完成后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。
-
-
-9.在SDKs->IntelliJ IDEA Community 2021.3.3->Classpath下导入程序需要的依赖:napi_generator.jar包
-
-
-
-10.若完成以上步骤配置,点击OK完成配置。Rebuild项目,若IDEA不能点击右上角的运行,点击Plugin后下三角选择Edit Configurations...选项,Run/Debug Configurations框中Use classpath of moudle选择generator,点击ok,等待安装完成。
-
-
-
-
-
-11.点击Intellij IDEA工具右上角Built Project按钮,等待工程built完成。
-
-
-
-12.在IDEA Community中依次点击Build>Prepare All Plugin Modules for development",然后在Select Modules框中点击ok,jar包生成完成后在工具右下角提示jar包生成成功,且包含jar包存放位置。
-
-
-
-
-
-
diff --git a/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md b/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index 1311178896e0f5e14107d91b9ce76b7c94a48240..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Ts接口生成工具IntelliJ插件使用说明
-
-## 简介
-
-Ts接口生成工具目前支持两种入口,分别是可执行程序、IntelliJ插件,本文主要介绍IntelliJ插件使用说明。IntelliJ插件下载路径如下,点击download下载。
-
-[下载链接](https://plugins.jetbrains.com/plugin/21420-ts-generator/edit/versions)
-
-## IntelliJ插件使用方法
-
-### 依赖
-
-系统:建议Windows 10
-
-开发工具:DevEco Studio
-
-### 使用指导
-
-1.新建或打开项目工程,以下以新建项目工程为例。
-
-File->New->Create Project。
-
-
-
-Ability Template选择Empty Ability,单击Next。
-
-
-
-填写Project name、Save location,其它选项可不修改,单击Finish,新的工程就创建好了。
-
-
-
-2.安装插件,File->Settings->Plugins->Installed->Install Plugin from Disk...,选择下载的generator.jar,安装成功之后重启IDE。
-
-
-
-
-
-3.把需要转换的.h文件放在DevEco stdio新建项目的src目录下。
-
-
-
-4.选择.h文件,点击右键选择Generate Ts Frame,工具弹出Generate Ts Frame弹窗,选择Ts-Gen页签。文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击ok。
-
-
-
-
-
-5.执行结束后会在输出目录下生成.d.ts代码文件。
diff --git a/hdc/ts/ts_IntelliJ_plugin/resources/META-INF/plugin.xml b/hdc/ts/ts_IntelliJ_plugin/resources/META-INF/plugin.xml
deleted file mode 100644
index 64b5b96ebbb2ca9ffae503c319657668dafcfbc8..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
- com.sk.ts
- Ts Generator
- 1.0.1
- 深圳开鸿数字产业发展有限公司
-
- Introduction
- One-click generation of NAPI framework code, business code framework, GN file, etc. according to the ts (typescript) interface file in the user-specified path.
- When developing the interface between JS applications and NAPI, the developers of the underlying framework do not need to pay attention to the upper-level application conversion logic such as Nodejs syntax, data type conversion between C++ and JS, and only focus on the underlying business logic. Professional people do professional things. Thus, the development efficiency can be greatly improved
- Sources on Gitee
- ]]>
-
-
- Features
- ]]>
-
-
-
-
- com.intellij.modules.platform
- com.sk.ng
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/hdc/ts/ts_IntelliJ_plugin/resources/cmds/linux/INTELLIJ_README_LINUX_zh.md b/hdc/ts/ts_IntelliJ_plugin/resources/cmds/linux/INTELLIJ_README_LINUX_zh.md
deleted file mode 100644
index d0893365de6d626394ae4428b4f42c5f224c3530..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/resources/cmds/linux/INTELLIJ_README_LINUX_zh.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# 目录说明
- 此目录用于存放napi_generator-linux可执行文件
-
-[可执行文件下载](http://ftpkaihongdigi.i234.me:5000/fsdownload/PPVcNMgVv/2022-06-13)
\ No newline at end of file
diff --git a/hdc/ts/ts_IntelliJ_plugin/resources/cmds/mac/INTELLIJ_README_MAC_zh.md b/hdc/ts/ts_IntelliJ_plugin/resources/cmds/mac/INTELLIJ_README_MAC_zh.md
deleted file mode 100644
index 2b79c41e144f94743618a7ba57c625ac67e24a78..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/resources/cmds/mac/INTELLIJ_README_MAC_zh.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# 目录说明
- 此目录用于存放napi_generator-macos可执行文件
-
-[可执行文件下载](http://ftpkaihongdigi.i234.me:5000/fsdownload/PPVcNMgVv/2022-06-13)
\ No newline at end of file
diff --git a/hdc/ts/ts_IntelliJ_plugin/resources/cmds/win/INTELLIJ_README_WIN_zh.md b/hdc/ts/ts_IntelliJ_plugin/resources/cmds/win/INTELLIJ_README_WIN_zh.md
deleted file mode 100644
index 95286c4fe3e5f61535020d5365a6af63851ed558..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/resources/cmds/win/INTELLIJ_README_WIN_zh.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# 目录说明
- 此目录用于存放napi_generator-win.exe可执行文件
-
-[可执行文件下载](http://ftpkaihongdigi.i234.me:5000/fsdownload/PPVcNMgVv/2022-06-13)
\ No newline at end of file
diff --git a/hdc/ts/ts_IntelliJ_plugin/resources/images/openDisk.png b/hdc/ts/ts_IntelliJ_plugin/resources/images/openDisk.png
deleted file mode 100644
index 5956a0e538a400c7deaf41167ae5ea70348b8584..0000000000000000000000000000000000000000
Binary files a/hdc/ts/ts_IntelliJ_plugin/resources/images/openDisk.png and /dev/null differ
diff --git a/hdc/ts/ts_IntelliJ_plugin/resources/images/text.png b/hdc/ts/ts_IntelliJ_plugin/resources/images/text.png
deleted file mode 100644
index f42534169aa41dd830a7cb09792fe1428c2f34f7..0000000000000000000000000000000000000000
Binary files a/hdc/ts/ts_IntelliJ_plugin/resources/images/text.png and /dev/null differ
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/action/SelectHAction.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/action/SelectHAction.java
deleted file mode 100644
index 8381b6a17da5dbe096ec696e94ed4de32a0db5da..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/action/SelectHAction.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.action;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.project.Project;
-import com.sk.ts.utils.FileUtil;
-import com.sk.ts.utils.GenNotification;
-import org.apache.http.util.TextUtils;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.util.prefs.Preferences;
-
-/**
- * 编译文件夹选择框
- *
- * @author: xudong
- * @see: select generator file path
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class SelectHAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
- private final JTextField outPath;
- private final Project project;
-
- public SelectHAction(JButton button, JTextField textField, JTextField outPath, Project project) {
- this.button = button;
- this.textField = textField;
- this.outPath = outPath;
- this.project = project;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- Preferences preferences = Preferences.userRoot();
- // 弹窗默认路径为上次选中的文件/目录路径
- String hFilePath = textField.getText().split(",")[0];
- if (hFilePath.isBlank()) {
- // 如果上次选中路径为空,则取历史记录中上次打开的路径
- hFilePath = preferences.get("interPathRecord", "");
- }
- JFileChooser fcDlg = new JFileChooser(hFilePath);
- fcDlg.setDialogTitle("请选择.h文件路径...");
- fcDlg.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- FileNameExtensionFilter filter = new FileNameExtensionFilter("文本文件(*.h)", "h");
- fcDlg.setMultiSelectionEnabled(true);
- fcDlg.setFileFilter(filter);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String upPath = fcDlg.getSelectedFile().getParent();
- File[] files = fcDlg.getSelectedFiles();
- String interFile = setSelectFile(files);
- if (TextUtils.isBlank(interFile)) {
- return;
- }
- // 设置默认打开路径;
- preferences.put("interPathRecord", upPath);
- textField.setText(interFile.substring(0, interFile.length() - 1));
- outPath.setText(upPath);
- }
- }
- }
-
- private String setSelectFile(File[] files) {
- StringBuilder interFile = new StringBuilder();
- boolean existFile = false;
- boolean existDir = false;
- for (File file : files) {
- if (file.isDirectory()) {
- if (!existDir) {
- existDir = true;
- interFile.append(file.getPath()).append(",");
- } else {
- GenNotification.notifyMessage(project,
- "目前只支持单个文件夹转换",
- "选择不符合要求",
- NotificationType.WARNING);
- textField.setText("");
- return "";
- }
- } else {
- if (!FileUtil.patternFileName(file.getName())) {
- GenNotification.notifyMessage(project,
- file.getPath(),
- file.getName() + "文件名不符合",
- NotificationType.WARNING);
- return "";
- }
- existFile = true;
- interFile.append(file.getPath()).append(",");
- }
- }
- if (existDir && existFile) {
- GenNotification.notifyMessage(project,
- "不能同时转换文件和文件夹",
- "选择不符合要求",
- NotificationType.WARNING);
- textField.setText("");
- return "";
- }
- return interFile.toString();
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/action/SelectOutPathAction.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/action/SelectOutPathAction.java
deleted file mode 100644
index 75b9dc9b7b1aa61c5c65b448db143546ae0eb9e6..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/action/SelectOutPathAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.action;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * 编译文件夹选择框
- *
- * @author: xudong
- * @see: select generator file path
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class SelectOutPathAction implements ActionListener {
- private final JButton button;
- private final JTextField textField;
-
- public SelectOutPathAction(JButton button, JTextField textField) {
- this.button = button;
- this.textField = textField;
- }
-
- @Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource().equals(button)) {
- JFileChooser fcDlg = new JFileChooser(textField.getText());
- fcDlg.setDialogTitle("请选择输出目录路径...");
- fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = fcDlg.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- String filepath = fcDlg.getSelectedFile().getPath();
- textField.setText(filepath);
- }
- }
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDiagPane.form b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDiagPane.form
deleted file mode 100644
index c9f5d86cb5bd7455068d2826288126fe58f119a4..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDiagPane.form
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDiagPane.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDiagPane.java
deleted file mode 100644
index 6fe85ed671766851c2200ef414a0d4e5b8efb545..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDiagPane.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.dialog;
-
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JDialog;
-import javax.swing.ImageIcon;
-
-/**
- * ConfirmDiagPane自定义确认对话框
- * 解决ShowConfirmDiag 在Deveco里面会出现界面错位问题。
- *
- * @author: xudong
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ConfirmDiagPane extends JDialog {
- private JPanel contentPane;
- private JLabel msgLabel;
- private JLabel iconLabel;
-
- /**
- * 构造函数
- *
- * @param sErrorMessage 错误信息
- */
- public ConfirmDiagPane(String sErrorMessage) {
- msgLabel.setText(sErrorMessage);
- iconLabel.setIcon(new ImageIcon(""));
- }
-
-
- JPanel getContentPanel() {
- return contentPane;
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDialog.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDialog.java
deleted file mode 100644
index 57753319263dad142a618307ab27b0e87fa46889..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ConfirmDialog.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.dialog;
-
-import com.intellij.openapi.ui.DialogWrapper;
-import org.jetbrains.annotations.Nullable;
-import javax.swing.JComponent;
-
-/**
- * 自定义确认对话框Wrapper
- *
- * @author: xudong
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ConfirmDialog extends DialogWrapper {
- private final ConfirmDiagPane confirmDiagPane;
-
- /**
- * 构造函数
- * @param message 弹出框信息内容
- */
- public ConfirmDialog(String message) {
- super(true);
- confirmDiagPane = new ConfirmDiagPane(message);
- setOKButtonText("Yes");
- setCancelButtonText("No");
- setUndecorated(true);
- setResizable(false);
- init();
- }
-
- @Override
- @Nullable
- protected JComponent createCenterPanel() {
- return confirmDiagPane.getContentPanel();
- }
-
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ErrorDialog.form b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ErrorDialog.form
deleted file mode 100644
index 5354cddb7e45ef20d8bfac5b50236885e2bb58f4..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ErrorDialog.form
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ErrorDialog.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ErrorDialog.java
deleted file mode 100644
index c8ede3dc2c14948653aa3ba851d1b8d877d4847c..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/ErrorDialog.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-
-/**
- * ErrorDialog错误对话框
- *
- * @author: xudong
- * @see: generator error dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class ErrorDialog extends JDialog {
- private static final Logger LOG = Logger.getInstance(ErrorDialog.class);
- private static final String URL =
- "rundll32 url.dll,FileProtocolHandler" + " https://gitee" + ".com/openharmony" + "-sig/napi_generator";
-
- private JPanel contentPane;
- private JButton buttonOK;
- private JButton buttonHelp;
- private JTextArea textAreaError;
- private String errorMessage;
-
- public ErrorDialog(String sErrorMessage) {
- errorMessage = sErrorMessage;
- }
-
- /**
- * 初始化
- */
- public void initDialog() {
- setContentPane(contentPane);
- setModal(true);
- getRootPane().setDefaultButton(buttonOK);
- setTitle("执行失败");
- textAreaError.setText(errorMessage);
- buttonOK.addActionListener(actionEvent -> onOK());
-
- buttonHelp.addActionListener(actionEvent -> onCancel());
-
- // call onCancel() when cross is clicked
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- /**
- * close dialog
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- });
-
- // call onCancel() on ESCAPE
- contentPane.registerKeyboardAction(actionEvent -> onCancel(),
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- }
-
- private void onOK() {
- dispose();
- }
-
- private void onCancel() {
- try {
- Runtime.getRuntime().exec(URL);
- } catch (IOException ioException) {
- LOG.error("exec command help error" + ioException);
- }
- dispose();
- }
-}
\ No newline at end of file
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenResultDialog.form b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenResultDialog.form
deleted file mode 100644
index 90afafa6e015c023031e72da3ca40b3cd4a3a9ac..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenResultDialog.form
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenResultDialog.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenResultDialog.java
deleted file mode 100644
index 53d3ae3ab3a89749cdcc79e424b5104a5e5b280f..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenResultDialog.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * GenResultDialog结果生成框
- *
- * @author: xudong
- * @see: generate success dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class GenResultDialog extends JDialog {
- private static final Logger LOG = Logger.getInstance(GenResultDialog.class);
-
- private JPanel contentPane;
- private JButton buttonOK;
- private JList resultList;
- private String path;
-
- public GenResultDialog(String directoryPath) {
- path = directoryPath;
- }
-
- /**
- * 初始化
- */
- public void initResultDialog() {
- setContentPane(contentPane);
- setModal(true);
- getRootPane().setDefaultButton(buttonOK);
- setTitle("执行成功");
- buttonOK.addActionListener(actionEvent -> onOK());
- List fileList = getDirFileName(path);
- resultList.setListData(fileList.toArray(new String[fileList.size()]));
- }
-
- private void onOK() {
- dispose();
- }
-
- private List getDirFileName(String path) {
- List files = new ArrayList<>();
- File file = new File(path);
- if (!file.exists()) {
- LOG.info("getDirFileName f not exist");
- return files;
- }
- File[] fileArray = file.listFiles();
- for (int i = 0; i < fileArray.length; i++) {
- File fs = fileArray[i];
- if (!fs.isDirectory()) {
- files.add(fs.getPath());
- } else {
- LOG.info("getDirFileName this file is dir");
- }
- }
- return files;
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenerateDialogPane.form b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenerateDialogPane.form
deleted file mode 100644
index 1396b68e21dfed4ca4a145b940d6e17ff56987fb..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenerateDialogPane.form
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenerateDialogPane.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenerateDialogPane.java
deleted file mode 100644
index 676c9d6798f496e04db25cacf4f4966f091be96b..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/GenerateDialogPane.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.dialog;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.ValidationInfo;
-
-import com.sk.ts.action.SelectHAction;
-import com.sk.ts.action.SelectOutPathAction;
-import com.sk.ts.utils.FileInfo;
-import com.sk.ts.utils.FileUtil;
-import com.sk.ts.utils.GenNotification;
-import org.apache.http.util.TextUtils;
-import org.jetbrains.annotations.Nullable;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.KeyStroke;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 配置对话框
- *
- * @author: xudong
- * @see: generator dialog
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class GenerateDialogPane extends JDialog {
- private static final Logger LOG = Logger.getInstance(GenerateDialogPane.class);
-
- private final Project project;
- private List tsFileList = new ArrayList<>();
- private JPanel contentPane;
- private JTextField textFieldSelectH;
- private JTextField textFieldSelectOutPath;
-
- private JButton buttonSelectH;
- private JButton buttonSelectOutPath;
-
- private boolean generateSuccess = true;
- private String sErrorMessage = "";
- private String interFileOrDir;
- private String genOutDir;
- private String scriptOutDir;
- private String hGenFileName;
- private String tsGenFileName;
- private String tsOutPath;
-
-
- /**
- * 构造函数
- *
- * @param project projectid
- * @param interFilePath 接口文件路径
- * @param genDir 生成框架文件路径
- * @param scriptDir 脚本目录
- */
- public GenerateDialogPane(Project project, String interFilePath, String genDir, String scriptDir) {
- setContentPane(contentPane);
- setModal(true);
- this.project = project;
- this.interFileOrDir = interFilePath;
- this.genOutDir = genDir;
- this.scriptOutDir = scriptDir;
- if (FileUtil.patternFileNameH(scriptDir)) {
- textFieldSelectH.setText(interFileOrDir);
- textFieldSelectOutPath.setText(genOutDir);
- }
- contentPane.registerKeyboardAction(actionEvent -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
- buttonSelectH.addActionListener(new SelectHAction(buttonSelectH, textFieldSelectH,
- textFieldSelectOutPath, project));
- buttonSelectOutPath.addActionListener(new SelectOutPathAction(buttonSelectOutPath, textFieldSelectOutPath));
-
- }
-
- @Override
- public synchronized void addWindowListener(WindowListener windowListener) {
- super.addWindowListener(windowListener);
- new WindowAdapter() {
- /**
- * close dialog
- *
- * @param windowEvent WindowEvent
- */
- @Override
- public void windowClosing(WindowEvent windowEvent) {
- onCancel();
- }
- };
- }
-
- /**
- * 检查输入的.h文件转换后的同名.d.ts文件是否在输出目录中已存在
- *
- * @param fileObj .h文件对象
- * @param outPutDir 输出目录
- * @return 如果ts文件已存在,返回文件名;否则返回空字符串
- */
- private String getExistFileName(File fileObj, String outPutDir) {
- if (fileObj.isDirectory()) {
- // 遇到文件夹直接跳过不检查,只检查普通.h文件是否存在对应的.ts
- return "";
- }
- String hFileName = fileObj.getName();
- String tsFileName = hFileName.substring(0, hFileName.lastIndexOf(".")) + ".d.ts";
- File tsFile = new File(outPutDir + "/" + tsFileName);
- return tsFile.exists() ? tsFile.toString() : "";
- }
-
- /**
- * 检查待生成的ts文件在输出目录中是否已存在
- *
- * @param hFilePath 待转换的.h文件/目录路径
- * @param outPutDir 输出目录路径
- * @return 如果ts文件已存在,返回文件名;否则返回空字符串
- */
- private String checkTsFileExist(String hFilePath, String outPutDir) {
- File hFileObj = new File(hFilePath);
- if (!hFileObj.isDirectory()) {
- return getExistFileName(hFileObj, outPutDir);
- } else {
- File[] fileList = hFileObj.listFiles();
- for (File fileObj : fileList) {
- String existFileName = getExistFileName(fileObj, outPutDir);
- if (!existFileName.equals("")) {
- return existFileName;
- }
- }
- }
- return "";
- }
-
- /**
- * 验证文本选择框是否空。是否替换已存在的内容
- *
- * @return ValidationInfo 返回不符要求的信息。
- */
- @Nullable
- public ValidationInfo validationInfo() {
- ValidationInfo validationInfo = null;
-
- String hFile = textFieldSelectH.getText();
- String outPutDir = textFieldSelectOutPath.getText();
- boolean isEmptyFile = TextUtils.isEmpty(hFile) || TextUtils.isEmpty(outPutDir);
- if (isEmptyFile) {
- String warnMsg = "文件路径、输出路径不能为空";
- warningMessage(warnMsg);
- validationInfo = new ValidationInfo(warnMsg);
- return validationInfo;
- }
-
- String existFileName = checkTsFileExist(hFile, outPutDir);
- if (!existFileName.equals("")) {
- ConfirmDialog confirmDialog = new ConfirmDialog(
- String.format("是否替换已存在的文件:%s ?", existFileName));
- if (!confirmDialog.showAndGet()) {
- validationInfo = new ValidationInfo(String.format("不替换现有文件:%s", existFileName));
- return validationInfo;
- }
- }
-
- return validationInfo;
- }
-
- private void onCancel() {
- dispose();
- }
-
- private void warningMessage(String title) {
- String notifyContent = "请选择接口文件或文件夹,生成框架路径,编译脚本路径";
- GenNotification.notifyMessage(this.project, notifyContent, title, NotificationType.WARNING);
- }
-
- /**
- * 拷贝文件到本地临时目录
- *
- * @param fileName 文件名
- */
- private void copyFileToLocalPath(String fileName) {
- String sysName = System.getProperties().getProperty("os.name").toUpperCase();
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- String execFn;
- if (sysName.contains("WIN")) {
- execFn = "cmds/win/" + fileName + ".exe";
- tmpDirFile += fileName + ".exe";
- } else if (sysName.contains("LINUX")) {
- execFn = "cmds/linux/" + fileName;
- tmpDirFile += fileName;
- } else {
- execFn = "cmds/mac/" + fileName;
- tmpDirFile += fileName;
- }
- try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(execFn)) {
- if (inputStream == null) {
- throw new IOException("exec File InputStream is Null");
- }
- byte[] bs = inputStream.readAllBytes();
- writeTmpFile(tmpDirFile, bs);
- if (sysName.contains("LINUX") || sysName.contains("MAC OS")) {
- executable(tmpDirFile);
- }
- } catch (IOException | InterruptedException e) {
- GenNotification.notifyMessage(this.project, e.getMessage(), "Can not Find File:" + execFn,
- NotificationType.ERROR);
- LOG.error(e);
- }
- }
-
- /**
- * 生成 -f -d 输入参数。
- *
- * @param fileOrDir 选中的文件或文件夹路径
- * @return 生成后的 -f -d的值
- */
- private String genInArgs(String fileOrDir) {
- tsFileList.clear();
- String[] interArr = fileOrDir.split(",");
- StringBuilder tsParam = new StringBuilder(" -f ");
- StringBuilder dirParam = new StringBuilder(" -d ");
- String inputCommand = "";
- if (interArr.length > 0) {
- for (String interStr : interArr) {
- File interFile = new File(interStr);
- if (interFile.isDirectory()) {
- dirParam.append(interStr).append(" ");
- for (File tsFile : interFile.listFiles()) {
- tsFileList.add(tsFile.getPath());
- }
- } else {
- tsParam.append(interStr).append(",");
- tsFileList.add(interStr);
- }
- }
- if (!TextUtils.isBlank(tsParam.toString().replaceAll("-f", ""))) {
- inputCommand += tsParam.substring(0, tsParam.length() - 1);
- }
- if (!TextUtils.isBlank(dirParam.toString().replace("-d", ""))) {
- inputCommand += dirParam.substring(0, dirParam.length() - 1);
- }
- }
- return inputCommand;
- }
-
- private boolean callExtProcess(String command) throws IOException, InterruptedException {
-
- if (TextUtils.isEmpty(command)) {
- GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
- return false;
- }
- Process process = Runtime.getRuntime().exec(command);
- genResultLog(process);
- StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
- StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
- errConsumer.start();
- outputConsumer.start();
-
- if (!generateSuccess) {
- GenNotification.notifyMessage(project, sErrorMessage, "提示", NotificationType.ERROR);
- return false;
- }
-
- errConsumer.join();
- outputConsumer.join();
- return true;
- }
-
- /**
- * 赋值可执行文件权限。
- *
- * @param execFn 可执行命令
- * @throws IOException 打开文件异常
- * @throws InterruptedException 中断异常
- */
- private void executable(String execFn) throws IOException, InterruptedException {
- callExtProcess("chmod a+x " + execFn);
- }
-
- /**
- * 拷贝可执行文件到临时文件夹
- *
- * @param path 目标文件路径
- * @param bs 字节内容
- * @throws IOException exception
- */
- private void writeTmpFile(String path, byte[] bs) throws IOException {
- File file = new File(path);
- if (!file.exists()) {
- boolean isNewFile = file.createNewFile();
- if (!isNewFile) {
- LOG.info("writeTmpFile createNewFile error");
- }
- }
- FileOutputStream fw = new FileOutputStream(file);
- fw.write(bs, 0, bs.length);
- fw.close();
- }
-
- /**
- * 获取生成成功结果文件。
- *
- * @param process 进程ID
- */
- private void genResultLog(Process process) {
- BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
- BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String sErr;
- String sOut;
- sErr = getErrorResult(stdError);
- if (TextUtils.isEmpty(sErr)) {
- sOut = genInputLog(stdInput);
- if (!generateIsSuccess(sOut)) {
- sErrorMessage = sOut;
- }
- return;
- }
- generateSuccess = false;
- sErrorMessage = sErr;
- }
-
- /**
- * 获取生成失败结果文件。
- *
- * @param stdError error buff
- * @return ErrorResult
- */
- private String getErrorResult(BufferedReader stdError) {
- StringBuilder sErr = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdError.readLine()) == null) {
- break;
- }
- sErr.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sErr.toString();
- }
-
- private boolean generateIsSuccess(String sOut) {
- generateSuccess = sOut.contains("success") || TextUtils.isEmpty(sOut);
- return generateSuccess;
- }
-
- /**
- * 获取生成文本内容。
- *
- * @param stdInput input buff
- * @return 返回当前输入框内容
- */
- private String genInputLog(BufferedReader stdInput) {
- StringBuilder sOut = new StringBuilder();
- while (true) {
- String sTmp;
- try {
- if ((sTmp = stdInput.readLine()) == null) {
- break;
- }
- sOut.append(sTmp).append(FileUtil.getNewline());
- } catch (IOException ioException) {
- LOG.error(" genResultLog stdInput error" + ioException);
- }
- }
- return sOut.toString();
- }
-
- static class StreamConsumer extends Thread {
- InputStream is;
-
- StreamConsumer(InputStream is) {
- super.setName("StreamConsumer");
- this.is = is;
- }
-
- @Override
- public void run() {
- try {
- InputStreamReader inputStreamReader = new InputStreamReader(is);
- BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
- String readLine;
- while ((readLine = bufferedReader.readLine()) != null) {
- LOG.error("StreamConsumer" + readLine);
- }
- } catch (IOException ioException) {
- LOG.error("StreamConsumer io error" + ioException);
- }
- }
- }
-
- /**
- * 获取指定输出目录下的文件列表
- *
- * @param outPath 输出目录
- * @return 文件信息列表
- */
- public List getFileInfoList(File outPath) {
- List fileInfoList = new ArrayList<>();
- File[] files = outPath.listFiles();
- for (File file : files) {
- fileInfoList.add(new FileInfo(file));
- }
- return fileInfoList;
- }
-
- /**
- * 执行主程序入口
- *
- * @return 执行状态
- */
- public boolean runFunH2ts() {
- GenNotification.notifyMessage(this.project, "", "Generating Ts", NotificationType.INFORMATION);
- copyFileToLocalPath("header_parser");
- String command;
- command = genCommandH2ts();
-
- File outPath = new File(textFieldSelectOutPath.getText());
- List oldFileList = getFileInfoList(outPath);
- try {
- if (!TextUtils.isEmpty(command) && callExtProcess(command)) {
- List newFileList = getFileInfoList(outPath);
- newFileList.removeAll(oldFileList); // 对比命令执行前后的文件列表差异,得到新生成的文件列表
- GenNotification.notifyGenResult(project, newFileList, "Generate Ts Successfully",
- NotificationType.INFORMATION);
- return true;
- }
- } catch (IOException | InterruptedException ex) {
- GenNotification.notifyMessage(project, textFieldSelectOutPath.getText(), "Command exec error",
- NotificationType.ERROR);
- LOG.error(ex);
- }
- return false;
- }
-
- /**
- * 生成命令行指令
- *
- * @return 返回命令行执行内容
- */
- private String genCommandH2ts() {
- String sysName = System.getProperties().getProperty("os.name").toUpperCase();
- String tmpDirFile = System.getProperty("java.io.tmpdir");
- if (sysName.contains("WIN")) {
- copyFileToLocalPath("napi_generator-win");
- tmpDirFile += "napi_generator-win.exe";
- } else if (sysName.contains("LINUX")) {
- copyFileToLocalPath("napi_generator-linux");
- tmpDirFile += "napi_generator-linux";
- } else {
- copyFileToLocalPath("napi_generator-macos");
- tmpDirFile += "napi_generator-macos";
- }
-
- File file = new File(tmpDirFile);
- String command = file.toString();
- String inArgs = genInArgs(textFieldSelectH.getText());
- command += inArgs + " -o " + textFieldSelectOutPath.getText() + " -t " + true;
- return command;
- }
-
- JPanel getContentPanel() {
- return contentPane;
- }
-
- /**
- * 获取生成的.d.ts文件名
- *
- * @return 生成的.d.ts文件名
- */
- public String getTsFileName() {
- hGenFileName = textFieldSelectH.getText();
- tsGenFileName = hGenFileName.substring(0, hGenFileName.lastIndexOf(".")) + ".d.ts";
- return tsGenFileName;
- }
-
- /**
- * 获取生成的.d.ts文件输出路径
- *
- * @return .d.ts文件输出路径
- */
- public String getTsOutPath() {
- tsOutPath = textFieldSelectOutPath.getText();
- return tsOutPath;
- }
-
- /**
- * 获取工程
- *
- * @return 当前工程
- */
- public Project getProject() {
- return this.project;
- }
-
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/TsGenerateDialog.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/TsGenerateDialog.java
deleted file mode 100644
index c27700cd573b46964bc598898840467e7220c44f..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/dialog/TsGenerateDialog.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * All rights reserved.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.dialog;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.ValidationInfo;
-import com.sk.ts.dialog.GenerateDialogPane;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JComponent;
-import java.awt.Desktop;
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Dimension;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import com.sk.dialog.GenerateDialog;
-
-/**
- * 主界面对话框Wrapper
- *
- * @author: xudong
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-05-27
- */
-public class TsGenerateDialog extends DialogWrapper {
- private static final Logger LOG = Logger.getInstance(TsGenerateDialog.class);
- private static final String FRAME_TITLE = "Generate Ts Frame";
- private static final String CODE_URL = "https://gitee.com/openharmony/napi_generator";
-
- JButton buttonHelp = new JButton("Help");
- JButton buttonOK = new JButton("OK");
- JButton buttonCancel = new JButton("Cancel");
- private boolean IS_SELECTED = false;
- private GenerateDialogPane genDiag;
-
- /**
- * 构造函数
- *
- * @param project projectId
- * @param destPath 目录文件
- * @param directoryPath 文件夹目录
- * @param fileName 文件名
- * @param isSelectedToolchain 是否启用工具链
- */
- public TsGenerateDialog(Project project, String destPath, String directoryPath,
- String fileName, boolean isSelectedToolchain) {
- super(true);
- this.setResizable(false);
- setTitle(FRAME_TITLE);
- setModal(true);
- genDiag = new GenerateDialogPane(project, destPath, directoryPath, fileName);
- IS_SELECTED = isSelectedToolchain;
- if (isSelectedToolchain) {
- buttonOK.setText("Next");
- } else {
- buttonOK.setText("OK");
- }
- init();
- }
-
- @Override
- protected void init() {
- super.init();
- getOKAction().setEnabled(false);
- getButton(getOKAction()).setVisible(false);
- getButton(getCancelAction()).setVisible(false);
- }
-
- /**
- * 创建视图
- *
- * @return 组件内容
- */
- @Nullable
- @Override
- protected JComponent createCenterPanel() {
- JPanel panel = new JPanel(new BorderLayout());
- JPanel northPanel = new JPanel(new BorderLayout());
- northPanel.setPreferredSize(new Dimension(800, 350));
- northPanel.add(genDiag.getContentPanel());
- JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- southPanel.setPreferredSize(new Dimension(800, 50));
- JPanel southWestPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- southWestPanel.setPreferredSize(new Dimension(390, 50));
- southWestPanel.add(buttonHelp);
- buttonHelpListener();
- JPanel southEastPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- southEastPanel.setPreferredSize(new Dimension(390, 50));
- southEastPanel.add(buttonCancel);
- buttonCancelListener();
- southEastPanel.add(buttonOK);
- buttonOKListener();
- southPanel.add(southWestPanel);
- southPanel.add(southEastPanel);
- panel.add(northPanel, BorderLayout.NORTH);
- panel.add(southPanel, BorderLayout.SOUTH);
- panel.repaint();
- return panel;
- }
-
- /**
- * 校验数据
- *
- * @return 检测文本框架是否有目录。
- */
- @Nullable
- @Override
- protected ValidationInfo doValidate() {
- return genDiag.validationInfo();
- }
-
- /**
- * help button监听事件
- * @param void 空
- * @return void 空
- * @throws log 输出异常
- */
- public void buttonHelpListener() {
- buttonHelp.addActionListener(e -> {
- try {
- Desktop.getDesktop().browse(new URI(CODE_URL));
- } catch (URISyntaxException | IOException e2) {
- LOG.error("Open help error:" + e2);
- }
- });
- }
-
- /**
- * cancel button监听事件
- *
- * @param void 空
- * @return void 空
- * @throws log 输出异常
- */
- public void buttonCancelListener() {
- buttonCancel.addActionListener(e -> {
- close(CANCEL_EXIT_CODE);
- });
- }
-
- /**
- * OK button监听事件
- * @param void 空
- * @return void 空
- * @throws log 输出异常
- */
- public void buttonOKListener() {
- buttonOK.addActionListener(e -> {
- ValidationInfo validationInfo = doValidate();
- if (validationInfo != null) {
- LOG.info(validationInfo.message);
- } else {
- if (genDiag.runFunH2ts()) {
- if (IS_SELECTED) {
- Project project = genDiag.getProject();
- String destPath = genDiag.getTsFileName();
- String directoryPath = genDiag.getTsOutPath();
- String fileName = genDiag.getTsOutPath();
- GenerateDialog generateDialog = new GenerateDialog(project, destPath, directoryPath, fileName);
- generateDialog.showAndGet();
- } else {
- close(CANCEL_EXIT_CODE);
- }
- }
- }
- });
- }
-}
-
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/ng/GenDTS.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/ng/GenDTS.java
deleted file mode 100644
index b4b0c6079c7208ed2962119364142cfb6964012a..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/ng/GenDTS.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.ng;
-
-import com.intellij.notification.NotificationType;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-
-import com.sk.ts.dialog.TsGenerateDialog;
-import com.sk.ts.utils.FileUtil;
-import com.sk.ts.utils.GenNotification;
-
-/**
- * 项目文件入口
- *
- * @author: xudong
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class GenDTS extends AnAction {
-
- @Override
- public void actionPerformed(AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
- // 获取需要处理的.d.ts文件绝对路径
- VirtualFile file = anActionEvent.getData(PlatformDataKeys.VIRTUAL_FILE);
- if (file == null) {
- GenNotification.notifyMessage(project, "", "file is not exist", NotificationType.ERROR);
- return;
- }
- if (project == null) {
- return;
- }
- String destPath = file.getPath();
- String directoryPath = file.getParent().getPath();
- String fileName = file.getName();
- boolean isSelectedToolchain = false;
- TsGenerateDialog wrapper = new TsGenerateDialog(project, destPath, directoryPath,
- fileName, isSelectedToolchain);
- wrapper.showAndGet();
- }
-
-
- @Override
- public void update(AnActionEvent event) {
- // 根据所选文件名,判断是否显示生成菜单项
- VirtualFile file = event.getData(PlatformDataKeys.VIRTUAL_FILE);
- if (file == null) {
- event.getPresentation().setEnabledAndVisible(false);
- } else {
- event.getPresentation().setEnabledAndVisible(FileUtil.patternFileName(file.getName()));
- }
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/ng/GenMenuDTS.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/ng/GenMenuDTS.java
deleted file mode 100644
index b9a4a86e2f1a6d7b86952ac5373ffb91e32191f5..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/ng/GenMenuDTS.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.ng;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.Project;
-
-import com.sk.ts.dialog.TsGenerateDialog;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * 工具菜单入口
- *
- * @author: liulongc digitalchina.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-05-27
- */
-public class GenMenuDTS extends AnAction {
-
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
- Project project = anActionEvent.getProject();
-
- if (project == null) {
- return;
- }
- boolean isSelectedToolchain = false;
- TsGenerateDialog wrapper = new TsGenerateDialog(project, "", "", "", isSelectedToolchain);
- wrapper.showAndGet();
- }
-
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/FileInfo.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/FileInfo.java
deleted file mode 100644
index ba0fedab1f936d7c884b8edeb3644bcd7fb1bda2..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/FileInfo.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.utils;
-
-import java.io.File;
-import java.util.Objects;
-
-/**
- * 文件信息类,提供自定义的文件对象比较方法
- *
- * @author: zhangzhicheng
- * @see: generator dialog
- * @version: v1.0.0
- * @since 2023-01-18
- */
-public class FileInfo {
- private String name;
- private String path;
- private long lastModifiedTime;
- private boolean isTimeEqual = false;
- private boolean isNameEqual = false;
- private boolean isPathEqual = false;
-
- public FileInfo(File file) {
- name = file.getName();
- path = file.getPath();
- lastModifiedTime = file.lastModified();
- }
-
- /**
- * 获取文件路径
- *
- * @return 文件路径
- */
- public String getPath() {
- return path;
- }
-
- /**
- * 重写比较方法,文件名和最后修改时间都相同才认为相等(被修改覆盖过的文件也认为是新文件)
- *
- * @param object 待比较的文件对象
- * @return 是否为相同文件
- */
- @Override
- public boolean equals(Object object) {
- FileInfo info = (FileInfo) object;
- if (lastModifiedTime == info.lastModifiedTime) {
- isTimeEqual = true;
- }
- if (Objects.equals(name, info.name)) {
- isNameEqual = true;
- }
- if (Objects.equals(path, info.path)) {
- isPathEqual = true;
- }
- if (object == null || getClass() != object.getClass()) {
- return false;
- }
- if (this == object) {
- return true;
- }
- return isTimeEqual && isNameEqual && isPathEqual;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name, path, lastModifiedTime);
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/FileUtil.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/FileUtil.java
deleted file mode 100644
index d1969de405a9753a4e949102456ea77d7195596c..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/FileUtil.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.utils;
-
-import java.util.regex.Pattern;
-
-/**
- * 文本文件工具
- *
- * @author: xudong
- * @see: file utils
- * @version: v1.0.0
- * @since 2022-02-21
- */
-public class FileUtil {
- /**
- * 获取换行符
- *
- * @return 换行符
- */
- public static String getNewline() {
- return System.getProperty("line.separator");
- }
-
- /**
- * 正则匹配所选文件名是否符合规范
- *
- * @param fileName 文件名
- * @return boolean 是否匹配
- */
- public static boolean patternFileName(String fileName) {
- String pattern = "(([.a-z_A-Z0-9]+).h)";
- return Pattern.matches(pattern, fileName);
- }
-
- /**
- * 正则匹配所选文件名是否符合规范
- *
- * @param fileName 文件名
- * @return boolean 是否匹配
- */
- public static boolean patternFileNameH(String fileName) {
- String pattern = "([.a-z_A-Z0-9]+).h";
- return Pattern.matches(pattern, fileName);
- }
-}
diff --git a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/GenNotification.java b/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/GenNotification.java
deleted file mode 100644
index 557faed022b3b8d37dcd7f010e9498297516a5e0..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_IntelliJ_plugin/src/com/sk/ts/utils/GenNotification.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.sk.ts.utils;
-
-import com.intellij.ide.actions.OpenFileAction;
-import com.intellij.notification.NotificationType;
-import com.intellij.notification.Notification;
-import com.intellij.notification.NotificationGroupManager;
-import com.intellij.notification.NotificationGroup;
-import com.intellij.notification.NotificationAction;
-import com.intellij.notification.Notifications;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * 通知框
- *
- * @author: liulongc digitalchina.com
- * @see: tool conversion plug-in
- * @version: v1.0.0
- * @since 2022-05-27
- */
-public class GenNotification {
-
- private static final Logger LOG = Logger.getInstance(FileUtil.class);
-
- private GenNotification() {
- }
-
- /**
- * 消息通知
- *
- * @param project projectid
- * @param content 提示内容
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- */
- public static void notifyMessage(@javax.annotation.Nullable Project project,
- String content,
- String title,
- NotificationType type) {
-
- NotificationGroupManager manager = NotificationGroupManager.getInstance();
- NotificationGroup notificationGroup = manager.getNotificationGroup("Generate.Result.Group");
- Notification notification = notificationGroup.createNotification(content, type);
- notification.setTitle(title);
- notification.setContent(content);
-
- if (NotificationType.ERROR.equals(type)) {
- LOG.error(content);
- } else if (NotificationType.WARNING.equals(type)) {
- LOG.warn(content);
- } else {
- LOG.info(content);
- }
- Notifications.Bus.notify(notification, project);
-
- }
-
- /**
- * 消息通知
- *
- * @param project projectid
- * @param newFileList 新增文件列表
- * @param title 提示栏内容
- * @param type 提示类型 Error,Waring,info
- */
- public static void notifyGenResult(@javax.annotation.Nullable Project project, List newFileList,
- String title, NotificationType type) {
- NotificationGroupManager manager = NotificationGroupManager.getInstance();
- NotificationGroup notificationGroup = manager.getNotificationGroup("Generate.Result.Group");
- Notification notification = notificationGroup.createNotification("", type);
- notification.setTitle(title);
- notification.setContent(null);
- addAction(project, newFileList, notification);
- Notifications.Bus.notify(notification, project);
- }
-
- private static void addAction(Project project, List newFileList, Notification notification) {
- LOG.info("generated file list log:");
- for (FileInfo fs : newFileList) {
- String filePath = fs.getPath();
- NotificationAction action = new NotificationAction(filePath) {
- @Override
- public void actionPerformed(@NotNull AnActionEvent anActionEvent,
- @NotNull Notification notification) {
- OpenFileAction.openFile(filePath, project);
- }
- };
- notification.addAction(action);
-
- }
- }
-}
diff --git a/hdc/ts/ts_vs_plugin/README_zh.md b/hdc/ts/ts_vs_plugin/README_zh.md
deleted file mode 100644
index 95240f0b6cff701ab4ee5fd8059cc502cb28e7b8..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/README_zh.md
+++ /dev/null
@@ -1,122 +0,0 @@
-# TS生成工具VSCode插件说明
-
-## 简介
-
-TS(type-script)接口生成工具,它可以根据定义在c++头文件中的接口,生成type-script语言的TS接口文件。若某个服务实现方式为c++,且供应用层访问的接口已在.h文件中定义,此时,NAPI接口开发者使用此工具可一键生成对应的ts文件,进而将生成的TS文件作为NAPI框架生成代码工具的输入,生成NAPI框架代码。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口,本文主要介绍VS Code插件使用指导。
-
-## 目录
-
- ├── ts # TS框架生成工具
- │ ├── ... # 其它文件
- │ ├── ts_vs_plugin # VS Code插件代码
- │ │ ├── docs # VS Code插件说明
- │ │ ├── src # VS Code插件源码
- │ │ ├── package.json # package.json 文件
- │ │ └── README_zh.md # VS Code插件说明
-
-## 约束
-
-系统:建议Ubuntu 20.04或者Windows 10
-
-依赖版本:VS Code 1.62.0
-
-## 使用方法
-
-### 使用对象
-
-系统开发者、应用Native开发者
-
-### 使用场景
-
-1) 系统框架层新增子系统,需对应用层提供接口。
-2) 系统框架层子系统能力增强后,需对应用层提供新接口。
-3) 应用层引入C++三方库,需增加OpenHarmony应用层接口。
-
-### 工具使用
-
-具体的工具使用步骤,可以左键单击以下链接了解:
-
-[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_vs_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,生成的输出文件,如下所示:
-
-
-
-
-其中生成的"test.d.ts"文件,定义了应用开发接口,如下所示:
-
- 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;
-
-## 开发说明
-
-### 对象
-
-工具的开发者
-
-### 开发场景
-
-若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
-
-### 开发步骤
-
-开发者可以根据如下的步骤来完成对工具VS Code插件的开发:
-
- [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_vs_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/guide/ts/ROADMAP_ZH.md)
-
-## FAQ
-
-对于常见问题解决方法指导如下:
-
- [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/docs/ts/FAQ.md)
-
-## 相关仓
-
-暂无
diff --git a/hdc/ts/ts_vs_plugin/docs/DEVELOP_ZH.md b/hdc/ts/ts_vs_plugin/docs/DEVELOP_ZH.md
deleted file mode 100644
index b65ed234a91b08b65cd9855f35e8da14089c4812..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/docs/DEVELOP_ZH.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# TS接口生成工具VSCode插件开发说明
-
-若当前工具功能不满足开发者需求,开发者需增强工具能力,则可基于已有源码进行工具二次开发,编译打包生成自定义的VS Code插件。
-
-## VS Code插件打包说明
-
-### Linux
-
-1.下载napi_generator-linux可执行程序与linux系统下header_parser.exe可执行程序,并放置在napi_generator/hdc/ts/ts_vs_plugin/src/目录下,下载链接如下(由于网络原因,可能会导致有的下载链接失效,因此提供了以下三个下载链接):
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-2.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
-之后会在当前目录下打包生成一个插件ts-gen-0.0.1.vsix。结果如下:
-
- kaihong1@ubuntu:~/napi/napi_generator_test0419/napi_generator/hdc/ts/ts_vs_plugin/src$ npx vsce package
- This extension consists of 3212 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: /home/kaihong1/napi/napi_generator_test0419/napi_generator/hdc/ts/ts_vs_plugin/src/ts-gen-0.0.1.vsix (3370 files, 44.42MB)
-
-### Windows
-
-1.下载napi_generator-win.exe可执行程序与Windows系统下header_parser.exe可执行程序,并放置在napi_generator/napi_vs_plugin/src/目录下,下载链接如下(由于网络原因,可能会导致有的下载链接失效,因此提供了以下三个下载链接):
-
-[下载链接1](http://ftpkaihongdigi.i234.me:5000/sharing/kBG1c7CvT)
-
-[下载链接2](http://ftp.kaihong.com:5000/sharing/kBG1c7CvT)
-
-[下载链接3](http://ftp.kaihongdigi.com:5000/sharing/kBG1c7CvT)
-
-2.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npm i
-
-3.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npm i typescript
-
-4.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npm i vsce
-
-5.在napi_generator/hdc/ts/ts_vs_plugin/src目录下执行命令:
-
- npx vsce package
-
- 之后会在当前目录下打包生成一个插件ts-gen-0.0.1.vsix。结果如下:
-
- E:\napi_generator_aboutTest\zjx_gjj_napi230401\napi_generator\hdc\ts\ts_vs_plugin\src>npx vsce package
- This extension consists of 3218 files, out of which 1547 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
- DONE Packaged: E:\napi_generator_aboutTest\zjx_gjj_napi230401\napi_generator\hdc\ts\ts_vs_plugin\src\ts-gen-0.0.1.vsix (3467 files, 42.3MB)
-
diff --git a/hdc/ts/ts_vs_plugin/docs/INSTRUCTION_ZH.md b/hdc/ts/ts_vs_plugin/docs/INSTRUCTION_ZH.md
deleted file mode 100644
index c2140e5399da48a2d600bf22f3fc7e9f2737167f..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/docs/INSTRUCTION_ZH.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Ts接口生成工具VSCode插件使用说明
-## 简介
-
-Ts接口生成工具可以根据定义在c++头文件中的接口,生成type-script语言的ts接口文件,工具支持三种入口,分别是可执行程序、IntelliJ插件、VS Code插件,使用者可以根据自己的需要选择合适的工具。本文主要介绍VS Code插件使用说明。
-
-## VS Code插件使用方法
-
-### 说明
-
-visual studio code 版本需1.62.0及以上。
-
-### 使用指导
-
-1.打开VS Code,在左侧边栏中选择插件安装。
-
-
-
-2. 在应用商店搜索ts-gen插件,再单击安装。
-
-
-
-3.安装完成后就会在VS Code的插件管理器中能看到ts-gen这个插件了。
-
-
-
-4.把需要转换的.h文件放到任意目录下。
-
-
-
-5.选择.h文件,点击右键选择 Generate Ts Frame,工具弹出Generate Ts Frame弹窗。文件路径文本框填写.h文件路径;输出目录选择文本框填写生成.d.ts文件存放路径,点击ok。
-
-
-
-6.执行结束后会在out目录下生成.d.ts代码文件。
-
diff --git a/hdc/ts/ts_vs_plugin/package.json b/hdc/ts/ts_vs_plugin/package.json
deleted file mode 100644
index a1a990e44a833020457b7cb6a306462fa9b78dce..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/package.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "ts_vs_plugin",
- "version": "1.0.0",
- "description": "This paper mainly introduces the NAPI framework code generation tool, which can generate NAPI framework code, business code framework and designed.The GN file according to the TS interface file in the path specified by the user. So developers need to focus on Nodejs related grammar framework layer, interface between c + + with JS type conversion, data type conversion, etc.. This tool is mainly used in the scenario of JS application calling NAPI interface, can focus on business logic implementation, Thus, the development efficiency can be greatly improved. Currently, the tool supports command line and VSCode plug-in.",
- "main": "index.js",
- "directories": {
- "doc": "docs"
- },
- "dependencies": {
- "mocha": "^9.2.1",
- "node-gyp": "^8.4.1",
- "stdio": "^2.1.1",
- "typescript": "^4.5.5"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git@gitee.com:joeysun001/napi_generator.git"
- },
- "author": "",
- "license": "ISC",
- "pkg": {
- "assets": [
- "src/node_modules/typescript/**/*"
- ]
- }
-}
diff --git a/hdc/ts/ts_vs_plugin/src/LICENSE b/hdc/ts/ts_vs_plugin/src/LICENSE
deleted file mode 100644
index 72f817fb44de8b9fd23fe71230b9dc5ccbe4ca35..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/hdc/ts/ts_vs_plugin/src/README.md b/hdc/ts/ts_vs_plugin/src/README.md
deleted file mode 100644
index e822b5ef548cd7e0d06cf4a6432b3f1b5de874d6..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# TS生成工具使用说明
-
-## 简介
-
-TS(type-script)接口生成工具,它可以根据定义在c++头文件中的接口,生成type-script语言的TS接口文件。若某个服务实现方式为c++,且供应用层访问的接口已在.h文件中定义,此时,NAPI接口开发者使用此工具可一键生成对应的ts文件,进而将生成的TS文件作为NAPI框架生成代码工具的输入,生成NAPI框架代码。
-
-## 约束
-
-visual studio code 版本需1.62.0及以上。
-
-## 操作简介
-
-1.安装VS Code插件。
-
-2.打开任意文件夹或文件,鼠标单击右键选择“Generate Ts Frame”插件。
-
-3.在窗口中填写相应参数。
-
-详细说明见
-
-[TS接口生成使用说明](https://gitee.com/openharmony/napi_generator/blob/master/hdc/ts/ts_vs_plugin/docs/INSTRUCTION_ZH.md)
-
-## 合作共建
-
-[联系方式](https://www.kaihong.com/)
diff --git a/hdc/ts/ts_vs_plugin/src/extension.js b/hdc/ts/ts_vs_plugin/src/extension.js
deleted file mode 100644
index f9ff9cbcf6cebd73bf72e02214acb794b9644285..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/extension.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// The module 'vscode' contains the VS Code extensibility API
-// Import the module and reference it with the alias vscode in your code below
-const vscode = require('vscode');
-const fs = require('fs');
-const re = require("./gen/tools/VsPluginRe");
-const { VsPluginLog } = require("./gen/tools/VsPluginLog");
-const { detectPlatform, readFile } = require('./gen/tools/VsPluginTool');
-const path = require('path');
-var exeFilePath = null;
-var globalPanel = null;
-
-var importToolChain = false;
-var extensionIds = [];
-var nextPluginId = null;
-// this method is called when your extension is activated
-// your extension is activated the very first time the command is executed
-
-/**
- * @param {vscode.ExtensionContext} context
- */
-function activate(context) {
- // Use the console to output diagnostic information (console.log) and errors (console.error)
- // This line of code will only be executed once when your extension is activated
- console.log('Congratulations, your extension "ts-gen" is now active!');
- let disposable = register(context, 'generate_ts');
- let disposableMenu = register(context, 'generate_ts_menu');
- context.subscriptions.push(disposable);
- context.subscriptions.push(disposableMenu);
-
- var platform = detectPlatform();
- if (platform == 'win') {
- exeFilePath = __dirname + "/napi_generator-win.exe";
- } else if (platform == 'mac') {
- exeFilePath = __dirname + "/napi_generator-macos";
- } else if (platform == 'Linux') {
- exeFilePath = __dirname + "/napi_generator-linux";
- }
-}
-
-function executorH2Ts(name, genDir) {
- var command = exeFilePath + " -f " + name + " -o " + genDir + " -t true";
- var exec = require('child_process').exec;
- exec(command, function (error, stdout, stderr) {
- VsPluginLog.logInfo('VsPlugin: stdout =' + stdout + ", stderr =" + stderr);
- if (error || stdout.indexOf("success") < 0) {
- vscode.window.showErrorMessage("genError:" + (error != null ? error : "") + stdout);
- return VsPluginLog.logError("VsPlugin:" + error + stdout);
- }
- vscode.window.showInformationMessage("Generated successfully");
- });
-}
-
-function exeFileExit() {
- if (fs.existsSync(exeFilePath)) {
- return true;
- }
- return false;
-}
-
-function register(context, command) {
- let disposable = vscode.commands.registerCommand(command, function (uri, boolValue, items) {
- // The code you place here will be executed every time your command is executed
- // Display a message box to the user
- globalPanel = vscode.window.createWebviewPanel(
- 'generate', // Identifies the type of WebView
- 'Generate Ts Frame', // Title of the panel displayed to the user
- vscode.ViewColumn.Two, // Display the WebView panel in the form of new columns in the editor
- {
- enableScripts: true, // Enable or disable JS, default is Enable
- retainContextWhenHidden: true, // Keep the WebView state when it is hidden to avoid being reset
- }
- );
- if (typeof(boolValue) == 'boolean' && Array.isArray(items)) {
- if (boolValue == true) {
- //遍历数组item,查看当前插件id是数组的第几个元素,并拿出下一个元素,并判断当前id是否是最后一个元素并做相应处理
- let myExtensionId = 'kaihong.ts-gen';
- for (let i = 0; i < items.length; i++) {
- if (myExtensionId == items[i] && (i == items.length - 1)) {
- importToolChain = false;
- } else if (myExtensionId == items[i] && (i != items.length - 1)) {
- importToolChain = boolValue;
- nextPluginId = items[i + 1];
- }
- extensionIds.push(items[i]);
- }
- }
- }
- globalPanel.webview.html = getWebviewContent(context, importToolChain);
- let msg;
- globalPanel.webview.onDidReceiveMessage(message => {
- msg = message.msg;
- if (msg == "cancel") {
- globalPanel.dispose();
- }
- else if(msg == "h2ts") {
- checkReceiveMsg(message);
- }else {
- selectPath(globalPanel, message);
- }
- }, undefined, context.subscriptions);
- // 路径有效性判断
- if (uri.fsPath !== undefined) {
- let fn = re.getFileInPath(uri.fsPath);
- let tt = re.match("([a-zA-Z_0-9]+.h)", fn);
- var result = {
- msg: "selectHFilePath",
- path: tt ? uri.fsPath : ""
- }
- globalPanel.webview.postMessage(result);
- }
- });
- return disposable;
-}
-
-function checkReceiveMsg(message) {
- let name = message.fileNames;
- let genDir = message.genDir;
- let buttonName = message.buttonName;
- name = re.replaceAll(name, " ", "");
- if ("" == name) {
- vscode.window.showErrorMessage("Please enter the path!");
- return;
- }
- if (exeFileExit()) {
- executorH2Ts(name, genDir);
- if (buttonName == 'Next') {
- startNextPlugin();
- }
- } else {
- vscode.window.showInformationMessage("Copy executable program to " + __dirname);
- }
-}
-
-/**
-* 获取插件执行命令
-*/
-function nextPluginExeCommand(nextPluginId) {
- if (nextPluginId == "kaihong.ApiScan") {
- return 'api_scan';
- } else if (nextPluginId == "kaihong.gn-gen") {
- return 'generate_gn';
- } else if (nextPluginId == "kaihong.service-gen") {
- return 'generate_service';
- } else if (nextPluginId == "kaihong.ts-gen") {
- return 'generate_ts';
- } else if (nextPluginId == "kaihong.napi-gen") {
- return 'generate_napi';
- } else {
- return null;
- }
-}
-
-/**
-* 执行完毕后开启工具链中下一个插件
-*/
-function startNextPlugin() {
- const extension = vscode.extensions.getExtension(nextPluginId);
- if (extension) {
- let startNextPlugin = nextPluginExeCommand(nextPluginId);
- try {
- vscode.commands.executeCommand(startNextPlugin, '', importToolChain, extensionIds);
- } catch (error) {
- console.error(error);
- }
- }
-}
-
-/**
-* 选择本地目录/文件夹
-*/
- function selectPath(panel, message) {
- let mode = 1;
- if (message.mode != undefined) {
- mode = message.mode;
- }
- const options = {
- canSelectMany: mode == 0 ? true : false,//是否可以选择多个
- openLabel: mode == 0 ? '选择文件' : '选择文件夹',//打开选择的右下角按钮label
- canSelectFiles: mode == 0 ? true : false,//是否选择文件
- canSelectFolders: mode == 0 ? false : true,//是否选择文件夹
- defaultUri:vscode.Uri.file(''),//默认打开本地路径
- filters: mode == 1 ? {} : { // 文件过滤选项,在文件夹选择模式下不可设置此配置,否则ubuntu系统下无法选择文件夹
- 'Text files': ['h']
- }
- };
-
- return vscode.window.showOpenDialog(options).then(fileUri => {
- if (fileUri && fileUri[0]) {
- console.log('Selected file: ' + fileUri[0].fsPath);
- let filePath = "";
- for (let index = 0; index < fileUri.length; index++) {
- filePath += fileUri[index].fsPath.concat(",");
- }
- var result = {
- msg: message.msg,
- path: filePath.length > 0 ? filePath.substring(0, filePath.length - 1) : filePath
- }
- panel.webview.postMessage(result);
- return fileUri[0].fsPath
- }
- });
-}
-
-// this method is called when your extension is deactivated
-function deactivate() { }
-
-function getWebviewContent(context, importToolChain) {
- let data = readFile(__dirname + '/vs_plugin_view.html');
- data = getWebViewContent(context, '/vs_plugin_view.html');
- let content = data.toString();
- if (importToolChain) {
- content = content.replace('Ok', 'Next');
- }
- return content;
-}
-
-function getWebViewContent(context, templatePath) {
- const resourcePath = path.join(context.extensionPath, templatePath);
- const dirPath = path.dirname(resourcePath);
- let html = fs.readFileSync(resourcePath, 'utf-8');
- html = html.replace(/( {
- if ($2.indexOf("https://") < 0) {
- return $1 + globalPanel.webview.asWebviewUri(vscode.Uri.file(path.resolve(dirPath, $2))) + '"';
- } else {
- return $1 + $2+'"';
- }
- });
- return html;
-}
-
-module.exports = {
- activate,
- deactivate
-}
\ No newline at end of file
diff --git a/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginLog.js b/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginLog.js
deleted file mode 100644
index 6ce4e7e3b09ec80708e81e93c2ffd3261a60f2a4..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginLog.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const fs = require('fs');
-
-class VsPluginLog {
- constructor() {
- }
-}
-VsPluginLog.LEV_NONE = 0;
-VsPluginLog.LEV_ERROR = 1;
-VsPluginLog.LEV_DEBUG = 2;
-VsPluginLog.LEV_INFO = 3;
-
-const LEV_STR = ["[NON]", "[ERR]", "[DBG]", "[INF]"]
-var logLevel = VsPluginLog.LEV_ERROR;
-var logFileName = null;
-var logResultMessage = [true, ""]
-
-function getDateString() {
- let nowDate = new Date();
- return nowDate.toLocaleString();
-}
-
-function saveLog(dateStr, levStr, detail) {
- if (logFileName) {
- let logStr = dateStr + " " + levStr + " " + detail + "\n";
- fs.appendFileSync(logFileName, logStr);
- }
-}
-
-VsPluginLog.init = function (level, fileName) {
- logLevel = level in [VsPluginLog.LEV_NONE, VsPluginLog.LEV_ERROR, VsPluginLog.LEV_DEBUG, VsPluginLog.LEV_INFO]
- ? level : VsPluginLog.LEV_ERROR;
- logFileName = fileName ? fileName : "napi_generator.log";
-}
-
-function recordLog(lev, ...args) {
- let dataStr = getDateString();
- let detail = args.join(" ");
- saveLog(dataStr, LEV_STR[lev], detail);
- if (lev == VsPluginLog.LEV_ERROR) {
- logResultMessage = [false, detail];
- }
- if (logLevel < lev) return;
- VsPluginLog.logInfo(dataStr + LEV_STR[lev] + detail);
-}
-
-VsPluginLog.logError = function (...args) {
- recordLog(VsPluginLog.LEV_ERROR, args);
-}
-
-VsPluginLog.logDebug = function (...args) {
- recordLog(VsPluginLog.LEV_DEBUG, args);
-}
-
-VsPluginLog.logInfo = function (...args) {
- recordLog(VsPluginLog.LEV_INFO, args);
-}
-
-VsPluginLog.getResult = function () {
- return logResultMessage;
-}
-
-module.exports = {
- VsPluginLog
-}
\ No newline at end of file
diff --git a/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginRe.js b/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginRe.js
deleted file mode 100644
index 909d7d54ea6331ab45c2fd58ea20f2444b66f254..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginRe.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const path = require('path');
-
-function search(ss, data) {
- ss = replaceAll(ss, "\\.", "\\.")
- let reg = new RegExp(ss);
- let tt = reg.exec(data);
- if (tt == null) return null;
- let ret = { "regs": [] }
- for (let i = 0; i < tt.length; i++) {
- let p = data.indexOf(tt[i]);
- if (tt[i] == null) {
- ret["regs"].push([-1, -1])
- }
- else {
- ret["regs"].push([p, p + tt[i].length])
- }
- }
-
- return ret;
-}
-
-function match(ss, data) {
- let tt = search(ss, data)
- if (tt != null && tt.regs[0][0] == 0) return tt;
- return null;
-}
-
-function getFileInPath(tpath) {
- return path.parse(tpath).base;
-}
-
-function getPathInPath(tpath) {
- return path.parse(tpath).dir;
-}
-
-function all(sfrom) {
- return new RegExp(sfrom, "g");
-}
-
-function replaceAll(ss, sfrom, sto) {
- return ss.replace(all(sfrom), sto)
-}
-
-module.exports = {
- search,
- match,
- getFileInPath,
- getPathInPath,
- replaceAll,
- all
-}
\ No newline at end of file
diff --git a/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginTool.js b/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginTool.js
deleted file mode 100644
index c00a6a7114c5d9df6fba42dc6ff0a9170760ffb3..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/gen/tools/VsPluginTool.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-const os = require('os');
-const tsc = require("../../node_modules/typescript");
-const fs = require('fs');
-let vscode = null;
-try {
- vscode = require('vscode');
-}
-catch (err) {
- vscode = null;
-}
-
-function replaceAll(s, sfrom, sto) {
- while (s.indexOf(sfrom) >= 0) {
- s = s.replace(sfrom, sto)
- }
- return s;
-}
-
-function detectPlatform() {
- if (os.type() == 'Windows_NT') {
- return 'win';
- } else if (os.type() == 'Darwin') {
- return 'mac';
- } else if (os.type() == 'Linux') {
- return 'Linux';
- }
-}
-
-function checkFileError(ifname) {
- let program = tsc.createProgram([ifname], {})
- let emitResult = program.emit();
- let allDiagnostics = tsc.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
-
- let errorMsg = ''
- allDiagnostics.forEach(diagnostic => {
- if (diagnostic.file) {
- let { line, character } = tsc.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
- let message = tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
- errorMsg += `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}\n`;
- } else {
- errorMsg += tsc.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + "\n";
- }
- });
-
- if (allDiagnostics.length > 0) {
- return [false, errorMsg];
- }
- return [true, ""];
-}
-
-function utf8ArrayToStr(array) {
- var out, i, len, c;
- var char2, char3;
-
- out = "";
- len = array.length;
- i = 0;
- while (i < len) {
- c = array[i++];
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- out += String.fromCharCode(c);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- char2 = array[i++];
- out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- char2 = array[i++];
- char3 = array[i++];
- out += String.fromCharCode(((c & 0x0F) << 12) |
- ((char2 & 0x3F) << 6) |
- ((char3 & 0x3F) << 0));
- break;
- }
- }
-
- return out;
- }
-
- function readFile(fn) {
- if (!fs.existsSync(fn)) {
- return "";
- }
- let data = fs.readFileSync(fn);
- data = utf8ArrayToStr(data);
- return data;
- }
-
-module.exports = {
- replaceAll,
- detectPlatform,
- checkFileError,
- readFile
-}
\ No newline at end of file
diff --git a/hdc/ts/ts_vs_plugin/src/images/file.png b/hdc/ts/ts_vs_plugin/src/images/file.png
deleted file mode 100644
index f5c365a02e99414acb29c643fc2d64d150cff9f0..0000000000000000000000000000000000000000
Binary files a/hdc/ts/ts_vs_plugin/src/images/file.png and /dev/null differ
diff --git a/hdc/ts/ts_vs_plugin/src/images/napi.png b/hdc/ts/ts_vs_plugin/src/images/napi.png
deleted file mode 100644
index 170d094f65402ae674bb746ccbba8a1d57e3ce09..0000000000000000000000000000000000000000
Binary files a/hdc/ts/ts_vs_plugin/src/images/napi.png and /dev/null differ
diff --git a/hdc/ts/ts_vs_plugin/src/images/path.png b/hdc/ts/ts_vs_plugin/src/images/path.png
deleted file mode 100644
index 56f408a584f243956fab1916d9152f34364cdf78..0000000000000000000000000000000000000000
Binary files a/hdc/ts/ts_vs_plugin/src/images/path.png and /dev/null differ
diff --git a/hdc/ts/ts_vs_plugin/src/jsconfig.json b/hdc/ts/ts_vs_plugin/src/jsconfig.json
deleted file mode 100644
index 53b981c57b79a7a2dac9995ee4ce04b8c94e0b17..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/jsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "ES2020",
- "checkJs": true, /* Typecheck .js files. */
- "lib": [
- "ES2020"
- ]
- },
- "exclude": [
- "node_modules"
- ]
-}
diff --git a/hdc/ts/ts_vs_plugin/src/package.json b/hdc/ts/ts_vs_plugin/src/package.json
deleted file mode 100644
index 21dc7cdd57bdc27e33a61d9937d9be3cb97e096f..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/package.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "name": "ts-gen",
- "displayName": "ts-gen",
- "description": "Generate TS interface file for OpenHarmony",
- "keywords": [
- "ts",
- "ts_generator"
- ],
- "icon": "images/napi.png",
- "version": "0.0.1",
- "engines": {
- "vscode": "^1.62.0"
- },
- "categories": [
- "Other"
- ],
- "activationEvents": [
- "onStartupFinished"
- ],
- "main": "./extension.js",
- "publisher": "kaihong",
- "contributes": {
- "commands": [
- {
- "command": "generate_ts",
- "title": "Generate Ts Frame"
- },
- {
- "command": "generate_ts_menu",
- "title": "Generate Ts Frame"
- }
- ],
- "menus": {
- "explorer/context": [
- {
- "when": "resourceExtname == .h",
- "command": "generate_ts"
- }
- ],
- "editor/context": [
- {
- "command": "generate_ts_menu"
- }
- ]
- }
- },
- "scripts": {
- "lint": "eslint .",
- "pretest": "npm run lint",
- "test": "node ./test/runTest.js"
- },
- "devDependencies": {
- "@types/glob": "^7.1.4",
- "@types/mocha": "^9.0.0",
- "@types/node": "14.x",
- "@types/vscode": "^1.62.0",
- "@vscode/test-electron": "^1.6.2",
- "eslint": "^8.1.0",
- "glob": "^7.1.7",
- "mocha": "^9.1.3",
- "webpack": "^5.64.4",
- "webpack-cli": "^4.9.1"
- },
- "dependencies": {
- "compressing": "^1.5.1",
- "node-gyp": "^9.0.0",
- "stdio": "^2.1.1",
- "typescript": "^4.9.5",
- "vsce": "^2.15.0"
- },
- "repository": {
- "type": "gitee",
- "url": "https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts"
- }
-}
diff --git a/hdc/ts/ts_vs_plugin/src/vs_plugin_view.html b/hdc/ts/ts_vs_plugin/src/vs_plugin_view.html
deleted file mode 100644
index 1f66a52b3a2f2e1f617b8f38b65e2e0cb319ad03..0000000000000000000000000000000000000000
--- a/hdc/ts/ts_vs_plugin/src/vs_plugin_view.html
+++ /dev/null
@@ -1,218 +0,0 @@
-
-
-
-
-
- Napi
-
-
-
-
-
-
-
\ No newline at end of file