Skip to content

[BEAM-11827] checkJavaLinkage task requires a spread operator for args - #14006

Merged
TheNeuralBit merged 1 commit into
apache:masterfrom
suztomo:BEAM-11827
Feb 17, 2021
Merged

[BEAM-11827] checkJavaLinkage task requires a spread operator for args#14006
TheNeuralBit merged 1 commit into
apache:masterfrom
suztomo:BEAM-11827

Conversation

@suztomo

@suztomosuztomo commented Feb 17, 2021

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/BEAM-11827

Problem

The sdks/java/build-tools/beam-linkage-check.sh is not working. It fails with "Failed to generate the baseline file. Check the build error above." (full log).

It's because ./gradlew ... -PjavaLinkageWriteBaseline=build/linkagecheck/baseline-beam-sdks-java-io-google-cloud-platform.xml :checkJavaLinkage task does not generate a file.

Diagnosis

Beam repository has migrated to the Gradle Kotlin DSL recently. The Kotlin Gradle DSL needs to add a spread operator when passing an array to "args" method. Otherwise the DSL passes a String argument from toString of the array (see the screenshot of the problem below; it shows the DSL passed an unexpected String to LinkageCheckerMain):

Screen Shot 2021-02-17 at 13 55 35

The fix is to add a spread operator "*" when passing the array to the method.

Confirmation

I confirmed the fix works:

suztomo@suztomo:~/beam$ mkdir build/linkagecheck
suztomo@suztomo:~/beam$ ./gradlew -Ppublishing -PskipCheckerFramework -PjavaLinkageArtifactIds=beam-sdks-java-io-google-cloud-platform -PjavaLinkageWriteBaseline=build/linkagecheck/baseline-beam-sdks-java-io-google-cloud-platform.xml :checkJavaLinkage
Configuration on demand is an incubating feature.
> Task :checkJavaLinkage
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Wrote the linkage errors as exclusion file: build/linkagecheck/baseline-beam-sdks-java-io-google-cloud-platform.xml
NOTE: This task published artifacts into your local Maven repository. You may want to remove them manually.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1m 49s
1121 actionable tasks: 203 executed, 918 up-to-date
suztomo@suztomo:~/beam$ ls build/linkagecheck/baseline-beam-sdks-java-io-google-cloud-platform.xml
build/linkagecheck/baseline-beam-sdks-java-io-google-cloud-platform.xml
suztomo@suztomo:~/beam$ head build/linkagecheck/baseline-beam-sdks-java-io-google-cloud-platform.xml
<?xml version="1.0" encoding="UTF-8"?>
<LinkageCheckerFilter>
<LinkageError>
<Target>
<Class name="org.tukaani.xz.LZMAOutputStream"/>
</Target>
<Source>
<Class name="org.apache.beam.repackaged.core.org.apache.commons.compress.compressors.lzma.LZMACompressorOutputStream"/>
</Source>
</LinkageError>
suztomo@suztomo:~/beam$ 

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

LangSDKDataflowFlinkSamzaSparkTwister2
GoBuild Status---Build Status---Build Status---
JavaBuild StatusBuild Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build StatusBuild Status
Build Status
Build Status
Build Status
PythonBuild Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
---Build Status---
XLangBuild StatusBuild StatusBuild Status---Build Status---

Pre-Commit Tests Status (on master branch)

---JavaPythonGoWebsiteWhitespaceTypescript
Non-portableBuild StatusBuild Status
Build Status
Build Status
Build Status
Build StatusBuild StatusBuild StatusBuild Status
Portable---Build Status------------

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

Comment threadbuild.gradle.kts
val linkageCheckerJava by configurations.creating
dependencies {
linkageCheckerJava("com.google.cloud.tools:dependencies:1.5.4")
linkageCheckerJava("com.google.cloud.tools:dependencies:1.5.6")

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This is the latest Linkage Checker version.

@suztomosuztomo changed the title checkJavaLinkage task requires a spread operator for args[BEAM-11827] checkJavaLinkage task requires a spread operator for argsFeb 17, 2021
@suztomo

Copy link
Copy Markdown
ContributorAuthor

retest this please

@suztomo

Copy link
Copy Markdown
ContributorAuthor

R: @kennknowles@TheNeuralBit
CC: @ramazan-yapparov

While I don't see the Jenkins/GitHub checks running today, the change is for Beam's build tools and is not supposed to affect the checks.

@TheNeuralBitTheNeuralBit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for tracking this down @suztomo, sorry I didn't catch it.

@TheNeuralBit
TheNeuralBit merged commit 01258f1 into apache:masterFeb 17, 2021
@suztomo

Copy link
Copy Markdown
ContributorAuthor

@TheNeuralBit Thank you!

Sign up for freeto 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.

2 participants

@suztomo@TheNeuralBit