Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support (or don't proclude) the Gradle Worker API #192

Open
nhoughto opened this issue Aug 30, 2021 · 8 comments
Open

Support (or don't proclude) the Gradle Worker API #192

nhoughto opened this issue Aug 30, 2021 · 8 comments

Comments

@nhoughto
Copy link
Contributor

One inherent limitation of Gradle projects is only a single task can run at any given time, with the Worker API (https://docs.gradle.org/current/userguide/worker_api.html#converting_to_the_worker_api) to allow many jobs to be run within a single task, using the Worker API requires specifically coding for it though.

The current 3.x by accident (i assume?) has a number of the right abstractions to make using the worker API possible, but similar to #190 having classes not be open makes extending the various innards of the library hard/impossible. For example the ProjectApiHelper abstraction solves for a large part of the normal problems implementors have with using the Worker API, but closed classes and NodeExtension relying on Project are two other blockers.

Since the use of the Worker API is pretty specific (for ex run N jest test suites in parallel) and the intent of this library is quite broad (run npm/yarn stuff) I don't expect you would do the implementation to support this, just maybe make it more possible for this library be extended to support it? Open to PRs?

@deepy
Copy link
Member

deepy commented Aug 30, 2021

Opening up the classes makes sense, but I'm curious about what ProjectApiHelper would help you solve, the way we use it is to get compatibility with Gradle 5 and 6+ at the same time. It's pretty specifically tailored to just help us call the right thing depending on Gradle version.

If you're looking at implementing something I'm guessing the abstraction is less useful and you probably just want to use things like ObjectFactory, ExecOperations and FileSystemOperations directly.

The closed classes are going to get opened, but I haven't had enough time to get working on it yet, though I'm curious on why the NodeExtension relying on Project is a blocker.
Do you intend to use it as a general data class?

@nhoughto
Copy link
Contributor Author

nhoughto commented Aug 30, 2021 via email

@deepy
Copy link
Member

deepy commented Aug 30, 2021

NodeExecConfiguration doesn't necessarily need Project though :-)

In your case I think you might want to have Gradle inject the services that are in ProjectHelperApi instead of depending on our internal helper, the link provided shows how to get FileSystemOperations but you could also use ProjectHelperApi as a reference

@nhoughto
Copy link
Contributor Author

nhoughto commented Aug 30, 2021 via email

@deepy deepy added this to the 3.2 milestone Sep 7, 2021
@deepy
Copy link
Member

deepy commented Oct 22, 2021

I've created #202 where I've started opening classes, it doesn't have all of them yet but I believe it should be the major ones necessary, let me know if there's any specifics you feel might be missing
(except NpmExecRunner/YarnExecRunner, I haven't gotten around to those yet)

@deepy deepy modified the milestones: 3.2, 3.3 Dec 7, 2021
@deepy
Copy link
Member

deepy commented Mar 26, 2022

I've had some success with getting node detection (and downloading) working and while node detection should work great with the Worker API I'm unfortunately not quite sure how to expose this to a library, unless the library is created and used in the same build I guess

@deepy deepy modified the milestones: 3.x +1, 4.0 Sep 18, 2022
@XhstormR
Copy link

XhstormR commented Aug 5, 2023

ping

@deepy
Copy link
Member

deepy commented Aug 5, 2023

@XhstormR bad news is that the initial idea has class loader issues
The good news is that the abstractions for workers are getting better
If you have a concrete use-case for workers I can see if I can create an example

@deepy deepy modified the milestones: 6.0, Priority Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants