1 package org.apache.maven.plugin.cxx.utils;
2
3 /*
4 * Copyright (C) 2011-2016, Neticoa SAS France - Tous droits réservés.
5 * Author(s) : Franck Bonin, Neticoa SAS France
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 *
19 */
20
21 import org.apache.maven.model.Dependency;
22 import org.apache.maven.plugins.annotations.Parameter;
23
24 import org.apache.maven.artifact.Artifact;
25 import org.codehaus.plexus.util.StringUtils;
26
27 /**
28 *
29 * @author fbonin
30 *
31 */
32 public class SourceTarget
33 {
34 /**
35 * Option 3 (highest priority). Provide explicit target path for each source dependency
36 *
37 * @since 0.0.6
38 */
39 @Parameter( )
40 public String targetDir;
41
42 /**
43 * Option 3 (highest priority). Provide explicit target path for each source dependency
44 *
45 * @since 0.0.6
46 */
47 @Parameter( )
48 public Dependency dependency;
49
50 /**
51 * test if provides artifact match this external dependency
52 *
53 * @since 0.0.6
54 */
55 public boolean dependencyMatch( Artifact artifact )
56 {
57 return dependency != null && artifact != null
58 && StringUtils.equals( dependency.getGroupId(), artifact.getGroupId() )
59 && StringUtils.equals( dependency.getArtifactId(), artifact.getArtifactId() )
60 && ( StringUtils.isEmpty( dependency.getVersion() )
61 || StringUtils.equals( dependency.getVersion(), artifact.getVersion() ) )
62 // ignore type since if not provided, Dependency class force it to "jar"
63 // but for source dependencies it is always "pom"
64 /*&& ( StringUtils.isEmpty( dependency.getType() )
65 || StringUtils.equals( dependency.getType(), artifact.getType() ) )*/;
66 }
67 }