Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,18 @@ public int run() throws IOException {
diagnosticsToClose.forEach(DiagnosticWriter::close);
}

if (!hasSeenCode()) {
// Fail extraction if no relevant files were found.
boolean seenRelevantFiles = EnvironmentVariables.isActionsExtractor()
? seenFiles // assume all files are relevant for Actions extractor
: hasSeenCode();
if (!seenRelevantFiles) {
if (seenFiles) {
warn("Only found JavaScript or TypeScript files that were empty or contained syntax errors.");
} else {
warn("No JavaScript or TypeScript code found.");
}
// ensuring that the finalize steps detects that no code was seen.
// Ensuring that the finalize steps detects that no code was seen.
// This is necessary to ensure we don't produce an overlay-base database without externs.
Path srcFolder = Paths.get(EnvironmentVariables.getWipDatabase(), "src");
try {
FileUtil8.recursiveDelete(srcFolder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class EnvironmentVariables {
public static final String CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE_ENV_VAR =
"CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE";

public static final String CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE_ENV_VAR =
"CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE";

public static final String CODEQL_DIST_ENV_VAR = "CODEQL_DIST";

/**
Expand Down Expand Up @@ -94,4 +97,8 @@ public static String getCodeQLDist() {
public static String getWipDatabase() {
return Env.systemEnv().getNonEmpty(CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE_ENV_VAR);
}

public static boolean isActionsExtractor() {
return Env.systemEnv().getNonEmpty(CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE_ENV_VAR) != null;
}
}