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

Create a new snippets project for Java #321

Merged

Conversation

MGaetan89
Copy link
Member

@MGaetan89 MGaetan89 commented Sep 25, 2024

This PR creates a new snippets Android project that uses Java.
The goal of that project is to contain all the code snippets from robolectric.org. This will allow us to compile them and ensure a coherent code style.

To create/use a snippet:

  • Surround the interesting piece of code with:
// --8<-- [start:some_identifier]
class MyFancyJavaCode {}
// --8<-- [start:some_identifier]
  • Include it in your Markdown file with:
--8<-- "snippets/<path_to_your_file>:some_identifier"

I've split the work in multiple commits:

  • 4c32192: setup a new empty project.
  • 1666d3e: add and use the first code snippet.
  • 989868a: enable Dependabot on the snippets project.
  • 6b58402: add a new workflow to validate the snippets project.
  • e8d17e9: add documentation about the snippets project.

Once this PR is approved and merged, the next steps are:

  • Include all the other Java snippets from the website in this project.
  • Create a new kotlin module and include all the Kotlin snippets in it.
  • Include all the Groovy/Kotlin DSL snippets.

@MGaetan89 MGaetan89 requested review from hoisie and utzcoz September 25, 2024 06:11
@MGaetan89 MGaetan89 self-assigned this Sep 25, 2024
@utzcoz
Copy link
Member

utzcoz commented Sep 25, 2024

@MGaetan89 I am afraid of these code snippet becomes oudated very soon. I prefer to using snippet in Robolectric repository or previous other repository.

@MGaetan89
Copy link
Member Author

@MGaetan89 I am afraid of these code snippet becomes oudated very soon. I prefer to using snippet in Robolectric repository or previous other repository.

Not sure to understand your point.
Currently, these snippets are hardcoded inside each page and probably haven't changed in a long time. This would ensure that they are always working will the latest version of Robolectric.
Or are you suggesting to move them inside the robolectric/robolectric repository?

@MGaetan89 MGaetan89 force-pushed the create_java_snippets_project branch from 1666d3e to 48f6d51 Compare October 29, 2024 06:05
@utzcoz
Copy link
Member

utzcoz commented Nov 2, 2024

@MGaetan89 Maybe it is ready for merging?

@MGaetan89
Copy link
Member Author

@MGaetan89 Maybe it is ready for merging?

I wanted to add some documentation and update Dependabot first. I'll do it in a bit

@MGaetan89 MGaetan89 force-pushed the create_java_snippets_project branch 2 times, most recently from 7d697be to 5f3ffd6 Compare November 2, 2024 09:18
@MGaetan89 MGaetan89 force-pushed the create_java_snippets_project branch from 5f3ffd6 to 6b58402 Compare November 2, 2024 09:20
@MGaetan89
Copy link
Member Author

The PR should be complete now.

I've added the following commits:

  • 989868a: enable Dependabot on the snippets project. Now we will get one PR for all GitHub Actions, one PR for all Gradle dependencies, and one PR for each Python dependency.
  • 6b58402: add a new workflow to validate the snippets project (check code style, build, lint, and test the project).
  • e8d17e9: add documentation about the snippets project.

@MGaetan89 MGaetan89 marked this pull request as ready for review November 2, 2024 09:47
Copy link
Member

@utzcoz utzcoz left a comment

Choose a reason for hiding this comment

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

LGTM.

@MGaetan89 MGaetan89 merged commit 2e7d7ba into robolectric:master Nov 2, 2024
3 checks passed
@MGaetan89 MGaetan89 deleted the create_java_snippets_project branch November 2, 2024 10:10
MGaetan89 added a commit to MGaetan89/robolectric.github.io that referenced this pull request Nov 11, 2024
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