Skip to content

Commit

Permalink
Merge pull request #906 from arunvenmany-ibm/gradle_deprecation_fix1.0
Browse files Browse the repository at this point in the history
removing deprecated usage of project.builddir in all test projects
  • Loading branch information
arunvenmany-ibm authored Sep 12, 2024
2 parents e120656 + 01f57bf commit 269444b
Show file tree
Hide file tree
Showing 44 changed files with 180 additions and 180 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ jobs:
- name: Run tests that require a minimum of Java 17 or later
if: ${{ matrix.java == '17' || matrix.java == '21' }}
run:
./gradlew clean install check -P"test.include"="**/TestSpringBootApplication30*,**/TestCompileJSPSource17*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info
./gradlew clean install check -P"test.include"="**/TestSpringBootApplication30*,**/TestCompileJSPSource17*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --warning-mode=all
# Run tests
- name: Run tests with Gradle on Ubuntu
run:
./gradlew clean install check -P"test.exclude"="**/TestSpringBootApplication30*,**/TestCompileJSPSource17*,**/DevContainerTest*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info
./gradlew clean install check -P"test.exclude"="**/TestSpringBootApplication30*,**/TestCompileJSPSource17*,**/DevContainerTest*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --warning-mode=all
# Copy build reports and upload artifact if build failed
- name: Copy build/report/tests/test for upload
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ test {

try {

output = new FileOutputStream("${project.getLayout().getBuildDirectory().getAsFile().get()}/gradle.properties");
output = new FileOutputStream("${project.getLayout().getBuildDirectory().getAsFile().get()}/gradle.properties")

if (libertyRuntime == "ol") {
runtimeGroup = "io.openliberty"
Expand Down
4 changes: 2 additions & 2 deletions docs/configureArquillian.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ arquillianConfiguration {
}
test {
reports.html.outputLocation = file("$buildDir/reports/it")
reports.junitXml.outputLocation = file("$buildDir/test-results/it")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/it")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/it")
include '**/*IT*'
exclude '**/unit/**'
testLogging.showStandardStreams = true
Expand Down
2 changes: 1 addition & 1 deletion docs/installLiberty.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You need to include `group`, `name`, and `version` values that describe the arti

### Properties

Use the [general runtime properies](libertyExtensions.md#general-runtime-properties) for properties to configure the runtime installation location if you want to override the defaults. By default, the runtime is installed in the `${project.buildDir}/wlp` folder.
Use the [general runtime properies](libertyExtensions.md#general-runtime-properties) for properties to configure the runtime installation location if you want to override the defaults. By default, the runtime is installed in the `${project.getLayout().getBuildDirectory().getAsFile().get()}/wlp` folder.

You can also use the `runtime` properties object in the [general runtime properies](libertyExtensions.md#general-runtime-properties) to configure the `group`, `name`, or `version` values of the artifact to use. These will override any `libertyRuntime` dependency configuration and can also be specified in a gradle.properties file or from the command line as project properties.

Expand Down
2 changes: 1 addition & 1 deletion docs/libertyExtensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The [deploy](deploy.md), [undeploy](undeploy.md), [libertyPackage](libertyPackag

| Attribute | Type | Since | Description | Required |
| --------- | ---- | ----- | ----------- | ---------|
| baseDir | String | 3.0 | The base installation directory. The actual installation directory of WebSphere Liberty server will be `${baseDir}/wlp`. The default value is `${project.buildDir}`. This was moved from the properties in the `install` block in version 3.0.| No |
| baseDir | String | 3.0 | The base installation directory. The actual installation directory of WebSphere Liberty server will be `${baseDir}/wlp`. The default value is `${project.getLayout().getBuildDirectory().getAsFile().get()}`. This was moved from the properties in the `install` block in version 3.0.| No |
| cacheDir | String | 3.0 | The directory used for caching downloaded files such as the license or `.jar` files. The default value is `${java.io.tmpdir}/wlp-cache`. This was moved from the properties in the `install` block in version 3.0.| No |
| installDir | String | 1.0 | Path to the WebSphere Liberty server installation `wlp` directory. To use a pre-installed version of Liberty, set this property to the path of the Liberty `wlp` directory, including `wlp` in the path. Additionally, `installDir` can be specified in the `gradle.properties` file or from the [command line](installLiberty.md#override-installDir). | No |
| outputDir | String | 1.0 | Deprecated. Value of the `${wlp_output_dir}` variable. The default value is `${installDir}/usr/servers/${serverName}`. This parameter has moved to the `server` block. | No |
Expand Down
2 changes: 1 addition & 1 deletion docs/libertyPackage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The `libertyPackage` task uses a `packageLiberty` block to define task specific
| --------- | ----- | ----- | ----------- | -------- |
| include | String | 1.0 | Controls the package contents. Can be used with values `all`, `usr`, `minify`, `wlp`, `runnable`, `all,runnable` and `minify,runnable`. The default value is `all`. The `runnable`, `all,runnable` and `minify,runnable` values are supported beginning with 8.5.5.9 and works with `jar` type packages only. | Yes, only when the `os` option is set. |
| os| String | 1.0 | A comma-delimited list of operating systems that you want the packaged server to support. To specify that an operating system is not to be supported, prefix it with a minus sign ("-"). The 'include' attribute __must__ be set to `minify`. | No |
| packageDirectory | String | 3.0 | Directory of the packaged file. The default value is `${project.buildDir}/libs`. If the directory is not absolute, it is created in `${project.buildDir}/libs`.| No |
| packageDirectory | String | 3.0 | Directory of the packaged file. The default value is `${project.getLayout().getBuildDirectory().getAsFile().get()}/libs`. If the directory is not absolute, it is created in `${project.getLayout().getBuildDirectory().getAsFile().get()}/libs`.| No |
| packageName | String | 3.0 | Name of the packaged file. The default value is `${project.name}`. | No |
| packageType | String | 3.0 | Type of package. Can be used with values `zip`, `jar`, `tar`, or `tar.gz`. Defaults to `jar` if `runnable` is specified for the `include` property. Otherwise the default value is `zip`. | No |
| serverRoot | String | 3.0 | Specifies the root server folder name in the packaged file. | No |
Expand Down
2 changes: 1 addition & 1 deletion pluginRepo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ publishing {
repositories {
maven {
name = "test"
url = uri("${rootProject.buildDir}/plugin-test-repository")
url = uri("${rootProject.getLayout().getBuildDirectory().getAsFile().get()}/plugin-test-repository")
}
}
}
32 changes: 16 additions & 16 deletions src/test/resources/arquillian-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ tasks.withType(Test) {

task verifyMainAppManaged (type:Test) {
description 'Tests that the main app is ready before the test app when verifyApps is set properly'
reports.html.outputLocation = file("$buildDir/reports/verify-main-app-managed")
reports.junitXml.outputLocation = file("$buildDir/test-results/verify-main-app-managed")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/verify-main-app-managed")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/verify-main-app-managed")
include '**/GreeterIT*'
classpath += configurations.arqManaged
dependsOn ':verifyMainAppManaged:configArq'
finalizedBy 'verifyMainAppManagedValidation'
}

task verifyMainAppManagedValidation (type:Test) {
reports.html.outputLocation = file("$buildDir/reports/verify-main-app-managed-rest-endpoint-it")
reports.junitXml.outputLocation = file("$buildDir/test-results/verify-main-app-managed-rest-endpoint-it")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/verify-main-app-managed-rest-endpoint-it")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/verify-main-app-managed-rest-endpoint-it")
include '**/VerifyMainAppIT.java'
classpath += configurations.arqManaged
dependsOn ':verifyMainAppManaged:configArq'
Expand All @@ -117,17 +117,17 @@ task verifyMainAppManagedValidation (type:Test) {

task skipWithXmlManaged (type:Test) {
description 'For the managed container, tests the task is skipped when the skipIfArquillianXmlExists flag is set to true and arquillian.xml exists in src/test/resources.'
reports.html.outputLocation = file("$buildDir/reports/skip-with-xml-managed")
reports.junitXml.outputLocation = file("$buildDir/test-results/skip-with-xml-managed")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/skip-with-xml-managed")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/skip-with-xml-managed")
include '**/SkipWithXmlIT*'
classpath += configurations.arqManaged
dependsOn ':skipWithXmlManaged:configArq'
finalizedBy 'skipWithXmlManagedRestEndpointIT'
}

task skipWithXmlManagedRestEndpointIT (type:Test) {
reports.html.outputLocation = file("$buildDir/reports/skip-with-xml-managed-rest-endpoint-it")
reports.junitXml.outputLocation = file("$buildDir/test-results/skip-with-xml-managed-rest-endpoint-it")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/skip-with-xml-managed-rest-endpoint-it")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/skip-with-xml-managed-rest-endpoint-it")
include '**/GreeterIT*'
classpath += configurations.arqManaged
dependsOn ':skipWithXmlManaged:configArq'
Expand All @@ -136,8 +136,8 @@ task skipWithXmlManagedRestEndpointIT (type:Test) {

task skipWithoutXmlManaged (type:Test) {
description 'For the managed container, tests the task is run when the skipIfArquillianXmlExists flag is set to true and arquillian.xml does not exist in src/test/resources'
reports.html.outputLocation = file("$buildDir/reports/skip-without-xml-managed")
reports.junitXml.outputLocation = file("$buildDir/test-results/skip-without-xml-managed")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/skip-without-xml-managed")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/skip-without-xml-managed")
include '**/SkipWithoutXmlIT*'
classpath += configurations.arqManaged
dependsOn 'compileJava'
Expand All @@ -146,8 +146,8 @@ task skipWithoutXmlManaged (type:Test) {
}

task skipWithoutXmlManagedRestEndpointIT (type:Test) {
reports.html.outputLocation = file("$buildDir/reports/skip-without-xml-managed-rest-endpoint-it")
reports.junitXml.outputLocation = file("$buildDir/test-results/skip-without-xml-managed-rest-endpoint-it")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/skip-without-xml-managed-rest-endpoint-it")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/skip-without-xml-managed-rest-endpoint-it")
include '**/GreeterIT*'
classpath += configurations.arqManaged
dependsOn ':skipWithoutXmlManaged:configArq'
Expand All @@ -156,8 +156,8 @@ task skipWithoutXmlManagedRestEndpointIT (type:Test) {

task skipWithXmlRemote (type:Test) {
description 'For the remote container, tests the task is run when the skipIfArquillianXmlExists flag is set to true and arquillian.xml does not exist in src/test/resources'
reports.html.outputLocation = file("$buildDir/reports/skip-with-xml-remote")
reports.junitXml.outputLocation = file("$buildDir/test-results/skip-with-xml-remote")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/skip-with-xml-remote")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/skip-with-xml-remote")
include '**/SkipWithXmlIT*'
classpath += configurations.arqRemote
dependsOn ':skipWithXmlRemote:configArq'
Expand All @@ -166,8 +166,8 @@ task skipWithXmlRemote (type:Test) {

task skipWithoutXmlRemote (type:Test) {
description 'For the remote container, tests the task is run when the skipIfArquillianXmlExists flag is set to true and arquillian.xml does not exist in src/test/resources'
reports.html.outputLocation = file("$buildDir/reports/skip-without-xml-remote")
reports.junitXml.outputLocation = file("$buildDir/test-results/skip-without-xml-remote")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/skip-without-xml-remote")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/skip-without-xml-remote")
include '**/SkipWithoutXmlIT*'
classpath += configurations.arqRemote
dependsOn ':skipWithoutXmlRemote:configArq'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
}

project.buildDir = '../build'
project.getLayout().setBuildDirectory('../build')

dependencies {
implementation 'io.openliberty.arquillian:arquillian-liberty-managed:1.0.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
}

project.buildDir = '../build'
project.getLayout().setBuildDirectory('../build')

dependencies {
implementation 'io.openliberty.arquillian:arquillian-liberty-remote:1.0.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
}

project.buildDir = '../build'
project.getLayout().setBuildDirectory('../build')

dependencies {
implementation 'io.openliberty.arquillian:arquillian-liberty-managed:1.0.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
}

project.buildDir = '../build'
project.getLayout().setBuildDirectory('../build')

dependencies {
implementation 'io.openliberty.arquillian:arquillian-liberty-remote:1.0.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
}

project.buildDir = '../build'
project.getLayout().setBuildDirectory('../build')

dependencies {
implementation 'io.openliberty.arquillian:arquillian-liberty-managed:1.0.7'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
}

liberty {
installDir = file("${project.buildDir}/wlp")
installDir = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/wlp")
}

clean.dependsOn "libertyStop"
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ liberty {
server{
name = 'LibertyProjectServer'
packageLiberty {
packageDirectory = "${project.buildDir}"
packageDirectory = "${project.getLayout().getBuildDirectory().getAsFile().get()}"
packageType = 'jar'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ compileJava.options.encoding = 'UTF-8'
ext {
// Liberty server properties
wlpServerName = 'LibertyProjectServer'
serverDirectory = "${project.buildDir}/wlp/usr/servers/${wlpServerName}"
serverDirectory = "${project.getLayout().getBuildDirectory().getAsFile().get()}/wlp/usr/servers/${wlpServerName}"
testServerHttpPort = 9080
testServerHttpsPort = 9443

Expand Down Expand Up @@ -83,25 +83,25 @@ task copyDerby {
doLast {
copy {
from configurations.derby
into "$buildDir/wlp/usr/shared/resources"
into "${project.getLayout().getBuildDirectory().getAsFile().get()}/wlp/usr/shared/resources"
include '*.jar'
}
}
}

test {
println 'inside the test block'
reports.html.outputLocation = file("$buildDir/reports/unit")
reports.junitXml.outputLocation = file("$buildDir/test-results/unit")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/unit")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/unit")
exclude '**/it/**'
}


task integrationTest(type: Test) {
group 'Verification'
description 'Runs the integration tests.'
reports.html.outputLocation = file("$buildDir/reports/it")
reports.junitXml.outputLocation = file("$buildDir/test-results/it")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/it")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/it")
include '**/it/**'
exclude '**/unit/**'

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/loose-ear-test/ejb-ear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ liberty {
name = "ejbServer"
deploy {
apps = [ear]
copyLibsDirectory = file("${project.buildDir}/libs")
copyLibsDirectory = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/libs")
}
verifyAppStartTimeout = 30
looseApplication = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ liberty {
name = "ejbServer"
deploy {
apps = [ear]
copyLibsDirectory = file("${project.buildDir}/libs")
copyLibsDirectory = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/libs")
}
verifyAppStartTimeout = 30
looseApplication = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ compileJava.options.encoding = 'UTF-8'
ext {
// Liberty server properties
wlpServerName = 'LibertyProjectServer'
serverDirectory = "${project.buildDir}/wlp/usr/servers/${wlpServerName}"
serverDirectory = "${project.getLayout().getBuildDirectory().getAsFile().get()}/wlp/usr/servers/${wlpServerName}"
testServerHttpPort = 9080
testServerHttpsPort = 9443

warContext = 'sample.servlet-1'
appName = 'LibertyProject'
packageDir = "${project.buildDir}"
packageDir = "${project.getLayout().getBuildDirectory().getAsFile().get()}"
packagingType = 'usr'


Expand Down Expand Up @@ -87,17 +87,17 @@ dependencies {

test {
println 'inside the test block'
reports.html.outputLocation = file("$buildDir/reports/unit")
reports.junitXml.outputLocation = file("$buildDir/test-results/unit")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/unit")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/unit")
exclude '**/it/**'
}


task integrationTest(type: Test) {
group 'Verification'
description 'Runs the integration tests.'
reports.html.outputLocation = file("$buildDir/reports/it")
reports.junitXml.outputLocation = file("$buildDir/test-results/it")
reports.html.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/reports/it")
reports.junitXml.outputLocation = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/test-results/it")
include '**/it/**'
exclude '**/unit/**'

Expand Down
Loading

0 comments on commit 269444b

Please sign in to comment.