Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactor to gradle 0.9

  • Loading branch information...
commit d14af91664e90cf25d95b881b1f023c25f7f31fd 1 parent db05727
Rene Groeschke authored
View
82 ...reskeby.eclipse.gradle/src/main/java/com/breskeby/eclipse/gradle/GradleExecScheduler.java
@@ -16,6 +16,9 @@
import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
import org.gradle.foundation.ProjectView;
import org.gradle.gradleplugin.foundation.GradlePluginLord;
+import org.gradle.gradleplugin.foundation.request.ExecutionRequest;
+import org.gradle.gradleplugin.foundation.request.RefreshTaskListRequest;
+import org.gradle.gradleplugin.foundation.request.Request;
import com.breskeby.eclipse.gradle.jobs.GradleBuildExecutionInteraction;
import com.breskeby.eclipse.gradle.jobs.GradleProcessExecListener;
@@ -40,29 +43,38 @@ public static GradleExecScheduler getInstance() {
private GradleExecScheduler(){
}
- private IStatus runGradleProcess(final String absolutePath, IProgressMonitor monitor){
+ private IStatus runGradleTaskRefreshProcess(final String absolutePath, IProgressMonitor monitor){
final GradlePluginLord gradlePluginLord = new GradlePluginLord();
gradlePluginLord.setGradleHomeDirectory(new File(GradlePlugin.getPlugin().getDefaultGradleHome()));
final File absoluteDirectory = new File(absolutePath).getParentFile();
gradlePluginLord.setCurrentDirectory(absoluteDirectory);
- GradleProcessExecListener executionlistener = new GradleRefreshRequestExecutionInteraction(monitor);
+ final GradleProcessExecListener executionlistener = new GradleRefreshRequestExecutionInteraction(monitor);
-// gradlePluginLord.addGeneralPluginObserver(new GeneralPluginObserver() {
-//
-// public void startingProjectsAndTasksReload() {
-//// GeneralPluginObserver.this.
-// }
-//
-// public void projectsAndTasksReloaded(boolean arg0) {
-//
-// }
-// }, true);
gradlePluginLord.startExecutionQueue();
- gradlePluginLord.addRefreshRequestToQueue(executionlistener);
+ final BooleanHolder isComplete = new BooleanHolder();
+
+ GradlePluginLord.RequestObserver observer = new GradlePluginLord.RequestObserver() {
+
+ public void executionRequestAdded( ExecutionRequest request )
+ {
+ request.setExecutionInteraction( executionlistener );
+ }
+ public void refreshRequestAdded( RefreshTaskListRequest request ) {
+ }
+ public void aboutToExecuteRequest( Request request ) {
+ }
+
+ public void requestExecutionComplete( Request request, int result, String output ) {
+ isComplete.value = true;
+ }
+ };
+
+ gradlePluginLord.addRequestObserver(observer, false);
+ gradlePluginLord.addRefreshRequestToQueue();
//keep job open til listener reports gradle has finished
- while(!executionlistener.isFinished()){
+ while(!isComplete.value){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
@@ -83,14 +95,14 @@ public void refreshTaskView(final String absolutePath, boolean synched) {
if(!synched){
Job job = new Job("Calculating Gradle Tasks...") {
protected IStatus run(IProgressMonitor monitor) {
- return runGradleProcess(absolutePath, monitor);
+ return runGradleTaskRefreshProcess(absolutePath, monitor);
}
};
job.setUser(false);
job.setPriority(Job.LONG);
job.schedule(); // start as soon as possible
}else{
- runGradleProcess(absolutePath, null);
+ runGradleTaskRefreshProcess(absolutePath, null);
}
}
@@ -107,7 +119,7 @@ protected IStatus run(IProgressMonitor monitor) {
return buildFileInformationCache.get(absolutePath);
}
- public void startGradleBuildRun(ILaunchConfiguration configuration, final String commandLine, final GradleProcess gradleProcess) throws CoreException{
+ public void startGradleBuildRun(final ILaunchConfiguration configuration, final String commandLine, final GradleProcess gradleProcess) throws CoreException{
final GradlePluginLord gradlePluginLord = new GradlePluginLord();
//TODO handle debug
@@ -125,12 +137,38 @@ public void startGradleBuildRun(ILaunchConfiguration configuration, final String
Job job = new Job("Running Gradle Build...") {
protected IStatus run(IProgressMonitor monitor) {
- GradleProcessExecListener executionlistener = new GradleBuildExecutionInteraction(monitor, gradleProcess);
+ final GradleProcessExecListener executionlistener = new GradleBuildExecutionInteraction(monitor, gradleProcess);
gradlePluginLord.startExecutionQueue();
- gradlePluginLord.addExecutionRequestToQueue(commandLine, executionlistener);
+ final BooleanHolder isComplete = new BooleanHolder();
+ ///
+ GradlePluginLord.RequestObserver observer = new GradlePluginLord.RequestObserver() {
+ public void executionRequestAdded( ExecutionRequest request )
+ {
+ request.setExecutionInteraction( executionlistener );
+ }
+ public void refreshRequestAdded( RefreshTaskListRequest request ) {
+
+ }
+ public void aboutToExecuteRequest( Request request ) {
+
+ }
+
+ public void requestExecutionComplete( Request request, int result, String output ) {
+ isComplete.value = true;
+ }
+ };
+
+ ///########
+ //add the observer before we add the request due to timing issues.
+ //It's possible for it to completely execute before we return from addExecutionRequestToQueue.
+
+ gradlePluginLord.addRequestObserver( observer, false );
+ Request request = gradlePluginLord.addExecutionRequestToQueue( commandLine, configuration.getName() );
+
+ //gradlePluginLord.addExecutionRequestToQueue(commandLine, executionlistener);
//keep job open til listener reports gradle has finished
- while(!executionlistener.isFinished()){
+ while(!isComplete.value){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
@@ -148,4 +186,8 @@ protected IStatus run(IProgressMonitor monitor) {
job.setPriority(Job.LONG);
job.schedule(); // start as soon as possible
}
+
+ private class BooleanHolder {
+ private boolean value = false;
+ }
}
View
6 ...radle/src/main/java/com/breskeby/eclipse/gradle/jobs/GradleBuildExecutionInteraction.java
@@ -63,4 +63,10 @@ public void reportTaskComplete(String arg0, float arg1) {
public void reportTaskStarted(String arg0, float arg1) {
subTask("Running Task :" + arg0);
}
+
+
+ public void reportNumberOfTasksToExecute(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
};
View
1  ...ipse.gradle/src/main/java/com/breskeby/eclipse/gradle/jobs/GradleProcessExecListener.java
@@ -9,6 +9,7 @@
private IProgressMonitor monitor;
protected boolean finished = false;
protected Throwable throwable = null;
+
public boolean isFinished() {
return finished;
}
View
5 .../main/java/com/breskeby/eclipse/gradle/jobs/GradleRefreshRequestExecutionInteraction.java
@@ -22,4 +22,9 @@ public void reportTaskComplete(String arg0, float arg1) {
public void reportTaskStarted(String arg0, float arg1) {
}
+
+ public void reportNumberOfTasksToExecute(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
}
View
1  .../src/main/java/com/breskeby/eclipse/gradle/launchConfigurations/GradleLaunchDelegate.java
@@ -50,7 +50,6 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
//get Argument String
StringBuffer cmdLine = new StringBuffer(configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""));
cmdLine.append(" ").append(configuration.getAttribute(IGradleConstants.GRADLE_TASKS_ATTRIBUTES, ""));
- System.out.println("MODE " + mode);
//add debug flag if mode is DEBUG
if(mode.equals("debug")){
cmdLine.append(" ").append("-d");
View
10 ....gradle/src/main/java/com/breskeby/eclipse/gradle/model/GradleTaskModelLabelProvider.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package com.breskeby.eclipse.gradle.model;
import org.eclipse.jface.viewers.IColorProvider;
View
2  com.breskeby.eclipse.gradle/withGradlePlugin.launch
@@ -20,7 +20,7 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="restart" value="false"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.ecf.identity@default:default,org.eclipse.text@default:default,org.eclipse.equinox.common@2:true,org.eclipse.jdt.junit@default:default,org.eclipse.core.net@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.ui.console@default:default,org.apache.commons.collections@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.compare.core@default:default,org.eclipse.osgi.services@default:default,org.eclipse.core.jobs@default:default,org.apache.lucene@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.debug.ui@default:default,org.eclipse.jdt@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.debug.core@default:default,org.junit@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.core.resources.compatibility@default:false,org.eclipse.jdt.core@default:default,com.ibm.icu@default:default,org.eclipse.equinox.security.macosx@default:false,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.ui.ide@default:default,org.codehaus.groovy.eclipse.core@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.ui.editors@default:default,org.mortbay.jetty.server@default:default,org.codehaus.groovy.eclipse.refactoring@default:default,org.eclipse.persistence.jpa.equinox.weaving@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.platform@default:default,org.apache.commons.logging@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.compare@default:default,org.codehaus.groovy.eclipse.ui@default:default,org.apache.lucene.analysis@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.swt@default:default,org.eclipse.ui@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.team.core@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.variables@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.ecf.filetransfer@default:default,org.eclipse.help.base@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.app@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.apache.jasper@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.equinox.frameworkadmin@default:default,javax.servlet.jsp@default:default,org.eclipse.core.filebuffers@default:default,javax.servlet@default:default,org.eclipse.core.runtime@default:true,org.eclipse.update.ui@default:default,org.eclipse.equinox.concurrent@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.jdt.groovy.core@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.security@default:default,org.eclipse.core.databinding@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.team.ui@default:default,org.apache.ant@default:default,org.apache.commons.lang*2.3.0.v200803061910@default:default,org.mortbay.jetty.util@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.ant.ui@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.jface@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.p2.core@default:default,org.codehaus.groovy*1.7.0.xx-20091008-1900-e35@default:default,org.eclipse.jface.text@default:default,org.eclipse.help.ui@default:default,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ui.views@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.core.filesystem.macosx@default:false,org.apache.commons.el@default:default,org.eclipse.core.filesystem@default:default,javax.transaction@default:false,org.eclipse.update.core@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.osgi@-1:true,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.search@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.search@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.jdt.groovy.core@default:default,org.codehaus.groovy.eclipse.codeassist.completion@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui.editors@default:default,org.codehaus.groovy.eclipse.ant@default:default,org.codehaus.groovy.eclipse.ui@default:default,javax.servlet@default:default,org.eclipse.core.net@default:default,org.eclipse.swt@default:default,org.codehaus.groovy.eclipse.cstviewer@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.ant.core@default:default,org.eclipse.debug.core@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.equinox.app@default:default,org.eclipse.core.jobs@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.platform@default:default,org.eclipse.compare@default:default,org.apache.commons.lang*2.3.0.v200803061910@default:default,org.eclipse.ui.console@default:default,org.eclipse.debug.ui@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.update.ui@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.equinox.common@2:true,org.mortbay.jetty.util@default:default,org.mortbay.jetty.server@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.ecf.filetransfer@default:default,org.apache.ant@default:default,org.apache.lucene@default:default,org.codehaus.groovy*1.7.0.xx-20091223-2000-e35-RC1@default:default,org.codehaus.groovy.eclipse.codebrowsing@default:default,org.eclipse.update.core@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,javax.transaction@default:false,org.eclipse.core.expressions@default:default,org.eclipse.update.configurator@3:true,org.eclipse.ui.cheatsheets@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.compare.core@default:default,org.eclipse.help.ui@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.filebuffers@default:default,com.ibm.icu@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.ui.ide@default:default,org.codehaus.groovy.eclipse.refactoring@default:default,org.eclipse.osgi.services@default:default,org.junit@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.core.resources.compatibility@default:false,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.core.runtime@default:true,org.eclipse.ui@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.jdt.core@default:default,org.apache.jasper@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.variables@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.core.filesystem.macosx@default:false,org.codehaus.groovy.eclipse.core@default:default,org.eclipse.ui.views@default:default,org.eclipse.equinox.security.macosx@default:false,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.persistence.jpa.equinox.weaving@default:false,org.eclipse.help@default:default,org.eclipse.osgi@-1:true,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.browser@default:default,org.eclipse.help.base@default:default,org.eclipse.core.resources@default:default,org.eclipse.team.ui@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.jdt@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.text@default:default,org.eclipse.equinox.p2.metadata@default:default,org.apache.lucene.analysis@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.jdt.compiler.tool@default:false,javax.servlet.jsp@default:default,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.jface.text@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.equinox.registry@default:default,org.apache.commons.collections@default:default,org.eclipse.ant.ui@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.team.core@default:default,org.apache.commons.el@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.ui.intro@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.core.databinding.property@default:default,org.apache.commons.logging@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.forms@default:default,org.codehaus.groovy.eclipse@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.ecf@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.equinox.security@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.breskeby.eclipse.gradle@default:default,org.codehaus.gradle@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
View
2  gradle-update-site/site.xml
@@ -3,7 +3,7 @@
<description name="Gradle Eclipse Plugins" url="http://www.breskeby.com/downloads/gradle/eclipse/update">
Update Site for the Gradle Plugin
</description>
- <feature url="features/com.breskeby.eclipse.gradle.feature_0.1.0.200910192246.jar" id="com.breskeby.eclipse.gradle.feature" version="0.1.0.200910192246">
+ <feature url="features/com.breskeby.eclipse.gradle.feature_0.1.0.200911022142.jar" id="com.breskeby.eclipse.gradle.feature" version="0.1.0.200911022142">
<category name="Gradle Support"/>
</feature>
<feature url="features/org.codehaus.gradle.feature_0.8.0.jar" id="org.codehaus.gradle.feature" version="0.8.0">
Please sign in to comment.
Something went wrong with that request. Please try again.