Skip to content

Commit

Permalink
DHFPROD-7663: Can now run DHF on Gradle 7
Browse files Browse the repository at this point in the history
Most changes are to ml-data-hub tests and the example projects; Gradle 7 uses Groovy 3, so had to bump up spock test to 2.0-3.0. Then had to modify many tests to not use the junit4 TemporaryFolder class, but rather a plain File.

For example projects - bumped them to gradlew 7.1.1, and replaced jcenter with mavenCentral.

Fixed several DHF tasks; task properties apparently should not have "public" on them, because otherwise you need to include a public getter. So it's simpler / better just to have e.g. "String flowName" with @input and @optional on it. Also fixed every other task property that didn't already have @input on it, or added @internal if appropriate. 

DHF will now also scaffold out a gradlew properties file for Gradle 7.1.1.
  • Loading branch information
rjrudin authored and MarkLogic Builder committed Aug 5, 2021
1 parent 743ac97 commit 5381a27
Show file tree
Hide file tree
Showing 52 changed files with 251 additions and 332 deletions.
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ subprojects {
repositories {
mavenCentral()
mavenLocal()

// This has to be configured here as Gradle 7 defaults to requiring https for accessing a repository.
// allowInsecureProtocol is used to override this, but it cannot be used by the gradle-node-plugin
// in the ./marklogic-data-hub and ./marklogic-data-hub-central projects. So we have to specify this
// repository here so we can make use of allowInsecureProtocol.
maven {
url nodeDistributionBaseUrl
allowInsecureProtocol = true
}
}

tasks.withType(Test){
Expand Down
3 changes: 1 addition & 2 deletions examples/dh-5-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}
dependencies {
if (project.hasProperty("testing")) {
Expand All @@ -22,7 +22,6 @@ apply plugin: "com.marklogic.ml-data-hub"
repositories {
mavenLocal()
mavenCentral()
jcenter()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
168 changes: 84 additions & 84 deletions examples/dh-5-example/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
2 changes: 1 addition & 1 deletion examples/dhf5-custom-hook/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/disconnected-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
// When connected to the Internet, download plugin dependencies from the following repositories
repositories {
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}
dependencies {
classpath "net.saliman:gradle-properties-plugin:1.5.1"
Expand Down Expand Up @@ -38,7 +38,7 @@ if (project.hasProperty("disconnected")) {
else {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}

configurations { gradlePlugins }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion examples/insurance/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion examples/mapping-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion examples/patient-hub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 3 additions & 9 deletions examples/reference-entity-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}
dependencies {
if (project.hasProperty("testing")) {
Expand All @@ -21,7 +21,6 @@ apply plugin: "com.marklogic.ml-data-hub"

repositories {
mavenCentral()
jcenter() // Needed for marklogic-unit-test-modules
if (project.hasProperty("testing")) {
mavenLocal()
}
Expand All @@ -31,14 +30,9 @@ configurations {
mlcp
}

dependencies {
mlcp "com.marklogic:mlcp:10.0.6.1"
mlcp files("lib")
}

dependencies {
// Ensures that the marklogic-unit-test modules are loaded into the modules database when the application is deployed
mlBundle "com.marklogic:marklogic-unit-test-modules:1.0.0"
mlBundle "com.marklogic:marklogic-unit-test-modules:1.1.0"

// Makes the DHF JUnit5 library available for tests
if (project.hasProperty("testing")) {
Expand All @@ -50,7 +44,7 @@ dependencies {
// Adds logging support for tests
testImplementation "ch.qos.logback:logback-classic:1.2.3"

mlcp "com.marklogic:mlcp:10.0.6.1"
mlcp "com.marklogic:mlcp:10.0.6.2"
mlcp files("lib")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
8 changes: 4 additions & 4 deletions examples/smart-mastering-complete/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}

dependencies {
Expand All @@ -19,16 +19,16 @@ apply plugin: "net.saliman.properties"
apply plugin: "com.marklogic.ml-data-hub"

repositories {
jcenter()
maven { url "http://developer.marklogic.com/maven2/" }
mavenCentral()
maven { url "https://developer.marklogic.com/maven2/" }
}

configurations {
mlcp
}

dependencies {
mlcp "com.marklogic:mlcp:10.0.6.1"
mlcp "com.marklogic:mlcp:10.0.6.2"
mlcp files("lib")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion examples/snapshot-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
Expand Down
Loading

0 comments on commit 5381a27

Please sign in to comment.