Skip to content

Add JaCoCo to v0.8.9-SNAPSHOT and remove v0.8.7#17836

Closed
somethingvague wants to merge 1 commit intobazelbuild:masterfrom
somethingvague:jacoco-0.8.9-SNAPSHOT
Closed

Add JaCoCo to v0.8.9-SNAPSHOT and remove v0.8.7#17836
somethingvague wants to merge 1 commit intobazelbuild:masterfrom
somethingvague:jacoco-0.8.9-SNAPSHOT

Conversation

@somethingvague
Copy link
Copy Markdown
Contributor

Related to #16412

PR 1 of 3 as described in README

@sgowroji sgowroji added team-Rules-Java Issues for Java rules awaiting-review PR is awaiting review from an assigned reviewer labels Mar 21, 2023
Copy link
Copy Markdown
Contributor

@cushon cushon left a comment

Choose a reason for hiding this comment

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

Based on #16412 (comment), I think we should try removing the remaining patch at this point.

Would you be willing to update this to use the published 0.8.9-SNAPSHOT release and delete the patch, instead of rebuilding with it applied?

@somethingvague somethingvague force-pushed the jacoco-0.8.9-SNAPSHOT branch from 18321e3 to ce22ff1 Compare March 30, 2023 16:26
@somethingvague
Copy link
Copy Markdown
Contributor Author

Based on #16412 (comment), I think we should try removing the remaining patch at this point.

This PR removes the patch, confirmed this works against a test project with updated java tools

@cushon cushon added the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 12, 2023
copybara-service bot pushed a commit that referenced this pull request Apr 13, 2023
Related to #16412

Partial commit for third_party/*, see #17836.

Signed-off-by: Sunil Gowroji <sgowroji@google.com>
@sgowroji
Copy link
Copy Markdown
Member

Merged at 11dc7de

@sgowroji sgowroji closed this Apr 13, 2023
@sgowroji sgowroji removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 13, 2023
fweikert pushed a commit to fweikert/bazel that referenced this pull request May 25, 2023
Related to bazelbuild#16412

Partial commit for third_party/*, see bazelbuild#17836.

Signed-off-by: Sunil Gowroji <sgowroji@google.com>
@davidhsv
Copy link
Copy Markdown

davidhsv commented Aug 28, 2024

The Jacoco snapshot of Bazel is from 30/03/2023, but the current snapshot available is from 31/03/2023. This difference in build dates is causing issues because our tests with coverage are running with the 0.8.9-snapshot(31/03), while Bazel is weaving the classes using a Jacoco agent from the 30/03 snapshot.

This mismatch is leading to a bug, because the hash in org.jacoco.agent.rt.internal_(hash) is dependent on the Jacoco agent build.

Is there a way to downgrade in runtime to 0.8.8 version of Jacoco in my local project, or to align the Bazel environment with the current snapshot?

@cushon
Copy link
Copy Markdown
Contributor

cushon commented Aug 29, 2024

The Jacoco snapshot of Bazel is from 30/03/2023, but the current snapshot available is from 31/03/2023. This difference in build dates is causing issues because our tests with coverage are running with the 0.8.9-snapshot(31/03), while Bazel is weaving the classes using a Jacoco agent from the 30/03 snapshot.

This mismatch is leading to a bug, because the hash in org.jacoco.agent.rt.internal_(hash) is dependent on the Jacoco agent build.

Is there a way to downgrade in runtime to 0.8.8 version of Jacoco in my local project, or to align the Bazel environment with the current snapshot?

Can you file a bug for this? Probably we should update Bazel to a newer non snapshot Jacobo release

@davidhsv
Copy link
Copy Markdown

davidhsv commented Aug 29, 2024

I was able to do a workaround downloading the jacoco used in bazel and creating a lib for it:

// BUILD.bazel

java_import(
    name = "jacocoagent",
    jars = ["jacocoagent-0.8.9-SNAPSHOT.jar"],
    visibility = ["//visibility:public"],  # Make it available to other packages
    )

//libs/jacoco/jacocoagent-0.8.9-SNAPSHOT.jar
jacocoagent-0.8.9-SNAPSHOT.jar.zip

And use it like this in the weaving:

_aspectj_weave(
        name = name,
        aspects = aspects,
        jar = jar,
        runtime_deps = ["//maven:org_aspectj_aspectjrt", "//libs/jacoco:jacocoagent"] + runtime_deps,
        **kwargs
    )

The error was: /private/var/tmp/_bazel_davidvieira/52af286067236843f81b50b2c41f19c6/execroot/mono/bazel-out/darwin_arm64-fastbuild/bin/[OMITTED]/identity/libidentity-raw.jar [error] can't determine superclass of missing type org.jacoco.agent.rt.internal_43a39aa.Offline
when weaving type com.[OMITTED].SyncedUserService
when weaving classes
when weaving
when batch building BuildConfig[null] #Files=0 AopXmls=#1
[Xlint:cantFindType]
(no source information available)
[Xlint:cantFindType]

@davidhsv
Copy link
Copy Markdown

In newer versions of Bazel, we already have a non-snapshot version of Jacoco. I think we are fine, at least we have a workaround for now, before updating Bazel.

Thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-Rules-Java Issues for Java rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants