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

Test databinding/viewbinding with Bazel 7.1.0 #164

Closed
wants to merge 2 commits into from

Conversation

arunkumar9t2
Copy link
Contributor

@arunkumar9t2 arunkumar9t2 commented Apr 8, 2024

Refine //tests/.. target to showcase databinding

Observations

When using Bazel 7.1.0 and associated android_tools, we get the following error

com.beust.jcommander.ParameterException: "-zipSourceOutput": couldn't convert "true " to a boolean
	at com.beust.jcommander.converters.BooleanConverter.convert(BooleanConverter.java:38)
	at com.beust.jcommander.converters.BooleanConverter.convert(BooleanConverter.java:28)
	at com.beust.jcommander.JCommander.convertValue(JCommander.java:1340)
	at com.beust.jcommander.ParameterDescription.addValue(ParameterDescription.java:249)
	at com.beust.jcommander.JCommander.processFixedArity(JCommander.java:920)
	at com.beust.jcommander.JCommander.processFixedArity(JCommander.java:901)
	at com.beust.jcommander.JCommander.parseValues(JCommander.java:731)
	at com.beust.jcommander.JCommander.parse(JCommander.java:363)
	at com.beust.jcommander.JCommander.parse(JCommander.java:342)
	at android.databinding.AndroidDataBinding.main(AndroidDataBinding.kt:67)
	at com.google.devtools.build.android.GenerateDatabindingBaseClassesAction.main(GenerateDatabindingBaseClassesAction.java:147)
	at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$13.call(ResourceProcessorBusyBox.java:142)
	at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:237)
	at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:184)
Exception in thread "main" java.lang.NoSuchMethodError: 'void com.beust.jcommander.JCommander.usage(java.lang.StringBuilder)'
	at android.databinding.AndroidDataBinding.printUsageAndExit(AndroidDataBinding.kt:91)
	at android.databinding.AndroidDataBinding.main(AndroidDataBinding.kt:76)
	at com.google.devtools.build.android.GenerateDatabindingBaseClassesAction.main(GenerateDatabindingBaseClassesAction.java:147)
	at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$13.call(ResourceProcessorBusyBox.java:142)
	at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:237)
	at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:184)

From a cursory look this seems to a dependency conflict between databinding's jcommander usage and Bazel's own jcommander version. Since everything is packaged into single android_tools.jar, the conflict occurs.

Workarounds

When using an older version of android_tools.jar (6.3.2) with Bazel 7.1.0, it seems we can overcome the error. This repo already uses 6.3.2 jars hence this specific issue does not occur here. However this is not recommended since there could be other mismatches and we should be using the same version of android_tools and Bazel when we migrate to 7.1.0.

Secondly the arg true does have a trailing space due to this not sure why in older versions boolean parsing appears succesfull

@arunkumar9t2 arunkumar9t2 changed the title Test databinding/viewbinding with Bazel 7.1.0 Test databinding/viewbinding with Bazel 7.1.0 Apr 8, 2024
@arunkumar9t2 arunkumar9t2 deleted the arun/databinding branch November 26, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant