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

Migrate test kits to Kotlin #1082

Closed
wants to merge 5 commits into from
Closed
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
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ val testKitImplementation: Configuration by configurations.getting

val intiTest: SourceSet by sourceSets.creating
val intiTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.testImplementation.get())
extendsFrom(testKitImplementation, configurations.testImplementation.get())
}
val intiTestRuntimeOnly: Configuration by configurations.getting {
extendsFrom(configurations.testRuntimeOnly.get())
}

val funcTest: SourceSet by sourceSets.creating
val funcTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.testImplementation.get())
extendsFrom(testKitImplementation, configurations.testImplementation.get())
}
val funcTestRuntimeOnly: Configuration by configurations.getting {
extendsFrom(configurations.testRuntimeOnly.get())
Expand All @@ -80,6 +80,8 @@ dependencies {
val mainOutput = sourceSets.main.map { it.output }
testKitImplementation(mainOutput)
testKitImplementation(gradleTestKit())
testKitImplementation(libs.apache.maven)
testKitImplementation(libs.assertk)

testImplementation(testKit.output)
testImplementation(platform(libs.junit.bom))
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apache-ant = "org.apache.ant:ant:1.10.15"
apache-commonsIo = "commons-io:commons-io:2.18.0"
apache-commonsLang = "org.apache.commons:commons-lang3:3.17.0"
apache-log4j = "org.apache.logging.log4j:log4j-core:2.24.2"
apache-maven = "org.apache.maven:maven-repository-metadata:3.9.9"
asm = "org.ow2.asm:asm-commons:9.7.1"
jdependency = "org.vafer:jdependency:2.11"
jdom2 = "org.jdom:jdom2:2.0.6.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package com.github.jengelman.gradle.plugins.shadow.transformers
import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer.MergeStrategy
import spock.lang.Unroll

import static com.github.jengelman.gradle.plugins.shadow.testkit.util.Utils.testObjectFactory
import static com.github.jengelman.gradle.plugins.shadow.testkit.Utils.testObjectFactory
import static groovy.lang.Closure.IDENTITY

@Unroll
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.jengelman.gradle.plugins.shadow.util

import com.github.jengelman.gradle.plugins.shadow.util.repo.maven.MavenFileModule
import com.github.jengelman.gradle.plugins.shadow.testkit.JarBuilder
import groovy.transform.InheritConstructors
import org.apache.commons.io.IOUtils

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.jengelman.gradle.plugins.shadow.util

import com.github.jengelman.gradle.plugins.shadow.testkit.AppendableJar
import org.codehaus.plexus.util.IOUtil
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.jengelman.gradle.plugins.shadow.util.repo

import com.github.jengelman.gradle.plugins.shadow.util.HashUtil
import com.github.jengelman.gradle.plugins.shadow.testkit.HashUtil

abstract class AbstractModule {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import assertk.assertThat
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import assertk.fail
import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory
import com.github.jengelman.gradle.plugins.shadow.testkit.testObjectFactory
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.jengelman.gradle.plugins.shadow.transformers
import assertk.assertThat
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory
import com.github.jengelman.gradle.plugins.shadow.testkit.testObjectFactory
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import assertk.assertions.isFalse
import assertk.assertions.isGreaterThan
import assertk.assertions.isNotEmpty
import assertk.assertions.isTrue
import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory
import com.github.jengelman.gradle.plugins.shadow.testkit.testObjectFactory
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isNotEmpty
import assertk.assertions.isTrue
import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory
import com.github.jengelman.gradle.plugins.shadow.testkit.testObjectFactory
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.jengelman.gradle.plugins.shadow.transformers
import assertk.assertThat
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory
import com.github.jengelman.gradle.plugins.shadow.testkit.testObjectFactory
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.jengelman.gradle.plugins.shadow.testkit

import java.io.File

class AppendableJar(private val file: File) {
private val contents = mutableMapOf<String, String>()

fun insertFile(path: String, content: String): AppendableJar = apply {
contents[path] = content
}

fun write(): File {
val builder = JarBuilder(file.outputStream())
contents.forEach { (path, content) ->
builder.withFile(path, content)
}
builder.build()
return file
}
}
Loading
Loading