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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MGaetan89
Copy link
Member

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"

Note

This PR is currently in draft to gather feedback regarding this approach before going any further with it.
The first commit (4c32192) focuses on creating a new empty project. There's nothing fancy there.
The second one (1666d3e) integrates the Java snippet from Robolectric's homepage.

If this solution is fine for you, before merging this PR, I'll add the following to it:

  • An update to the main Readme file to explain how snippets work.
  • A Readme file in the snippets project explaining its goal.
  • A new GitHub Actions to:
    • Check the code style of the snippets project.
    • Compile and test the snippets project.
  • Enable Dependabot for Gradle.

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 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?

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