Skip to content

Commit

Permalink
Merge pull request #115 from openbase/feature/updateToJava21
Browse files Browse the repository at this point in the history
Update to Java 21 and Kotlin 2.0.0
  • Loading branch information
DivineThreepwood authored Aug 8, 2024
2 parents 2c6954c + 41cd26a commit aa077d8
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 63 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ jobs:

steps:
- name: "Checkout Branch"
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: "Setup Java"
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
java-version: '21'

- name: Setup Gradle cache
uses: actions/cache@v2.1.2
uses: actions/cache@v4
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
Expand All @@ -41,7 +42,7 @@ jobs:
run: ./gradlew build -x test

- name: Upload Gradle reports
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: Build Backend Reports
Expand All @@ -58,15 +59,16 @@ jobs:

steps:
- name: "Checkout Branch"
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: "Setup Java"
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
java-version: '21'

- name: Setup Gradle cache
uses: actions/cache@v2.1.2
uses: actions/cache@v4
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
Expand All @@ -79,7 +81,7 @@ jobs:
RUN_LONG_INTEGRATION_TESTS: false

- name: Upload Gradle reports
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: Test Backend Reports
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/publish-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Publish Packages
uses: gradle/gradle-build-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ nexusPublishing {

tasks.withType(KotlinCompile::class).all {
kotlinOptions {
jvmTarget = "17"
jvmTarget = "21"
}
}
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/org.openbase.jul.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ group = "org.openbase"
val releaseVersion = !version.toString().endsWith("-SNAPSHOT")

java {
sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = sourceCompatibility
withSourcesJar()
withJavadocJar()
}

dependencies {
api("org.openbase:jps:_")
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20")
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.0")
api("kr.pe.kwonnam.slf4j-lambda:slf4j-lambda-core:0.1")
implementation("org.jetbrains.kotlin:kotlin-script-runtime:1.9.20")
implementation("org.jetbrains.kotlin:kotlin-script-runtime:2.0.0")
testImplementation("org.junit.jupiter:junit-jupiter:[5.8,5.9-alpha)")
testImplementation("org.junit.jupiter:junit-jupiter-api:[5.8,5.9-alpha)")
testImplementation(Testing.mockK)
Expand All @@ -41,7 +41,7 @@ dependencies {

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
jvmTarget = "21"
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/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 Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

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.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

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.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ abstract class AbstractResourcePanel<R : NameProvider, PRP : ResourcePanel>: Res
private val CHILDREN_MONITOR = Any()
var objectType: ObjectType

constructor(
resource: R,
placementPolygon: Polygon?,
objectType: ObjectType,
parentResourcePanel: PRP?,
drawLayer: DrawLayer? = null,
parentPanel: ResourceDisplayPanel<out ResourcePanel>,
linkAsChild: Boolean = false,
) {
this.resource = resource
this.objectType = objectType
this.state = VisibleResourcePanelState.Unselected
this.mouseState = VisibleResourcePanelMouseState.Untouched
this.parentResourcePanel = parentResourcePanel?: this as PRP
this.parentPanel = parentPanel
this.placementPolygon = placementPolygon
this.boundingBox = placementPolygon!!.bounds2D
this.transformedBoundingBox = Rectangle2D.Double()
this.jComponents = ArrayList()
this.childrens = LinkedList()
if(linkAsChild) {
this.parentResourcePanel.addChild(this, drawLayer!!)
}
}

constructor(resource: R, placementPolygon: Polygon, imageURI: String?, parentPanel: ResourceDisplayPanel<out ResourcePanel>) : this(
resource,
placementPolygon,
Expand Down Expand Up @@ -99,19 +124,17 @@ abstract class AbstractResourcePanel<R : NameProvider, PRP : ResourcePanel>: Res
parentPanel
)

constructor(resource: R, placementPolygon: Polygon, objectType: ObjectType, parentPanel: ResourceDisplayPanel<out ResourcePanel>) {
this.resource = resource
this.objectType = objectType
this.state = VisibleResourcePanelState.Unselected
this.mouseState = VisibleResourcePanelMouseState.Untouched
this.parentResourcePanel = this as PRP
this.parentPanel = parentPanel
this.placementPolygon = placementPolygon
this.boundingBox = placementPolygon.bounds2D
this.transformedBoundingBox = Rectangle2D.Double()
this.jComponents = ArrayList()
this.childrens = LinkedList()
}
constructor(resource: R,
placementPolygon: Polygon,
objectType: ObjectType,
parentPanel: ResourceDisplayPanel<out ResourcePanel>
) : this (
resource = resource,
placementPolygon = placementPolygon,
objectType = objectType,
parentResourcePanel = null,
parentPanel = parentPanel,
)

constructor(
resource: R,
Expand Down Expand Up @@ -151,22 +174,16 @@ abstract class AbstractResourcePanel<R : NameProvider, PRP : ResourcePanel>: Res
placementPolygon: Polygon?,
objectType: ObjectType,
parentResourcePanel: PRP,
drawLayer: DrawLayer?
) {
this.resource = resource
this.objectType = objectType
this.state = VisibleResourcePanelState.Unselected
this.mouseState = VisibleResourcePanelMouseState.Untouched
this.parentResourcePanel = parentResourcePanel
this.parentPanel = parentResourcePanel.parentPanel
this.placementPolygon = placementPolygon
this.boundingBox = placementPolygon!!.bounds2D
this.transformedBoundingBox = Rectangle2D.Double()
this.jComponents = ArrayList()
this.childrens = LinkedList()
this.parentResourcePanel.addChild(this, drawLayer!!)
assert(placementPolygon != null)
}
drawLayer: DrawLayer?,
) : this (
resource = resource,
placementPolygon = placementPolygon,
objectType = objectType,
parentResourcePanel = parentResourcePanel,
parentPanel = parentResourcePanel.parentPanel,
drawLayer = drawLayer,
linkAsChild = true,
)

override fun getName(): String {
return resource.name
Expand Down
5 changes: 2 additions & 3 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version.junit.jupiter=5.10.1
version.java3d..j3d-core=1.3.1
plugin.io.github.gradle-nexus.publish-plugin=1.3.0
## # available=2.0.0-rc-1
version.kotlinx.coroutines=1.8.0
version.kotlinx.coroutines=1.8.1
## unused
version.org.apache.commons..commons-collections4=4.4
## unused
Expand Down Expand Up @@ -42,8 +42,7 @@ version.org.controlsfx..controlsfx=11.2.0
version.org.codehaus.woodstox..woodstox-core-asl=[4.1,4.2-alpha)
version.org.apache.commons..commons-lang3=3.13.0
version.mockk=1.13.8
version.kotlin=1.9.20
## # available=2.0.0-Beta1
version.kotlin=2.0.0
version.kotest=5.6.2
## # available=5.7.0
## # available=5.7.1
Expand Down

0 comments on commit aa077d8

Please sign in to comment.