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

feat(java): projenrc.java #470

Merged
merged 2 commits into from
Jan 7, 2021
Merged

feat(java): projenrc.java #470

merged 2 commits into from
Jan 7, 2021

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Jan 7, 2021

If projenrcJava is set to true for java projects (or --projenrc-java switch is provided in projen new, the java project will support writing your projenrc file in java (yeah!).

In this case, the projenrc file will be located under src/test/java/projenrc.java and projen synth will take care to compile it and execute it with a dependency on com.github.eladb/projen.

Next steps:

  1. The CLI should auto-detect the synth task and defer to it when pj is executed without a subcommand. This will allow projects to customize how synth is performed for each language.
  2. Currently projen new will still generate a .projenrc.js file, but this should be moved from the CLI to the library and then java.Projenrc should generate the Java equivalent in the right location when the project is bootstrapped. That should be fun.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Elad Ben-Israel added 2 commits January 7, 2021 14:01
If `projenrc` is set to `true` for java projects, a `synth` task will be added which will execute the Java program under `src/test/java/projenrc.java`. This enables writing your projenrc files in java (for java projects).

Enabling this will add a test dependency on `com.github.eladb/projen` and a task called `synth` which will compile the code and run it.

So your workflow is to update `projenrc.java` and run `pj synth`.

In a subsequent commit, we will auto-detect the `synth` task and use it when `pj` is executed without any subcommand, so projects can customize their synthesize task.
@mergify mergify bot added the contribution/core ⚙️ used by automation label Jan 7, 2021
@eladb eladb changed the title feat(java): support projenrc in java feat(java): projenrc.java Jan 7, 2021
@mergify mergify bot merged commit 9d099f6 into master Jan 7, 2021
@mergify mergify bot deleted the benisrae/java-projenrc branch January 7, 2021 12:11
execute this program.

By default, `projenrc.java` is placed under the `test` scope (and
`com.github.eladb/projen` test dependency is added). This ensures that
Copy link
Contributor

Choose a reason for hiding this comment

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

Above it says org.projen/projen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The group id is com.github.eladb but the java package is org.projen. I was just lazy to create a new group ID for projen at the moment, but we can do that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core ⚙️ used by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants