-
Notifications
You must be signed in to change notification settings - Fork 22
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
Java path for kotlin tests compilation on Windows machines #412
Open
SergeyDatskiv
wants to merge
2
commits into
development
Choose a base branch
from
SergeyDatskiv/bugfix/410-javac-path-for-kotlinc
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Java path for kotlin tests compilation on Windows machines #412
SergeyDatskiv
wants to merge
2
commits into
development
from
SergeyDatskiv/bugfix/410-javac-path-for-kotlinc
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SergeyDatskiv
commented
Nov 4, 2024
src/main/kotlin/org/jetbrains/research/testspark/tools/factories/TestCompilerFactory.kt
Show resolved
Hide resolved
Probably closes #320 |
core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt
Show resolved
Hide resolved
Kotlin compilation modulo this issue works on my Windows now. |
Vladislav0Art
approved these changes
Nov 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with minor suggestions. There is a question about the Java home path param in the Kotlin compiler.
I checked both Java and Kotlin test generation on Mac. Both work as expected.
core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/jetbrains/research/testspark/tools/factories/TestCompilerFactory.kt
Outdated
Show resolved
Hide resolved
Removed some todos, decreased line length and declared variables in a constructor.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this merge request we are closing an issue where Windows users who did not have java in their PATH variable could not run the generated kotlin tests because
kotlinc
requires Java to be in the path variable.Description of changes made
To address this issue, I added the same Java Path, which is used by the
JavaTestCompiler
to theKotlinTestCompiler
class. This required changing theTestCompilerFacotry
to find the Java path and pass it toKotlinTestCompiler
. I decided to remove dedicated functions for creating Kotlin and Java test compilers because I thought that now they are more similar than different. Instead, I added a private function for finding the Java home path.The
KotlinTestCompiler
now gets ajavaHomeDirectoryPath
which is not directly assigned in the constructor because that would require changing theTestCompiler
class. I thought thatTestCompiler
class should not be dedicated to the Java / Kotlin language, hence I did not change it.The Java path is set only if we detect that the system is a Windows machine. It is set through a chain of commands via command prompt.
Other notes
Why is merge request needed
Closes #410