Skip to content

Commit

Permalink
Merging in 2.2.0 work
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed May 6, 2016
1 parent b544435 commit afbc93f
Show file tree
Hide file tree
Showing 15 changed files with 296 additions and 137 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ trim_trailing_whitespace = false

[*.java]
indent_size = 4

[*.groovy]
indent_size = 4
187 changes: 91 additions & 96 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,96 +1,91 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.2"
}
}

plugins {
id "groovy"
id "maven-publish"
id "eclipse"
id "idea"
id "com.jfrog.bintray" version "1.5"
}

apply plugin: "com.gradle.plugin-publish"

sourceCompatibility = "1.7"
targetCompatibility = "1.7"

repositories {
jcenter()
mavenLocal() // Used for local development only
}

dependencies {
compile gradleApi()
compile localGroovy()
compile mlAppDeployerDependency
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allJava
from sourceSets.main.allGroovy
}

publishing {
publications {
mainJava(MavenPublication) {
from components.java
}
sourcesJava(MavenPublication) {
from components.java
artifact sourcesJar
}
}
repositories {
maven {
url publishUrl
}
}
}

if (project.hasProperty("myBintrayUser")) {
bintray {
user = myBintrayUser
key = myBintrayKey
publications = ['mainJava', 'sourcesJava']
pkg {
repo = 'maven'
name = project.name
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/rjrudin/' + project.name + '.git'
version {
name = "2.1.0"
released = new Date()
}
}
}
}

pluginBundle {
website = 'http://www.gradle.org/'
vcsUrl = 'https://github.com/rjrudin/' + project.name + '.git'
description = 'Testing ml-gradle publishing'
tags = ['marklogic']

plugins {
mlgradlePlugin {
id = 'com.marklogic.ml-gradle'
displayName = 'ml-gradle for MarkLogic'
description = 'Gradle plugin for configuring and deploying applications to MarkLogic'
tags = ['marklogic']
version = "2.1.0"
}
}

mavenCoordinates {
version = "2.1.0"
}
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.2"
}
}

plugins {
id "groovy"
id "maven-publish"
id "eclipse"
id "idea"
id "com.jfrog.bintray" version "1.5"
}

apply plugin: "com.gradle.plugin-publish"

sourceCompatibility = "1.7"
targetCompatibility = "1.7"

repositories {
jcenter()
mavenLocal() // Used for local development only
}

dependencies {
compile gradleApi()
compile localGroovy()
compile mlAppDeployerDependency
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allJava
from sourceSets.main.allGroovy
}

publishing {
publications {
mainJava(MavenPublication) {
from components.java
}
sourcesJava(MavenPublication) {
from components.java
artifact sourcesJar
}
}
}

if (project.hasProperty("myBintrayUser")) {
bintray {
user = myBintrayUser
key = myBintrayKey
publications = ['mainJava', 'sourcesJava']
pkg {
repo = 'maven'
name = project.name
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/rjrudin/' + project.name + '.git'
version {
name = "2.2.0-RC1"
released = new Date()
}
}
}
}

pluginBundle {
website = 'http://www.gradle.org/'
vcsUrl = 'https://github.com/rjrudin/' + project.name + '.git'
description = 'Testing ml-gradle publishing'
tags = ['marklogic']

plugins {
mlgradlePlugin {
id = 'com.marklogic.ml-gradle'
displayName = 'ml-gradle for MarkLogic'
description = 'Gradle plugin for configuring and deploying applications to MarkLogic'
tags = ['marklogic']
version = "2.2.0-RC1"
}
}

mavenCoordinates {
version = "2.2.0-RC1"
}
}
8 changes: 7 additions & 1 deletion examples/local-testing-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ buildscript {
jcenter()
mavenLocal()
}
dependencies {
dependencies {
classpath "com.marklogic:ml-gradle:${mlGradleVersion}"
}
}

apply plugin: "com.marklogic.ml-gradle"

ext {
mlAppConfig {
customTokens.put("CUSTOM_TOKEN", "testing")
}
}
2 changes: 1 addition & 1 deletion examples/local-testing-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Set this to the version you used when running
# Set this to the version you used when running
# "gradle -Pversion=(something) publishToMavenLocal" on your local ml-gradle repo
mlGradleVersion=DEV

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
xquery version "1.0-ml";

module namespace sample = "urn:sampleapp";

declare function echo($str as xs:string?) as xs:string
{
"You said: " || $str
};
5 changes: 3 additions & 2 deletions examples/sample-project/src/main/ml-modules/services/echo.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ xquery version "1.0-ml";

module namespace service = "http://marklogic.com/rest-api/resource/echo";

import module namespace sample = "urn:sampleapp" at "/ext/sample-project/lib/sample-lib.xqy";

declare function get(
$context as map:map,
$params as map:map
) as document-node()*
{
document {
text {
"You said:",
map:get($params, "text")
sample:echo(map:get($params, "text"))
}
}
};
31 changes: 21 additions & 10 deletions src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ import com.marklogic.gradle.task.databases.ClearModulesDatabaseTask
import com.marklogic.gradle.task.databases.ClearSchemasDatabaseTask
import com.marklogic.gradle.task.databases.ClearTriggersDatabaseTask
import com.marklogic.gradle.task.databases.DeployDatabasesTask
import com.marklogic.gradle.task.databases.MergeContentDatabaseTask
import com.marklogic.gradle.task.databases.MergeDatabaseTask
import com.marklogic.gradle.task.databases.ReindexContentDatabaseTask
import com.marklogic.gradle.task.databases.ReindexDatabaseTask
import com.marklogic.gradle.task.databases.SetContentUpdatesAllowedTask
import com.marklogic.gradle.task.flexrep.DeleteAllFlexrepConfigsTask
import com.marklogic.gradle.task.flexrep.DeployFlexrepAtPathTask
Expand Down Expand Up @@ -156,8 +160,12 @@ class MarkLogicPlugin implements Plugin<Project> {
project.task("mlClearSchemasDatabase", type: ClearSchemasDatabaseTask, group: dbGroup, description: "Deletes all documents in the schemas database")
project.task("mlClearTriggersDatabase", type: ClearTriggersDatabaseTask, group: dbGroup, description: "Deletes all documents in the triggers database")
project.task("mlDeployDatabases", type: DeployDatabasesTask, group: dbGroup, dependsOn: "mlPrepareRestApiDependencies", description: "Deploy each database, updating it if it exists, in the configuration directory")
project.task("mlMergeContentDatabase", type: MergeContentDatabaseTask, group: dbGroup, description: "Merge the database named by mlAppConfig.contentDatabaseName")
project.task("mlMergeDatabase", type: MergeDatabaseTask, group: dbGroup, description: "Merge the database named by the project property dbName; e.g. gradle mlMergeDatabase -PdbName=my-database")
project.task("mlReindexContentDatabase", type: ReindexContentDatabaseTask, group: dbGroup, description: "Reindex the database named by mlAppConfig.contentDatabaseName")
project.task("mlReindexDatabase", type: ReindexDatabaseTask, group: dbGroup, description: "Reindex the database named by the project property dbName; e.g. gradle mlReindexDatabase -PdbName=my-database")
project.task("mlSetContentUpdatesAllowed", type: SetContentUpdatesAllowedTask, group: dbGroup, description: "Sets updated-allowed on each primary forest for the content database; must set the mode via e.g. -Pmode=flash-backup")

String devGroup = "ml-gradle Development"
project.task("mlScaffold", type: GenerateScaffoldTask, group: devGroup, description: "Generate project scaffold for a new project")
project.task("mlCreateResource", type: CreateResourceTask, group: devGroup, description: "Create a new resource extension in the modules services directory")
Expand All @@ -178,10 +186,10 @@ class MarkLogicPlugin implements Plugin<Project> {

String groupsGroup = "ml-gradle Group"
project.task("mlDeployGroups", type: DeployGroupsTask, group: groupsGroup, description: "Deploy each group, updating it if it exists, in the configuration directory")

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")

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"])
project.task("mlReloadModules", group: modulesGroup, dependsOn: ["mlClearModulesDatabase", "mlLoadModules"], description: "Reloads modules by first clearing the modules database and then loading modules")
Expand All @@ -191,11 +199,11 @@ class MarkLogicPlugin implements Plugin<Project> {
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)").mustRunAfter("mlClearSchemasDatabase")
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")

String securityGroup = "ml-gradle Security"
project.task("mlDeployAmps", type: DeployAmpsTask, group: securityGroup, description: "Deploy each amp, updating it if it exists, in the configuration directory")
project.task("mlDeployCertificateAuthorities", type: DeployCertificateAuthoritiesTask, group: securityGroup, description: "Deploy each certificate authority, updating it if it exists, in the configuration directory")
Expand Down Expand Up @@ -236,7 +244,11 @@ class MarkLogicPlugin implements Plugin<Project> {
AdminConfig adminConfig = new DefaultAdminConfigFactory(new ProjectPropertySource(project)).newAdminConfig()
project.extensions.add("mlAdminConfig", adminConfig)

AppConfig appConfig = new DefaultAppConfigFactory(new ProjectPropertySource(project)).newAppConfig()
ProjectPropertySource propertySource = new ProjectPropertySource(project);
AppConfig appConfig = new DefaultAppConfigFactory(propertySource).newAppConfig()
if (appConfig.isReplaceTokensInModules()) {
appConfig.getModuleTokensPropertiesSources().add(propertySource);
}
project.extensions.add("mlAppConfig", appConfig)

ManageConfig manageConfig = new DefaultManageConfigFactory(new ProjectPropertySource(project)).newManageConfig()
Expand Down Expand Up @@ -278,7 +290,7 @@ class MarkLogicPlugin implements Plugin<Project> {

/**
* If the groovysh plugin has already been applied, then we can jvmArgs and args on the shell task automatically.
* Otherwise, the shell task needs to be configured in the Gradle file.
* Otherwise, the shell task needs to be configured in the Gradle file.
*/
if (project.getExtensions().findByName("groovysh")) {
project.afterEvaluate {
Expand Down Expand Up @@ -321,7 +333,7 @@ class MarkLogicPlugin implements Plugin<Project> {
LoadSchemasCommand lsc = new LoadSchemasCommand()
project.extensions.add("mlLoadSchemasCommand", lsc)
commands.add(lsc)

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

Expand All @@ -334,7 +346,6 @@ class MarkLogicPlugin implements Plugin<Project> {

// Modules
LoadModulesCommand lmc = new LoadModulesCommand()
lmc.initializeDefaultModulesLoader(context)
project.extensions.add("mlLoadModulesCommand", lmc)
commands.add(lmc)

Expand Down Expand Up @@ -372,7 +383,7 @@ class MarkLogicPlugin implements Plugin<Project> {
mimetypeCommands.add(new DeployMimetypesCommand())
project.extensions.add("mlMimetypeCommands", mimetypeCommands)
commands.addAll(mimetypeCommands)

// Forest replicas
List<Command> replicaCommands = new ArrayList<Command>()
replicaCommands.add(new ConfigureForestReplicasCommand())
Expand Down
Loading

0 comments on commit afbc93f

Please sign in to comment.