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

Support scala_artifact #19128

Merged
merged 16 commits into from May 26, 2023
Merged

Conversation

alonsodomin
Copy link
Contributor

This is an initial stab at fixing #12969 using target generation to determine the actual artifact name.

It also introduces a breaking change in the excludes field of jvm_artifact to be able to distinguish between which of the mentioned exclusions are Scala artifacts (and hence require name mangling based on Scala version) are which ones aren't.

For example, the following BUILD:

scala_artifact(
  group="com.example",
  artifact="test",
  version="1.0",
  excludes=[
    scala_exclude(group="com.example", artifact="test_scala_exclude"),
    jvm_exclude(group="com.example", artifact="test_jvm_exclude")
  ]
)

Would generate the equivalent to:

jvm_artifact(
  group="com.example",
  artifact="test_2.13",
  version="1.0",
  excludes=[
    jvm_exclude(group="com.example", artifact="test_scala_exclude_2.13"),
    jvm_exclude(group="com.example", artifact="test_jvm_exclude")
  ]
)

For a Scala version of 2.13.x.

This approach could be extended in the future to support cross platform builds to ScalaJS and/or Scala Native.

@alonsodomin alonsodomin marked this pull request as ready for review May 24, 2023 12:32
pants.toml Outdated Show resolved Hide resolved
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks a lot! This looks great.

src/python/pants/backend/scala/target_types.py Outdated Show resolved Hide resolved
src/python/pants/jvm/target_types.py Outdated Show resolved Hide resolved
@stuhood
Copy link
Sponsor Member

stuhood commented May 25, 2023

Regarding the breaking change: would it be possible to support both exclusion field values for a deprecation period, with the string version always assumed to be a jvm exclusion?

@alonsodomin
Copy link
Contributor Author

yeah, it makes sense to go through a deprecation phase.

I thought I could have a BUILD file fix rule that could replace the old one with the new one. But it seems I need to invest more time in understanding the current API for that.

@alonsodomin alonsodomin merged commit b455834 into pantsbuild:main May 26, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: JVM JVM backend-related issues category:new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants