Skip to content

Copy raw files for connected code in cli build - #477

Merged
tjpalmer merged 6 commits into
mainfrom
connected-dependencies
Aug 31, 2026
Merged

Copy raw files for connected code in cli build#477
tjpalmer merged 6 commits into
mainfrom
connected-dependencies

Conversation

@tjpalmer

Copy link
Copy Markdown
Contributor
  • 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refold raw files back in here.

)
}
},
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.backends instead of combining the list of backends from each library, since harness.backends is 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(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@tjpalmer
tjpalmer marked this pull request as ready for review August 28, 2026 21:29
Signed-off-by: Tom <tom@temper.systems>
@tjpalmer
tjpalmer merged commit d8ead15 into main Aug 31, 2026
2 checks passed
@tjpalmer
tjpalmer deleted the connected-dependencies branch August 31, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants