Skip to content

Commit

Permalink
Merge pull request #36 from Yuanruitao/i18n
Browse files Browse the repository at this point in the history
feat: 支持国际化 #26
  • Loading branch information
Yuanruitao authored Feb 22, 2023
2 parents a5d828e + 0f5c1a7 commit 0e6f2fe
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 42 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
build-root-directory: src/backend/core
gradle-version: 6.7.1
arguments: clean buildAndCopyZip -DmavenCredUserName=${{ secrets.NAME }} -DmavenCredPassword=${{ secrets.GITHUB_TOKEN }} -DmavenRepoUrl=http://maven.aliyun.com/nexus/content/groups/public/
arguments: clean buildZipWithEn -DmavenCredUserName=${{ secrets.NAME }} -DmavenCredPassword=${{ secrets.GITHUB_TOKEN }} -DmavenRepoUrl=http://maven.aliyun.com/nexus/content/groups/public/
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -59,7 +59,7 @@ jobs:
release_name: ${{ github.ref }}
draft: true
prerelease: true
- name: Upload Release Asset
- name: Upload ZH_CN Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -68,3 +68,12 @@ jobs:
asset_path: src/backend/core/build/distributions/CodeCCCheckAtom.zip
asset_name: CodeCCCheckAtom.zip
asset_content_type: application/zip
- name: Upload EN Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: src/backend/core/build/distributions/CodeCCCheckAtom_en.zip
asset_name: CodeCCCheckAtom_en.zip
asset_content_type: application/zip
26 changes: 21 additions & 5 deletions src/backend/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ allprojects {
into "../../frontend/target/frontend"
}

task cleanTarget(type:Delete) {
delete "../../../target"
}

task copyDocs(type:Copy) {
from "../../../docs"
into "../../../target/file/docs"
Expand All @@ -130,21 +134,33 @@ allprojects {
into "../../../target/file/images"
}

task buildZip(type: Zip, dependsOn: [shadowJar, copyFrontend, copyDocs, copyImages]) {
task buildZipCn(type: Zip, dependsOn: [shadowJar, copyFrontend, cleanTarget, copyDocs, copyImages]) {
from "build/libs", "task.json", "quality.json", "../../frontend/target", "../../../target"
into "CodeCCCheckAtom"
archiveName "CodeCCCheckAtom.zip"
}

task buildAndCopyZip(type: Copy, dependsOn: [buildZip]) {
from "build/distributions"
into "build/distributions"
task renameEnTaskJson(type:Copy) {
from "task_en.json"
into "../../../target/"
rename { String fileName ->
// a simple way is to remove the "-$version" from the jar filename
// but you can customize the filename replacement rule as you wish.
fileName = "CodeCCCheckAtom.zip"
fileName = "task.json"
}
}

task buildZipWithEn(type: Zip, dependsOn: [buildZipCn, renameEnTaskJson]) {
from "build/libs", "quality.json", "../../frontend/target", "../../../target"
into "CodeCCCheckAtom"
archiveName "CodeCCCheckAtom_en.zip"
}

// task buildAndCopyZip(type: Copy, dependsOn: [buildZipCn, buildZipEn]) {
// from "build/distributions"
// into "build/distributions"
// }

check.dependsOn ktlint

// 固定入口类 不要改
Expand Down
70 changes: 35 additions & 35 deletions src/backend/core/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@
"rule": {},
"type": "atom-checkbox-list",
"required": true,
"label": "Programming Language",
"label": "工程语言",
"list": [],
"default": [],
"desc": "tools will match different programming language",
"desc": "不同代码语言,可选择相匹配的工具",
"tabName": "basic"
},
"tools": {
"rule": {},
"required": true,
"hidden": true,
"type": "atom-checkbox-list",
"label": "Code Review Tool",
"label": "代码检查工具",
"list": [],
"default": [],
"tabName": "basic"
},
"asyncTask": {
"rule": {},
"type": "enum-input",
"label": "Sync Method",
"label": "执行方式",
"list": [
{
"value": false,
"label": "Synchronize"
"label": "同步"
},
{
"value": true,
"label": "Asynchronous"
"label": "异步"
}
],
"default": false,
Expand All @@ -52,23 +52,23 @@
"asyncTaskRequired": true
},
"type": "task-select",
"label": "Task",
"label": "任务",
"required": true,
"tabName": "async",
"inline": true,
"list": {},
"default": "",
"rely": {},
"desc": "You can choose to create a task yourself in the CodeCC service, or you can directly enter the task ID. The task ID can be obtained from the CodeCC link (in /codecc/myproj/task/25324/, 25324 is the task ID). Support pipeline variables."
"desc": "可选择CodeCC服务中自建任务,也可以直接输入任务ID。ID可从CodeCC链接中获取到,例如/codecc/myproj/task/25324/中的数字。支持流水线变量。"
},
"goPath": {
"rule": {},
"type": "vuex-input",
"label": "GOPATH",
"default": "",
"required": false,
"desc": "Help find the code path of the dependent library to get a more useful result",
"placeholder": "Relative paths under {WORKSPACE}, please use comma to separate multiple paths, support pipeline variables",
"desc": "可帮助工具查找依赖库代码路径,更好地扫描告警",
"placeholder": "${WORKSPACE}下相对路径,多路径请用英文逗号分割,支持使用流水线变量",
"tabName": "basic",
"inline": true,
"rely": {
Expand All @@ -84,7 +84,7 @@
"pyVersion": {
"rule": {},
"type": "enum-input",
"label": "Python Version",
"label": "Python版本",
"required": true,
"list": [
{
Expand Down Expand Up @@ -112,7 +112,7 @@
"scriptType": {
"rule": {},
"type": "enum-input",
"label": "Script Type",
"label": "脚本类型",
"required": true,
"hidden": false,
"list": [
Expand All @@ -131,12 +131,12 @@
"rule": {
"scriptRequired": true
},
"label": "Script",
"label": "脚本内容",
"hidden": false,
"default": "#Coverity/Klocwork will compile your code by calling the compilation script to identify defects\n# Please use build tools such as maven/cmake to write a compilation script build.sh\n# Make sure build.sh can compile the code\n# cd path/to/build.sh\n# sh build.sh",
"default": "# Coverity/Klocwork将通过调用编译脚本来编译您的代码,以追踪深层次的缺陷\n# 请使用依赖的构建工具如maven/cmake等写一个编译脚本build.sh\n# 确保build.sh能够编译代码\n# cd path/to/build.sh\n# sh build.sh",
"required": true,
"type": "atom-ace-editor",
"desc": "The corresponding tool will use this script to compile the code in order to track the compilation process and find code defects",
"desc": "相应工具将使用该脚本编译代码,以便追踪编译过程,发现代码缺陷",
"tabName": "basic"
},
"languageRuleSetMap": {
Expand Down Expand Up @@ -166,52 +166,52 @@
},
"multiPipelineMark": {
"rule": {},
"label": "label",
"placeholder": "Optional. Only numbers, letters, and underscores are supported.",
"label": "附加标识",
"placeholder": "默认可不填。仅支持数字、字母和下划线。",
"type": "vuex-input",
"default": "",
"tabName": "basic",
"desc": "If the pipeline has multiple code analysis plugins, a label can be used to distinguish them.",
"desc": "若流水线有多个代码分析插件可用此字段区分。",
"inline": true
},
"toolScanType": {
"rule": {},
"type": "radio-group",
"label": "Scan Method",
"label": "扫描方式",
"required": true,
"list": [
{
"label": "Incremental Scan(recommended)",
"label": "增量扫描(推荐)",
"value": "1"
},
{
"label": "MR/PR Scan",
"label": "MR/PR扫描",
"value": "2"
},
{
"label": "Full Scan",
"label": "全量扫描",
"value": "0"
}
],
"default": "1",
"desc": "Incremental scan: Scan the difference code between current build and previous build. Full scan will be used in the first time.\nMR/PR Scan: Scan the difference code between the source branch and the target branch of MR/PR. The source branch code needs to be pulled to the workspace\nFull Scan: Scan all codes. Klocwork, Pinpoint, Gometalinter, and repetition rate only support this scanning method."
"desc": "增量扫描:扫描本次构建与上次构建的差异代码。首次为全量扫描。\nMR/PR扫描:扫描MR/PR的源分支与目标分支的差异代码。源分支代码需拉取到工作空间。\n全量扫描:扫描全部代码。KlocworkPinpointGometalinter、重复率仅支持该扫描方式。"
},
"mrCommentEnable": {
"label": "",
"default": true,
"type": "atom-checkbox",
"text": "Sync the defect info to Tencent internal Git viewing page"
"text": "将扫描出的问题同步到工蜂代码查看页面"
},
"newDefectJudgeFromDate": {
"default": "",
"label": "New Alerts Threshold",
"desc": "Alerts sent after the selected date are New Alerts"
"label": "新告警判定",
"desc": "所选日期之后产生的告警为新告警"
},
"transferAuthorList": {
"default": [],
"type": "author-transfer",
"label": "change owner",
"desc": "Alerts will sent to the new owner when the tools's ownership changed "
"label": "处理人转换",
"desc": "各工具原处理人的告警都将自动转给新处理人"
},
"path": {
"default": [],
Expand All @@ -226,8 +226,8 @@
"default": false,
"placeholder": "",
"type": "atom-checkbox",
"text": "use open sourced tool to scan project",
"desc": "Use open sourced scanning tool when selected",
"text": "是否是开源扫描项目",
"desc": "选中则走开源扫描流程",
"required": false,
"disabled": false,
"hidden": true
Expand All @@ -236,25 +236,25 @@
"output": {
"BK_CI_CODECC_TASK_ID": {
"type": "string",
"description": "CodeCC task id"
"description": "CodeCC的任务id"
},
"BK_CI_CODECC_TASK_STATUS": {
"type": "string",
"description": "Whether the CodeCC task runs successfully"
"description": "CodeCC任务是否运行成功,成功则未true,不然取不到"
}
},
"releaseInfo": {
"projectId": "demo",
"name": "CodeCC Code Check",
"name": "CodeCC代码检查",
"language": "java",
"logoUrl": "${{indexFile(\"images/logo.png\")}}",
"category": "TASK",
"classifyCode": "scm",
"jobType": "AGENT",
"os": ["LINUX", "MACOS", "WINDOWS"],
"labelCodes": [],
"summary":"Support all CodeCC code inspection tools under Linux, MacOS, and Windows systems, including code defects (bkcheck, etc.), security vulnerabilities (sensitive information, high-risk components, etc.), code specifications (CppLint, CheckStyle, etc.), cyclomatic complexity, repetition rate, etc. .",
"description": "${{indexFile(\"docs/aboutCodeCC_en.md\")}}",
"summary":"支持Linux、MacOS、Windows系统下执行所有CodeCC代码检查工具,包括代码缺陷(bkcheck等)、安全漏洞(敏感信息、高危组件等)、代码规范(CppLint、CheckStyle等)、圈复杂度、重复率等。",
"description": "${{indexFile(\"docs/aboutCodeCC.md\")}}",
"configInfo": {
"frontendType": "SPECIAL"
},
Expand Down
Loading

0 comments on commit 0e6f2fe

Please sign in to comment.