项目识别: 包含vsproject.ide.json文件,内容为json数据
有"language"属性
属性值为"c"、"c++"
有"buildTools"属性
属性值为"makefile"、"cmake"
tasks.json配置文件
文件位置:.vscode/
文件作用:用来告诉 IDE 如何构建(编译)程序
testC项目的tasks.json实例
说明:该build脚本,用来实现对testC项目进行编译,本实例是通过makefile实现编译。
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"linux": {
"command": "bash",
"args": [
"-c",
"make"
]
}
},
...
]
}
Makefile 与配置关系 本testC项目中,Makefile文件内预制了编译和运行参数。 例如:
用户在配置页面修改“编译输出文件”内容,并保存时。 实际Makefile文件内的 KConfig_outputFileName 值会跟随改变。 这样当IDE执行项目编译,调用tasks.json的build项,执行make build时,实际生成的编译输出文件会跟随Makefile文件内的KConfig_outputFileName 定义而改变。
# KylinCode 编译配置项
KConfig_outputFileName = main
KConfig_compileDebugLevel = -g
KConfig_WarningLevel =
KConfig_OptimizeLevel =
KConfig_ExtraPara =
KConfig_IncludesPath =
KConfig_LibraryPath =
KConfig_Libraries =
其他配置项修改原理与“编译输出文件”相同。
cmake类型与makefile原理相同。
打开刚才创建的 Java 项目 testJava
点击“配置当前项目”
在右侧编辑区弹出“配置项目”页面。
打开调试配置文件 launch.json,如下代码。用来支持java项目的调试功能。
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch Current File",
"request": "launch",
"mainClass": "${file}",
"args": ""
},
{
"type": "java",
"name": "Launch App",
"request": "launch",
"mainClass": "testgradle.App",
"projectName": "app"
}
]
}
打开任务文件 tasks.json,如下文,用来支持项目的编译和调试功能;
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "javac",
"args": [
"src/main.java",
"-sourcepath",
"src",
"-classpath",
"${config:java.project.referencedLibraries}",
"-d",
"${config:java.project.outputPath}"
]
},
{
"label": "run",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "java",
"args": [
"-cp",
"${config:java.project.outputPath}",
"main"
],
"dependsOn": [
"javac"
]
},
{
"label": "clean",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "rm $(find . -name \"*.class\")"
}
]
}
打开 Java 类路径配置
可以修改源码路径、输出路径、添加依赖库等;修改结果会保存在settings.json
打开打开工作区设置页。
打开工作区设置 json 文件。
包括以下:
打开调试配置文件launch.json,点击可以打开文件编辑调试配置。(如当前项目没有,会弹出创建选择) 创建方法如下:
launch.json文件创建成功
打开任务文件 tasks.json,点击可以打开文件编辑编译、运行等任务。(如果当前项目没有,会弹出创建选择)
创建方法如下:
点击菜单中的终端->配置任务->使用模板创建tasks.json文件->others
tasks.json文件创建成功
创建的tasks.json默认内容如下:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "echo Hello"
}
]
}
根据项目情况修改tasks.json文件,以testJava为例修改后内容如下:
{
"label": "build",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "javac",
"args": [
"src/main.java",
"-sourcepath",
"src",
"-classpath",
"${config:java.project.referencedLibraries}",
"-d",
"${config:java.project.outputPath}"
]
},
{
"label": "run",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "java",
"args": [
"-cp",
"${config:java.project.outputPath}",
"main"
],
"dependsOn": [
"javac"
]
}
修改后,即可支持通过任务进行编译、运行等操作。
编译功能入口,为项目开发提供快捷操作。
运行功能入口,为项目开发提供快捷操作。
调试功能入口,点击进入“调试”功能
依赖.vscode/launch.json文件
点击“调试”按钮,进入调试页面。
如图,此时项目没有launch.json文件。
点击“创建 launch.json 文件。
弹出选择调试器,请根据项目类型选择相应的调试器。
创建完成,会进入运行调试页面。可以按项目需要修改launch.json,可以点击左侧选择需要的调试配置项
点击绿色三角开始调试。
Kylin Project Manager:支持麒麟V10操作系统的创建项目和打包插件,支持X86、ARM、LongArch架构
配置淘宝源
yarn config set registry http://registry.npm.taobao.org/
cd ${projectpath}/web
yarn
cd ${projectpath}/
yarn
yarn run compile
cd ${projectpath}/
yarn
yarn run compile
yarn run package
Find the Kylin Project Manager extension through the extension filter
Click to install
Complete the installation.
If it is a version upgrade, the main program extension needs to be reloaded to take effect. Please follow the prompts to complete the installation.
Expand the "Project Operations Area" in Explorer
Provide entry points for project creation, configuration, compilation, debugging, running, packaging, and other related functions
Click on "Create New Project" or use Ctrl+Shift+P to bring up a command window, enter "Create Project" or "project. createProject", select PROJECT: Create Project, and bring up the page.
The "Create Project" page pops up in the editing area on the right.
The page includes:
Language selection tree (currently including c/c++and Java)
You can select different language types to create by clicking on the switch.
Create project entry area
Associated with the language selection tree, switching between different languages will display different input content pages.
Including function buttons such as close, previous/next, create, etc
Open the C/C++project you just created, testC
Click on 'Configure Current Project'
The "Configuration Items" page pops up in the editing area on the right.
The content of the project compilation output file can be modified.
You can choose to modify compilation, debugging, and running parameters.
On the second page, click Save and the message 'Save Successfully' will appear. Complete project compilation, debugging, and configuration of running parameters.
Open the Java project you just created, testJava
Click on 'Configure Current Project'
The "Configuration Items" page pops up in the editing area on the right.
Open the debugging configuration file launch.json,
Open the task file tasks.json,
Open Java class path configuration
You can modify the source code path, output path, add dependency libraries, etc; The modification results will be saved in settings.json
Open the workspace settings page.
Open the workspace settings JSON file.
Open other types of test projects
Click on 'Configure Current Project'
The "Configuration Items" page pops up in the editing area on the right.
Including the following:
Compilation function entry, providing quick operations for project development.
Dependency on the. vscode/tasks.json file definition.
Clicking will open the build project execution for tasks.json, which will be compiled through the terminal.
Run the function entry to provide quick operations for project development.
Dependency on the. vscode/tasks.json file definition.
Clicking will open all the projects in tasks.json, select the run project, choose to continue without scanning the task output, and run the program through the terminal execution.
Debug function entry, click to enter the "Debug" function
Dependency on the. vscode/launch.json file
Click the "Deb
Kylin Project Manager: Create Project and make package for the Kylin V10 operating system, supporting X86, ARM, and LongArch architectures
[Kylin Project Manager - links to the Repository] (https://gitee.com/openkylin/ide-project-manager)
[Kylin Project Manager - download link] (https://gitee.com/openkylin/ide-project-manager/releases)
Configure Taobao registry
yarn config set registry http://registry.npm.taobao.org/
cd ${projectpath}/web
yarn
cd ${projectpath}/
yarn
yarn run compile
cd ${projectpath}/
yarn
yarn run compile
yarn run package
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。