diff --git a/modules/sdk/gradle-plugins-poshi-runner/.classpath b/modules/sdk/gradle-plugins-poshi-runner/.classpath
index c4a2614bff0992..ebb283b6542127 100644
--- a/modules/sdk/gradle-plugins-poshi-runner/.classpath
+++ b/modules/sdk/gradle-plugins-poshi-runner/.classpath
@@ -17,6 +17,7 @@
+
diff --git a/modules/sdk/gradle-plugins-poshi-runner/ivy.xml b/modules/sdk/gradle-plugins-poshi-runner/ivy.xml
index 8ed5be10deb7e3..cde235777e1f7f 100644
--- a/modules/sdk/gradle-plugins-poshi-runner/ivy.xml
+++ b/modules/sdk/gradle-plugins-poshi-runner/ivy.xml
@@ -17,6 +17,7 @@
+
diff --git a/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/PoshiRunnerPlugin.java b/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/PoshiRunnerPlugin.java
index 24ce99a5d4b561..77b6ccf4cfcbd3 100644
--- a/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/PoshiRunnerPlugin.java
+++ b/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/PoshiRunnerPlugin.java
@@ -14,8 +14,9 @@
package com.liferay.gradle.plugins.poshi.runner;
-import com.liferay.gradle.plugins.poshi.runner.util.GradleUtil;
import com.liferay.gradle.plugins.poshi.runner.util.OSDetector;
+import com.liferay.gradle.util.GradleUtil;
+import com.liferay.gradle.util.StringUtil;
import java.io.File;
@@ -32,6 +33,7 @@
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ResolvableDependencies;
import org.gradle.api.file.FileTree;
+import org.gradle.api.plugins.BasePlugin;
import org.gradle.api.reporting.DirectoryReport;
import org.gradle.api.tasks.Copy;
import org.gradle.api.tasks.JavaExec;
@@ -58,6 +60,8 @@ public class PoshiRunnerPlugin implements Plugin {
@Override
public void apply(Project project) {
+ GradleUtil.applyPlugin(project, BasePlugin.class);
+
final PoshiRunnerExtension poshiRunnerExtension =
GradleUtil.addExtension(
project, "poshiRunner", PoshiRunnerExtension.class);
@@ -124,8 +128,7 @@ protected void addPoshiRunnerDependenciesPoshiRunner(
GradleUtil.addDependency(
project, CONFIGURATION_NAME, "com.liferay",
- "com.liferay.poshi.runner", poshiRunnerExtension.getVersion(),
- null);
+ "com.liferay.poshi.runner", poshiRunnerExtension.getVersion());
}
protected void addPoshiRunnerDependenciesSikuli(
@@ -153,7 +156,8 @@ else if (OSDetector.isWindows()) {
GradleUtil.addDependency(
project, CONFIGURATION_NAME, "org.bytedeco.javacpp-presets",
- "opencv", poshiRunnerExtension.getOpenCVVersion(), classifier);
+ "opencv", poshiRunnerExtension.getOpenCVVersion(), classifier,
+ true);
}
protected void addTasksExpandPoshiRunner(Project project) {
@@ -167,7 +171,10 @@ protected void addTasksRunPoshi(Project project) {
Test test = GradleUtil.addTask(
project, RUN_POSHI_TASK_NAME, Test.class);
- test.dependsOn(EXPAND_POSHI_RUNNER_TASK_NAME);
+ test.dependsOn(
+ BasePlugin.CLEAN_TASK_NAME +
+ StringUtil.capitalize(RUN_POSHI_TASK_NAME),
+ EXPAND_POSHI_RUNNER_TASK_NAME);
test.include("com/liferay/poshi/runner/PoshiRunner.class");
diff --git a/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/util/GradleUtil.java b/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/util/GradleUtil.java
deleted file mode 100644
index 895e7cce889d47..00000000000000
--- a/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/util/GradleUtil.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- */
-
-package com.liferay.gradle.plugins.poshi.runner.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.gradle.api.Project;
-import org.gradle.api.Task;
-import org.gradle.api.artifacts.Configuration;
-import org.gradle.api.artifacts.ConfigurationContainer;
-import org.gradle.api.artifacts.Dependency;
-import org.gradle.api.artifacts.dsl.DependencyHandler;
-import org.gradle.api.plugins.ExtensionContainer;
-import org.gradle.api.tasks.TaskContainer;
-
-/**
- * @author Andrea Di Giorgi
- */
-public class GradleUtil {
-
- public static Configuration addConfiguration(Project project, String name) {
- ConfigurationContainer configurationContainer =
- project.getConfigurations();
-
- return configurationContainer.create(name);
- }
-
- public static Dependency addDependency(
- Project project, String configurationName, String group, String name,
- String version, String classifier) {
-
- DependencyHandler dependencyHandler = project.getDependencies();
-
- Map dependencyNotation = new HashMap<>();
-
- dependencyNotation.put("group", group);
- dependencyNotation.put("name", name);
- dependencyNotation.put("version", version);
-
- if (Validator.isNotNull(classifier)) {
- dependencyNotation.put("classifier", classifier);
- }
-
- return dependencyHandler.add(configurationName, dependencyNotation);
- }
-
- public static T addExtension(
- Project project, String name, Class clazz) {
-
- ExtensionContainer extensionContainer = project.getExtensions();
-
- return extensionContainer.create(name, clazz, project);
- }
-
- public static T addTask(
- Project project, String name, Class clazz) {
-
- TaskContainer taskContainer = project.getTasks();
-
- return taskContainer.create(name, clazz);
- }
-
- public static Configuration getConfiguration(Project project, String name) {
- ConfigurationContainer configurationContainer =
- project.getConfigurations();
-
- return configurationContainer.getByName(name);
- }
-
- public static Task getTask(Project project, String name) {
- TaskContainer taskContainer = project.getTasks();
-
- return taskContainer.getByName(name);
- }
-
-}
\ No newline at end of file
diff --git a/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/util/Validator.java b/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/util/Validator.java
deleted file mode 100644
index ceaed4576f1b4b..00000000000000
--- a/modules/sdk/gradle-plugins-poshi-runner/src/com/liferay/gradle/plugins/poshi/runner/util/Validator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- */
-
-package com.liferay.gradle.plugins.poshi.runner.util;
-
-/**
- * @author Brian Wing Shun Chan
- * @author Andrea Di Giorgi
- */
-public class Validator {
-
- public static boolean isNotNull(String s) {
- return !isNull(s);
- }
-
- public static boolean isNull(String s) {
- if (s == null) {
- return true;
- }
-
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
-
- if (!Character.isWhitespace(c)) {
- return false;
- }
- }
-
- return true;
- }
-
-}
\ No newline at end of file
diff --git a/modules/sdk/gradle-util/src/com/liferay/gradle/util/GradleUtil.java b/modules/sdk/gradle-util/src/com/liferay/gradle/util/GradleUtil.java
index 7cbd5e5e4c1b09..005f1c8ca5782c 100644
--- a/modules/sdk/gradle-util/src/com/liferay/gradle/util/GradleUtil.java
+++ b/modules/sdk/gradle-util/src/com/liferay/gradle/util/GradleUtil.java
@@ -90,8 +90,20 @@ public static Dependency addDependency(
Project project, String configurationName, String group, String name,
String version, boolean transitive) {
+ return addDependency(
+ project, configurationName, group, name, version, null, transitive);
+ }
+
+ public static Dependency addDependency(
+ Project project, String configurationName, String group, String name,
+ String version, String classifier, boolean transitive) {
+
Map dependencyNotation = new HashMap<>();
+ if (Validator.isNotNull(classifier)) {
+ dependencyNotation.put("classifier", classifier);
+ }
+
dependencyNotation.put("group", group);
dependencyNotation.put("name", name);
dependencyNotation.put("transitive", transitive);