Skip to content

Commit

Permalink
checkAtom support clang and clangwarning
Browse files Browse the repository at this point in the history
  • Loading branch information
JamiKX1 committed Oct 14, 2021
1 parent 4e4e707 commit 9f6403e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ object Build {
// runCompileTools = false //just for test
if (runCompileTools) {
// 编译型工具,串行
CodeccWeb.downloadAnyUnzip(commandParam)
//CodeccWeb.downloadAnyUnzip(commandParam)
executor.execute {
var curTool = ""
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.tencent.devops.docker.tools.LogUtils
import com.tencent.devops.pojo.OSType
import com.tencent.devops.pojo.exception.CodeccUserConfigException
import com.tencent.devops.utils.CodeccEnvHelper
import com.tencent.devops.utils.script.CommandLineUtils
import com.tencent.devops.utils.script.ScriptUtils
import java.io.File
import java.util.*
Expand Down Expand Up @@ -191,6 +192,9 @@ object CodeccConfig {
@Synchronized
fun downloadToolZip(commandParam: CommandParam, toolName: String) {
val softwareRootPath = "/data/codecc_software"
if (!File(softwareRootPath).exists()) {
File(softwareRootPath).mkdirs()
}
var toolSourceName = ""
var toolBinaryName = ""
var suffix = ""
Expand All @@ -201,7 +205,10 @@ object CodeccConfig {
toolSourceName = "clang_scan.zip"
toolBinaryName = "clang-${getConfig("CLANG_NEW_VERSION")}"
suffix = "tar.xz"
val clangVersion = toolBinaryName.replace(Regex("\\.\\d*"), "")
commandParam.clangHomeBin = CodeccWeb.downloadCompileTool(toolName, toolSourceName, toolBinaryName, suffix)
CommandLineUtils.execute("chmod -R 755 ${commandParam.clangHomeBin}", File("."), true)
ScriptUtils.execute("ln -s -f $clangVersion clang;ln -s -f clang clang++", File("$softwareRootPath/clang_scan/$toolBinaryName/bin"))
}else if(ToolConstants.CLANGWARNING == toolName) {
toolSourceName = "clangwarning_scan.zip"
CodeccWeb.downloadCompileTool(toolName, toolSourceName, toolBinaryName, suffix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ object CodeccWeb : BaseApi() {
var conn: HttpURLConnection?
var inputStream: InputStream?
var rootPath = "/data/codecc_software"
var url = "https://github.com/TencentBlueKing/codeccScan/raw/master/${toolName}_scan/$toolSourceZip"
var url = "https://hub.fastgit.org/TencentBlueKing/codeccScan/raw/master/${toolName}_scan/$toolSourceZip"
val toolHome = "$rootPath/${toolName}_scan"
if (File(toolHome).exists() && File(toolHome).list()?.isNotEmpty() == true) {
if (File("$toolHome/$toolBinaryName").exists()) {
Expand Down Expand Up @@ -118,6 +118,7 @@ object CodeccWeb : BaseApi() {
bis.close()
conn.disconnect()

LogUtils.printLog("start to unzip tool and tool source zip")
FileUtil.unzipFile(toolFullPath, toolHome)
if (toolBinaryName != ""){
if ("tar.gz" == suffix) {
Expand All @@ -132,6 +133,7 @@ object CodeccWeb : BaseApi() {
e.printStackTrace()
throw CodeccDependentException("get the download file $toolName failed! please check it!: ${e.message}")
}
LogUtils.printLog("download tool zip done.")
return if (File("$toolHome/$toolBinaryName").exists()) {
return "$toolHome/$toolBinaryName"
} else {
Expand Down

0 comments on commit 9f6403e

Please sign in to comment.