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

Add initial API to import new project into the workspace #751

Closed
donat opened this issue Aug 27, 2018 · 6 comments
Closed

Add initial API to import new project into the workspace #751

donat opened this issue Aug 27, 2018 · 6 comments
Assignees
Milestone

Comments

@donat
Copy link
Contributor

donat commented Aug 27, 2018

No description provided.

@donat donat self-assigned this Aug 27, 2018
@donat donat added this to the Buildship 3.0 milestone Aug 27, 2018
@donat donat changed the title Add API to import new project into the workspace Add initial API to import new project into the workspace Aug 28, 2018
@mickaelistria
Copy link

There is now this API which BuildShip could contribute to: https://wiki.eclipse.org/E4/UI/Smart_Import .
It's the one used by File > Import Projects from Filesystem... to detect the possible import scenario for a given folder. Basically BuildShip could jump in whenever there is a build.gradle and suggest import of the modules that have a build.gradle and even run the typical operations to compute the list of modules.

@donat
Copy link
Contributor Author

donat commented Aug 30, 2018

@mickaelistria Thanks for notification. Frankly, I didn't think about smart import when I sketched the API outline. Nonetheless, I've read through the related discussion. It seems to me that the original design problems @oehme mentioned on that thread are still valid. The new synchronization APIs don't actually do more than what we had already in the internal packages. If you have more insights or updates how should we approach the implementation of the Gradle project configurator, let me know.

@mickaelistria
Copy link

To be honest, I was never convinced by @oehme or whoever that it was fully impossible. The Smart Import API allows to let Gradle compute the actual modules to import, even if they don't have a build.gradle file directly.
And even if some important limitations are found, it'd still be highly profitable to at least implement one basic approach (looking only at build.gradle files) and then upon completion to open a pop-up suggesting additional analysis if it seems worth it, possibly redirecting to the complete Gradle import wizard.

@donat
Copy link
Contributor Author

donat commented Aug 30, 2018

I agree, it would be nice if we could enable the importer for the basic Gradle use-cases.

How can we execute something at the end of the project configuration phase, though? Judging from the API there's no ordering between the configurators. What happens when there are multiple configurators trying to open import dialogs?

@mickaelistria
Copy link

How can we execute something at the end of the project configuration phase, though?

There is no API that does that, but IIRC, you can create a Job that first waits for Job.join(SmartImportJob.class) to wait for completion of the import job and then run whatever you want.

Judging from the API there's no ordering between the configurators.

There is one, but the API doesn't show it, so it's indeed better to not rely on it at the moment.

What happens when there are multiple configurators trying to open import dialogs?

At the moment, only the Maven configurator would show a dialog in case of missing lifecycle listeners. I guess in case 2 configurators open a dialog, both dialog would pop-up simultaneously or so. But so far, it doesn't seem to be a very probably case.
Note that if you mimic some parts of the MavenConfigurator for instance, it would prevent both Maven and Gradle configurators to try configuring the same folder as one would take priority (kind of randomly, but again, in the vast majority of cases, it's not likely to happen).

@donat
Copy link
Contributor Author

donat commented Aug 30, 2018

Waiting for the Job.join(SmartImportJob.class) could be a start, thanks for the tip.

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

2 participants