1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.hazendaz.maven.makeself;
19
20 import java.nio.file.Files;
21 import java.nio.file.Path;
22
23 import org.apache.maven.plugin.MojoExecutionException;
24 import org.apache.maven.plugin.MojoFailureException;
25 import org.apache.maven.plugins.annotations.LifecyclePhase;
26 import org.apache.maven.plugins.annotations.Mojo;
27 import org.apache.maven.plugins.annotations.Parameter;
28
29
30
31
32
33
34
35
36
37
38
39
40 @Mojo(name = "git", defaultPhase = LifecyclePhase.NONE, requiresProject = false)
41 public class GitMojo extends AbstractGitMojo {
42
43
44 @Parameter(defaultValue = "false", property = "makeself.skip")
45 private boolean skip;
46
47 @Override
48 public void execute() throws MojoExecutionException, MojoFailureException {
49
50 if (this.gitPath == null) {
51 this.gitPath = "";
52 }
53
54
55 if (this.skip) {
56 this.getLog().info("Makeself git is skipped");
57 return;
58 }
59
60 if (!this.isWindows()) {
61 this.getLog().info("Portable git is only applicable on Windows; skipping on this platform");
62 return;
63 }
64
65
66 if (!this.gitPath.isEmpty() && Files.exists(Path.of(this.gitPath))) {
67 this.getLog().info("Using existing 'Git' found at " + this.gitPath);
68 this.gitPath = this.gitPath + AbstractGitMojo.GIT_USER_BIN;
69 } else {
70
71 this.checkGitSetup();
72 }
73
74 this.getLog().info("Portable git is available at: " + this.gitPath);
75 }
76
77 }