1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.github.maven_nar;
21
22 import java.io.File;
23
24 import org.apache.maven.plugin.MojoExecutionException;
25 import org.apache.maven.plugin.MojoFailureException;
26 import org.apache.maven.plugins.annotations.Parameter;
27
28
29
30
31
32
33 public abstract class AbstractGnuMojo extends AbstractResourcesMojo {
34
35
36
37 @Parameter(defaultValue = "nar.gnu.useonwindows", required = true)
38 private boolean gnuUseOnWindows;
39
40
41
42
43 @Parameter(defaultValue = "${basedir}/src/gnu")
44 private File gnuSourceDirectory;
45
46
47
48
49 @Parameter(defaultValue = "${project.build.directory}/nar/gnu")
50 private File gnuTargetDirectory;
51
52
53
54
55
56
57 private File getGnuAOLDirectory() throws MojoFailureException, MojoExecutionException {
58 return new File(this.gnuTargetDirectory, getAOL().toString());
59 }
60
61
62
63
64
65
66 protected final File getGnuAOLSourceDirectory() throws MojoFailureException, MojoExecutionException {
67 return new File(getGnuAOLDirectory(), "src");
68 }
69
70
71
72
73
74
75 protected final File getGnuAOLTargetDirectory() throws MojoFailureException, MojoExecutionException {
76 return new File(getGnuAOLDirectory(), "target");
77 }
78
79 protected final File getGnuSourceDirectory() {
80 return this.gnuSourceDirectory;
81 }
82
83
84
85
86
87
88 protected final boolean useGnu() {
89 return this.gnuUseOnWindows || !NarUtil.isWindows();
90 }
91 }