Skip to content

Commit 2a0945c

Browse files
committed
Merge remote-tracking branch 'origin/main' into powershell-crypto
2 parents 0469eac + 657686b commit 2a0945c

285 files changed

Lines changed: 31019 additions & 97 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

actions/ql/lib/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.25
2+
3+
No user-facing changes.
4+
15
## 0.4.24
26

37
No user-facing changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.4.25
2+
3+
No user-facing changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.4.24
2+
lastReleaseVersion: 0.4.25

actions/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/actions-all
2-
version: 0.4.24
2+
version: 0.4.25
33
library: true
44
warnOnImplicitThis: true
55
dependencies:

actions/ql/src/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.17
2+
3+
No user-facing changes.
4+
15
## 0.6.16
26

37
No user-facing changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.6.17
2+
3+
No user-facing changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.6.16
2+
lastReleaseVersion: 0.6.17

actions/ql/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/actions-queries
2-
version: 0.6.16
2+
version: 0.6.17
33
library: false
44
warnOnImplicitThis: true
55
groups: [actions, queries]

binary/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**/bin/*
2+
**/obj/*
3+
**/*.dll
4+
**/myDB/*
5+
**/oatDB/*
6+
**/test-db-jvm/*
7+
**/test-db-jvm-create/*
8+
**/test-db-jvm*
9+
**/tools/*

binary/build-macos.sh

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
# Build script for macOS (ARM64)
6+
# Usage:
7+
# ./build-macos.sh -cil -cliFolder /path/to/cli # Build CIL extractor
8+
# ./build-macos.sh -cil -clean # Clean CIL build artifacts
9+
# ./build-macos.sh -cil -init -cliFolder /path/to/cli # Initialize and build CIL
10+
#
11+
# Future: x86 extractor support will be added
12+
13+
# Defensive script directory detection
14+
if [[ -n "${BASH_SOURCE[0]:-}" ]]; then
15+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16+
elif [[ -n "${0:-}" ]]; then
17+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
18+
else
19+
echo "Error: Unable to determine script directory"
20+
exit 1
21+
fi
22+
23+
if [[ -z "${SCRIPT_DIR}" || "${SCRIPT_DIR}" != /* ]]; then
24+
echo "Error: Failed to determine absolute script directory"
25+
exit 1
26+
fi
27+
28+
# Verify we're in the expected directory by checking for a known file
29+
if [[ ! -f "${SCRIPT_DIR}/build-win64.ps1" ]]; then
30+
echo "Error: Script directory validation failed - expected files not found"
31+
echo "SCRIPT_DIR: ${SCRIPT_DIR}"
32+
exit 1
33+
fi
34+
35+
# Parse arguments
36+
BUILD_CIL=false
37+
BUILD_X86=false
38+
CLEAN=false
39+
INIT=false
40+
CLI_FOLDER=""
41+
42+
while [[ $# -gt 0 ]]; do
43+
case $1 in
44+
-cil)
45+
BUILD_CIL=true
46+
shift
47+
;;
48+
-x86)
49+
BUILD_X86=true
50+
shift
51+
;;
52+
-clean)
53+
CLEAN=true
54+
shift
55+
;;
56+
-init)
57+
INIT=true
58+
shift
59+
;;
60+
-cliFolder)
61+
CLI_FOLDER="$2"
62+
shift 2
63+
;;
64+
*)
65+
echo "Unknown option: $1"
66+
echo "Usage: $0 [-cil|-x86] [-clean|-init] [-cliFolder <path>]"
67+
exit 1
68+
;;
69+
esac
70+
done
71+
72+
# If no extractor specified, show usage
73+
if [[ "$BUILD_CIL" == false && "$BUILD_X86" == false ]]; then
74+
echo "Usage: $0 [-cil|-x86] [-clean|-init] [-cliFolder <path>]"
75+
echo ""
76+
echo "Options:"
77+
echo " -cil Build the CIL (C# IL) extractor"
78+
echo " -x86 Build the x86 extractor (not yet implemented)"
79+
echo " -clean Clean build artifacts"
80+
echo " -init Initialize dependencies (x86 only)"
81+
echo " -cliFolder Path to the CodeQL CLI folder (required for build)"
82+
exit 1
83+
fi
84+
85+
# Validate arguments
86+
if [[ "$CLEAN" == false && -z "$CLI_FOLDER" ]]; then
87+
echo "Error: -cliFolder is required unless -clean is specified"
88+
exit 1
89+
fi
90+
91+
build_cil() {
92+
local tools_folder="${CLI_FOLDER}/cil/tools/osx64"
93+
local cil_folder="${CLI_FOLDER}/cil"
94+
95+
pushd "${SCRIPT_DIR}/extractor/cil" > /dev/null
96+
97+
dotnet build Semmle.Extraction.CSharp.IL -o "${tools_folder}" -c Release --self-contained
98+
if [[ $? -ne 0 ]]; then
99+
echo "Build failed"
100+
popd > /dev/null
101+
exit 1
102+
fi
103+
104+
popd > /dev/null
105+
106+
# Create directories
107+
mkdir -p "${tools_folder}"
108+
mkdir -p "${cil_folder}"
109+
110+
# Copy extractor configuration
111+
cp "${SCRIPT_DIR}/extractor/cil/codeql-extractor.yml" "${cil_folder}/"
112+
113+
# Copy downgrades if they exist
114+
if [[ -d "${SCRIPT_DIR}/downgrades" ]]; then
115+
cp -r "${SCRIPT_DIR}/downgrades" "${cil_folder}/"
116+
fi
117+
118+
# Copy dbscheme files
119+
local ql_lib_folder="${SCRIPT_DIR}/ql/lib"
120+
cp "${ql_lib_folder}/semmlecode.binary.dbscheme" "${cil_folder}/"
121+
if [[ -f "${ql_lib_folder}/semmlecode.binary.dbscheme.stats" ]]; then
122+
cp "${ql_lib_folder}/semmlecode.binary.dbscheme.stats" "${cil_folder}/"
123+
fi
124+
125+
# Copy tool scripts
126+
mkdir -p "${cil_folder}/tools"
127+
cp "${SCRIPT_DIR}/tools/cil/"* "${cil_folder}/tools/"
128+
chmod +x "${cil_folder}/tools/"*.sh
129+
130+
echo "CIL extractor built successfully to ${cil_folder}"
131+
}
132+
133+
clean_cil() {
134+
echo "Cleaning CIL build artifacts..."
135+
136+
local bin_dir="${SCRIPT_DIR}/extractor/cil/Semmle.Extraction.CSharp.IL/bin"
137+
local obj_dir="${SCRIPT_DIR}/extractor/cil/Semmle.Extraction.CSharp.IL/obj"
138+
139+
[[ -d "${bin_dir}" ]] && rm -rf "${bin_dir}"
140+
[[ -d "${obj_dir}" ]] && rm -rf "${obj_dir}"
141+
142+
echo "CIL clean complete"
143+
}
144+
145+
build_x86() {
146+
echo "x86 extractor build for macOS is not yet implemented"
147+
echo "This will require:"
148+
echo " - LIEF library (build with cmake/make)"
149+
echo " - Zydis library (build with cmake/make)"
150+
echo " - fmt library"
151+
echo " - Boost headers"
152+
echo " - args library"
153+
echo " - clang++ compiler"
154+
exit 1
155+
}
156+
157+
clean_x86() {
158+
echo "Cleaning x86 build artifacts..."
159+
160+
local x86_dir="${SCRIPT_DIR}/extractor/x86"
161+
162+
[[ -d "${x86_dir}/args" ]] && rm -rf "${x86_dir}/args"
163+
[[ -d "${x86_dir}/boost-minimal" ]] && rm -rf "${x86_dir}/boost-minimal"
164+
[[ -d "${x86_dir}/fmt" ]] && rm -rf "${x86_dir}/fmt"
165+
[[ -d "${x86_dir}/LIEF" ]] && rm -rf "${x86_dir}/LIEF"
166+
[[ -d "${x86_dir}/zydis" ]] && rm -rf "${x86_dir}/zydis"
167+
[[ -f "${x86_dir}/extractor" ]] && rm -f "${x86_dir}/extractor"
168+
[[ -f "${x86_dir}/main.o" ]] && rm -f "${x86_dir}/main.o"
169+
170+
echo "x86 clean complete"
171+
}
172+
173+
init_x86() {
174+
echo "x86 extractor initialization for macOS is not yet implemented"
175+
exit 1
176+
}
177+
178+
# Execute requested builds
179+
if [[ "$BUILD_CIL" == true ]]; then
180+
if [[ "$CLEAN" == true ]]; then
181+
clean_cil
182+
else
183+
build_cil
184+
fi
185+
fi
186+
187+
if [[ "$BUILD_X86" == true ]]; then
188+
if [[ "$CLEAN" == true ]]; then
189+
clean_x86
190+
elif [[ "$INIT" == true ]]; then
191+
init_x86
192+
else
193+
build_x86
194+
fi
195+
fi

0 commit comments

Comments
 (0)