Home » Eclipse Projects » Oomph » Execution of Gradle task before import
Execution of Gradle task before import [message #1706540] |
Thu, 27 August 2015 15:11 |
Maksim Melnik 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 |
Ed Merks 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 #1707289 is a reply to message #1707071] |
Thu, 03 September 2015 13:45 |
Maksim Melnik 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 |
Ed Merks 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 #1707776 is a reply to message #1707775] |
Wed, 09 September 2015 10:32 |
|
<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>
<setupTask
<br>
xsi:type="gradler:GradlerTask"/>
<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&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)
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| |
Re: Execution of Gradle task before import [message #1707799 is a reply to message #1707780] |
Wed, 09 September 2015 12:36 |
Maksim Melnik 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 |
|
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
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 |
Maksim Melnik 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 |
|
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
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| |
Re: Execution of Gradle task before import [message #1707898 is a reply to message #1707895] |
Thu, 10 September 2015 09:05 |
|
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
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| |
Re: Execution of Gradle task before import [message #1708346 is a reply to message #1708333] |
Tue, 15 September 2015 17:30 |
|
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
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Goto Forum:
Current Time: Thu Dec 05 17:30:00 GMT 2024
Powered by FUDForum. Page generated in 0.10876 seconds
|