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

Issue with cross-building project that uses Avro classifier artifact #198

Open
clairemcginty opened this issue Sep 27, 2024 · 0 comments
Open

Comments

@clairemcginty
Copy link

clairemcginty commented Sep 27, 2024

I'm encountering an issue cross-compiling projects that import avro classifier artifacts and use default sbt-avro settings. Basically, the first compilation succeeds, but the second fails, because avroUnpackDependencies has cached the result for external-library-avro.jar... except that by default, these dependencies are unpacked into target dir target/scala-{VERSION}/src_managed.

Therefore, if we cross compile Seq(2.12, 2.13), the first compilation succeeds because the records are unpacked to target/scala-2.12/src_managed then compiled, but the second compilation fails because sbt-avro thinks that the unpacking is complete, but it looks for unpacked records in target/scala-2.13/src_managed, which is empty.

This is fixable by setting avroUnpackDependencies / target := target.value / "avro_external", but ideally it would work out of the box.

Maybe we can incorporate Scala binary version into the cache key if the value of avroUnpackDependencies / target contains -{scalaBinaryVersion.value}? Or just update the default value of avroUnpackDependencies outside of sourceManaged?

Repro here: https://github.com/clairemcginty/sbt-avro/tree/cross-compile-issue

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

No branches or pull requests

1 participant