Skip to content

Commit 2617084

Browse files
committed
Added mlDeleteResourceTimestampsFile
1 parent 70550e3 commit 2617084

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

examples/sample-project/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
jcenter()
99
}
1010
dependencies {
11-
classpath "com.marklogic:ml-gradle:3.8.0"
11+
classpath "com.marklogic:ml-gradle:3.10.0"
1212
}
1313
}
1414

src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ class MarkLogicPlugin implements Plugin<Project> {
9797
project.task("mlPostDeploy", group: deployGroup, description: "Add dependsOn to this task to add tasks at the end of mlDeploy").mustRunAfter(["mlDeployApp"])
9898
project.task("mlPostUndeploy", group: deployGroup, description: "Add dependsOn to this task to add tasks at the end of mlUndeploy").mustRunAfter(["mlUndeployApp"])
9999
project.task("mlDeploy", group: deployGroup, dependsOn: ["mlDeployApp", "mlPostDeploy"],
100-
description: "Deploys all application resources in the configuration directory and allows for additional steps via mlPostDeploy.dependsOn. Use -Pignore to specify a comma-delimited list of short class names of ml-app-deployer command classes to ignore while deploying.").mustRunAfter("mlClearModulesDatabase")
101-
project.task("mlUndeploy", group: deployGroup, dependsOn: ["mlUndeployApp", "mlPostUndeploy"], description: "Undeploys all application resources in the configuration directory and allows for additional steps via mlPostUndeploy.dependsOn; requires -Pconfirm=true to be set so this isn't accidentally executed")
102-
project.task("mlRedeploy", group: deployGroup, dependsOn: ["mlClearModulesDatabase", "mlDeploy"], description: "Clears the modules database and then deploys the application")
100+
description: "Deploys all application resources in the configuration directory and allows for additional steps via mlPostDeploy.dependsOn. Use -Pignore to specify a comma-delimited list of short class names of ml-app-deployer command classes to ignore while deploying.")
101+
.mustRunAfter("mlClearModulesDatabase", "mlDeleteResourceTimestampsFile")
102+
project.task("mlUndeploy", group: deployGroup, dependsOn: ["mlUndeployApp", "mlPostUndeploy", "mlDeleteResourceTimestampsFile"], description: "Undeploys all application resources in the configuration directory and allows for additional steps via mlPostUndeploy.dependsOn; requires -Pconfirm=true to be set so this isn't accidentally executed")
103+
project.task("mlRedeploy", group: deployGroup, dependsOn: ["mlClearModulesDatabase", "mlDeploy", "mlDeleteResourceTimestampsFile"], description: "Clears the modules database and then deploys the application")
104+
project.task("mlDeleteResourceTimestampsFile", type: DeleteResourceTimestampsFileTask, group: deployGroup, description: "Delete the properties file in the build directory (stored there by default) that keeps track of when each resource was last deployed; the file path can be overridden by setting the filePath property of this class")
103105

104106
String adminGroup = "ml-gradle Admin"
105107
project.task("mlInit", type: InitTask, group: adminGroup, description: "Perform a one-time initialization of a MarkLogic server; uses the properties 'mlLicenseKey' and 'mlLicensee'")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.marklogic.gradle.task
2+
3+
import com.marklogic.appdeployer.command.ResourceFileManagerImpl
4+
import org.gradle.api.tasks.TaskAction
5+
6+
class DeleteResourceTimestampsFileTask extends MarkLogicTask {
7+
8+
String filePath
9+
10+
@TaskAction
11+
void deleteResourceTimestampsFile() {
12+
if (filePath == null) {
13+
filePath = ResourceFileManagerImpl.DEFAULT_FILE_PATH
14+
}
15+
File f = new File(filePath)
16+
if (f.exists()) {
17+
println "Deleting " + f.getAbsolutePath() + "\n"
18+
f.delete()
19+
} else {
20+
println "Resource timestamps file " + filePath + " does not exist, so not deleting"
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)