Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/main/java/com/cosium/code/format/InstallHooksMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ public class InstallHooksMojo extends AbstractMavenGitCodeFormatMojo {
@Parameter(property = "gcf.propertiesToAdd")
private String[] propertiesToAdd;

/**
* The list of preliminary Maven goals to invoke before invoking the main
* git-code-format:on-pre-commit goal from the pre-commit script.
*/
@Parameter(property = "gcf.preliminaryGoals")
private String[] preliminaryGoals;

@Parameter(property = "gcf.debug", defaultValue = "false")
private boolean debug;

Expand Down Expand Up @@ -124,6 +131,7 @@ private void writePluginHooks(Path hooksDirectory) throws IOException {
StandardCharsets.UTF_8.toString(),
mavenEnvironment.getMavenExecutable(debug).toAbsolutePath(),
pomFile().toAbsolutePath(),
preliminaryMavenGoalsToInvoke(),
mavenCliArguments());
getLog().debug("Written plugin pre commit hook file");
}
Expand All @@ -141,6 +149,10 @@ private void configureHookBaseScripts(Path hooksDirectory) throws IOException {
basePreCommitHook.appendCommandCall(preCommitHookBaseScriptCall());
}

private String preliminaryMavenGoalsToInvoke() {
return Stream.of(preliminaryGoals).collect(Collectors.joining(" "));
}

private String mavenCliArguments() {
Stream<String> propagatedProperties =
ofNullable(propertiesToPropagate)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
set -e
%s -f %s com.cosium.code:git-code-format-maven-plugin:on-pre-commit %s
%s -f %s %s com.cosium.code:git-code-format-maven-plugin:on-pre-commit %s
Loading