1 /*
2 * #%L
3 * Native ARchive plugin for Maven
4 * %%
5 * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
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.project.MavenProject;
27 import org.apache.maven.project.MavenProjectHelper;
28 import org.codehaus.plexus.archiver.manager.ArchiverManager;
29
30 /**
31 * Interface to define the layout of nar files (executables, libs, include dirs)
32 * in both the repository (local,
33 * unpacked) as well as in target.
34 *
35 * @author Mark Donszelmann (Mark.Donszelmann@gmail.com)
36 */
37 public interface NarLayout {
38 /**
39 * Called to attach nars to main nar/jar file. This method needs to produce
40 * all the attached nar archive files.
41 */
42 void
43 attachNars(File baseDir, ArchiverManager archiverManager, MavenProjectHelper projectHelper, MavenProject project)
44 throws MojoExecutionException, MojoFailureException;
45
46 /**
47 * Specifies where binaries are stored
48 *
49 * @return
50 */
51 File getBinDirectory(File baseDir, String artifactId, String version, String aol)
52 throws MojoExecutionException, MojoFailureException;
53
54 /**
55 * Specifies where includes are stored
56 *
57 * @return
58 */
59 File getIncludeDirectory(File baseDir, String artifactId, String version)
60 throws MojoExecutionException, MojoFailureException;
61
62 /**
63 * Specifies where libraries are stored
64 *
65 * @return
66 * @throws MojoExecutionException
67 * , MojoFailureException
68 */
69 File getLibDirectory(File baseDir, String artifactId, String version, String aol, String type)
70 throws MojoExecutionException, MojoFailureException;
71
72 /**
73 * Returns the unpack directory of a specific nar file.
74 */
75 File getNarUnpackDirectory(File baseUnpackDirectory, File narFile);
76
77 /**
78 * Specifies where all the "no architecture" specific files are stored
79 */
80 File getNoArchDirectory(File baseDir, String artifactId, String version)
81 throws MojoExecutionException, MojoFailureException;
82
83 /**
84 * Called to attach nars to main nar/jar file. This method needs to set
85 * NarInfo accordingly so it can be included in the nar archive.
86 */
87 void prepareNarInfo(File baseDir, MavenProject project, NarInfo narInfo, AbstractNarMojo libraryName)
88 throws MojoExecutionException;
89
90 /**
91 * Called to unpack a nar file
92 *
93 * @param defaultAOL
94 * @param linkerName
95 */
96 void
97 unpackNar(File baseDir, ArchiverManager archiverManager, File file, String os, String linkerName, AOL defaultAOL)
98 throws MojoExecutionException, MojoFailureException;
99
100 }