Skip to content

Conversation

tdyas
Copy link

@tdyas tdyas commented May 14, 2022

Add a contrived example of using the Kotlin Serialization plugin to encode and decode JSON data.

@tdyas
Copy link
Author

tdyas commented May 14, 2022

Note: I pushed pants.toml directly to main as the initial commit. Probably worth reviewing pants.toml as well despite it not being in this PR.

Copy link

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Thanks!

@tdyas
Copy link
Author

tdyas commented May 16, 2022

CI failure:

  ClasspathRootOnlyWasInner: The following targets had dependees, but can only be used as roots in a build graph:
  * src/jvm/org/pantsbuild/example/json/JsonExample.kt	(kotlin_source)

https://github.com/pantsbuild/example-kotlin/runs/6438158675?check_suite_focus=true#step:6:11

@stuhood / @chrisjrn: Thoughts on this failure? kotlin_source is not marked as root only. Only deploy_jar is marked with root_only=True. (Technically the ClasspathEntryRequest being marked.)

@stuhood
Copy link
Member

stuhood commented May 16, 2022

CI failure:

  ClasspathRootOnlyWasInner: The following targets had dependees, but can only be used as roots in a build graph:
  * src/jvm/org/pantsbuild/example/json/JsonExample.kt	(kotlin_source)

https://github.com/pantsbuild/example-kotlin/runs/6438158675?check_suite_focus=true#step:6:11

@stuhood / @chrisjrn: Thoughts on this failure? kotlin_source is not marked as root only. Only deploy_jar is marked with root_only=True. (Technically the ClasspathEntryRequest being marked.)

Bug...

It looks like this code is looking at a loop variable: https://github.com/pantsbuild/pants/blob/43a3ab258f36e74a84ea2b2091c5a374259677d4/src/python/pants/jvm/compile.py#L121-L125

@tdyas
Copy link
Author

tdyas commented May 16, 2022

CI failure:

  ClasspathRootOnlyWasInner: The following targets had dependees, but can only be used as roots in a build graph:
  * src/jvm/org/pantsbuild/example/json/JsonExample.kt	(kotlin_source)

https://github.com/pantsbuild/example-kotlin/runs/6438158675?check_suite_focus=true#step:6:11
@stuhood / @chrisjrn: Thoughts on this failure? kotlin_source is not marked as root only. Only deploy_jar is marked with root_only=True. (Technically the ClasspathEntryRequest being marked.)

Bug...

It looks like this code is looking at a loop variable: https://github.com/pantsbuild/pants/blob/43a3ab258f36e74a84ea2b2091c5a374259677d4/src/python/pants/jvm/compile.py#L121-L125

Good eyes!

@tdyas
Copy link
Author

tdyas commented May 16, 2022

pantsbuild/pants#15494 appears to fix the issue.

tdyas pushed a commit to pantsbuild/pants that referenced this pull request May 16, 2022
…entations (#15494)

The conditional logic which checked for a root-only `ClasspathEntryRequest` implementation in a non-root position looked at a loop variable which could be unrelated to the compatible `ClasspathEntryRequest` implementation at issue. 

Solution: Check the root-only status of the compatible `ClasspathEntryRequest` implementation and avoid checking the loop variable.

h/t to @stuhood for spotting the bug. pantsbuild/example-kotlin#1 (comment)

[ci skip-rust]

[ci skip-build-wheels]
tdyas pushed a commit to tdyas/pants that referenced this pull request May 16, 2022
…entations (pantsbuild#15494)

The conditional logic which checked for a root-only `ClasspathEntryRequest` implementation in a non-root position looked at a loop variable which could be unrelated to the compatible `ClasspathEntryRequest` implementation at issue. 

Solution: Check the root-only status of the compatible `ClasspathEntryRequest` implementation and avoid checking the loop variable.

h/t to @stuhood for spotting the bug. pantsbuild/example-kotlin#1 (comment)

[ci skip-rust]

[ci skip-build-wheels]
tdyas pushed a commit to tdyas/pants that referenced this pull request May 16, 2022
…entations (pantsbuild#15494)

The conditional logic which checked for a root-only `ClasspathEntryRequest` implementation in a non-root position looked at a loop variable which could be unrelated to the compatible `ClasspathEntryRequest` implementation at issue. 

Solution: Check the root-only status of the compatible `ClasspathEntryRequest` implementation and avoid checking the loop variable.

h/t to @stuhood for spotting the bug. pantsbuild/example-kotlin#1 (comment)

[ci skip-rust]

[ci skip-build-wheels]
tdyas pushed a commit to pantsbuild/pants that referenced this pull request May 17, 2022
…entations (Cherry pick of #15494) (#15497)

The conditional logic which checked for a root-only `ClasspathEntryRequest` implementation in a non-root position looked at a loop variable which could be unrelated to the compatible `ClasspathEntryRequest` implementation at issue. 

Solution: Check the root-only status of the compatible `ClasspathEntryRequest` implementation and avoid checking the loop variable.

h/t to @stuhood for spotting the bug. pantsbuild/example-kotlin#1 (comment)

[ci skip-rust]

[ci skip-build-wheels]
tdyas pushed a commit to pantsbuild/pants that referenced this pull request May 17, 2022
…entations (Cherry pick of #15494) (#15496)

The conditional logic which checked for a root-only `ClasspathEntryRequest` implementation in a non-root position looked at a loop variable which could be unrelated to the compatible `ClasspathEntryRequest` implementation at issue. 

Solution: Check the root-only status of the compatible `ClasspathEntryRequest` implementation and avoid checking the loop variable.

h/t to @stuhood for spotting the bug. pantsbuild/example-kotlin#1 (comment)

[ci skip-rust]

[ci skip-build-wheels]
@tdyas tdyas merged commit 6f27e12 into pantsbuild:main May 25, 2022
@tdyas tdyas deleted the json_example branch May 25, 2022 00:36
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.

3 participants