This repository was archived by the owner on Jan 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +71
-4
lines changed Expand file tree Collapse file tree 7 files changed +71
-4
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,11 @@ CODEQL_PLATFORM = osx64
14
14
endif
15
15
endif
16
16
17
- CODEQL_TOOLS = $(addprefix codeql-tools/,autobuild.cmd autobuild.sh index.cmd index.sh)
17
+ CODEQL_TOOLS = $(addprefix codeql-tools/,autobuild.cmd autobuild.sh index.cmd index.sh linux64 osx64 win64 )
18
18
19
19
EXTRACTOR_PACK_OUT = build/codeql-extractor-go
20
20
21
- BINARIES = go-extractor go-tokenizer go-autobuilder go-bootstrap go-gen-dbscheme
21
+ BINARIES = go-extractor go-tokenizer go-autobuilder go-build-runner go- bootstrap go-gen-dbscheme
22
22
23
23
.PHONY : tools tools-codeql tools-codeql-full clean autoformat \
24
24
tools-linux64 tools-osx64 tools-win64 check-formatting
Original file line number Diff line number Diff line change @@ -4,7 +4,12 @@ SETLOCAL EnableDelayedExpansion
4
4
rem Some legacy environment variables for the autobuilder.
5
5
set LGTM_SRC = %CD%
6
6
7
- type NUL && " %CODEQL_EXTRACTOR_GO_ROOT% /tools/%CODEQL_PLATFORM% /go-autobuilder.exe"
7
+ if " %CODEQL_EXTRACTOR_GO_BUILD_TRACING% " == " on" (
8
+ echo " Tracing enabled"
9
+ type NUL && " %CODEQL_EXTRACTOR_GO_ROOT% /tools/%CODEQL_PLATFORM% /go-build-runner.exe"
10
+ ) else (
11
+ type NUL && " %CODEQL_EXTRACTOR_GO_ROOT% /tools/%CODEQL_PLATFORM% /go-autobuilder.exe"
12
+ )
8
13
exit /b %ERRORLEVEL%
9
14
10
15
ENDLOCAL
Original file line number Diff line number Diff line change 11
11
LGTM_SRC=" $( pwd) "
12
12
export LGTM_SRC
13
13
14
- " $CODEQL_EXTRACTOR_GO_ROOT /tools/$CODEQL_PLATFORM /go-autobuilder"
14
+ if [ " ${CODEQL_EXTRACTOR_GO_BUILD_TRACING:- } " == " on" ]; then
15
+ echo " Tracing enabled"
16
+ " $CODEQL_EXTRACTOR_GO_ROOT /tools/$CODEQL_PLATFORM /go-build-runner"
17
+ else
18
+ " $CODEQL_EXTRACTOR_GO_ROOT /tools/$CODEQL_PLATFORM /go-autobuilder"
19
+ fi
Original file line number Diff line number Diff line change
1
+ * * / go - autobuilder :
2
+ order compiler
3
+ trace no
4
+ * * / go :
5
+ invoke ${config_dir }/ go - extractor
6
+ prepend - - mimic
7
+ prepend "${compiler}"
Original file line number Diff line number Diff line change
1
+ * * / go - autobuilder :
2
+ order compiler
3
+ trace no
4
+ * * / go :
5
+ invoke ${config_dir }/ go - extractor
6
+ prepend - - mimic
7
+ prepend "${compiler}"
Original file line number Diff line number Diff line change
1
+ * * / go - autobuilder .exe :
2
+ order compiler
3
+ trace no
4
+ * * / go .exe :
5
+ invoke ${config_dir }/ go - extractor .exe
6
+ prepend - - mimic
7
+ prepend "${compiler}"
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/github/codeql-go/extractor/util"
5
+ "log"
6
+ "os"
7
+ "os/exec"
8
+ "path/filepath"
9
+ "runtime"
10
+
11
+ "github.com/github/codeql-go/extractor/autobuilder"
12
+ )
13
+
14
+ func main () {
15
+ // check if a build command has successfully extracted something
16
+ autobuilder .CheckExtracted = true
17
+ if autobuilder .Autobuild () {
18
+ return
19
+ }
20
+
21
+ // if the autobuilder fails, invoke the extractor manually
22
+ // we cannot simply call `go build` here, because the tracer is not able to trace calls made by
23
+ // this binary
24
+ log .Printf ("No build commands succeeded, falling back to go build ./..." )
25
+
26
+ mypath , err := os .Executable ()
27
+ if err != nil {
28
+ log .Fatalf ("Could not determine path of extractor: %v.\n " , err )
29
+ }
30
+ extractor := filepath .Join (filepath .Dir (mypath ), "go-extractor" )
31
+ if runtime .GOOS == "windows" {
32
+ extractor = extractor + ".exe"
33
+ }
34
+
35
+ util .RunCmd (exec .Command (extractor , "./..." ))
36
+ }
You can’t perform that action at this time.
0 commit comments