Skip to content

Commit

Permalink
feat: Build the extension and the plugin with Java 11 (#66) (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
warnyul authored May 23, 2024
1 parent 9fdf04a commit bd8af24
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.jvmToolchain.get()))
languageVersion.set(JavaLanguageVersion.of(libs.versions.jvmToolchainMin.get()))
}
}

Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ gradlePluginPublish = "1.2.1"
guava = "33.2.0-jre"
junit4 = "4.13.2"
junit5 = "5.10.2"
jvmToolchainMin = "11"
jvmToolchain = "17"
kotlin = "1.9.24"
kover = "0.8.0"
robolectric = "4.12.1"
robolectricAndroidAll = "14-robolectric-10818077"
robolectricAndroidAll = "13-robolectric-9030017"
robolectricExtensionGradlePlugin = "0.6.1"
# Use when bom also added to the dependencies
sources = "sources"

[libraries]
androidGradle = { module = "com.android.tools.build:gradle", version.ref = "androidGradle" }
androidGradleJdk11 = { module = "com.android.tools.build:gradle", version.require = "7.0.4" }
androidxTestExtJunit = { module = "androidx.test.ext:junit", version.ref = "androidxTestExtJunit" }
detektFormatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
detektRulesLibraries = { module = "io.gitlab.arturbosch.detekt:detekt-rules-libraries", version.ref = "detekt" }
Expand Down
6 changes: 3 additions & 3 deletions robolectric-extension-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildConfig {
}

kotlin {
jvmToolchain(libs.versions.jvmToolchain.get().toInteger())
jvmToolchain(libs.versions.jvmToolchainMin.get().toInteger())
}

detekt {
Expand All @@ -33,12 +33,12 @@ dependencies {
detektPlugins(libs.detektFormatting)
detektPlugins(libs.detektRulesLibraries)
compileOnly(gradleApi())
compileOnly(libs.androidGradle)
compileOnly(libs.androidGradleJdk11)
testImplementation(gradleTestKit())
testImplementation(platform(libs.junit5Bom))
testImplementation(libs.junit5JupiterApi)
testImplementation(libs.kotlinTestJUnit5)
testImplementation(libs.androidGradle)
testImplementation(libs.androidGradleJdk11)
testRuntimeOnly(libs.junit5JupiterEngine)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RobolectricJUnitJupiterGradlePlugin : Plugin<Project> {
}

private fun Project.enableIncludeAndroidResources() {
val androidExtension = extensions.findByName("android") as? CommonExtension<*, *, *, *, *, *>
val androidExtension = extensions.findByName("android") as? CommonExtension<*, *, *, *>
@Suppress("UnstableApiUsage")
androidExtension?.testOptions?.unitTests?.isIncludeAndroidResources = true
}
Expand Down
2 changes: 1 addition & 1 deletion robolectric-extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ configurations.configureEach { configuration ->
}

kotlin {
jvmToolchain(libs.versions.jvmToolchain.get().toInteger())
jvmToolchain(libs.versions.jvmToolchainMin.get().toInteger())
}

robolectricJUnitJupiter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class JUnit5RobolectricSandboxBuilderTest {
fun `Given the same arguments when call build twice then should return two different sandboxes with the same classloader `() {
// Given
val instrumentationConfiguration = createInstrumentationConfiguration()
val runtimeSdk: Sdk = TestUtil.sdkCollection.getSdk(34)
val compileSdk: Sdk = TestUtil.sdkCollection.getSdk(34)
val runtimeSdk: Sdk = TestUtil.sdkCollection.getSdk(33)
val compileSdk: Sdk = TestUtil.sdkCollection.getSdk(33)
val resourcesMode: ResourcesMode = ResourcesMode.BINARY
val sqLiteMode: SQLiteMode.Mode = SQLiteMode.Mode.NATIVE

Expand All @@ -45,11 +45,11 @@ class JUnit5RobolectricSandboxBuilderTest {
fun `Given different arguments when call build twice then should return two different sandboxes with different classloaders`() {
// Given
val instrumentationConfiguration1 = createInstrumentationConfiguration()
val runtimeSdk1: Sdk = TestUtil.sdkCollection.getSdk(34)
val compileSdk1: Sdk = TestUtil.sdkCollection.getSdk(34)
val runtimeSdk1: Sdk = TestUtil.sdkCollection.getSdk(33)
val compileSdk1: Sdk = TestUtil.sdkCollection.getSdk(33)
val instrumentationConfiguration2 = createInstrumentationConfiguration()
val runtimeSdk2: Sdk = TestUtil.sdkCollection.getSdk(33)
val compileSdk2: Sdk = TestUtil.sdkCollection.getSdk(33)
val runtimeSdk2: Sdk = TestUtil.sdkCollection.getSdk(32)
val compileSdk2: Sdk = TestUtil.sdkCollection.getSdk(32)
val resourcesMode: ResourcesMode = ResourcesMode.BINARY
val sqLiteMode: SQLiteMode.Mode = SQLiteMode.Mode.NATIVE

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sdk=34
sdk=33
packageName=tech.apter.junit.jupiter.robolectric

0 comments on commit bd8af24

Please sign in to comment.