Repository navigation
Conversation
- Add targeted backend and UI test tasks - Prepare UI test inputs with optional artifact reuse - Coordinate TypeScript builds and fix deployment packaging - Document build and test commands
- Reuse Core's report task and output path - Document report generation
Miggets7
left a comment
There was a problem hiding this comment.
The new lifecycle and test tasks follow openremote/core#3545, and no blocking issues were found. The inline comments cover a few non-blocking points: strict JSON parsing of tsconfig files, an unordered clean and assemble in the rest component tasks, and some duplicated or redundant task wiring.
All 9 changed files were reviewed and compared with the corresponding changes in openremote/core#3545. The parsing of the if (...) return statement in build.gradle was checked separately with Groovy 4.0.33. Gradle builds, the task graph, and the tests were not run for this review.
This review was AI-assisted.
| def projects = [configFile] as Set | ||
| typeScriptProjects[configFile] = projects | ||
| // Track the file read so reference changes invalidate the configuration cache. | ||
| def config = new JsonSlurper().parseText(configFile.getText('UTF-8')) |
There was a problem hiding this comment.
Parse tsconfig files leniently
tsconfig files are JSONC, but the default JsonSlurper parser rejects comments. If a custom project adds a comment to any tsconfig.json in a reference graph, Gradle configuration fails with a JSON parse error. new JsonSlurper().setType(JsonParserType.LAX) accepts comments. Core has the same code.
| id 'base' | ||
| } | ||
|
|
||
| abstract class TypeScriptOutputLock implements BuildService<BuildServiceParameters.None> {} |
There was a problem hiding this comment.
Consider simpler ordering for the TypeScript builds
The output lock and the recursive tsconfig walk add about 50 lines to serialize three TypeScript projects in this repository, and each lock is also held for the whole npmTest run. Making each npmBuild mustRunAfter the npmBuild tasks of its referenced projects would cover the build races with less code. Keeping this file identical to Core is a reasonable argument for leaving it as is.
|
|
||
| rootProject.allprojects { | ||
| tasks.matching { | ||
| it.name in ['installDist', 'prepareUi', 'publishUi', 'npmBuild'] |
There was a problem hiding this comment.
Consider dropping installDist from this list
This also makes the backend installDist tasks in :manager, :setup, :agent, and :model, which only depend on jar, depend on both generateTypeScript tasks. The UI app installDist tasks already get that dependency through npmBuild. Without installDist here, ./gradlew :manager:installDist no longer generates TypeScript.
|
|
||
| tasks.register('prepareUi') { | ||
| dependsOn clean, build, npmPrepare | ||
| dependsOn clean, assemble, npmPrepare |
There was a problem hiding this comment.
Order clean before assemble
Gradle does not order the tasks in a dependsOn list, so clean can run after assemble and delete its output before npmPrepare runs. This predates the PR, but the line changes here. Adding tasks.named('assemble') { mustRunAfter 'clean' }, for example in the subprojects block of ui/build.gradle, fixes it for both prepareUi and publishUi.
There was a problem hiding this comment.
Confirmed with a dry run
A dry run of :ui:component:rest:prepareUi on main, where this line still reads dependsOn clean, build, npmPrepare, executes the tasks in this order:
:ui:component:rest:build
:ui:component:rest:clean
:ui:component:rest:npmPrepare
clean deletes build/lib, the tsc output that module, types, and exports in package.json point to. npmPrepare only rebuilds build/dist with rspack, so prepareUi leaves an incomplete package. publishUi has the same order. Replacing build with assemble adds no ordering constraint, so this should be fixed in this PR.
| @@ -1,5 +1,7 @@ | |||
| tasks.register('clean', Delete) { | |||
| delete layout.buildDirectory | |||
| tasks.register('npmBuild', Exec) { | |||
There was a problem hiding this comment.
Consider registering npmBuild once
The same npmBuild task is now defined in four build files: custom, custom-react, model, and rest. Registering it once in ui/build.gradle for subprojects that have a package.json, and adding the onlyIf in rest, would keep the definitions from drifting apart. If matching Core's per-module layout matters more, this can stay.
|
|
||
| dependencies { | ||
| subprojects.forEach { subproject -> | ||
| if (subproject.path.startsWith(':ui')) return |
There was a problem hiding this comment.
Make the subproject filter easier to read
The extra indentation after return makes the withPlugin block look like the body of the if. Groovy parses it correctly, but it is easy to misread. A single filter avoids that:
dependencies {
subprojects.findAll { !it.path.startsWith(':ui') && it.path != ':test' }.each { p ->
p.pluginManager.withPlugin('java') {
// Aggregate unit test results spread over different projects
testReportAggregation project(p.path)
}
}
}
Miggets7
left a comment
There was a problem hiding this comment.
The ordering problem in the rest component's prepareUi and publishUi tasks should be fixed before merge. It predates this PR, but the PR changes those lines, and a dry run confirmed that clean deletes the TypeScript output the package points to. The other inline comments remain non-blocking.
A dry run of :ui:component:rest:prepareUi on main showed clean executing after build and before npmPrepare. The PR branch itself was not run for this review, so its task order was checked by reading the build scripts. Because the rest package is private, the incomplete output cannot be published to npm, but prepareUi still produces a broken package.
This review was AI-assisted.
- Centralize test groups, reporting, and integration test configuration in testing.gradle - Wait for PostgreSQL and Keycloak before integration test preparation and report startup instructions on timeout - Document service checks and dependency setup for custom UI app tests
- Parse commented TypeScript configs and handle trailing reference commas - Order UI cleanup, compilation, and packaging - Avoid TypeScript generation for backend distribution tasks - Simplify the unit test reporting filter
testing.gradle:test:testruns, and report startup instructions on timeoutSimilar to openremote/core#3545
Closes openremote/core#3344