Skip to content

Commit ef323ae

Browse files
committed
Merge pull request #188 from paxtonhare/184_simple_gradle
fixed #184
2 parents 4732df8 + 84cbfe0 commit ef323ae

File tree

12 files changed

+194
-0
lines changed

12 files changed

+194
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
maven {url 'http://developer.marklogic.com/maven2/'}
5+
}
6+
}
7+
8+
plugins {
9+
id 'java'
10+
id 'eclipse'
11+
id 'idea'
12+
id 'net.saliman.properties' version '1.4.5'
13+
id 'com.marklogic.ml-data-hub-plugin' version '1.0.0-beta.1'
14+
id 'com.marklogic.ml-gradle' version '2.1.0'
15+
}
16+
17+
repositories {
18+
jcenter()
19+
maven {url 'http://developer.marklogic.com/maven2/'}
20+
}
21+
22+
dependencies {
23+
compile 'com.marklogic:marklogic-data-hub:+'
24+
compile 'com.marklogic:marklogic-xcc:8.0.5'
25+
}
26+
27+
ext {
28+
// mlAppConfig is an instance of com.marklogic.appdeployer.AppConfig
29+
mlAppConfig {
30+
// override some default values with our values
31+
modulesDatabaseName = mlModulesDbName
32+
triggersDatabaseName = mlTriggersDbName
33+
schemasDatabaseName = mlSchemasDbName
34+
restPort = Integer.parseInt(mlStagingAppserverPort)
35+
36+
// Configure custom tokens for our json files
37+
customTokens.put("%%STAGING_SERVER_NAME%%", mlStagingAppserverName)
38+
customTokens.put("%%STAGING_SERVER_PORT%%", mlStagingAppserverPort)
39+
customTokens.put("%%STAGING_DB_NAME%%", mlStagingDbName)
40+
41+
customTokens.put("%%FINAL_SERVER_NAME%%", mlFinalAppserverName)
42+
customTokens.put("%%FINAL_SERVER_PORT%%", mlFinalAppserverPort)
43+
customTokens.put("%%FINAL_DB_NAME%%", mlFinalDbName)
44+
45+
customTokens.put("%%MODULES_DB_NAME%%", mlModulesDbName)
46+
}
47+
}
48+
49+
ext {
50+
// don't create the REST Api. We will do it manually
51+
mlAppDeployer.commands.remove(mlAppDeployer.getCommand("DeployRestApiServersCommand"))
52+
mlAppDeployer.commands.remove(mlAppDeployer.getCommand("UpdateRestApiServersCommand"))
53+
54+
// remove the original deploy content database command
55+
// as we do not need it.
56+
def deployDbCmd = mlAppDeployer.getCommand("DeployContentDatabasesCommand")
57+
mlAppDeployer.commands.remove(deployDbCmd)
58+
59+
// install the staging database
60+
def stagingDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("staging-db.json")
61+
mlAppDeployer.commands.add(stagingDbCommand)
62+
mlDatabaseCommands.add(0, stagingDbCommand)
63+
64+
// install the final database
65+
def finalDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("final-db.json")
66+
mlAppDeployer.commands.add(finalDbCommand)
67+
mlDatabaseCommands.add(1, finalDbCommand)
68+
69+
// install the modules database
70+
def modulesDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("modules-db.json")
71+
mlAppDeployer.commands.add(modulesDbCommand)
72+
mlDatabaseCommands.add(2, modulesDbCommand)
73+
74+
// temp workaround for ml-gradle issue #78
75+
// https://github.com/rjrudin/ml-gradle/issues/78
76+
def lmc = mlAppDeployer.getCommand("LoadModulesCommand")
77+
lmc.setModulesLoader(new com.marklogic.client.modulesloader.impl.DefaultModulesLoader(mlAppConfig.newXccAssetLoader()))
78+
}
79+
80+
// This task will deploy the Data Hub Modules into MarkLogic
81+
task deployHubModules(type: com.marklogic.gradle.task.MarkLogicTask) {
82+
description = "Call this task to deploy the MarkLogic Data Hub Modules"
83+
doLast {
84+
def cmd = new com.marklogic.hub.commands.LoadModulesCommand()
85+
cmd.execute(getCommandContext())
86+
}
87+
}
88+
89+
// Set up a dependency on deployHubModules. This forces the hub
90+
// modules to be deployed whenever you deploy your custom modules.
91+
// This is necessary for the Hub to function properly.
92+
mlLoadModules.dependsOn deployHubModules
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
mlHost=localhost
2+
mlAppName=gradle-advanced-example
3+
4+
mlStagingAppserverName=data-hub-STAGING
5+
mlStagingAppserverPort=8100
6+
mlStagingDbName=data-hub-STAGING
7+
8+
mlFinalAppserverName=data-hub-FINAL
9+
mlFinalAppserverPort=8101
10+
mlFinalDbName=data-hub-FINAL
11+
12+
mlModulesDbName=data-hub-MODULES
13+
mlTriggersDbName=data-hub-TRIGGERS
14+
mlSchemasDbName=data-hub-SCHEMAS
15+
16+
hubModulesPath=src/main/ml-modules/root
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"database-name": "%%FINAL_DB_NAME%%",
3+
"range-element-index": [],
4+
"schema-database": "%%SCHEMAS_DATABASE%%",
5+
"triggers-database": "%%TRIGGERS_DATABASE%%",
6+
"triple-index": true,
7+
"collection-lexicon": true,
8+
"uri-lexicon": true
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"database-name": "%%MODULES_DB_NAME%%",
3+
"collection-lexicon": true,
4+
"uri-lexicon": true
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"database-name": "%%SCHEMAS_DATABASE%%"
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"database-name": "%%STAGING_DB_NAME%%",
3+
"range-element-index": [],
4+
"schema-database": "%%SCHEMAS_DATABASE%%",
5+
"triggers-database": "%%TRIGGERS_DATABASE%%",
6+
"triple-index": true,
7+
"collection-lexicon": true,
8+
"uri-lexicon": true
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"database-name": "%%TRIGGERS_DATABASE%%"
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"server-name": "%%FINAL_SERVER_NAME%%",
3+
"server-type": "http",
4+
"root": "/",
5+
"group-name": "%%GROUP%%",
6+
"port": %%FINAL_SERVER_PORT%%,
7+
"modules-database": "%%MODULES_DB_NAME%%",
8+
"content-database": "%%FINAL_DB_NAME%%",
9+
"authentication": "digest",
10+
"default-error-format": "json",
11+
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
12+
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
13+
"rewrite-resolves-globally": true
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"server-name": "%%STAGING_SERVER_NAME%%",
3+
"server-type": "http",
4+
"root": "/",
5+
"group-name": "%%GROUP%%",
6+
"port": %%STAGING_SERVER_PORT%%,
7+
"modules-database": "%%MODULES_DB_NAME%%",
8+
"content-database": "%%STAGING_DB_NAME%%",
9+
"authentication": "digest",
10+
"default-error-format": "json",
11+
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
12+
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
13+
"rewrite-resolves-globally": true
14+
}

examples/gradle-advanced/src/main/ml-modules/root/entities/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)