Skip to content

Commit

Permalink
Merge pull request #685 from marklogic/dev
Browse files Browse the repository at this point in the history
Merge dev to master for 4.6.1
  • Loading branch information
rjrudin authored Jan 16, 2024
2 parents bef94da + db47ccc commit 4cbb7bc
Show file tree
Hide file tree
Showing 63 changed files with 114 additions and 260 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ First, [install Gradle](https://gradle.org/install/).

Then, in an empty directory, create a file named "build.gradle" with your favorite text editor and enter the following:

plugins { id "com.marklogic.ml-gradle" version "4.6.0" }
plugins { id "com.marklogic.ml-gradle" version "4.6.1" }

Then run:

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = "com.marklogic"
version = "4.6.0"
version = "4.6.1"

java {
sourceCompatibility = 1.8
Expand All @@ -32,7 +32,7 @@ dependencies {
implementation gradleApi()
implementation localGroovy()

api 'com.marklogic:ml-app-deployer:4.6.0'
api 'com.marklogic:ml-app-deployer:4.6.1'
implementation "com.marklogic:mlcp-util:1.0.1"
implementation "com.marklogic:marklogic-data-movement-components:2.7.0"
implementation "commons-io:commons-io:2.11.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/alert-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "java"
id "eclipse"
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion examples/corb2-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
}

plugins {
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion examples/cpf-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "java"
id "eclipse"
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-forests-and-replicas-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
}
2 changes: 1 addition & 1 deletion examples/custom-rest-rewriter-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
}

task generateCustomRewriterModules {
Expand Down
2 changes: 1 addition & 1 deletion examples/data-services/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "java"
id "net.saliman.properties" version "1.5.1"
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
id 'com.marklogic.ml-development-tools' version '6.0.0'
}

Expand Down
72 changes: 13 additions & 59 deletions examples/dependency-project/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
This set of projects demonstrates:

- How a "provider" project can publish a zip of MarkLogic files (modules, data, schemas, or system plugins)
- How an ml-gradle or DHF project can depend on this zip so that the files are automatically included
in an application
- How a "provider" project can publish a zip of MarkLogic files (modules, data, schemas, or system plugins).
- How an ml-gradle project can depend on this zip so that the files are automatically included in an application.

## Publishing the provider

To try this out, you'll first need Gradle installed locally.

Then, begin by publishing the zip from the provider project:
To try this out, begin by publishing the zip from the provider project:

cd provider-project
gradle publishToMavenLocal
../../gradlew publishToMavenLocal

If you'd like to inspect the zip, you'll find it at ~/.m2/repository/com/marklogic/example-dependency.
If you'd like to inspect the zip, you'll find it at `~/.m2/repository/com/marklogic/example-dependency`.

## Deploying and verifying the ml-gradle project

Next, deploy the app in the ml-gradle-client-project, replacing "changeme" below with the password for your admin user
(or using a different admin-like user):

cd ../ml-gradle-client-project
gradle -i mlDeploy -PmlUsername=admin -PmlPassword=change
../../gradlew -i mlDeploy -PmlUsername=admin -PmlPassword=change

You'll see logging like this that lets you know that the modules and data from the example-dependency zip
will be included when the application is deployed:
Expand All @@ -32,7 +29,6 @@ Found mlBundle configuration, will extract all of its dependencies to build/mlBu
Finished extracting mlBundle dependencies
Module paths including mlBundle paths: [/Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/build/mlBundle/example-dependency/ml-modules, /Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/src/main/ml-modules]
Data paths including mlBundle paths: [/Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/build/mlBundle/example-dependency/ml-data, /Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/src/main/ml-data]
Plugin paths including mlBundle paths: [/Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/build/mlBundle/example-dependency/ml-plugins, /Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/src/main/ml-plugins]
Schema paths including mlBundle paths: [/Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/build/mlBundle/example-dependency/ml-schemas, /Users/rrudin/dev/workspace/ml-gradle/examples/dependency-project/ml-gradle-client-project/src/main/ml-schemas]
:mlPrepareBundles (Thread[Task worker for ':',5,main]) completed. Took 0.059 secs.
```
Expand Down Expand Up @@ -60,16 +56,6 @@ Shutting down ExecutorService
Writing 2 documents to MarkLogic; port: 8030
```

And also some logging like this that indicates that a system plugin was installed:

```
Writing plugin zip file to URI: /com.marklogic/plugins/varianceplugin.zip
Writing content for /com.marklogic/plugins/varianceplugin.zip
Installing plugin with scope 'native' from URI: /com.marklogic/plugins/varianceplugin.zip
Installed plugin with scope 'native', result: 1
Finished executing command [com.marklogic.appdeployer.command.plugins.InstallPluginsCommand]
```

And finally, some logging like this that indicates that schemas were loaded:

```
Expand All @@ -86,47 +72,15 @@ Writing 1 documents to MarkLogic; port: 8000; database: ml-gradle-client-schemas

You can then use qconsole to verify that the following documents were inserted:

- In ml-gradle-client-modules: /example.sjs (in addition to the modules included by this project: /my-lib.xqy and /Default/ml-gradle-client/rest-api/properties.xml)
- In ml-gradle-client-schemas: /tde/template1.json (in addition to the schema file included in this project: /tde/my-template.json)
- In ml-gradle-client-content: /example/data1.json and /example/data2.json (in addition to the data files including
in this project: /testdata/test1.json, /testdata/test2.json, and /testdata/test3.json)
- In Extensions: /native/scope.xml, /native/varianceplugin/libvarianceplugin.dylib, and /native/varianceplugin/manifest.xml

Note that ml-gradle-client-content also contains the plugin zip file at /com.marklogic/plugins/varianceplugin.zip . If
you don't want that to remain, you can use a custom Gradle task to delete it after the deployment, or use the
mlPluginDatabaseName property to store the zip file in a different database.

You can also verify that the plugin was installed correctly by running the following task:

gradle testPlugin

Which should return:

```
> Task :testPlugin
66.6666666666667
```
- In ml-gradle-client-modules: `/example.sjs` (in addition to the modules included by this project: `/my-lib.xqy` and `/Default/ml-gradle-client/rest-api/properties.xml`).
- In ml-gradle-client-schemas: `/tde/template1.json` (in addition to the schema file included in this project: `/tde/my-template.json`).
- In ml-gradle-client-content: `/example/data1.json` and `/example/data2.json` (in addition to the data files including
in this project: `/testdata/test1.json`, `/testdata/test2.json`, and `/testdata/test3.json`).

See [Loading data](https://github.com/marklogic/ml-app-deployer/wiki/Loading-data) for more
information on configuring how data is loaded during a deployment.

## Provider project with system plugin

## Deploying and verifying the DHF project

The DHF project is deployed the same way as the ml-gradle project, though you'll first need to run hubInit to
initialize the project (this is to avoid adding a bunch of DHF files to version control that aren't needed for
the purposes of this example):

cd ../dhf-client-project
gradle -i mlDeploy

You'll see the same logging as shown above for the ml-gradle project. And likewise, you can use qconsole
to verify that the following documents were inserted:

- In dhf-client-MODULES: /example.sjs
- In dhf-client-FINAL: /example/data1.json, /example/data2.json

Note that in a DHF project, the final database is equivalent to the default content database in an ml-gradle
project. Thus, data is loaded by default to the final database. This can be overridden via the
mlDataDatabaseName property.

The `./provider-with-plugin-project` directory is included as a reference for including a MarkLogic system plugin
in a bundle. Building this plugin requires a C++ compiler, so it is not included in `./provider-project`.
8 changes: 0 additions & 8 deletions examples/dependency-project/dhf-client-project/.gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions examples/dependency-project/dhf-client-project/build.gradle

This file was deleted.

53 changes: 0 additions & 53 deletions examples/dependency-project/dhf-client-project/gradle.properties

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
//buildscript {
// repositories {
// mavenCentral()
// mavenLocal()
// }
// dependencies {
// classpath "com.marklogic:ml-gradle:4.2.0"
// }
//}

plugins {
id "net.saliman.properties" version "1.5.1"
id "com.marklogic.ml-gradle" version "4.6.0"
id "com.marklogic.ml-gradle" version "4.6.1"
}

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

repositories {
mavenLocal()
}

dependencies {
mlBundle "com.marklogic:example-dependency:1.0.0"
}

task testPlugin(type: com.marklogic.gradle.task.ServerEvalTask) {
description = "Run this to verify that the plugin from the example-dependency bundle was installed correctly; should get 66.67 as a result"
javascript = "cts.aggregate('native/varianceplugin', 'variance', cts.elementReference(xs.QName('amount')))"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mlAppName=ml-gradle-client
mlRestPort=8030
mlRestPort=8037
mlContentForestsPerHost=2

# Define these in gradle-local.properties
Expand Down
3 changes: 0 additions & 3 deletions examples/dependency-project/provider-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ task bundleJar(type: Jar) {
from("src/main/ml-data") {
into("example-dependency/ml-data")
}
from("src/main/ml-plugins") {
into("example-dependency/ml-plugins")
}
from("src/main/ml-schemas") {
into("example-dependency/ml-schemas")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id "maven-publish"
}

group = "com.marklogic"
version = "1.0.0"

configurations {
bundle
}

task bundleJar(type: Jar) {
from("src/main/ml-plugins") {
into("example-dependency/ml-plugins")
}
destinationDirectory = file("build/libs")
archiveBaseName = "example-dependency-with-plugin"
}

artifacts {
bundle bundleJar
}

publishing {
publications {
mainBundle(MavenPublication) {
artifactId "example-dependency-with-plugin"
artifact bundleJar
}
}
}
Loading

0 comments on commit 4cbb7bc

Please sign in to comment.