okbuck
okbuck copied to clipboard
mixed scala + java projects leads to wrong compiler flags
Say you have a gradle project with both scala and java sources (both scala and java plugins applied), and with extra compiler flags for your java code:
testCompile.options.compilerArgs << "-Xlint:unchecked"
okbuck generates a BUCK file with incorrect scala compiler flags:
scala_test(
name = 'test_main',
srcs = glob([
'src/test/scala/**/*.java',
'src/test/scala/**/*.scala',
]),
source = '8',
target = '8',
extra_arguments = [
'-Xlint:unchecked',
],
which then causes buckw to fail:
$ ./buckw test
scalac error: 'unchecked' is not a valid choice for '-Xlint'
scalac -help gives more information
Build failed: Command failed with exit code 1.
stderr: scalac error: 'unchecked' is not a valid choice for '-Xlint'
scalac -help gives more information
This needs to be fixed upstream in buck as well:
https://github.com/facebook/buck/blob/master/src/com/facebook/buck/jvm/scala/ScalaLibraryDescription.java#L178
Currently it overrides the java args and passes them into javac
This needs to be fixed upstream in buck before we can apply a fix in okbuck. Kotlin and groovy rules use their own extra compiler arguments that the scala rules do not. @dsilvasc Can you please create an issue on buck?
@kageiit Thanks for following up. I filed https://github.com/facebook/buck/issues/1898