Bugfixes re task ordering
Soft ordering rules were upsetting Gradle (task graph getting complicated and cycles occur). Removed them. Most important rule is to run bintray upload after git push and we have it.
Added more logging to the exec method. Helpful when debugging.
@@ -6,7 +6,6 @@ import org.gradle.api.Task;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
import org.gradle.api.tasks.Exec;
import org.gradle.process.ExecResult;
import org.gradle.process.ExecSpec;
@@ -15,6 +14,7 @@ import org.mockito.release.gradle.BumpVersionFileTask;
import org.mockito.release.gradle.ContinuousDeliveryPlugin;
import org.mockito.release.internal.gradle.util.CommonSettings;
import org.mockito.release.internal.gradle.util.ExtContainer;
+import org.mockito.release.internal.gradle.util.StringUtil;
import org.mockito.release.version.VersionFile;
import java.io.ByteArrayOutputStream;
@@ -105,23 +105,15 @@ public class DefaultContinuousDeliveryPlugin implements ContinuousDeliveryPlugin
t.setErrorOutput(output);
}
});
-
- //Add soft ordering rule to make git push run as late as possible
- //it is an operation that is hard to roll back / recover
- t.shouldRunAfter(project.getTasks().matching(Specs.SATISFIES_ALL));
}
});
final Task bintrayUploadAll = CommonSettings.task(project, "bintrayUploadAll", new Action<Task>() {
public void execute(Task t) {
t.setDescription("Depends on all 'bintrayUpload' tasks from all Gradle projects.");
- //It is safer to run bintray upload after git push
+ //It is safer to run bintray upload after git push (hard to reverse operation)
//This way, when git push fails we don't publish jars to bintray
t.mustRunAfter("gitPush");
-
- //Add soft ordering rule to make bintray upload run as late as possible
- //it is an operation that is hard to roll back / recover
- t.shouldRunAfter(project.getTasks().matching(Specs.SATISFIES_ALL));
}
});
@@ -131,10 +123,6 @@ public class DefaultContinuousDeliveryPlugin implements ContinuousDeliveryPlugin
public void execute(BintrayPlugin bintrayPlugin) {
Task bintrayUpload = project.getTasks().getByName(BintrayPlugin.BINTRAY_UPLOAD_TASK);
bintrayUploadAll.dependsOn(bintrayUpload);
-
- //Add soft ordering rule to make git push run as late as possible
- //it is an operation that is hard to roll back / recover
- gitPush.shouldRunAfter(bintrayUpload);
}
});
}
@@ -373,6 +361,7 @@ public class DefaultContinuousDeliveryPlugin implements ContinuousDeliveryPlugin
}
private static ExecResult exec(Project project, final String... commandLine) {
+ LOG.lifecycle(" Running:\n " + StringUtil.join(asList(commandLine), " ") );
return project.exec(new Action<ExecSpec>() {
public void execute(ExecSpec e) {
e.commandLine(commandLine);
