diff --git a/examples/sample-project/build.gradle b/examples/sample-project/build.gradle index be1b0a4d9..bcca584fe 100644 --- a/examples/sample-project/build.gradle +++ b/examples/sample-project/build.gradle @@ -8,7 +8,7 @@ buildscript { jcenter() } dependencies { - classpath "com.marklogic:ml-gradle:3.6.0" + classpath "com.marklogic:ml-gradle:3.6.2" } } diff --git a/gradle.properties b/gradle.properties index 288fadede..06bf09fa0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.marklogic -version=3.6.1 -mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.1 +version=3.6.2 +mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.2 mlcpUtilDependency=com.marklogic:mlcp-util:0.9.0 mlDataMovementDependency=com.marklogic:marklogic-data-movement-components:1.0 diff --git a/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy b/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy index 14da318ff..f8811e285 100644 --- a/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy +++ b/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy @@ -30,6 +30,7 @@ import com.marklogic.gradle.task.groups.DeployGroupsTask import com.marklogic.gradle.task.groups.SetTraceEventsTask import com.marklogic.gradle.task.hosts.AssignHostsToGroupsTask import com.marklogic.gradle.task.mimetypes.DeployMimetypesTask +import com.marklogic.gradle.task.mimetypes.UndeployMimetypesTask import com.marklogic.gradle.task.qconsole.ExportWorkspacesTask import com.marklogic.gradle.task.qconsole.ImportWorkspacesTask import com.marklogic.gradle.task.roxy.RoxyMigrateBuildStepsTask @@ -193,6 +194,7 @@ class MarkLogicPlugin implements Plugin { String mimetypesGroup = "ml-gradle Mimetypes" project.task("mlDeployMimetypes", type: DeployMimetypesTask, group: mimetypesGroup, description: "Deploy each mimetype, updating it if it exists, in the configuration directory") + project.task("mlUndeployMimetypes", type: UndeployMimetypesTask, group: mimetypesGroup, description: "Undeploy each mimetype defined in the configuration directory") String modulesGroup = "ml-gradle Modules" project.task("mlLoadModules", type: LoadModulesTask, group: modulesGroup, dependsOn: "mlPrepareRestApiDependencies", description: "Loads modules from directories defined by mlAppConfig or via a property on this task").mustRunAfter(["mlClearModulesDatabase"]) diff --git a/src/main/groovy/com/marklogic/gradle/task/DeleteModuleTimestampsFileTask.groovy b/src/main/groovy/com/marklogic/gradle/task/DeleteModuleTimestampsFileTask.groovy index 00f2cdaca..c98f8b764 100644 --- a/src/main/groovy/com/marklogic/gradle/task/DeleteModuleTimestampsFileTask.groovy +++ b/src/main/groovy/com/marklogic/gradle/task/DeleteModuleTimestampsFileTask.groovy @@ -1,19 +1,18 @@ package com.marklogic.gradle.task -import com.marklogic.client.ext.modulesloader.impl.PropertiesModuleManager -import org.gradle.api.DefaultTask import org.gradle.api.tasks.TaskAction -class DeleteModuleTimestampsFileTask extends DefaultTask { - - String filePath = PropertiesModuleManager.DEFAULT_FILE_PATH +class DeleteModuleTimestampsFileTask extends MarkLogicTask { @TaskAction void deleteFile() { + String filePath = getAppConfig().getModuleTimestampsPath() File f = new File(filePath) if (f.exists()) { println "Deleting " + f.getAbsolutePath() + "\n" f.delete() + } else { + println "Module timestamps file " + filePath + " does not exist, so not deleting" } } } diff --git a/src/main/groovy/com/marklogic/gradle/task/cluster/RestartClusterTask.groovy b/src/main/groovy/com/marklogic/gradle/task/cluster/RestartClusterTask.groovy index c46f6dffd..c37c8b04c 100644 --- a/src/main/groovy/com/marklogic/gradle/task/cluster/RestartClusterTask.groovy +++ b/src/main/groovy/com/marklogic/gradle/task/cluster/RestartClusterTask.groovy @@ -2,7 +2,7 @@ package com.marklogic.gradle.task.cluster import com.marklogic.gradle.task.MarkLogicTask import com.marklogic.mgmt.ManageClient -import com.marklogic.mgmt.admin.ActionRequiringRestart +import com.marklogic.mgmt.resource.clusters.ClusterManager import org.gradle.api.tasks.TaskAction class RestartClusterTask extends MarkLogicTask { @@ -10,11 +10,7 @@ class RestartClusterTask extends MarkLogicTask { @TaskAction void restartCluster() { final ManageClient client = getManageClient(); - getAdminManager().invokeActionRequiringRestart(new ActionRequiringRestart() { - public boolean execute() { - client.postForm("/manage/v2", "state", "restart") - return true; - } - }); + println "Restarting local cluster" + new ClusterManager(client).restartLocalCluster(getAdminManager()) } } diff --git a/src/main/groovy/com/marklogic/gradle/task/mimetypes/UndeployMimetypesTask.groovy b/src/main/groovy/com/marklogic/gradle/task/mimetypes/UndeployMimetypesTask.groovy new file mode 100644 index 000000000..d5afa0778 --- /dev/null +++ b/src/main/groovy/com/marklogic/gradle/task/mimetypes/UndeployMimetypesTask.groovy @@ -0,0 +1,12 @@ +package com.marklogic.gradle.task.mimetypes + +import com.marklogic.gradle.task.MarkLogicTask +import org.gradle.api.tasks.TaskAction + +class UndeployMimetypesTask extends MarkLogicTask { + + @TaskAction + void undeployMimetypes() { + undeployWithCommandListProperty("mlMimetypeCommands") + } +}