Skip to main content



      Home
Home » Eclipse Projects » Oomph » Run task only once(Run import projects task only once)
Run task only once [message #1852045] Wed, 27 April 2022 08:39 Go to next message
Eclipse UserFriend
We have a number of tasks defined in the installation.setup file, which run every time a new workspace is created, or an existing one is opened.

One of the tasks is a "Projects Import" task which imports the projects based on the location of the workspace(as a rule, we define the workspace inside a project).

Often times we do not need all of the modules that are being imported, so we remove them(only from the workspace, not from disk). However, because the import project task runs every time a workspace is opened, the modules that we removed are being re-imported.

We are looking for a way to prevent this behaviour. So far, we have tried the following:
- setting a bootstrap trigger -> not available in projects import task
- filter by a variable which we set to false after workspace has been created -> does not work because variables are evaluated before tasks are executed
- create a file inside the workspace, and do the import tasks projects only if the file does not exist -> we were able to create the file, but were unable to check if it exists. According to this post https://www.eclipse.org/forums/index.php/t/1070369/, this could be the way, but we're not sure how to do it.
- overwrite workspace.setup from within a task in installation.setup -> we tried using ResourceCopy, TextModify, but workspace.setup gets overwritten back to its original value(empty)
- create new setup file and import it with an eclipse ini task, but only after workspace has been created - it tried to load the file before tasks are run
Re: Run task only once [message #1852067 is a reply to message #1852045] Thu, 28 April 2022 06:16 Go to previous message
Eclipse UserFriend
The simplest thing to avoid the problem would be to close the projects rather than remove them from the workspace. This way the implementation of isNeeded will find that the projects exist:

https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup.projects/src/org/eclipse/oomph/setup/projects/impl/ProjectsImportTaskImpl.java#n301

Otherwise, we'd need something similar to what the Launch task has for keeping track of whether it has run once already along with a new property to indicate whether one wants to run on each startup which would be true by default so that no existing tasks are affected by the new behavior:

https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup.launching/src/org/eclipse/oomph/setup/launching/impl/LaunchTaskImpl.java#n282
Previous Topic:Issues Eclipse DE
Next Topic:Thanks Oomph!
Goto Forum:
  


Current Time: Sun May 18 13:28:25 EDT 2025

Powered by FUDForum. Page generated in 0.03709 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top