Repository navigation
Replies: 4 comments 1 reply
|
rough stuff is up at https://github.com/Jarvvski/mise/tree/feat/gradle-workspace-provider |
|
Implemented in #14508: fix(task): let project overrides take over from a failing workspace provider |
|
Just seen #14508 landed - that takes the sharper half of the error question, and the line in the PR body about Gradle is the bit I was hoping for. So question 4 gets answered by being fixed rather than argued about: declaring a project in a provider's namespace now clears that provider's error, so a provider that can't read its input stops being a repo-wide outage. That does change my refusal policy. I picked "decline quietly, never return an error" because erroring took So I'd like to flip to:
If you'd rather a provider never fail at all, I'll keep declining instead. Either is fine to build, I just don't want to pick the quiet one by default now that it isn't forced. The other five are still open. The one I'd most like a steer on is still the ID format - falling back to Gradle's own project path gives Branch is still up at https://github.com/Jarvvski/mise/tree/feat/gradle-workspace-provider. I'll rebase it onto current main before opening the PR. AI-assisted - Tool: opencode; model: fireworks-ai/accounts/fireworks/models/deepseek-v4p1-flash; version: unavailable. |
|
Implemented in #14512: feat(task): discover Gradle workspaces |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mise infers a monorepo's projects and dep edges from four ecosystems right now: Cargo, uv, Go and Node.js. I'd like to add Gradle as a fifth, so
mise tasks graph,mise run --affectedand^taskupstream deps work in JVM multi-module builds.Maven (
pom.xml) is the obvious second one, and honestly it's the easier of the two to parse. I want to start with Gradle anyway: it's where my own needs are (so I'll actually finish it), and its structure is the harder design to get right. Get that sorted and Maven is mostly typing.It's all a static read
Everything here reads files already on disk, same as the existing providers. Repo docs say that cargo, uv, Go and the Node package managers "do not need to be installed to build the graph". A Gradle provider therefore; never runs Gradle, never shells out to
gradleor a wrapper script.Where I need help
Gradle is the first ecosystem where the structure lives in executable build script rather than in data, so the risk profile is different from the other four. It's not really honest to call a Gradle parser sound the way your Go one is.
Safely parseable, i.e. a
settings.gradle(.kts)whose membership is literal:include(":app", ":lib"),include ':app', ':lib'(Groovy and Kotlin DSL)include(":services:person-service")project(":x").projectDir = file("...")remapproject(":lib")orproject(path: ":lib", configuration: "...")inside adependencies {}blockprojects.fooaccessors whenTYPESAFE_PROJECT_ACCESSORSis enabledNot (easily) parseable ((lol)):
include: variables, interpolation, anything computedfile("modules").listFiles()?.forEach { include(it.name) }apply from:and settings plugins that mutate project structuresubprojects {}/allprojects {}blocks that touch deps,buildSrc/build-logicconvention plugins,dependencies.add(...),afterEvaluateI don't think anyone touching this kind of tooling ships a sound static Gradle graph. Renovate has a custom static parser but doesn't build a dep graph from it. Syft only reads lockfiles. Gradle's own
projectsand Tooling API need the build executed anyway.Design
We detect either a
settings.gradleorsettings.gradle.ktsat the workspace root.Identity is the project path (
:app,:services:person-service), which is Gradle's own unique identifier.group,versionandnameare mutable and defaulted, so they belong inmetadata, not in the ID. That gives IDs likegradle::appandgradle::services:person-service.A bit of a change from
workspace.rshere, is that a provider should derive the local part from ecosystem metadata, like a package name, rather than from the project's current filesystem location, so IDs survive agit mv. A Gradle project path is usually directory-derived (though it can be remapped viaprojectDir).Options I can see:
gradle:plus the path verbatim (gradle::app). Faithful to Gradle, keeps the leading colon.gradle:plus the path with the leading colon stripped (gradle:app). Tidier intasks graphoutput.gradle:<group>:<name>, falling back to the path, where both are literal and present. Metadata-derived, butgroupis frequently unset.Personally, im leaning towrads the first choice, but open to discussion!
Edges: literal
project(":…")references inside adependencies {}block, resolved to the owning project's ID, self-edges skipped.Refusal policy:
[monorepo.projects] depends_addrepair them, which is the precedent the Go provider already setsA possible bug that's impoirtant for refusals
The two paths diverge:
workspace_project_graph_for_task_loading()keeps provider errors and returns the graph, so task loading warns and carries onworkspace_project_graph()(src/config/mod.rs:942-950) then bails:So a provider returning
Errmakesmise tasks graphandmise run --affectedhard-fail for the whole repo, including the Cargo/Node/Go users in it who have nothing to do with Gradle. That's why my refusal policy declines rather than errors. With Gradle, unparseable input is going to be common, and erroring on it takes the graph down for everyone.Two questions I ended up at:
Ok(vec![])is indistinguishable from "not my workspace", and there's no warning channel a provider can use. ASkipReason-style channel would help, or just documenting that providers should neverErron user input. Either applies to the existing providers too, sincego.rscurrently bails on a malformedgo.workanyway?Out of scope for v1
includeandproject(...)formsincludeBuild)subprojects {}/allprojects {}/ convention pluginsQuestions
gradle::app), stripped (gradle:app), orgroup:namewith a fallback? See above.includeright, or would you rather a warning surfaced somewhere?Got a working local prototype (projects, edges, the refusal path, unit tests). Can push it up to a branch on my fork if useful.
All reactions