Skip to content

Commit

Permalink
Merge branch 'main' into verifySig
Browse files Browse the repository at this point in the history
  • Loading branch information
jjiwooLim committed Oct 23, 2023
2 parents 14663d7 + 651a3f9 commit 5c1f967
Show file tree
Hide file tree
Showing 57 changed files with 744 additions and 143 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
RUNTIME: [ol, wlp]
RUNTIME_VERSION: [23.0.0.6, 23.0.0.9]
java: [17, 11, 8]
RUNTIME_VERSION: [23.0.0.10]
java: [21, 17, 11, 8]
exclude:
- java: 8
RUNTIME_VERSION: 23.0.0.6
- java: 17
RUNTIME_VERSION: 23.0.0.6
RUNTIME: wlp
- java: 11
RUNTIME: ol
name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Linux
steps:
# Checkout repos
Expand Down Expand Up @@ -66,12 +66,17 @@ jobs:
# Install dependencies
- name: Install ci.ant and ci.common
run: |
mvn -V clean install -f ci.ant --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false
mvn -V clean install -f ci.common --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false
mvn -V clean install -f ci.ant --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
mvn -V clean install -f ci.common --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
# Run tests that require a minimum of Java 17 or later
- 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*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info
# Run tests
- name: Run tests with Gradle on Ubuntu
run:
./gradlew clean install check -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" -P"test.exclude"="**/DevContainerTest*" --stacktrace --info
./gradlew clean install check -P"test.exclude"="**/TestSpringBootApplication30*,**/DevContainerTest*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info
# Copy build reports and upload artifact if build failed
- name: Copy build/report/tests/test for upload
if: ${{ failure() }}
Expand All @@ -96,15 +101,13 @@ jobs:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
RUNTIME: [ol, wlp]
RUNTIME_VERSION: [23.0.0.6, 23.0.0.9]
java: [17, 11, 8]
RUNTIME_VERSION: [23.0.0.10]
java: [21, 17, 11, 8]
exclude:
- java: 8
RUNTIME_VERSION: 23.0.0.6
- java: 8
RUNTIME: ol
- java: 11
RUNTIME: wlp
- java: 17
RUNTIME_VERSION: 23.0.0.6
name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Windows
steps:
# Checkout repos
Expand Down Expand Up @@ -141,16 +144,21 @@ jobs:
# Install ci.ant
- name: Install ci.ant
working-directory: C:/ci.ant
run: mvn -V clean install --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false
run: mvn -V clean install --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
# Install ci.common
- name: Install ci.common
working-directory: C:/ci.common
run: mvn -V clean install --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false
run: mvn -V clean install --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
# Run tests that require a minimum of Java 17 or later
- 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*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon
# Run tests
- name: Run tests with Gradle on Windows
working-directory: C:/ci.gradle
# LibertyTest is excluded because test0_run hangs
run: ./gradlew clean install check -P"test.exclude"="**/Polling*,**/LibertyTest*,**/GenerateFeaturesTest*,**/DevContainerTest*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon
run: ./gradlew clean install check -P"test.exclude"="**/Polling*,**/LibertyTest*,**/GenerateFeaturesTest*,**/TestSpringBootApplication30*,**/DevContainerTest*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon
timeout-minutes: 75
# Copy build reports and upload artifact if build failed
- name: Copy build/report/tests/test for upload
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: "com.gradle.plugin-publish"

archivesBaseName = 'liberty-gradle-plugin'
group = 'io.openliberty.tools'
version = '3.7'
version = '3.7.1-SNAPSHOT'

repositories {
mavenLocal()
Expand Down Expand Up @@ -40,26 +40,26 @@ configurations {
}

compileJava {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

compileTestJava {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

compileGroovy {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

compileTestGroovy {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

def libertyAntVersion = "1.9.13"
def libertyAntVersion = "1.9.14-SNAPSHOT"
def libertyCommonVersion = "1.8.30-SNAPSHOT"

dependencies {
Expand Down
8 changes: 5 additions & 3 deletions docs/spring-boot-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ The `server.xml` file provided by the `configDirectory` or `serverXmlFile` param
| Feature | Description |
| ------- | ----------- |
| springBoot-1.5 | Required to support applications with Spring Boot version 1.5.x. |
| springBoot-2.0 | Required to support applications with Spring Boot version 2.0.x and above. |
| springBoot-2.0 | Required to support applications with Spring Boot version 2.x. |
| springBoot-3.0 | Required to support applications with Spring Boot version 3.x. |

The Liberty features that support the Spring Boot starters can be found [here](https://www.ibm.com/support/knowledgecenter/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/rwlp_springboot.html). They should be enabled in the `server.xml` along with the appropriate Spring Boot feature.


### Gradle Compatibility

There is a known build conflict that Spring Boot Gradle plugin 1.5.x is incompatible with Gradle 5.x. As the Spring Boot 1.5.x plugin will not be updated to support Gradle 5.x, consider upgrading the Spring Boot plugin or downgrading Gradle.
The Spring Boot Gradle plugin 3.x requires Java 17 and a minimum of Gradle 7.5. There is a known build conflict that Spring Boot Gradle plugin 1.5.x is incompatible with Gradle 5.x. As the Spring Boot 1.5.x plugin will not be updated to support Gradle 5.x, consider upgrading the Spring Boot plugin or downgrading Gradle.

| Spring Boot version | Advised Gradle version |
| ------------------- | -------------- |
| 2.0.x | 4.x+ |
| 3.x | 7.5+ or 8.x |
| 2.x | 4.x+ |
| 1.5.x | 2.9 or 3.x (Although we observed compatibility up to 4.10, proceed at your own risk)|

Refer to the [current release Spring docs](https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/#introduction) to be advised on Gradle compatibility for the latest Spring Boot Gradle plugin.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 18 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand All @@ -205,6 +210,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

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

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 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
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package io.openliberty.tools.gradle

import io.openliberty.tools.gradle.extensions.ServerExtension
import io.openliberty.tools.gradle.tasks.AbstractServerTask
import io.openliberty.tools.gradle.tasks.AbstractLibertyTask

import org.gradle.api.Project
import org.gradle.api.tasks.TaskDependency
Expand Down Expand Up @@ -92,8 +93,9 @@ public class LibertyTasks {
}

project.deploy {
if (AbstractServerTask.findSpringBootVersion(project) != null) {
if (springBootVersion?.startsWith('2')) {
String springBootVersion = AbstractServerTask.findSpringBootVersion(project)
if (springBootVersion != null) {
if (AbstractLibertyTask.isSpringBoot2plus(springBootVersion)) {
dependsOn 'bootJar'
} else { //version 1.5.x
dependsOn 'bootRepackage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.openliberty.tools.gradle.tasks


import io.openliberty.tools.common.plugins.util.AbstractContainerSupportUtil
import io.openliberty.tools.common.plugins.util.InstallFeatureUtil
import io.openliberty.tools.common.plugins.util.InstallFeatureUtil.ProductProperties
import io.openliberty.tools.common.plugins.util.PluginExecutionException
Expand Down Expand Up @@ -111,6 +112,7 @@ public class AbstractFeatureTask extends AbstractServerTask {
private class InstallFeatureTaskUtil extends InstallFeatureUtil {
public InstallFeatureTaskUtil(File installDir, File buildDir, String from, String to, Set<String> pluginListedEsas, List<ProductProperties> propertiesList, String openLibertyVerion, String containerName, List<String> additionalJsons, String verify, Collection<Map<String,String>> keyMap) throws PluginScenarioException, PluginExecutionException {
super(installDir, buildDir, from, to, pluginListedEsas, propertiesList, openLibertyVerion, containerName, additionalJsons, verify, keyMap)
setContainerEngine(this);
}

@Override
Expand Down Expand Up @@ -327,5 +329,16 @@ public class AbstractFeatureTask extends AbstractServerTask {
return util
}

protected void setContainerEngine(AbstractContainerSupportUtil util) throws PluginExecutionException {
String LIBERTY_DEV_PODMAN = "liberty.dev.podman";
Map<String, Object> projectProperties = project.getProperties();
if (!projectProperties.isEmpty() && projectProperties.containsKey(LIBERTY_DEV_PODMAN)) {
Object isPodman = projectProperties.get(LIBERTY_DEV_PODMAN);
if (isPodman != null) {
util.setIsDocker(!(Boolean.parseBoolean(isPodman.toString())));
logger.debug("liberty.dev.podman was set to: " + (Boolean.parseBoolean(isPodman.toString())));
}
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2021.
* (C) Copyright IBM Corporation 2017, 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,19 +78,51 @@ abstract class AbstractLibertyTask extends DefaultTask {
return version
}

protected static boolean isSpringBoot1(String springBootVersion) {
if (springBootVersion == null) {
return false
}
return springBootVersion.startsWith('1.')
}

protected static boolean isSpringBoot2plus(String springBootVersion) {
if (springBootVersion == null) {
return false
}
if (springBootVersion.contains('.')) {
String majorVersion = springBootVersion.substring(0,springBootVersion.indexOf('.'))
try {
int majorVersionNumber = Integer.parseInt(majorVersion)
return majorVersionNumber > 1
} catch (NumberFormatException e) {
}
}
return false
}

protected static String getLibertySpringBootFeature(String springBootVersion) {
if (isSpringBoot1(springBootVersion)) {
return "springBoot-1.5"
} else if (isSpringBoot2plus(springBootVersion)) {
String majorVersion = springBootVersion.substring(0,springBootVersion.indexOf('.'))
return "springBoot-"+majorVersion+".0"
}
return null
}

protected static Task findSpringBootTask(Project project, String springBootVersion) {
if (springBootVersion == null) {
return null
}
Task task
//Do not change the order of war and java
if (springBootVersion.startsWith('2.')) {
if (isSpringBoot2plus(springBootVersion)) {
if (project.plugins.hasPlugin('war')) {
task = project.bootWar
} else if (project.plugins.hasPlugin('java')) {
task = project.bootJar
}
} else if (springBootVersion.startsWith('1.')) {
} else if (isSpringBoot1(springBootVersion)) {
if (project.plugins.hasPlugin('war')) {
task = project.war
} else if (project.plugins.hasPlugin('java')) {
Expand Down
Loading

0 comments on commit 5c1f967

Please sign in to comment.