2021-07-12 19:28:50 +03:00
|
|
|
all: extractor dbscheme
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
EXE = .exe
|
|
|
|
CODEQL_PLATFORM = win64
|
|
|
|
else
|
|
|
|
EXE =
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
CODEQL_PLATFORM = linux64
|
|
|
|
endif
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
CODEQL_PLATFORM = osx64
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
FILES=codeql-extractor.yml\
|
|
|
|
tools/qltest.cmd\
|
|
|
|
tools/index-files.sh\
|
|
|
|
tools/index-files.cmd\
|
|
|
|
tools/autobuild.sh\
|
|
|
|
tools/qltest.sh\
|
|
|
|
tools/autobuild.cmd\
|
2021-08-11 13:24:31 +03:00
|
|
|
ql/lib/ruby.dbscheme.stats\
|
|
|
|
ql/lib/ruby.dbscheme
|
2021-07-12 19:28:50 +03:00
|
|
|
|
|
|
|
BIN_FILES=target/release/ruby-extractor$(EXE) target/release/ruby-autobuilder$(EXE)
|
|
|
|
|
|
|
|
extractor-common:
|
2021-08-02 17:12:23 +03:00
|
|
|
rm -rf build
|
|
|
|
mkdir build
|
|
|
|
mkdir build/codeql-extractor-ruby
|
2021-08-11 13:24:31 +03:00
|
|
|
cp codeql-extractor.yml ql/lib/ruby.dbscheme ql/lib/ruby.dbscheme.stats build/codeql-extractor-ruby
|
2021-07-12 19:28:50 +03:00
|
|
|
cp -r tools build/codeql-extractor-ruby/
|
|
|
|
|
|
|
|
.PHONY: tools
|
|
|
|
tools: $(BIN_FILES)
|
2021-08-02 18:40:10 +03:00
|
|
|
rm -rf tools/bin
|
|
|
|
mkdir tools/bin
|
2021-07-12 19:28:50 +03:00
|
|
|
cp -r target/release/ruby-autobuilder$(EXE) tools/bin/autobuilder$(EXE)
|
|
|
|
cp -r target/release/ruby-extractor$(EXE) tools/bin/extractor$(EXE)
|
|
|
|
|
|
|
|
target/release/%$(EXE):
|
|
|
|
cargo build --release --bin $(basename $(notdir $@))
|
|
|
|
|
|
|
|
dbscheme:
|
|
|
|
cargo build --bin ruby-generator
|
2021-08-11 17:17:09 +03:00
|
|
|
cargo run -p ruby-generator -- --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
|
|
|
|
codeql query format -i ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
|
2021-07-12 19:28:50 +03:00
|
|
|
|
|
|
|
.PHONY: extractor
|
|
|
|
extractor: $(FILES) $(BIN_FILES)
|
|
|
|
rm -rf extractor-pack
|
2021-08-02 17:12:23 +03:00
|
|
|
mkdir extractor-pack
|
|
|
|
mkdir extractor-pack/tools
|
|
|
|
mkdir extractor-pack/tools/$(CODEQL_PLATFORM)
|
2021-07-12 19:28:50 +03:00
|
|
|
cp codeql-extractor.yml extractor-pack/codeql-extractor.yml
|
|
|
|
cp tools/qltest.cmd extractor-pack/tools/qltest.cmd
|
|
|
|
cp tools/index-files.sh extractor-pack/tools/index-files.sh
|
|
|
|
cp tools/index-files.cmd extractor-pack/tools/index-files.cmd
|
|
|
|
cp tools/autobuild.sh extractor-pack/tools/autobuild.sh
|
|
|
|
cp tools/qltest.sh extractor-pack/tools/qltest.sh
|
|
|
|
cp tools/autobuild.cmd extractor-pack/tools/autobuild.cmd
|
2021-08-11 13:24:31 +03:00
|
|
|
cp ql/lib/ruby.dbscheme.stats extractor-pack/ruby.dbscheme.stats
|
|
|
|
cp ql/lib/ruby.dbscheme extractor-pack/ruby.dbscheme
|
2021-07-12 19:28:50 +03:00
|
|
|
cp target/release/ruby-extractor$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/extractor$(EXE)
|
|
|
|
cp target/release/ruby-autobuilder$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/autobuilder$(EXE)
|
2021-08-31 15:22:26 +03:00
|
|
|
|
|
|
|
test: extractor dbscheme
|
2021-11-23 18:18:33 +03:00
|
|
|
codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path extractor-pack --consistency-queries ql/consistency-queries ql/test
|