Skip to content

Commit 60c723e

Browse files
committed
Swift: aggregate default output directories
In case the extractor is run in isolation for debugging/testing, this will avoid littering the current working directory with artifacts, and instead having a single `extractor-out` directory to inspect or clean up. Also extractor logs have been nested into a `swift` directory, as the log directory provided by the `codeql` cli is actually shared between languages.
1 parent b6a7661 commit 60c723e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

swift/extractor/infra/log/SwiftLogging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ void Log::configure() {
9494
// as we are configuring logging right now, we collect problems and log them at the end
9595
auto problems = collectSeverityRulesAndReturnProblems("CODEQL_EXTRACTOR_SWIFT_LOG_LEVELS");
9696
if (text || binary) {
97-
std::filesystem::path logFile = getEnvOr("CODEQL_EXTRACTOR_SWIFT_LOG_DIR", ".");
97+
std::filesystem::path logFile = getEnvOr("CODEQL_EXTRACTOR_SWIFT_LOG_DIR", "extractor-out/log");
98+
logFile /= "swift";
9899
logFile /= logRootName;
99100
logFile /= std::to_string(std::chrono::system_clock::now().time_since_epoch().count());
100101
std::error_code ec;

swift/extractor/main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ codeql::TrapDomain invocationTrapDomain(codeql::SwiftExtractorState& state) {
177177

178178
codeql::SwiftExtractorConfiguration configure(int argc, char** argv) {
179179
codeql::SwiftExtractorConfiguration configuration{};
180-
configuration.trapDir = getenv_or("CODEQL_EXTRACTOR_SWIFT_TRAP_DIR", ".");
181-
configuration.sourceArchiveDir = getenv_or("CODEQL_EXTRACTOR_SWIFT_SOURCE_ARCHIVE_DIR", ".");
182-
configuration.scratchDir = getenv_or("CODEQL_EXTRACTOR_SWIFT_SCRATCH_DIR", ".");
180+
configuration.trapDir = getenv_or("CODEQL_EXTRACTOR_SWIFT_TRAP_DIR", "extractor-out/trap/swift");
181+
configuration.sourceArchiveDir =
182+
getenv_or("CODEQL_EXTRACTOR_SWIFT_SOURCE_ARCHIVE_DIR", "extractor-out/src");
183+
configuration.scratchDir =
184+
getenv_or("CODEQL_EXTRACTOR_SWIFT_SCRATCH_DIR", "extractor-out/working");
183185
configuration.frontendOptions.assign(argv + 1, argv + argc);
184186
return configuration;
185187
}

0 commit comments

Comments
 (0)