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

Add missing KotlinJvmTaskExecutorTest to the test suite #1089

Merged
merged 5 commits into from
Dec 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ private val Directories.incrementalData
* Create a new [JvmCompilationTask] with sources found in the generatedSources directory. This should be run after
* annotation processors have been run.
*/
internal fun JvmCompilationTask.expandWithGeneratedSources(): JvmCompilationTask =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Internal will be visible to tests if you pass this target to the test target as an associate dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

going to make it public to avoid using 4f0b728

Copy link
Collaborator

Choose a reason for hiding this comment

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

Forgot about the kt_bootstrap layer that these sources are wrapped in.

fun JvmCompilationTask.expandWithGeneratedSources(): JvmCompilationTask =
expandWithSources(
Stream.of(directories.generatedSources, directories.generatedJavaSources)
.map { s -> Paths.get(s) }
Expand Down
11 changes: 11 additions & 0 deletions src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ kt_rules_test(
],
)

kt_rules_test(
name = "KotlinJvmTaskExecutorTest",
srcs = ["jvm/KotlinJvmTaskExecutorTest.kt"],
deps = [
"//kotlin/compiler:kotlin-test",
"//src/main/kotlin/io/bazel/kotlin/builder/tasks",
"@kotlin_rules_maven//:junit_junit",
],
)

test_suite(
name = "tasks_tests",
tests = [
Expand All @@ -109,5 +119,6 @@ test_suite(
":KotlinBuilderJvmJdepsTest",
":KotlinBuilderJvmKaptTest",
":KotlinBuilderJvmStrictDepsTest",
":KotlinJvmTaskExecutorTest",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class KotlinJvmTaskExecutorTest {

assertTrue(expandedCompileTask.hasInputs())
assertNotNull(expandedCompileTask.inputs.javaSourcesList.find { path ->
path.endsWith("a_test_1/generated_sources/AnotherGenClass.java")
path.endsWith("generated_sources/AnotherGenClass.java")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This always generates not 1 but a random number a-test-115507972808607999568. Removing the prefix here.

})
assertEquals(expandedCompileTask.inputs.javaSourcesCount, 1)
assertNotNull(expandedCompileTask.inputs.kotlinSourcesList.find { path ->
path.endsWith("a_test_1/generated_sources/AGenClass.kt")
path.endsWith("generated_sources/AGenClass.kt")
})
assertEquals(expandedCompileTask.inputs.kotlinSourcesCount, 1)
}
Expand Down