-
Notifications
You must be signed in to change notification settings - Fork 12
IaC Extractor: Windows Support #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,14 +1,58 @@ | ||||||||||
| cargo build --release | ||||||||||
| $ErrorActionPreference = "Stop" | ||||||||||
|
|
||||||||||
| # Set platform | ||||||||||
| $platform = "win64" | ||||||||||
|
|
||||||||||
| cargo run --release -p ql-generator -- --dbscheme ql/src/ql.dbscheme --library ql/src/codeql_ql/ast/internal/TreeSitter.qll | ||||||||||
| codeql query format -i ql\src\codeql_ql\ast\internal\TreeSitter.qll | ||||||||||
| # Check for CodeQL binary | ||||||||||
| if (Get-Command "codeql" -ErrorAction SilentlyContinue) { | ||||||||||
| $CODEQL_BINARY = "codeql" | ||||||||||
| } | ||||||||||
| elseif (Get-Command "gh" -ErrorAction SilentlyContinue) { | ||||||||||
| try { | ||||||||||
| gh codeql version 2>&1 | Out-Null | ||||||||||
| $CODEQL_BINARY = "gh codeql" | ||||||||||
| } | ||||||||||
| catch { | ||||||||||
|
||||||||||
| catch { | |
| catch { |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: Lines 22-23 use tabs while most other lines in the file use spaces. These lines should use spaces to match the rest of the file's indentation style.
| Write-Error "Neither 'codeql' nor 'gh' command found" | |
| exit 1 | |
| Write-Error "Neither 'codeql' nor 'gh' command found" | |
| exit 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| param( | ||
| [string]$ExtractorName = "iac", | ||
| [string]$ExtractorLocations = "$env:USERPROFILE\.codeql\extractors" | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| Write-Host "Creating extractor directory..." | ||
| if (!(Test-Path $ExtractorLocations)) { | ||
| New-Item -ItemType Directory -Path $ExtractorLocations -Force | Out-Null | ||
| } | ||
|
|
||
| Write-Host "Checking latest release..." | ||
| gh release list -L 1 -R "advanced-security/codeql-extractor-$ExtractorName" | ||
|
|
||
| Write-Host "Downloading extractor pack..." | ||
| gh release download ` | ||
| -R "advanced-security/codeql-extractor-$ExtractorName" ` | ||
| -D "$ExtractorLocations" ` | ||
| --clobber ` | ||
| --pattern 'extractor-*.tar.gz' | ||
|
|
||
| Write-Host "Extracting extractor pack..." | ||
| tar -zxf "$ExtractorLocations/extractor-$ExtractorName.tar.gz" --directory "$ExtractorLocations" | ||
|
|
||
| Write-Host "Installation complete! Extractor installed to: $ExtractorLocations" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| param( | ||
| [string]$TestsDir = "ql/test" | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| # Check for CodeQL binary | ||
| if (Get-Command "codeql" -ErrorAction SilentlyContinue) { | ||
| $CODEQL_BINARY = "codeql" | ||
| } | ||
| elseif (Get-Command "gh" -ErrorAction SilentlyContinue) { | ||
| try { | ||
| gh codeql version 2>&1 | Out-Null | ||
| $CODEQL_BINARY = "gh codeql" | ||
| } | ||
| catch { | ||
| Write-Host "Installing gh-codeql extension..." | ||
| gh extension install github/gh-codeql | ||
| $CODEQL_BINARY = "gh codeql" | ||
| } | ||
| } | ||
| else { | ||
| Write-Error "Neither 'codeql' nor 'gh' command found" | ||
| exit 1 | ||
| } | ||
|
|
||
| Write-Host "Installing ql/test pack dependencies..." | ||
| if ($CODEQL_BINARY -eq "gh codeql") { | ||
| gh codeql pack install ql/test | ||
| } | ||
| else { | ||
| codeql pack install ql/test | ||
| } | ||
|
|
||
| Write-Host "Running tests in $TestsDir" | ||
|
|
||
| if ($CODEQL_BINARY -eq "gh codeql") { | ||
| gh codeql test run ` | ||
| -j 0 ` | ||
| --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition ` | ||
| --search-path ./extractor-pack ` | ||
| "$TestsDir" | ||
| } | ||
| else { | ||
| codeql test run ` | ||
| -j 0 ` | ||
| --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition ` | ||
| --search-path ./extractor-pack ` | ||
| "$TestsDir" | ||
| } | ||
|
|
||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Tests failed with exit code $LASTEXITCODE" | ||
| exit $LASTEXITCODE | ||
| } | ||
|
|
||
| Write-Host "All tests passed!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: Line 8 uses tabs while most other lines in the file use spaces. This line should use spaces to match the rest of the file's indentation style.