Skip to content

Add Task.Command#makeExclusive#6959

Open
alexarchambault wants to merge 3 commits intocom-lihaoyi:mainfrom
alexarchambault:command-make-exclusive
Open

Add Task.Command#makeExclusive#6959
alexarchambault wants to merge 3 commits intocom-lihaoyi:mainfrom
alexarchambault:command-make-exclusive

Conversation

@alexarchambault
Copy link
Copy Markdown
Collaborator

@alexarchambault alexarchambault commented Mar 23, 2026

New attempt at #6928

This adds a makeExclusive helper on Task.Command, that can be used to make a copy of the command with exclusive set to true.

This can be helpful if users want to make existing Mill commands exclusive, like

def testForked(args: String*) =
  super.testForked(args*).makeExclusive(true)
def publishLocal(localIvyRepo: String = null, sources: Boolean = true, doc: Boolean = true, transitive: Boolean = false) =
  super.publishLocal(localIvyRepo, sources, doc, transitive).makeExclusive(true)

This can be useful in some contexts, like if the tests do fancy terminal stuff and cannot run in parallel because of that, or when publishing locally many modules at a time while passing --transitive=true (if several command runs try to publish a given transitive dependency at the same time, they sometimes clash, with one writing files that the other doesn't expect to exist already).

@lefou
Copy link
Copy Markdown
Member

lefou commented Mar 23, 2026

def testForked(args: String*) =
  super.testForked(args*).withExclusive(true)
def publishLocal(localIvyRepo: String = null, sources: Boolean = true, doc: Boolean = true, transitive: Boolean = false) =
  super.publishLocal(localIvyRepo, sources, doc, transitive).withExclusive(true)

Is the resulting binary even calling the super task?

I think I'm open to the idea of this PR, but have issue with the name, which claims to be a harmless property changer, while what we get is a potentially new command with an copied implementation. I'd prefer a name that make this more clear, but I currently don't have an idea. Maybe there are some good naming patterns in the copy-on-write domain?

@alexarchambault
Copy link
Copy Markdown
Collaborator Author

alexarchambault commented Mar 24, 2026

I initially named it makeExclusive in #6928. I don't mind either way.

@alexarchambault alexarchambault changed the title Add Task.Command#withExclusive Add Task.Command#makeExclusive Mar 25, 2026
@alexarchambault
Copy link
Copy Markdown
Collaborator Author

Just changed it to makeExclusive again

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