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

POM changes to fix build for contributors #1083

Merged
merged 4 commits into from
Dec 14, 2024

Conversation

leoger
Copy link
Contributor

@leoger leoger commented Dec 7, 2024

Hi @anidotnet , I already have what appears to be a working fix for #1079, but as a first step to prepare for that, I offer a proposed changes to the build setup. Basically, most people trying to follow the simple instructions in README.md to clone and build the project would get an error. Currently, mvn clean install requires gpg to be installed for the gpg signing step to run successfully.

I was reading between the lines here to try to understand your intention, but I think that the configuration of the BOM module makes it very clear. Since a BOM can't truly require any meaningful build steps, the only reason to have maven-gpg-plugin and nexus-staging-maven-plugin there is if those are used to sign and push the actual release artifacts. If that's correct, then the traditional and recommended way to structure this within Maven is to set it up as a "profile". I put it in the parent POM and named it as "release". Then as a next step, the Github Actions config files can be updated from mvn ... deploy to mvn -P release ... deploy. (NOTE: now that I look more closely at those configs, I see the existing workaround was just -Dgpg.skip=true. 😅 As I now see there is a workaround, I will no longer treat this PR as a dependency of the fix for #1079 🙏 )

In order to not break any existing setups, I temporarily configured the release profile to be ON by default, but this still provides the benefit that now someone without gpg installed on their machine can build the project successfully by disabling the release profile. (That can either be set in the IDE, as in this screenshot below, or using command line flags, e.g. mvn -P '!release' <target>)


The other commit in this PR is a simple version change of the error-prone plugin library. In the README file, it says:

To build and test Nitrite, ensure you have JDK 11 (or higher) and Maven 3 installed.

However, the given version of the error-prone plugin fails at runtime with an Unsupported class file major version 61 error, which means it requires JDK 17, actually. You can of course tell me whether you want to hold back the error-prone version or if we should just update the README to say

... ensure you have JDK 17 (or higher) ...

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes

    • Downgraded the error-prone dependency to ensure compatibility with JDK 11.
  • Chores

    • Removed the maven-gpg-plugin and nexus-staging-maven-plugin from multiple projects, simplifying the build process.
    • Introduced a new profile for release management in the main pom.xml.
    • Updated deployment commands in workflow files to utilize the new profile for deployment processes.

Copy link
Contributor

coderabbitai bot commented Dec 7, 2024

Walkthrough

The changes across multiple pom.xml files involve the removal of the maven-gpg-plugin and nexus-staging-maven-plugin from the build sections of several projects, including nitrite-bom, nitrite-jackson-mapper, nitrite-mvstore-adapter, nitrite-rocksdb-adapter, nitrite-support, nitrite, and potassium-nitrite. Additionally, the nitrite-spatial project saw the addition of a new dependency, GeographicLib-Java:2.0. The main alteration in the root pom.xml is the introduction of a new profile for managing these plugins while downgrading the version of the error-prone dependency.

Changes

File Path Change Summary
nitrite-bom/pom.xml Removed <build> section with maven-gpg-plugin and nexus-staging-maven-plugin.
nitrite-jackson-mapper/pom.xml Removed maven-gpg-plugin and nexus-staging-maven-plugin from <build>.
nitrite-mvstore-adapter/pom.xml Removed maven-gpg-plugin and nexus-staging-maven-plugin from <build>.
nitrite-rocksdb-adapter/pom.xml Removed maven-gpg-plugin and nexus-staging-maven-plugin from <build>.
nitrite-spatial/pom.xml Added dependency net.sf.geographiclib:GeographicLib-Java:2.0 and removed maven-gpg-plugin.
nitrite-support/pom.xml Removed maven-gpg-plugin and nexus-staging-maven-plugin from <plugins>.
nitrite/pom.xml Removed maven-gpg-plugin and nexus-staging-maven-plugin from <build>.
pom.xml Downgraded error-prone version from 2.36.0 to 2.31.0, added deploy profile for plugins.
potassium-nitrite/pom.xml Removed maven-gpg-plugin and nexus-staging-maven-plugin from <build>.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Maven
    participant Nexus

    User->>Maven: Build Project
    Maven->>Nexus: Deploy Artifacts
    Note right of Maven: No signing/staging plugins
Loading

🐰 "In the meadow where changes bloom,
The plugins have left, making room.
With new paths to take and dependencies bright,
We hop into spring with pure delight!" 🌼

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eab17b5 and 578979b.

📒 Files selected for processing (1)
  • .github/workflows/build.yml (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build.yml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@leoger
Copy link
Contributor Author

leoger commented Dec 7, 2024

Now that I see where the Github Actions are configured, I think I'll just push the next commit into this branch, disabling release by default, removing the -Dgpg.skip=true from no-longer needed spots, etc.

@leoger leoger marked this pull request as draft December 7, 2024 07:58
@leoger leoger force-pushed the pom-fix-build-for-contributors branch from 3f9d516 to 81aae5b Compare December 7, 2024 08:00
@leoger
Copy link
Contributor Author

leoger commented Dec 7, 2024

NOTE: I'm leaving this in Draft state until I hear your thoughts on the basic concept and e.g. whether something like "deploy" would be a better name for the maven profile.

@anidotnet
Copy link
Contributor

Thanks for taking time to work on this. I'll suggest to rename the profile to - deploy as the same profile is being used for both release and snapshot builds.

As for error-prone version, downgrading the version to support JDK 11 is the right way. I guess I merged the dependabot PR too quickly 😄 .

@leoger leoger force-pushed the pom-fix-build-for-contributors branch from ce900e1 to eab17b5 Compare December 8, 2024 23:43
@leoger leoger marked this pull request as ready for review December 8, 2024 23:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3f9d516 and eab17b5.

📒 Files selected for processing (12)
  • .github/workflows/build.yml (4 hunks)
  • .github/workflows/release.yml (1 hunks)
  • .github/workflows/snapshot.yml (1 hunks)
  • nitrite-bom/pom.xml (0 hunks)
  • nitrite-jackson-mapper/pom.xml (0 hunks)
  • nitrite-mvstore-adapter/pom.xml (0 hunks)
  • nitrite-rocksdb-adapter/pom.xml (0 hunks)
  • nitrite-spatial/pom.xml (0 hunks)
  • nitrite-support/pom.xml (0 hunks)
  • nitrite/pom.xml (0 hunks)
  • pom.xml (2 hunks)
  • potassium-nitrite/pom.xml (0 hunks)
💤 Files with no reviewable changes (8)
  • nitrite-spatial/pom.xml
  • nitrite-bom/pom.xml
  • nitrite-jackson-mapper/pom.xml
  • potassium-nitrite/pom.xml
  • nitrite/pom.xml
  • nitrite-mvstore-adapter/pom.xml
  • nitrite-rocksdb-adapter/pom.xml
  • nitrite-support/pom.xml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pom.xml
🔇 Additional comments (3)
.github/workflows/release.yml (1)

54-54: Verify profile name based on PR discussion

The addition of -P deploy aligns with moving GPG-related plugins to a profile. However, based on the PR discussion, confirm if "deploy" is the agreed-upon name (vs. the original "release" suggestion).

✅ Verification successful

Profile name 'deploy' is correctly used in the workflow

The Maven profile name -P deploy in the workflow matches the profile ID deploy defined in the root pom.xml, confirming the change is consistent with the implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the profile name in pom.xml
rg -A 5 '<profile>' | rg -A 1 'id>'

Length of output: 221

.github/workflows/snapshot.yml (1)

54-54: LGTM! Consistent with release workflow

The change maintains consistency with the release workflow by using the same deploy profile, which is the correct approach as both workflows require GPG signing and artifact deployment.

.github/workflows/build.yml (1)

42-42: ⚠️ Potential issue

Verify build behavior for contributors without GPG

The removal of -Dgpg.skip=true flags assumes the GPG plugin is properly isolated in the deploy profile. However, since the PR mentions the profile is temporarily ON by default, this could still cause build failures for contributors without GPG installed.

Consider these options:

  1. Keep the profile disabled by default (preferred)
  2. Keep -Dgpg.skip=true until the profile is confirmed to be disabled by default

Also applies to: 73-73, 96-96, 114-114

✅ Verification successful

Let me gather more information about the profile configuration.


Removal of -Dgpg.skip=true is safe for contributors

The GPG plugin is properly isolated in the deploy profile, and there's no default activation configured. The profile will only be active when explicitly enabled using -P deploy. Regular contributor builds will work without GPG as:

  • The GPG plugin is strictly confined to the deploy profile
  • The profile is not enabled by default (no <activation> block)
  • The native tests module has GPG explicitly skipped
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the deploy profile is enabled by default in pom.xml
rg -A 10 '<profile>' | rg -A 5 'activation'

# Check for any remaining GPG plugin configurations outside the profile
rg -A 5 'maven-gpg-plugin'

Length of output: 1418


Script:

#!/bin/bash
# Check the complete profile configuration in pom.xml
rg -B 5 -A 20 '<profile>' pom.xml

Length of output: 784

.github/workflows/build.yml Outdated Show resolved Hide resolved
@leoger
Copy link
Contributor Author

leoger commented Dec 13, 2024

@anidotnet any concerns about merging this PR in its current form?

I have a general sense that coderabbitai's suggestion here is correct but I'm not confident that I know enough about the context and interpretation of build.yaml commands to agree with it. (e.g. how is the windows shell configured? is this command inlined into something larger that makes the % meaningful?) For now, I'd prefer to leave that question for a potential future change. I am at least confident that removing -Dgpg.skip=true makes that run command more correct.

@anidotnet
Copy link
Contributor

anidotnet commented Dec 14, 2024

Please remove the --% from the windows build script. As we are not using -Dgpg.skip=true, it is not required anymore.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@leoger
Copy link
Contributor Author

leoger commented Dec 14, 2024

Removed!

@anidotnet anidotnet merged commit 1f98b39 into nitrite:main Dec 14, 2024
17 checks passed
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.

2 participants