Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group=com.marklogic
publishUrl=file:../gh-pages-marklogic-java/releases
version=2.0
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.0
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.1
12 changes: 12 additions & 0 deletions src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.marklogic.appdeployer.command.forests.ConfigureForestReplicasCommand
import com.marklogic.appdeployer.command.groups.DeployGroupsCommand
import com.marklogic.appdeployer.command.mimetypes.DeployMimetypesCommand
import com.marklogic.appdeployer.command.modules.LoadModulesCommand
import com.marklogic.appdeployer.command.schemas.LoadSchemasCommand
import com.marklogic.appdeployer.command.restapis.DeployRestApiServersCommand
import com.marklogic.appdeployer.command.security.DeployAmpsCommand
import com.marklogic.appdeployer.command.security.DeployCertificateAuthoritiesCommand
Expand Down Expand Up @@ -72,6 +73,7 @@ import com.marklogic.gradle.task.forests.DeployForestReplicasTask
import com.marklogic.gradle.task.groups.DeployGroupsTask
import com.marklogic.gradle.task.mimetypes.DeployMimetypesTask
import com.marklogic.gradle.task.scaffold.GenerateScaffoldTask
import com.marklogic.gradle.task.schemas.LoadSchemasTask
import com.marklogic.gradle.task.security.DeployAmpsTask
import com.marklogic.gradle.task.security.DeployCertificateAuthoritiesTask
import com.marklogic.gradle.task.security.DeployCertificateTemplatesTask
Expand Down Expand Up @@ -181,6 +183,10 @@ class MarkLogicPlugin implements Plugin<Project> {
project.task("mlWatch", type: WatchTask, group: modulesGroup, description: "Run a loop that checks for new/modified modules every second and loads any that it finds")
project.task("mlDeleteModuleTimestampsFile", type: DeleteModuleTimestampsFileTask, group: modulesGroup, description: "Delete the properties file in the build directory that keeps track of when each module was last loaded")

String schemasGroup = "ml-gradle Schemas"
project.task("mlLoadSchemas", type: LoadSchemasTask, group: schemasGroup, description: "Loads special-purpose data into the schemas database (XSD schemas, Inference rules, and [MarkLogic 9] Extraction Templates)")
project.task("mlReloadSchemas", dependsOn: ["mlClearSchemasDatabase", "mlLoadSchemas"], group: schemasGroup, description: "Clears schemas database then loads special-purpose data into the schemas database (XSD schemas, Inference rules, and [MarkLogic 9] Extraction Templates)")

String serverGroup = "ml-gradle Server"
project.task("mlDeployServers", type: DeployServersTask, group: serverGroup, dependsOn: "mlPrepareRestApiDependencies", description: "Updates the REST API server (if it exists) and deploys each other server, updating it if it exists, in the configuration directory ")
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")
Expand Down Expand Up @@ -306,6 +312,12 @@ class MarkLogicPlugin implements Plugin<Project> {
project.extensions.add("mlDatabaseCommands", dbCommands)
commands.addAll(dbCommands)

// Schemas
List<Command> schemasCommands = new ArrayList<Command>()
schemasCommands.add(new LoadSchemasCommand())
project.extensions.add("mlLoadSchemasCommands", schemasCommands)
commands.addAll(schemasCommands)

// REST API instance creation
commands.add(new DeployRestApiServersCommand())

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.marklogic.gradle.task.schemas

import org.gradle.api.tasks.TaskAction

import com.marklogic.appdeployer.AppDeployer
import com.marklogic.appdeployer.command.schemas.LoadSchemasCommand
import com.marklogic.appdeployer.impl.SimpleAppDeployer
import com.marklogic.gradle.task.MarkLogicTask

class LoadSchemasTask extends MarkLogicTask {

@TaskAction
void loadSchemas() {
LoadSchemasCommand command = null
// Check for a LoadSchemasCommand in the AppDeployer first, as that may have additional configuration that we
// don't want to have to duplicate on this task
AppDeployer d = getAppDeployer()
if (d instanceof SimpleAppDeployer) {
command = d.getCommand(LoadSchemasCommand)
}
if (command == null) {
command = new LoadSchemasCommand()
}
command.execute(getCommandContext())
}
}