Copy raw files for connected code in cli build - #477
Conversation
tjpalmer
commented
Aug 28, 2026
- Also test 3rd party dependency in be-java for connected code
- That was my original focus but I detoured to needing connecteds working in cli builds generally
- In a bit of manual testing, this doesn't seem to recopy raw files when they get changed
- If it's an easy fix, let me know, and I can fit that in here or the next pr
- Mostly, I'm just hoping my overall strategy looks sound
- Also sneak in a fix to allow reporting compiler errors as failures for temper test on be-java
Signed-off-by: Tom <tom@temper.systems>
Signed-off-by: Tom <tom@temper.systems>
Signed-off-by: Tom <tom@temper.systems>
Signed-off-by: Tom <tom@temper.systems>
| dependenciesText.split(commaSeparated).map { dependencyText -> | ||
| val deps = TList.unpackOrNull(base.configExports[JavaBackend.javaDependenciesKey]) ?: return@lazy emptyList() | ||
| deps.mapNotNull dep@{ depValue -> | ||
| val dependencyText = TString.unpackOrNull(depValue) ?: return@dep null |
There was a problem hiding this comment.
Still not super structured, but expect a list of strings instead of a string with commas in it.
| } | ||
| hasAnyReport = true | ||
| ToolchainResult(libraryName = libraryName, result = testResult) | ||
| } |
There was a problem hiding this comment.
We do a single mvn test (with extra args) for all the libraries, for speed reasons. And we were ignoring failure results if we had no test report. But if I attach the failure to each library, I get broken reporting when there is a test failure (like "Tests passed: 0 of 1 (-2 not run)"). So I changed this to report the failure on only one of the libraries at most and only after we know there were no reports for any of them. With this change, I get failure report for compiler errors, while for test failures, I get proper reporting like "Tests passed: 0 of 1 (1 not run)".
Awesome would be to attach to wherever compiler errors happen, but this should do fine as is.
| ) { output, libraryName, jobName -> | ||
| val result = doTestResult(listOf(JavaBackend.Java17.backendId), jobName, output, libraryName) | ||
| checkErrorResults(result) | ||
| checkFailureResults(result) |
There was a problem hiding this comment.
Turns out we don't distinguish well in our checking. I looked into improving that, but it was an additional tangent that I didn't chase down fully.
| @Timeout(JAVA_TIMEOUT_SECONDS) | ||
| fun connectedsJava17All() { | ||
| checkPassing("ConnectedsJava17", "/testing/connecteds", listOf(JavaBackend.Java17.backendId)) | ||
| } |
There was a problem hiding this comment.
We could add this to other backends in the future. And because I have custom config.temper.md, this doesn't work great as a funtest. And because it's a cli build, I needed connecteds supported in proper builds.
| public add(i: Int): Void; | ||
|
|
||
| public contains(i: Int): Boolean; | ||
| } |
There was a problem hiding this comment.
Lots of text, but this is my main trick for exposing nice instance methods while hiding a non-connected type.
| source.filePath!! to source.fetchedContent!!.toString() // likely a String anyway | ||
| } ?: mapOf() | ||
| LibraryContent(config, modules, rawFiles) | ||
| }, |
There was a problem hiding this comment.
Refold raw files back in here.
| ) | ||
| } | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Moved this up so I have the backend factories sooner. Big changes:
- Had to make a new log sink because the normal one is only available later.
- Used
harness.backendsinstead of combining the list of backends from each library, sinceharness.backendsis where we feed those from, anyway.
| // Explode the backends x libraries to backends that are each responsible for translating one library | ||
| // for one target language. | ||
| val backendOrganization = organizeBackends( | ||
| backendIds = libraries.flatMap { it.first.supportedBackendList }.toSet(), |
There was a problem hiding this comment.
Here's the old backend id logic that I simplified.
| val extensions = factory.backendMeta.fileExtensionMap.values.toSet() | ||
| val rawBackendFiles = rawFiles.filter { entry -> | ||
| entry.key.lastOrNull()?.extension?.let { it in extensions } == true | ||
| } |
There was a problem hiding this comment.
Filter from all raw backend files to just those for this backend.
| maxLogLevel = logLevelTracker.maxLogLevel, | ||
| libraryConfigurations = libraryConfigurationsBundle, | ||
| partitionedModules = libraries, | ||
| partitionedModules = libraries.map { it.config to it.modules }, |
There was a problem hiding this comment.
Filter raw files back out again here. Maybe could change downstream to expect them, but I didn't make that change here.
Signed-off-by: Tom <tom@temper.systems>
Signed-off-by: Tom <tom@temper.systems>