|
9 | 9 | - main
|
10 | 10 | workflow_dispatch:
|
11 | 11 |
|
| 12 | +env: |
| 13 | + FORCE_CUSTOMIZATION: "false" |
| 14 | + |
12 | 15 | jobs:
|
13 | 16 | prepare-bundles-matrix:
|
14 | 17 | name: "Prepare CodeQL bundle matrix"
|
@@ -64,23 +67,32 @@ jobs:
|
64 | 67 | qlquery_path=codeql/qlpacks/codeql/$lang-queries/$qlquery_version
|
65 | 68 | fi
|
66 | 69 |
|
67 |
| - if [ -f $qllib_path/Customizations.qll ]; |
68 |
| - then |
69 |
| - mkdir $qllib_path/customizations |
70 |
| - cp $lang_path/*.qll $qllib_path/customizations |
71 |
| -
|
72 |
| - # Import custom modules |
73 |
| - for module_path in $lang_path/*.qll; do |
74 |
| - module_file=${module_path##*/} |
75 |
| - module_name=${module_file%.*} |
76 |
| - echo "import customizations.$module_name" >> $qllib_path/Customizations.qll |
77 |
| - done |
78 |
| -
|
79 |
| - # Rebuild cache |
80 |
| - rm -r $qlquery_path/.cache |
81 |
| - codeql/codeql query compile --search-path codeql --threads 0 $qlquery_path |
| 70 | + if [ -d $qllib_path ]; then |
| 71 | + if [ ! -f $qllib_path/Customizations.qll ] && [ "$FORCE_CUSTOMIZATION" = "true" ]; then |
| 72 | + echo "::warning::Forcing customization for language $lang" |
| 73 | + echo "import $lang" > $qllib_path/Customizations.qll |
| 74 | + sed -i -e '0,/^import/s//private import Customizations\nimport/' $qllib_path/$lang.qll |
| 75 | + fi |
| 76 | +
|
| 77 | + if [ -f $qllib_path/Customizations.qll ]; then |
| 78 | + mkdir $qllib_path/customizations |
| 79 | + cp $lang_path/*.qll $qllib_path/customizations |
| 80 | +
|
| 81 | + # Import custom modules |
| 82 | + for module_path in $lang_path/*.qll; do |
| 83 | + module_file=${module_path##*/} |
| 84 | + module_name=${module_file%.*} |
| 85 | + echo "import customizations.$module_name" >> $qllib_path/Customizations.qll |
| 86 | + done |
| 87 | +
|
| 88 | + # Rebuild cache |
| 89 | + rm -r $qlquery_path/.cache |
| 90 | + codeql/codeql query compile --search-path codeql --threads 0 $qlquery_path |
| 91 | + else |
| 92 | + echo "::warning::Skipping customization for language $lang, because it doesn't have a Customizations.qll" |
| 93 | + fi |
82 | 94 | else
|
83 |
| - echo "Skipping customization for language $lang, because it doesn't have a Customizations.qll" |
| 95 | + echo "::error::Unable to customize language $lang, because it is not present in the CodeQL Bundle $CODEQL_BUNDLE" |
84 | 96 | fi
|
85 | 97 | done
|
86 | 98 |
|
|
0 commit comments