Skip to content

Commit 46fab68

Browse files
committed
#592 All deploy/undeploy tasks now depend on mlPrepareBundles
1 parent 636fc67 commit 46fab68

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ class MarkLogicPlugin implements Plugin<Project> {
100100
project.getConfigurations().create("mlRestApi")
101101

102102
// No group or description on these so they don't show up in "gradle tasks"
103-
project.task("mlDeployApp", type: DeployAppTask, dependsOn: ["mlDeleteModuleTimestampsFile", "mlPrepareBundles"])
104-
project.task("mlUndeployApp", type: UndeployAppTask, dependsOn: ["mlPrepareBundles"])
103+
project.task("mlDeployApp", type: DeployAppTask, dependsOn: ["mlDeleteModuleTimestampsFile"])
104+
project.task("mlUndeployApp", type: UndeployAppTask)
105105

106106
String deployGroup = "ml-gradle Deploy"
107107
project.task("mlPostDeploy", group: deployGroup, description: "Add dependsOn to this task to add tasks at the end of mlDeploy").mustRunAfter(["mlDeployApp"])
@@ -151,7 +151,7 @@ class MarkLogicPlugin implements Plugin<Project> {
151151
"Note that this includes those created via the deployment of resources such as temporal collections and view schemas. You may want to use mlDeleteUserSchemas instead.")
152152
project.task("mlClearTriggersDatabase", type: ClearTriggersDatabaseTask, group: dbGroup, description: "Deletes all documents in the triggers database")
153153
project.task("mlDeleteDatabase", type: DeleteDatabaseTask, group: dbGroup, description: "Delete a database along with all of its forests and any replicas; requires -Pconfirm=true to be set so this isn't accidentally executed")
154-
project.task("mlDeployDatabases", type: DeployDatabasesTask, group: dbGroup, dependsOn: "mlPrepareBundles", description: "Deploy each database, updating it if it exists, in the configuration directory")
154+
project.task("mlDeployDatabases", type: DeployDatabasesTask, group: dbGroup, description: "Deploy each database, updating it if it exists, in the configuration directory")
155155
project.task("mlMergeContentDatabase", type: MergeContentDatabaseTask, group: dbGroup, description: "Merge the database named by mlAppConfig.contentDatabaseName")
156156
project.task("mlMergeDatabase", type: MergeDatabaseTask, group: dbGroup, description: "Merge the database named by the project property dbName; e.g. gradle mlMergeDatabase -PdbName=my-database")
157157
project.task("mlReindexContentDatabase", type: ReindexContentDatabaseTask, group: dbGroup, description: "Reindex the database named by mlAppConfig.contentDatabaseName")
@@ -262,7 +262,7 @@ class MarkLogicPlugin implements Plugin<Project> {
262262
project.task("mlReloadSchemas", dependsOn: ["mlDeleteUserSchemas", "mlLoadSchemas"], group: schemasGroup, description: "Deletes user schemas via mlDeleteUserSchemas and then loads schemas via mlLoadSchemas")
263263

264264
String serverGroup = "ml-gradle Server"
265-
project.task("mlDeployServers", type: DeployServersTask, group: serverGroup, dependsOn: "mlPrepareBundles", description: "Updates the REST API server (if it exists) and deploys each other server, updating it if it exists, in the configuration directory ")
265+
project.task("mlDeployServers", type: DeployServersTask, group: serverGroup, description: "Updates the REST API server (if it exists) and deploys each other server, updating it if it exists, in the configuration directory ")
266266
project.task("mlUndeployOtherServers", type: UndeployOtherServersTask, group: serverGroup, description: "Delete any non-REST API servers (e.g. ODBC and XBC servers) defined by server files in the configuration directory")
267267

268268
String securityGroup = "ml-gradle Security"
@@ -328,6 +328,14 @@ class MarkLogicPlugin implements Plugin<Project> {
328328
"Use -PrunCodeCoverage to enable code coverage support when running the tests. " +
329329
"Use -PrunTeardown and -PrunSuiteTeardown to control whether teardown and suite teardown scripts are run; these default to 'true' and can be set to 'false' instead. ")
330330

331+
// Any granular task that deploys/undeploys resources may need to do so for a resource in a bundle, so these
332+
// tasks must all depend on mlPrepareBundles
333+
project.tasks.each { task ->
334+
if (task.name.startsWith("mlDeploy") || task.name.startsWith("mlUndeploy")) {
335+
task.dependsOn("mlPrepareBundles")
336+
}
337+
}
338+
331339
logger.info("Finished initializing ml-gradle\n")
332340
}
333341

0 commit comments

Comments
 (0)