Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure compatibility with Java 21 #1615

Merged
merged 14 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/jgiven_branch_and_pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
ANDROID: true
strategy:
matrix:
java: [ '11', '17', '19']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

19 will be omitted completely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 19 was not an LTS release and is thus not supported anymore. Once I've got this, I'd also like to add the two newest versions.

java: [ '17', '21']
junit: ['4.13.2']
steps:
- name: Ensure chrome is installed
Expand All @@ -27,7 +27,7 @@ jobs:
JUNIT_VERSION: ${{matrix.junit}}
run: "./gradlew -i -s check -DjunitVersion=${JUNIT_VERSION}"
- name: Run Jacoco
if: ${{matrix.java == '11' && github.ref == 'refs/heads/master' && github.head_ref == null}}
if: ${{matrix.java == '17' && github.ref == 'refs/heads/master' && github.head_ref == null}}
run: ./gradlew overallJacocoReport coveralls
- name: Upload test results html files
continue-on-error: true
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/jgiven_examples_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,21 @@ jobs:
name: test-report-example-projects
path: /home/runner/work/JGiven/JGiven/example-projects/*/build/reports/tests
if-no-files-found: ignore
- name: Test Java 11 Project
run: source scripts/source_files/helper_functions.sh && runMavenTestOnGivenProject example-projects/java11/pom.xml 1.1-t
- name: Test Java 17 Project
run: source scripts/source_files/helper_functions.sh && runMavenTestOnGivenProject example-projects/java17/pom.xml 1.1-t
- name: Test TestNG Example Project
run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/testng/build.gradle 1.1-t
- uses: olafurpg/setup-scala@v14
with:
java-version: [email protected]
- name: Test Scala Example Project
run: source scripts/source_files/helper_functions.sh && runScalaTest
run: |
sudo apt-get update
sudo apt-get install apt-transport-https curl gnupg -yqq
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
sudo apt-get update
sudo apt-get install sbt
source scripts/source_files/helper_functions.sh && runScalaTest
- name: Upload test results html files
continue-on-error: true
if: ${{failure()}}
Expand All @@ -71,6 +77,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '17'
distribution: 'adopt'
- name: Load the bash script
run: scripts/local_release_with_version.sh
- name: Run validation
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mock_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
GPG_KEY_ID: '[email protected]'
VERSION: '0.0.1-TEST'
steps:
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Set up a server certificate
run: |
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Release v2.0.0
## Breaking changes
## Backward incompatible changes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, backward incompatible with respect to...? It's a bit confusing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous version. I refraine from using "breaking" because I hope that the changes do not actually break anything
(Java 17 is pretty much required if you do java by now, and the gradle issue should only affect some fringe cases). therefore I wanted to use less agressive wording

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it's just wording in the end, but "breaking changes" is somehow "well-known"; the new wording seems... a bit off. But probably it's rather on my side than a general issue ;)

* Gradle-Plugin: The jgiven report task now forces execution of test tasks. That is, when the task jgivenTestReport is explicitly requested, for instance via the command line, the test tasks it depends on are also executed. For implementations where the jgiven task is set to finalize a test task (i.e `test.finalizedBy(jgiven)`, the behavior is unchanged.
* JGiven now requires Java 17
## Fixed issues:
* The Gradle-Plugin is now configuration-cache compliant [#1527](https://github.com/TNG/JGiven/issues/1527) (big thanks to @jjohannes for basically doing all the work)
* Various dependency updates.
* JGiven is now compatible to Gradle 9
* JGiven is now guaranteed to be compatible with Java 21

# Release v1.3.1
## Fixed issues
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ nexusStaging {

subprojects {
ext {
androidCompileSdkVersion = 33
androidCompileSdkVersion = 34
androidMinSdkVersion = 29
androidTargetSdkVersion = 32

Expand Down Expand Up @@ -219,7 +219,7 @@ configure(subprojects.findAll { !it.name.contains("android") }) {
}

java {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
Expand Down
12 changes: 7 additions & 5 deletions example-projects/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.5.2'
}
}

Expand All @@ -19,7 +19,8 @@ repositories {
}

android {
compileSdkVersion 33
compileSdkVersion 34
namespace 'jgiven.tngtech.com.jgiven_android.example'
defaultConfig {
applicationId "com.tngtech.jgiven.android.example"
minSdkVersion 29
Expand All @@ -36,8 +37,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

Expand All @@ -46,8 +47,9 @@ configurations {
}

dependencies {
implementation('androidx.appcompat:appcompat:1.6.1') {
implementation('androidx.appcompat:appcompat:1.7.0') {
exclude group: 'com.google.guava', module: 'listenablefuture'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}

androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import jgiven.tngtech.com.jgiven_android.example.R;


@RunWith(AndroidJUnit4.class)
Expand Down
3 changes: 1 addition & 2 deletions example-projects/android/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tngtech.jgiven.android.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Expand Down
3 changes: 1 addition & 2 deletions example-projects/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tngtech.jgiven.android.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import jgiven.tngtech.com.jgiven_android.example.R;

public class MainActivity extends AppCompatActivity {

Expand Down
4 changes: 0 additions & 4 deletions example-projects/java11/src/main/java/module-info.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>17</source>
<target>17</target>
<debug>true</debug>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.tngtech.jgiven.exampleprojects.java11;
package com.tngtech.jgiven.exampleprojects.java17;

import java.util.function.*;

public class Java11 {
public class Java17 {

public static boolean test(String y) {
Predicate<String> p = ( var x ) -> x == x;
Expand Down
4 changes: 4 additions & 0 deletions example-projects/java17/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module jgiven.exampleprojects.java17 {
exports com.tngtech.jgiven.exampleprojects.java17;
requires java.base;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.tngtech.jgiven.exampleprojects.java11;
package com.tngtech.jgiven.exampleprojects.java17;

import com.tngtech.jgiven.junit.SimpleScenarioTest;
import org.junit.Test;
import com.tngtech.jgiven.exampleprojects.java11.Java11;
import com.tngtech.jgiven.exampleprojects.java17.Java17;

public class Java11Test extends SimpleScenarioTest<Java11Test.Steps> {
public class Java17Test extends SimpleScenarioTest<Java17Test.Steps> {

@Test
public void example_scenario() {
Expand All @@ -20,7 +20,7 @@ public void some_context() {
}

public void some_action() {
Java11.test("f");
Java17.test("f");
}

public void some_outcome() {
Expand Down
4 changes: 2 additions & 2 deletions example-projects/junit5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ plugins {
apply plugin: 'com.tngtech.jgiven.gradle-plugin'

compileJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
options.compilerArgs += '-parameters'
options.encoding = 'UTF-8'
}
Expand Down
4 changes: 2 additions & 2 deletions example-projects/kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ apply plugin: 'eclipse'
apply plugin: 'com.tngtech.jgiven.gradle-plugin'

compileJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
options.compilerArgs += '-parameters'
options.encoding = 'UTF-8'
}
Expand Down
2 changes: 1 addition & 1 deletion example-projects/maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>11</release>
<release>17</release>
<debug>true</debug>
</configuration>
</plugin>
Expand Down
4 changes: 2 additions & 2 deletions example-projects/selenium/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ repositories {
}

compileJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
options.compilerArgs += '-parameters'
options.encoding = 'UTF-8'
}
Expand Down
4 changes: 2 additions & 2 deletions example-projects/testng/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ plugins {
apply plugin: 'com.tngtech.jgiven.gradle-plugin'

compileJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
options.compilerArgs += '-parameters'
options.encoding = 'UTF-8'
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ spring-version = "5.3.39"
androidx-test-version = "1.6.1"

[libraries]
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "7.4.2"}
androidx-appcompat = {module = "androidx.appcompat:appcompat", version = "1.6.1"}
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "8.5.2"}
androidx-appcompat = {module = "androidx.appcompat:appcompat", version = "1.7.0"}
androidx-test-core = {module = "androidx.test:core", version.ref = "androidx-test-version"}
androidx-test-rules = {module = "androidx.test:rules", version.ref = "androidx-test-version"}
androidx-test-junit = {module = "androidx.test.ext:junit", version = "1.2.1"}
Expand Down
11 changes: 6 additions & 5 deletions jgiven-android-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ repositories {
apply plugin: 'com.android.application'

android {
compileSdkVersion androidCompileSdkVersion
compileSdk androidCompileSdkVersion
namespace 'jgiven.tngtech.com.jgiven_android.example'
defaultConfig {
applicationId "com.tngtech.jgiven.android.example"
minSdkVersion androidMinSdkVersion
Expand All @@ -28,8 +29,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

buildTypes {
Expand All @@ -47,8 +48,8 @@ configurations {
dependencies {
implementation(libs.androidx.appcompat) {
exclude group: 'com.google.guava', module: 'listenablefuture'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}

androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.guava', module: 'listenablefuture'
Expand All @@ -65,7 +66,7 @@ dependencies {
}

def targetDir = 'build/reports/jgiven/json'
def adb = android.getAdbExe().toString()
def adb = android.adbExecutable.toString()
def reportsDir = '/storage/emulated/0/Download/jgiven-reports'

task cleanJGivenReports(type: Delete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.tngtech.jgiven.integration.android.AndroidJGivenTestRule;
import com.tngtech.jgiven.junit.SimpleScenarioTest;
import java.util.List;

import jgiven.tngtech.com.jgiven_android.example.R;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
3 changes: 1 addition & 2 deletions jgiven-android-test/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tngtech.jgiven.android.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Expand Down
3 changes: 1 addition & 2 deletions jgiven-android-test/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tngtech.jgiven.android.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import jgiven.tngtech.com.jgiven_android.example.R;

public class MainActivity extends AppCompatActivity {

Expand Down
4 changes: 2 additions & 2 deletions jgiven-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
namespace 'jgiven.tngtech.com.jgiven_android'

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

defaultConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class JGivenPluginShould extends Specification {

repositories { mavenCentral() }
dependencies {
testImplementation 'com.tngtech.jgiven:jgiven-junit:1.2.5'
testImplementation 'com.tngtech.jgiven:jgiven-junit:1.3.1'
testImplementation 'junit:junit:4.13.2'
}
"""
Expand Down Expand Up @@ -59,7 +59,7 @@ class JGivenPluginShould extends Specification {

repositories { mavenCentral() }
dependencies {
testImplementation 'com.tngtech.jgiven:jgiven-junit:1.2.5'
testImplementation 'com.tngtech.jgiven:jgiven-junit:1.3.1'
testImplementation 'junit:junit:4.13.2'
}
"""
Expand Down
Loading
Loading