Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Execution of Gradle task before import
Execution of Gradle task before import [message #1706540] Thu, 27 August 2015 15:11 Go to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Hello Eclipse Community,
I am trying to import Gradle java-Projects into eclipse, which are at the beginning pure gradle projects. However , the command 'gradlew eclipse' can convert them into eclipse projects. Thus i am looking for a way to execute a command before importing the projects into workspace. Is it possible in oomph ?

Alternatively, is it possible to import non-java projects into eclipse? For example i can let my eclipse have a gradle plugin pre-installed. Will it then be able to import my gradle projects ?
Maksim

[Updated on: Thu, 27 August 2015 15:41]

Report message to a moderator

Re: Execution of Gradle task before import [message #1706599 is a reply to message #1706540] Fri, 28 August 2015 04:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
Maksim,

This sounds similar to a Maven import task. In that case the projects
also not properly Eclipse projects, i.e., no .project files. So I
imagine it's possible to integrate with Gradle, but someone would need
to implement such a task We do have a wizard for creating an extension
task implementation, so anyone can implement such interesting extensions...


On 27/08/2015 5:11 PM, Maksim Melnik wrote:
> Hello Eclipse Community,
> I am trying to import Gradle java-Projects into eclipse, which are at
> the beginning pure gradle projects. However , the command 'gradlew
> eclipse' can convert them into eclipse projects. Thus i am looking for
> a way to execute a command before importing the projects into
> workspace. Is it possible in oomph ?
> Maksim


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Execution of Gradle task before import [message #1707036 is a reply to message #1706599] Tue, 01 September 2015 15:56 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
As i understand there is also no way to execute command line - tasks after the installation, am i right?
You mentioned that you have a wizard for creating an extension task implementation? Could i contact you per e-mail on this behalf ?

[Updated on: Tue, 01 September 2015 15:57]

Report message to a moderator

Re: Execution of Gradle task before import [message #1707071 is a reply to message #1707036] Wed, 02 September 2015 05:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
You need to install the org.eclipse.oomph.setup.ui.ide (.feature.group)
to install this Oomph wizard.

On 01/09/2015 5:56 PM, Maksim Melnik wrote:
> As i understand there is also no way to execute comand line arguments
> after the installation, am i right? You mentioned that you have a
> wizard for creating an extension task implementation? Could i contact
> you per e-mail on this behalf ?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Execution of Gradle task before import [message #1707289 is a reply to message #1707071] Thu, 03 September 2015 13:45 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
You said that you have a wizard for creating an extension
task implementation and that i need to install the org.eclipse.oomph.setup.ui.ide in order to install the wizzard.

How do i install the org.eclipse.oomph.setup.ui.ide ?

I've cloned oomph git directory and i found this project in the project viewer, however , i don't really understand what you mean by installing it. I've tried to run it as eclipse IDE application, but it did not work.

My intention is to execute a cmd - command after the git clone task.

[Updated on: Thu, 03 September 2015 13:48]

Report message to a moderator

Re: Execution of Gradle task before import [message #1707292 is a reply to message #1707289] Thu, 03 September 2015 14:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
Maksim,

That plugin registers a wizard that allows you to do File -> New ->
Project -> Oomph -> Setup Task Extension, so if you see that wizard, all
is good, if you don't, you've not installed it.


On 03/09/2015 3:45 PM, Maksim Melnik wrote:
> How do i install the org.eclipse.oomph.setup.ui.ide ?
> I've cloned oomph git directory and i found this project in the
> project viewer, however , i don't really understand what you mean by
> installing it. I've tried to run it as eclipse IDE application, but it
> did not work.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Execution of Gradle task before import [message #1707296 is a reply to message #1707292] Thu, 03 September 2015 14:23 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Thank you for your reply,
now, my question is, how do i test-deploy the task?

Is there any documentation on how to work with the task extension wizard? Or should i just take mavenImport task as example and try do mine?
Re: Execution of Gradle task before import [message #1707309 is a reply to message #1707296] Thu, 03 September 2015 15:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
Maksim,

Comments below.

On 03/09/2015 4:23 PM, Maksim Melnik wrote:
> Thank you for your reply,
> now, my question is, how do i test-deploy the task?
Launch a runtime Eclipse instance that includes the task.
>
> Is there any documentation on how to work with the task extension wizard?
No.
> Or should i just take mavenImport task as example and try do mine?
Outside of the the core setup model, all the other tasks are examples of
extension tasks...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Execution of Gradle task before import [message #1707310 is a reply to message #1707309] Thu, 03 September 2015 16:00 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Okay, thank you once again Ed, it worked Smile
Now, my question is, given i have implemented the task and created a .setup file which uses my task.

How does oomph installer get my task implementation when i give him my .setup file ?

Does it load task implementations from the internet? Which then would mean that i need to submit my task implementation to you.

Or does the .setup file contain all the needed operations for my task, and the installer does not need any further informations about it.

Sorry if I ask too many questions.
Maksim
Re: Execution of Gradle task before import [message #1707322 is a reply to message #1707310] Thu, 03 September 2015 17:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
Maksim,

Comments below.

On 03/09/2015 6:00 PM, Maksim Melnik wrote:
> Okay, thank you once again Ed, it worked :)
> Now, my question is, given i have implemented the task and created a
> .setup file which uses my task.
>
> How does oomph installer get my task implementation when i give him my
> .setup file ?

The enablement annotation on the EClass specifies what needs to be
installed and from where.
> Does it load task implementations from the internet?
It augments the p2 tasks with the requirements and update sites from the
enablement annotation.
> Which then would mean that i need to submit my task implementation to
> you.
No, it just needs to be at some update site.
>
> Or does the .setup file contain all the needed operations for my task,
> and the installer does not need any further informations about it.
Your implementation is generally needed to implement isNeeded and perform...
>
> Sorry if I ask too many questions.
> Maksim


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Execution of Gradle task before import [message #1707775 is a reply to message #1707322] Wed, 09 September 2015 10:20 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Hey Ed,

i have implemented the perform method for a task, which simply executes ' dir ' command and prints the result into the context.

Now, i start new IDE and create a new .setup file which uses my task:
 <setupTask
      xsi:type="gradler:GradlerTask"/>


It is also shown correctly in the outline view - startup triggers.

However when i try to run the setup file in the installer ( i use your installer, don't compile my own or so... ) , my task is not executed when new eclipse starts up.


I also have some questions on what you have said above.

Where do i find the enablement annotation on the EClass ? How do I set it ?

You said that the installer augments the p2 tasks with the requirements and update sites from the enablement annotation.
Does that mean that my task implementation should be online so that the installer can find it ?
Re: Execution of Gradle task before import [message #1707776 is a reply to message #1707775] Wed, 09 September 2015 10:32 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6691
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 09.09.2015 um 12:20 schrieb Maksim Melnik:<br>
<blockquote cite="mid:msp15l$a4d$1@xxxxxxxxe.org" type="cite">Hey
Ed,
<br>
<br>
i have implemented the perform method for a task, which simply
executes ' dir ' command and prints the result into the context.
<br>
<br>
Now, i start new IDE and create a new .setup file which uses my
task:
<br>
<br>
&lt;setupTask
<br>
     xsi:type="gradler:GradlerTask"/&gt;
<br>
<br>
<br>
It is also shown correctly in the outline view - startup triggers.
<br>
<br>
However when i try to run the setup file in the installer ( i use
your installer, don't compile my own or so... ) , my task is not
executed when new eclipse starts up.
<br>
</blockquote>
Can you please show the implementation of your isNeeded() method?<br>
<br>
<blockquote cite="mid:msp15l$a4d$1@xxxxxxxxe.org" type="cite">
<br>
<br>
I also have some questions on what you have said above.
<br>
<br>
Where do i find the  enablement annotation on the EClass ? </blockquote>
Have a look at one of our extension models, e.g., Git.ecore:<br>
<br>
<img src="https://www.eclipse.org/forums/index.php?t=getfile&amp;id=23193" alt=""><br>
<br>
<blockquote cite="mid:msp15l$a4d$1@xxxxxxxxe.org" type="cite">How
do I set it ?
<br>
</blockquote>
You can copy/adjust from any of our extension models.<br>
<br>
<blockquote cite="mid:msp15l$a4d$1@xxxxxxxxe.org" type="cite">
<br>
You said that the installer augments the p2 tasks with the
requirements and update sites from the enablement annotation. Does
that mean that my task implementation should be online so that the
installer can find it ?
<br>
</blockquote>
Yes. In a runtime launch from within Eclipse the needed EPackages
would be found through the normal extension registry, though.<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://www.esc-net.de">http://www.esc-net.de</a><br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
<br>
</body>
</html>
  • Attachment: ceaibgcd.png
    (Size: 13.05KB, Downloaded 163 times)


Re: Execution of Gradle task before import [message #1707780 is a reply to message #1707776] Wed, 09 September 2015 10:43 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Hey Eike,
my isNeeded always returns true.

I found the enablement annotations , but since i didn't upload my task implementation anywhere, i don't know what should i set it to. Where should i upload it ?

I think that the task is not executed because the installer cannot fetch the implementation of the task. Can it be the case ?

[Updated on: Wed, 09 September 2015 10:46]

Report message to a moderator

Re: Execution of Gradle task before import [message #1707799 is a reply to message #1707780] Wed, 09 September 2015 12:36 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
An update,

i managed to create a plugin site and upload it to the internet. After setting the enablement annotation the task also got executed in the installed eclipse, which is nice.

However, the task is executed after the Projects Import task. Whereas i want it the other way, my task before projects import... Is there a way to control it?

Additionally, is there any way to get the git clone folder in the perform function of the implementation?

[Updated on: Wed, 09 September 2015 13:12]

Report message to a moderator

Re: Execution of Gradle task before import [message #1707826 is a reply to message #1707799] Wed, 09 September 2015 14:48 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6691
Registered: July 2009
Senior Member
Am 09.09.2015 um 14:36 schrieb Maksim Melnik:
> An update,
>
> i managed to create a plugin site and upload it to the internet. After setting the enablement annotation the task also
> got executed in the installed eclipse, which is nice.
Very good.

>
> However, the task is executed after the Projects Import task. Whereas i want it the other way, my task before projects
> import... Is there a way to control it?
You can *author* that in your .setup file by setting the successors or predecessors of your task explicitely.

Or you can *implement* a fixed task priority by overriding SetupTaskImpl.getPriority(). Have a look at the "slots" we
define in SetupTask:

public interface SetupTask extends ModelElement
{
public static final int PRIORITY_REDIRECTION = 100;
public static final int PRIORITY_INSTALLATION = 200;
public static final int PRIORITY_CONFIGURATION = 300;
public static final int PRIORITY_EARLY = 400;
public static final int PRIORITY_DEFAULT = 500;
public static final int PRIORITY_LATE = 600;

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Execution of Gradle task before import [message #1707835 is a reply to message #1707826] Wed, 09 September 2015 15:11 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Thank you Eike,
it worked, what about getting git clone repository in the perform function? How do i actually access variables in the .setup file?
Re: Execution of Gradle task before import [message #1707843 is a reply to message #1707835] Wed, 09 September 2015 16:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6691
Registered: July 2009
Senior Member
Am 09.09.2015 um 17:11 schrieb Maksim Melnik:
> Thank you Eike, it worked,
Great.

> what about getting git clone repository in the perform function?
Sorry, I don't get that question.

> How do i actually access variables in the .setup file?
You mean like in https://wiki.eclipse.org/Eclipse_Oomph_Authoring#Declaring_and_Using_Variables ?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Execution of Gradle task before import [message #1707846 is a reply to message #1707843] Wed, 09 September 2015 16:43 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Oh yes, you are right.

I've got another problem now.

All my projects are created using java-7. Now, in order to start oomph i need the java 8. Thus, i change my path to java8 and start oomph.

Since i want my eclipse to run on java7 , i chose it in the very first menu of oomph. (First screenshot)
After oomph installs the new it starts it, so far so good.

But then , what i see is , that the new eclipse actually uses java8 (Second screenshot)

Is it a bug, or am i doing something wrong?
I cannot complete full eclipse installation becuz my projects are not compatible with java 8... Thats why i neeed java 7
  • Attachment: Capture.PNG
    (Size: 56.02KB, Downloaded 180 times)
  • Attachment: Capture2.PNG
    (Size: 74.40KB, Downloaded 196 times)
Re: Execution of Gradle task before import [message #1707850 is a reply to message #1707846] Wed, 09 September 2015 17:20 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6691
Registered: July 2009
Senior Member
Am 09.09.2015 um 18:43 schrieb Maksim Melnik:
> Oh yes, you are right.
>
> I've got another problem now.
>
> All my projects are created using java-7. Now, in order to start oomph i need the java 8.
Yes, the Platform decided to make use of Java 8 in Neon, for example in JFace and the help system.

> Thus, i change my path to java8 and start oomph.
>
> Since i want my eclipse to run on java7 , i chose it in the very first menu of oomph. (First screenshot)
> After oomph installs the new it starts it, so far so good.
Yes, the installer knows about the minimum Java requirement of the different products and product versions, e.g., Java 7
for Mars, Java 8 for Neon.

>
> But then , what i see is , that the new eclipse actually uses java8 (Second screenshot)
Well, that's not the JRE to be used for the installed IDE, it's the JRE used for Java development in that workspace. And
you must have picked that at some point. It's probably stored in your user.setup and you can change it there at any time
and reperform the respective JRETask to have your workspace adjusted.

>
> Is it a bug, or am i doing something wrong?
Probably the latter :P

> I cannot complete full eclipse installation becuz my projects are not compatible with java 8... Thats why i neeed java 7
That should work; see above.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Execution of Gradle task before import [message #1707895 is a reply to message #1707850] Thu, 10 September 2015 08:49 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Hello Eike,
thank you again for your reply, i found that the JRE path variable was hidden in the installation menu Smile

Now I've still got a question about how to access the git clone location in the perform method in my task.

In the link which you have given to me stands:
" Attribute values of setup tasks with a defined ID. The reference syntax is ${taskID.attributeName}. "
But i guess it refers to batch scripts. I guess the git clone path is also not in my system environments

Here is my git-clone task:
 <setupTask
      xsi:type="git:GitCloneTask"
      id="git.clone"
      remoteURI="http://roskilde.lhs-systems.com:8000/GIT_main">
    <description>${scope.project.label}</description>
  </setupTask>


how do i programmatically get the string from ${scope.project.label} into my perform method of my task.

And another example is, i need the java path from the ${jre.location-1.7} variable.
How can i get that ?
Re: Execution of Gradle task before import [message #1707898 is a reply to message #1707895] Thu, 10 September 2015 09:05 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6691
Registered: July 2009
Senior Member
Am 10.09.2015 um 10:49 schrieb Maksim Melnik:
> Hello Eike,
> thank you again for your reply, i found that the JRE path variable was hidden in the installation menu :)
>
> Now I've still got a question about how to access the git clone location in the perform method in my task.
> In the link which you have given to me stands:
> " Attribute values of setup tasks with a defined ID. The reference syntax is ${taskID.attributeName}. "
> But i guess it refers to batch scripts. I guess the git clone path is also not in my system environments
>
> Here is my git-clone task:
> <setupTask
> xsi:type="git:GitCloneTask"
> id="git.clone"
With this ID of your GitCloneTask you can refer to the actual local clone location with ${git.clone.location} from
anywhere in your .setup file.

> remoteURI="http://roskilde.lhs-systems.com:8000/GIT_main">
> <description>${scope.project.label}</description>
> </setupTask>
>
> how do i programmatically get the string from ${scope.project.label} into my perform method of my task.
Try context.get("scope.project.label").

>
> And another example is, i need the java path from the ${jre.location-1.7} variable.
> How can i get that ?
If it exists it's probably context.get("jre.location-1.7").

But please note that it seems generally better to not expect such variable in the SetupTaskContext. Instead add
respective attributes to your task and give them meaningful names. Then you can leave the wiring of values to the setup
authors.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Execution of Gradle task before import [message #1708333 is a reply to message #1707898] Tue, 15 September 2015 14:42 Go to previous messageGo to next message
Maksim Melnik is currently offline Maksim MelnikFriend
Messages: 52
Registered: August 2015
Member
Thank you Eike for your help,
so far everything works just perfect, however there is still a problem that my task is automatically included into startup task, so it is executed each time when i start my eclipse , instead of just once , after the installation... Is there a way to correct this?

My another issue is preferences sharing, is it possible to keep eclipse updated, when for example someone adds some preferences to the .setup file?

Cheers,
Maksim
Re: Execution of Gradle task before import [message #1708346 is a reply to message #1708333] Tue, 15 September 2015 17:30 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6691
Registered: July 2009
Senior Member
Am 15.09.2015 um 16:42 schrieb Maksim Melnik:
> Thank you Eike for your help,
> so far everything works just perfect, however there is still a problem that my task is automatically included into
> startup task, so it is executed each time when i start my eclipse , instead of just once , after the installation...
> Is there a way to correct this?
If you can't strictly control it via the constant value of the ValidTriggers annotation you need to implement your
SetupTask.isNeeded() method such that it returns false when nothing is to do. But please note that isNeeded() is
generally expected to return rather quickly. Two approaches to achieve that are:

1) Remember a flag somwhere under .metadata to remember the fact that a one-time task has successfully executed. See
ProjectSetImportTaskImpl.Helper.isNeeded() for an example with more fine-grained state that is remembered.

2) Leave more expensive computation to the MANUAL trigger and skip the STARTUP trigger completely. See
P2TaskImpl.isNeeded() for an example of a task that's only needed at startup if from the explicit top-level requirements
it's obvious that software is missing (i.e., it omits expensive remote queries for update searches).

3) Combinations of the two approaches 1 and 2.

> My another issue is preferences sharing, is it possible to keep eclipse updated, when for example someone adds some
> preferences to the .setup file?
To which setup file do you mean?

Project setup files can easily serve this purpose because you can link a workspace to multiple project setups. YOu could
use one such project for a team just to store/distribute some preference tasks.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:New Installer Use
Next Topic:Installing Eclipse Modeling with EGit Project Checkout Failed
Goto Forum:
  


Current Time: Thu Dec 05 17:30:00 GMT 2024

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

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

Back to the top