View Javadoc

1   /*
2   Karma core - Core of the Karma application
3   Copyright (C) 2004  Toolforge <www.toolforge.nl>
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19  package nl.toolforge.karma.core.cmd.util;
20  
21  import nl.toolforge.karma.core.manifest.Manifest;
22  import nl.toolforge.karma.core.module.Module;
23  
24  import java.io.File;
25  
26  /***
27   * The BuildEnvironment
28   *
29   * @author D.A. Smedes
30   * @version $Id: BuildEnvironment.java,v 1.11 2004/11/10 23:53:09 asmedes Exp $
31   */
32  public class BuildEnvironment {
33  
34    private Manifest manifest;
35    private Module module;
36  
37    public BuildEnvironment(Manifest manifest, Module module) {
38      this.manifest = manifest;
39      this.module = module;
40    }
41  
42    /***
43     * @deprecated Use {@link Manifest#getBuildBaseDirectory()} instead.
44     */
45    public File getBuildRootDirectory() {
46      return manifest.getBuildBaseDirectory();
47    }
48  
49    /***
50     * manifest/build/module; location where a modules' artifacts end up, like compiled classes,
51     * tests, packages, etc.
52     *
53     * @return
54     */
55    public File getModuleBuildRootDirectory() {
56      return new File(getBuildRootDirectory(), module.getName());
57    }
58  
59    /***
60     * manifest/build/module/build; location where a modules' classes have been compiled (the non-test classes).
61     *
62     * @return
63     */
64    public File getModuleBuildDirectory() {
65      return new File(getModuleBuildRootDirectory(), "build");
66    }
67  
68    /***
69     * manifest/build/module/test location where a modules' test classes have been compiled (the test classes).
70     *
71     * @return
72     */
73    public File getModuleTestBuildDirectory() {
74      return new File(getModuleBuildRootDirectory(), "test");
75    }
76  
77    public File getModuleJavadocDirectory() {
78      return new File(getModuleBuildRootDirectory(), "javadoc");
79    }
80  
81    public File getModulePackageDirectory() {
82      return new File(getModuleBuildRootDirectory(), "package");
83    }
84  
85    public File getModuleSourceDirectory() {
86      return new File(module.getBaseDir(), "src" + File.separator + "java");
87    }
88  
89    public File getModuleTestSourceDirectory() {
90      return new File(module.getBaseDir(), "test" + File.separator + "java");
91    }
92  
93    /***
94     * @deprecated Use {@link Manifest#getBuildBaseDirectory()} instead.
95     */
96    public File getManifestBuildDirectory() {
97  //    return new File(manifest.getBaseDirectory(), "build");
98      return manifest.getBuildBaseDirectory();
99    }
100 
101 }