View Javadoc

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.cpptasks;
21  
22  import java.io.File;
23  
24  import org.apache.tools.ant.BuildException;
25  
26  import com.github.maven_nar.cpptasks.types.ConditionalFileSet;
27  
28  /**
29   * Specifies files that should not be compiled using precompiled headers.
30   *
31   * @author Curt Arnold
32   */
33  public final class PrecompileExceptDef {
34    private ConditionalFileSet localSet = null;
35    /**
36     * Collection of <fileset>contained by definition
37     */
38    private final PrecompileDef owner;
39  
40    /**
41     * Constructor
42     * 
43     */
44    public PrecompileExceptDef(final PrecompileDef owner) {
45      this.owner = owner;
46    }
47  
48    /**
49     * Adds filesets that specify files that should not be processed using
50     * precompiled headers.
51     * 
52     * @param exceptSet
53     *          FileSet specify files that should not be processed with
54     *          precompiled headers enabled.
55     */
56    public void addFileset(final ConditionalFileSet exceptSet) {
57      this.owner.appendExceptFileSet(exceptSet);
58    }
59  
60    public void execute() throws org.apache.tools.ant.BuildException {
61      throw new org.apache.tools.ant.BuildException("Not an actual task, but looks like one for documentation purposes");
62    }
63  
64    /**
65     * Sets the base-directory
66     */
67    public void setDir(final File dir) throws BuildException {
68      if (this.localSet == null) {
69        this.localSet = new ConditionalFileSet();
70        this.owner.appendExceptFileSet(this.localSet);
71      }
72      this.localSet.setDir(dir);
73    }
74  
75    /**
76     * Comma or space separated list of file patterns that should not be
77     * compiled using precompiled headers.
78     * 
79     * @param includes
80     *          the string containing the include patterns
81     */
82    public void setIncludes(final String includes) {
83      if (this.localSet == null) {
84        this.localSet = new ConditionalFileSet();
85        this.owner.appendExceptFileSet(this.localSet);
86      }
87      this.localSet.setIncludes(includes);
88    }
89  }