修改kylin-code配置文件

This commit is contained in:
dinglili 2024-07-31 17:10:52 +08:00
parent 368e395a9d
commit 1c83157628
6 changed files with 1355 additions and 0 deletions

View File

@ -0,0 +1,246 @@
{
"version":"0.0.3",
"kylin-ide-lowest-ver":"0.4.0",
"first_class_list":{
"description":{
"en":"",
"zh_cn":"勾选分类后会安装该选项的基本插件、系统软件依赖。可以从插件市场或openKylin extensions-repo仓库获取更多插件。"
},
"Remote_key":{
"en":"Remote development",
"zh_cn":"远程开发"
},
"C_key":{
"en":"C/C++ development",
"zh_cn":"C/C++开发"
},
"Python3_key":{
"en":"Python3 development",
"zh_cn":"Python3开发"
},
"Go_key":{
"en":"Go development",
"zh_cn":"Go开发"
},
"JavaScript_key":{
"en":"Built-in JavaScript development",
"zh_cn":"内置JavaScript开发",
"show_type":"picked_gray"
}
},
"second_class":{
"Remote_key": {
"discription":{
"en":"Remote development",
"zh_cn":"远程开发"
},
"ext-list": [
"KylinIdeTeam.extension-dependency",
"xhafei.remote-dev"
],
"pkg-list":{
},
"script-list":[
]
},
"C_key": {
"discription":{
"en":"Basic function of C/C++ development: linting, intellisense, compile, debug. You may install other extensions to get more functions.",
"zh_cn":"C/C++开发需要的基本功能:语法检查、跳转、补全、编译、调试等。可以安装其他插件获得更多功能。"
},
"ext-list": [
"KylinIdeTeam.extension-dependency",
"KylinIdeTeam.gitlens",
"KylinIdeTeam.project-manager",
"KylinIdeTeam.vscode-clangd",
"KylinIdeTeam.debug",
"KylinIdeTeam.cmake-intellisence"
],
"pkg-list":{
"deb":{
"git":{},
"ssh-askpass":{},
"clangd":{},
"libclang-common-10-dev":{},
"build-essential":{},
"cmake":{},
"gdb":{},
"debhelper":{}
}
},
"script-list":[
]
},
"Python3_key":{
"discription":{
"en":"Python3 development",
"zh_cn":"Python3开发"
},
"ext-list": [
"KylinIdeTeam.extension-dependency",
"KylinIdeTeam.gitlens",
"KylinIdeTeam.python"
],
"pkg-list":{
"deb":{
"git":{},
"ssh-askpass":{},
"python3":{},
"python3-autopep8":{},
"python3-pip":{}
}
},
"script-list":[
{
"order":1,
"postin":"python3-pip" ,
"file_url":"base-url:/python3_config-0.0.2.sh",
"file_name": "python3_config-0.0.2.sh",
"ver": "0.0.2",
"sign-md5": "aef9f6ef790eae1249d645dab5c7faab19896a5e9357b4e058dddd74b2bff7d8ed5c793196d1e12b27608423931f54f55304be1faa439e21ff44d967477fa9dc9550db1a5a8605ab9e5cac3448095d9d1831b880b574dc63724bcd47c834f6865c98a26bbdbc6290f65b09ca8b45c80b6eed7caf978cd25cde28512daed2823d"
}
]
},
"Go_key":{
"discription":{
"en":"Go development",
"zh_cn":"Go开发"
},
"ext-list": [
"KylinIdeTeam.extension-dependency",
"KylinIdeTeam.gitlens",
"KylinIdeTeam.go"
],
"pkg-list":{
"deb":{
"git":{},
"ssh-askpass":{},
"golang-1.14":{}
}
},
"script-list":[
{
"order":1,
"postin":"golang-1.14",
"file_url":"base-url:/go_config-0.0.2.js",
"file_name": "go_config-0.0.2.js",
"ver": "0.0.2",
"sign-md5": "a54150fd8eab3d686f3eee0e70215030bb0d886ecae1aced4dc0b6feccc4340f6f68812360ce1ad7c0c2c7317871dc2ee245c81aa6c122d119b06ba93c28ef85af75de42362553571ba935fef147d901005f1b36eda0f83e92d42462e0bd219d5d67812e1f89287b20eb632a42478f2f63a10688f5ec837ca35d050fdeac9936"
}
]
},
"JavaScript_key":{
"discription":{
"en":"Built-in support JavaScript development(Please install NodeJS by yourself if needed)",
"zh_cn":"内置支持JavaScript开发如需NodeJS请自行安装"
},
"ext-list": [
],
"pkg-list":{
},
"script-list":[
]
}
},
"ext_detail":{
"KylinIdeTeam.extension-dependency":{
"ext_id": "KylinIdeTeam.extension-dependency",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.project-manager":{
"ext_id": "KylinIdeTeam.project-manager",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-gradle":{
"ext_id": "KylinIdeTeam.vscode-gradle",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-java-dependency":{
"ext_id": "KylinIdeTeam.vscode-java-dependency",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-java-pack": {
"ext_id": "KylinIdeTeam.vscode-java-pack",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-java-test": {
"ext_id": "KylinIdeTeam.vscode-java-test",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-maven": {
"ext_id": "KylinIdeTeam.vscode-maven",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.gitlens": {
"ext_id": "KylinIdeTeam.gitlens",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.cmake-intellisence": {
"ext_id": "KylinIdeTeam.cmake-intellisence",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.go": {
"ext_id": "KylinIdeTeam.go",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.java": {
"ext_id": "KylinIdeTeam.java",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.python": {
"ext_id": "KylinIdeTeam.python",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-clangd": {
"ext_id": "KylinIdeTeam.vscode-clangd",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.debug": {
"ext_id": "KylinIdeTeam.debug",
"ext_version": {
"latest":true
}
},
"KylinIdeTeam.vscode-java-debug": {
"ext_id": "KylinIdeTeam.vscode-java-debug",
"ext_version": {
"latest":true
}
},
"xhafei.remote-dev": {
"ext_id": "xhafei.remote-dev",
"ext_version": {
"latest":true
}
}
}
}

View File

@ -0,0 +1,365 @@
{
"version": "0.0.2",
"KylinIdeTeam.extension-dependency": {
"ext_id": "KylinIdeTeam.extension-dependency",
"ext_name": "extension dependency",
"ext_descrip": {
"en": "extension dependency",
"zh_cn": "插件依赖管理器"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-extension-dependency"
}
}
},
"KylinIdeTeam.offline-extensions-manager": {
"ext_id": "KylinIdeTeam.offline-extensions-manager",
"ext_name":"offline extensions manager",
"ext_descrip": {
"en": "offline extensions manager",
"zh_cn": "离线插件管理器"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-offline-extensions-manager"
}
}
},
"KylinIdeTeam.project-manager": {
"ext_id": "KylinIdeTeam.project-manager",
"ext_name":"Kylin Project Manager",
"ext_descrip": {
"en": "Kylin Project Manager",
"zh_cn": "麒麟项目管理器"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-project-manager"
}
}
},
"KylinIdeTeam.vscode-gradle": {
"ext_id": "KylinIdeTeam.vscode-gradle",
"ext_name":"Java Gradle (Support openjdk11 runtime)",
"ext_descrip": {
"en": "Java Gradle (Support openjdk11 runtime)",
"zh_cn": "Java Gradle(支持openjdk11运行时)"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-vscode-gradle"
}
}
},
"KylinIdeTeam.vscode-java-dependency": {
"ext_id": "KylinIdeTeam.vscode-java-dependency",
"ext_name":"Java Dependency (Support openjdk11 runtime)",
"ext_descrip": {
"en": "Java Dependency (Support openjdk11 runtime)",
"zh_cn": "Java依赖(支持openjdk11运行时) "
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-vscode-java-dependency"
}
}
},
"KylinIdeTeam.vscode-java-pack": {
"ext_id": "KylinIdeTeam.vscode-java-pack",
"ext_name":"Java Pack (Support openjdk11 runtime)",
"ext_descrip": {
"en": "Java Pack (Support openjdk11 runtime)",
"zh_cn": "Java Pack(支持openjdk11运行时) "
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-vscode-java-pack"
}
}
},
"KylinIdeTeam.vscode-java-test": {
"ext_id": "KylinIdeTeam.vscode-java-test",
"ext_name":"Java Test (Support openjdk11 runtime)",
"ext_descrip": {
"en": "Java Test (Support openjdk11 runtime)",
"zh_cn": "Java Test(支持openjdk11运行时) "
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-vscode-java-test"
}
}
},
"KylinIdeTeam.vscode-maven": {
"ext_id": "KylinIdeTeam.vscode-maven",
"ext_name":"Java Maven (Support openjdk11 runtime)",
"ext_descrip": {
"en": "Java Maven (Support openjdk11 runtime)",
"zh_cn": "Java Maven(支持openjdk11运行时) "
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-vscode-maven"
}
}
},
"KylinIdeTeam.gitlens": {
"ext_id": "KylinIdeTeam.gitlens",
"ext_name": "gitlens",
"ext_descrip": {
"en": "Gitlens lower version for friendly licence",
"zh_cn": "Gitlens免费版本"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-gitlens"
}
}
},
"KylinIdeTeam.cmake-intellisence": {
"ext_id": "KylinIdeTeam.cmake-intellisence",
"ext_name": "CMake IntelliSence",
"ext_descrip": {
"en": "CMake IntelliSence",
"zh_cn": "CMake编辑支持"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "cmake-intellisence"
}
}
},
"KylinIdeTeam.go": {
"ext_id": "KylinIdeTeam.go",
"ext_name": "Go(for KylinOS)",
"ext_descrip": {
"en": "Go(for KylinOS)",
"zh_cn": "Go编辑调试支持(适配麒麟操作系统)"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-go"
}
}
},
"KylinIdeTeam.java": {
"ext_id": "KylinIdeTeam.java",
"ext_name": "Java (Support openjdk11 runtime) ",
"ext_descrip": {
"en": "Java (Support openjdk11 runtime) ",
"zh_cn": "Java编辑支持 (支持openjdk11运行时)"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-java"
}
}
},
"KylinIdeTeam.python": {
"ext_id": "KylinIdeTeam.python",
"ext_name": "Python(with jedi language server)",
"ext_descrip": {
"en": "Python(with jedi language server) ",
"zh_cn": "Python编辑调试支持(使用jedi语言服务端)"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-python"
}
}
},
"KylinIdeTeam.vscode-clangd": {
"ext_id": "KylinIdeTeam.vscode-clangd",
"ext_name": "vscode-clangd",
"ext_descrip": {
"en": "C/C++ edit support, use clangd as language server",
"zh_cn": "C/C++编辑支持使用clangd作为语言服务端"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-vscode-clangd"
}
}
},
"KylinIdeTeam.debug": {
"ext_id": "KylinIdeTeam.debug",
"ext_name": "Native Debug(fix some bugs)",
"ext_descrip": {
"en": "C/C++ gdb debug support",
"zh_cn": "C/C++ gdb调试支持"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "native-debug"
}
}
},
"KylinIdeTeam.historydebug": {
"ext_id": "KylinIdeTeam.historydebug",
"ext_name": "historyDebug",
"ext_descrip": {
"en": "history debug",
"zh_cn": "历史调试支持"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "historydebug"
}
}
},
"KylinIdeTeam.js-debug": {
"ext_id": "KylinIdeTeam.js-debug",
"ext_name": "JavaScript Debugger(for KylinOS)",
"ext_descrip": {
"en": "JavaScript Debugger(for KylinOS)",
"zh_cn": "JavaScript调试支持(适配麒麟系统)"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-js-debug"
}
}
},
"KylinIdeTeam.vscode-java-debug": {
"ext_id": "KylinIdeTeam.vscode-java-debug",
"ext_name": "Java Debug (Support openjdk11 runtime)",
"ext_descrip": {
"en": "Java Debug (Support openjdk11 runtime)",
"zh_cn": "Java调试支持(支持openjdk11运行时)"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "vscode-java-debug"
}
}
},
"KylinIdeTeam.deadlock-detect": {
"ext_id": "KylinIdeTeam.deadlock-detect",
"ext_name": "deadlock-detect",
"ext_descrip": {
"en": "C/C++/java deadlock detect",
"zh_cn": "C/C++/java 程序死锁分析"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "deadlock-detect"
}
}
},
"KylinIdeTeam.memleak-detect": {
"ext_id": "KylinIdeTeam.memleak-detect",
"ext_name": "memleak-detect",
"ext_descrip": {
"en": "C/C++ memory leak detect",
"zh_cn": "C/C++ 程序泄漏检测"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-memleak-detect"
}
}
},
"xhafei.remote-dev": {
"ext_id": "xhafei.remote-dev",
"ext_name": "Kylin remote development",
"ext_descrip": {
"en": "remote development support",
"zh_cn": "远程开发支持"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "mcy-kylin",
"repo": "remote-dev"
}
}
},
"ms-vscode.cmake-tools": {
"ext_id": "ms-vscode.cmake-tools",
"ext_name": "CMake Tools",
"ext_descrip": {
"en": "CMake Tools",
"zh_cn": "CMake工具"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "mu_ruichao",
"repo": "exts"
}
}
},
"KylinIdeTeam.qmake-tools": {
"ext_id": "KylinIdeTeam.qmake-tools",
"ext_name": "QMake Tools",
"ext_descrip": {
"en": "QMake Tools",
"zh_cn": "QMake工具"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-qmake-tools"
}
}
},
"KylinIdeTeam.qt-support": {
"ext_id": "KylinIdeTeam.qt-support",
"ext_name": "Qt Support",
"ext_descrip": {
"en": "Qt Support",
"zh_cn": "Qt 支持"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-qt-support"
}
}
}
}

View File

@ -0,0 +1,32 @@
{
"ver": "0.0.3",
"base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/0.4.0",
"ext-file": {
"file_url": "base-url:/ext_link_address-0.0.2.json",
"file_name": "ext_link_address-0.0.2.json",
"ver": "0.0.2",
"sign-md5": "1697c442da9dd290ef353a230f6de2e926d7b82c650e20a72042bef82ee908a1ced3f82b1905886d3e061eb7c96082e3fb6148f56cdd8486e5bbc470cd9f1d75d2ee69d08e8ba68df498da5203f4ad85c27f50386032e6cb3893a6dd04060ee358db33fca360d9e0d523852870563bd4ded45dbe2adf9e710a3db7719c7e74f6"
},
"match-script":
{
"file_url": "base-url:/os_classify_script-0.0.2.js",
"file_name": "os_classify_script-0.0.2.js",
"ver": "0.0.2",
"sign-md5": "844d390832ab4e5fa9576e60f348a10cbd6474bff8a7af773d53a11243a0bb1e0f057ba5ba564516d25b8fe1e05b25a7540e2f037d26a574e2d6c2e1659f32425050cb3b7b39aea8ede59f165b3ed19a096100934970a1a1e6499dd32f82d20eb9a711dc449e6de3a45c10f75ec51c7c7b28e1851b50250499560b9d7eb2e826"
},
"config-file": {
"x86_openkylin_desktop": [
{
"discription": {
"en": "X86 openKylin Desktop",
"zh_cn": "X86 openKylin开源操作系统"
},
"file_url": "base-url:/desktop_os_common-0.0.3.json",
"file_name": "desktop_os_common-0.0.3.json",
"ver": "0.0.3",
"kylin-ide-lowest-ver": "0.4.0",
"sign-md5":"1b8df34d441b8a1b4bb6859164a661c5ee1984193e361da3ae0ad7fc123c76a21c11f75b2d1926b9d71bfb2a9e59f0d07e1fe8efabdabbc37bf463904fb3e4243ec4e5340a92ae245910372349b972beb08fbd72f47984acbcaac2527fc7ff1605626e996d00a5b0f4b9d4a22ece22afc647d34627e96c4f22c1c043b845a20b"
}
]
}
}

View File

@ -0,0 +1,527 @@
const { exec, spawnSync, spawn, execSync } = require('child_process');
const os = require('os');
const fs = require('fs');
//go工具安装
function GoToolsInstall(archName, goVersion, goPath, systemtype,controller) {
return new Promise(async (resolve, reject) => {
let installToolsMessage = '';
let codeProcess = 0
if (archName.indexOf('longarch64') === -1) {
installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go版本为" + goVersion + "的工具:" + '\n';
switch (goVersion) {
case '1.13':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try {
await gopls095Install(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlv160Install(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
})
.catch((error) => {
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
console.log("Go工具安裝失败")
}
return
case '1.14':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try {
await gopls095Install(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlv161Install(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
})
.catch((error) => {
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
console.log("Go工具安裝失败:", error);
reject(error);
}
return
case '1.15':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try {
await gopls095Install(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlv161Install(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
})
.catch((error) => {
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
console.log("Go工具安裝失败:", error)
}
return
default:
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:")
installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具:" + '\n';
try {
await goplsInstall(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlvInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
})
.catch((error) => {
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
console.log("Go工具安裝失败:", error)
reject(error);
}
}
} else {
installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go版本为" + goVersion + "的工具:" + '\n';
switch (goVersion) {
case '1.15':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try {
await gopls095Install(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
.catch((error) => {
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
reject(error);
}
return
case '1.14':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try {
await gopls095Install(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
.catch((error) => {
console.error(error);
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
console.log("Go工具安裝失败:", error);
reject(error);
}
return
case '1.13':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try {
await gopls095Install(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
.catch((error) => {
console.error(error);
reject(error);
});
} catch (error) {
console.log("Go工具安裝失败:", error)
reject(error);
}
return
default:
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:")
installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具" + '\n';
try {
await goplsInstall(goPath,controller)
.then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
})
.catch((error) => {
console.error(error);
reject(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) {
console.log("Go工具安裝失败:", error);
reject(error);
}
}
}
})
}
//判断go路径是否存在
function executableFileExists(filePath) {
let exists = true;
try {
exists = fs.statSync(filePath).isFile();
if (exists) {
fs.accessSync(filePath, fs.constants.F_OK | fs.constants.X_OK);
}
} catch (e) {
exists = false;
}
return exists;
}
//下载gopls@0.9.5
function gopls095Install(goPath,controller) {
return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls@v0.9.5"],{detached:true,shell:true});
ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) {
console.log("gopls@v0.9.5安装成功");
resolve(["gopls@v0.9.5安装成功", code,signal]);
} else {
console.log("gopls@v0.9.5安装失败");
reject(["gopls@v0.9.5安装失败", code,signal]);
}
});
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
})
}
//下载gopls
function goplsInstall(goPath,controller) {
return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) {
console.log("gopls安装成功");
resolve(["gopls安装成功", code,signal]);
}else {
console.log("gopls安装失败");
reject(["gopls安装失败", code,signal]);
}
});
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
})
}
//下载dlv@1.6.0
function dlv160Install(goPath,controller) {
return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.0"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) {
console.log("dlv@v1.6.0安装成功");
resolve(["dlv@v1.6.0安装成功", code,signal]);
} else {
console.log("dlv@v1.6.0安装失败");
reject(["dlv@v1.6.0安装失败", code,signal]);
}
});
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
})
}
//下载dlv@1.6.1
function dlv161Install(goPath,controller) {
return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.1"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) {
console.log("dlv@v1.6.1安装成功");
resolve(["dlv@v1.6.1安装成功", code,signal])
}else {
console.log("dlv@v1.6.1安装失败");
reject(["dlv@v1.6.1安装失败", code,signal])
}
});
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
})
}
//下载dlv
function dlvInstall(goPath,controller) {
return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) {
console.log("dlv安装成功");
resolve(["dlv安装成功", code,signal])
} else {
console.log("dlv安装失败");
reject(["dlv安装失败", code,signal])
}
});
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
})
}
//下载go-outline
function goOutLineInstall(goPath,controller) {
return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/ramya-rao-a/go-outline"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code,signal) => {
controller.signal.removeEventListener('abort', cancelTask);
console.log(`子进程退出码:${code}`);
if (code === 0) {
console.log("go-outline安装成功");
resolve(["go-outline安装成功", code,signal])
} else {
console.log("go-outline安装失败");
reject(["go-outline安装失败", code,signal])
}
});
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
})
}
//获取go路径以及版本号
function getGoPath() {
const p = "";
const defaultPathsForGo =
process.platform === 'win32'
? ['C:\\Program Files\\Go\\bin\\go.exe', 'C:\\Program Files (x86)\\Go\\bin\\go.exe']
: ['/usr/bin/go', '/bin/go', '/usr/local/go/bin/go', '/usr/local/bin/go', '/usr/lib/go-1.15/bin/go', '/usr/lib/go-1.14/bin/go', '/usr/lib/go-1.13/bin/go'];
for (const p of defaultPathsForGo) {
if (executableFileExists(p)) {
return p;
}
}
return p;
}
//设置go代理
function setting(goPath) {
process.env.GO111MODULE = "on";
process.env.GOPROXY = "https://goproxy.cn,direct";
exec(`${goPath} env -w GO111MODULE=on && ${goPath} env -w GOPROXY=https://goproxy.cn,direct`, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
// console.log(`stdout: ${stdout}`);
console.log("Go代理设置成功!")
// console.log(`stderr: ${stderr}`);
})
}
//检查系统类型
function checkSystemType() {
let cmdResult = spawnSync('ls', ['/usr/bin/dpkg']);
if (cmdResult.stdout !== null) {
let libcResult = spawnSync('dpkg-query', ['-W', 'libc6']);
if (libcResult.stdout !== null) {
if (libcResult.stdout.toString() !== '') {
return 'deb';
}
}
}
cmdResult = spawnSync('ls', ['/usr/bin/rpm']);
if (cmdResult.stdout !== null) {
let libcResult = spawnSync('rpm', ['-qa', 'glibc']);
if (libcResult.stdout !== null) {
if (libcResult.stdout.toString() !== '') {
return 'rpm';
}
}
}
return 'unknown';
}
async function main(controller) {
return new Promise((resolve, reject) => {
let goVersion = "";
let goPath = "";
const archName = os.arch();
goPath = getGoPath();
if (goPath === '') {
resolve("go路径找不到");
return;
}
if (goPath.indexOf('go-1.15') !== -1) {
goVersion = "1.15";
} else if (goPath.indexOf('go-1.14') !== -1) {
goVersion = "1.14";
} else if (goPath.indexOf('go-1.13') !== -1) {
goVersion = "1.13";
} else {
let cmdResult = spawnSync('go', ['version']);
if (cmdResult && cmdResult.stdout !== null && cmdResult.stdout.toString().indexOf("1.13") !== -1) {
goVersion = '1.13';
}
}
const systemtype = checkSystemType();
let p = new Promise((resolve, reject) => {
setting(goPath)
setTimeout(() => {
resolve();
}, 1000);
// reject("dddd");
})
p.then(async (value) => {
if (goPath !== "") {
GoToolsInstall(archName, goVersion, goPath, systemtype,controller)
.then(([results, code]) => {
resolve([results, code])
}).catch((error) => {
reject(error);
});
} else {
reject("找不到go路径")
}
})
})
}
module.exports = {
main
}

View File

@ -0,0 +1,182 @@
const os = require('os');
const fs = require('fs');
var os_arch;
var os_org;
var os_type;
var os_custom;
var pretty_name;
var milestone;
var dist_id;
var pretty_name;
var os_info;
const kyinfoPath = '/etc/.kyinfo';
const osReleasePath = '/etc/os-release';
//检查系统架构
function getArch() {
const arch = os.arch();
let res = '';
switch (arch) {
case 'x64':
case 'x86':
case "x86_64": res = 'x86'; break;
case 'arm':
case 'arm64':
case 'aarch64': res = 'arm'; break;
case 'loongarch': res = 'loongarch'; break;
default: res = arch;
}
return res;
}
function getoskey() {
if (os_arch == 'x86' && os_org == 'openkylin' && os_type == 'desktop') {
return "x86_openkylin_desktop";
}
return "undefined"
}
function getFileData() {
//1、架构
//2、是否是麒麟系统
//3、是桌面系统还是服务器系统
//4、是否是V10
//5、是否带sp是sp几
//6、小版本号
//7、定制版字符
os_arch = getArch();
/*
1.存在.kyinfo的系统 取值dist_id 架构之前的信息
2.不在.kyinfo的系统但是存在os-release 的kylin系统
3.不是kylin的系统但是存在os-release
*/
let data;
let releasedata;
if (fs.existsSync(kyinfoPath) && fs.existsSync(osReleasePath)) {
os_org = "kylin";
try {
let version_id;
data = fs.readFileSync(kyinfoPath, 'utf8');
releasedata = fs.readFileSync(osReleasePath, 'utf8');
// 使用 split 方法将文件内容分割成行数组
const lines = data.split('\n');
// 遍历行数组 获取系统架构
lines.forEach((line) => {
line=line.replace(/ /g, "");
if (line.startsWith("milestone=")) {
milestone = line.slice(10).toLocaleLowerCase();
} else if (line.startsWith("dist_id=")) {
dist_id = line.slice(8).toLocaleLowerCase();
}
});//end lines
const releasedatalines = releasedata.split('\n');
releasedatalines.forEach((line) => {
if (line.startsWith("PRETTY_NAME=")) {
pretty_name = line.slice(12).toLocaleLowerCase().replace(/"/g, '');
} else if (line.startsWith("VERSION_ID=")) {
version_id = line.slice(11).toLocaleLowerCase().replace(/"/g, '');
}
});
if (version_id) {
os_version_id = version_id;
}
os_type = dist_id.includes('desktop') ? "desktop" : "server";
if (milestone.indexOf('release')) {
os_release = milestone.slice(milestone.indexOf('release') + 8);
}
if (dist_id.includes('edu')) {
os_custom = 'edu';
} else {
os_custom = 'gen';
}
if (dist_id.includes('hwe')) {
os_custom += 'hwe';
}
if (dist_id.includes('gfb')) {
os_custom += 'gfb'
}
} catch (err) {
os_info = "";
console.log(err);
}
} else
if (fs.existsSync(osReleasePath)) {
try {
let version_id;
releasedata = fs.readFileSync(osReleasePath, 'utf8');
const releasedatalines = releasedata.split('\n');
releasedatalines.forEach((line) => {
if (line.startsWith("PRETTY_NAME=")) {
pretty_name = line.slice(12).toLocaleLowerCase().replace(/"/g, '');
pretty_name=pretty_name.replace(/ /g, "_")
} else if (line.startsWith("VERSION_ID=")) {
version_id = line.slice(11).toLocaleLowerCase().replace(/"/g, '');
} else if (line.startsWith("ID=")) {
os_org = line.slice(3).toLocaleLowerCase().replace(/"/g, '');
} else if (line.startsWith("VERSION_CODENAME=")) {
os_custom = line.slice(17).toLocaleLowerCase().replace(/"/g, '');
}else if(line.startsWith('NAME=')){
os_org=line.slice(5).toLocaleLowerCase().replace(/"/g, '')
}
});
if (version_id) {
os_version_id = version_id;
}
if (pretty_name.includes('openkylin'))
os_type = "desktop";
} catch (err) {
os_info = "";
}
}
}
function getosinfo(){
os_info = getoskey();
return os_info;
}
function showosinfo() {
let osData = '';
if (fs.existsSync(kyinfoPath)) {
if (os_arch) { osData += os_arch; }
if (os_org) { osData += "_" + os_org; }
if (milestone) { osData += "_" + milestone; }
osData = osData.replace(/^_+|_+$/g, '');
osData = osData.replace("-release-", "-");
osData = osData.replace(/-/g, "_");
return osData;
}
else {
//架构
if (os_arch) {osData += os_arch;}
//组织
if (os_org) {osData += "_" + os_org;}
//操作系统类型
if (os_type) {osData += "_" + os_type;}
if (pretty_name) {osData += "_" + pretty_name;}
if(os_custom){ osData += "_" + os_custom; }
osData = osData.replace(/^_+|_+$/g, '');
return osData;
}
}
function getsupportlist(){
let strArry=["X86 openkylin操作系统"
];
return strArry;
}
function getoscontent(){
return [getosinfo(),showosinfo(),getsupportlist()]
}
getFileData();
module.exports = {
getosinfo ,
showosinfo,
getsupportlist,
getoscontent
}

View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "exec \"pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple\""
pip3 install pylint -break-system-packages -i https://pypi.tuna.tsinghua.edu.cn/simple