Unverified Commit b6a1e94c authored by Pavel's avatar Pavel Committed by GitHub

Add comment about clangd, generate compilation database even if compilation...

Add comment about clangd, generate compilation database even if compilation wasn't successful  (#806)

* ignore .clangd

* add comment about clangd

* generate `compile_commands.json` even if compilation wasn't successful
parent 7ae944d9
...@@ -10,3 +10,4 @@ deploy.bat ...@@ -10,3 +10,4 @@ deploy.bat
*.xcodeproj *.xcodeproj
skiko/src/jvmMain/java skiko/src/jvmMain/java
.cache .cache
.clangd
\ No newline at end of file
...@@ -182,17 +182,18 @@ abstract class CompileSkikoCppTask() : AbstractSkikoNativeToolTask() { ...@@ -182,17 +182,18 @@ abstract class CompileSkikoCppTask() : AbstractSkikoNativeToolTask() {
for (work in submittedWorks) { for (work in submittedWorks) {
RunExternalProcessWork.workResults.remove(work) RunExternalProcessWork.workResults.remove(work)
} }
}
if (compiler.get().startsWith("clang")) { // Create compile_commands.json to be able to open the project in Fleet. It is CLang convention (https://clang.llvm.org/docs/JSONCompilationDatabase.html#build-system-integration)
val compileCommands = buildString { if (compiler.get().startsWith("clang")) {
appendLine("[") val compileCommands = buildString {
append(sourceOutputPairs.joinToString(",\n") { (_, outputFile) -> appendLine("[")
Files.readString(Path.of(outputFile.absolutePath + ".json")).trim().removeSuffix(",") append(sourceOutputPairs.joinToString(",\n") { (_, outputFile) ->
}) Files.readString(Path.of(outputFile.absolutePath + ".json")).trim().removeSuffix(",")
appendLine("]") })
appendLine("]")
}
Files.writeString(outDir.toPath().resolve("compile_commands.json"), compileCommands)
} }
Files.writeString(outDir.toPath().resolve("compile_commands.json"), compileCommands)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment