Browse Source

A project may now have a name attribute.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271304 13f79535-47bb-0310-9956-ffa450edef68
master
adammurdoch 23 years ago
parent
commit
8b39211862
5 changed files with 61 additions and 8 deletions
  1. +20
    -0
      proposal/myrmidon/docs/index.html
  2. +23
    -3
      proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProject.java
  3. +3
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  4. +10
    -5
      proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Project.java
  5. +5
    -0
      proposal/myrmidon/src/xdocs/index.xml

+ 20
- 0
proposal/myrmidon/docs/index.html View File

@@ -298,6 +298,26 @@ take the following attributes:
<font color="#000000" size="-1" face="arial,helvetica,sanserif"> <font color="#000000" size="-1" face="arial,helvetica,sanserif">
Default Value Default Value
</font> </font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
name
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
The project name.
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
The name of the project file, with the extension removed.
</font>
</td> </td>
</tr> </tr>
<tr> <tr>


+ 23
- 3
proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProject.java View File

@@ -46,6 +46,25 @@ public class DefaultProject
///The base directory of project ///The base directory of project
private File m_baseDirectory; private File m_baseDirectory;


///The project name
private String m_name;

/**
* Returns the project name.
*/
public String getProjectName()
{
return m_name;
}

/**
* Sets the project name.
*/
public void setProjectName( String name )
{
m_name = name;
}

/** /**
* Get the imports for project. * Get the imports for project.
* *
@@ -111,7 +130,7 @@ public class DefaultProject
/** /**
* Retrieve a target by name. * Retrieve a target by name.
* *
* @param name the name of target
* @param targetName the name of target
* @return the Target or null if no target exists with name * @return the Target or null if no target exists with name
*/ */
public final Target getTarget( final String targetName ) public final Target getTarget( final String targetName )
@@ -151,14 +170,15 @@ public class DefaultProject


/** /**
* Retrieve base directory of project. * Retrieve base directory of project.
*
* @return the projects base directory
*/ */
public final void setBaseDirectory( final File baseDirectory ) public final void setBaseDirectory( final File baseDirectory )
{ {
m_baseDirectory = baseDirectory; m_baseDirectory = baseDirectory;
} }


/**
* Adds a type library import to the project.
*/
public final void addTypeLib( final TypeLib typeLib ) public final void addTypeLib( final TypeLib typeLib )
{ {
m_imports.add( typeLib ); m_imports.add( typeLib );


+ 3
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java View File

@@ -128,6 +128,8 @@ public class DefaultProjectBuilder
} }


//get project-level attributes //get project-level attributes
final String projectName = configuration.getAttribute( "name",
FileUtil.removeExtension(file.getName()) );
final String baseDirectoryName = configuration.getAttribute( "basedir", null ); final String baseDirectoryName = configuration.getAttribute( "basedir", null );
final String defaultTarget = configuration.getAttribute( "default", "main" ); final String defaultTarget = configuration.getAttribute( "default", "main" );
final Version version = getVersion( configuration ); final Version version = getVersion( configuration );
@@ -156,6 +158,7 @@ public class DefaultProjectBuilder


//create project and ... //create project and ...
final DefaultProject project = new DefaultProject(); final DefaultProject project = new DefaultProject();
project.setProjectName( projectName );
project.setDefaultTargetName( defaultTarget ); project.setDefaultTargetName( defaultTarget );
project.setBaseDirectory( baseDirectory ); project.setBaseDirectory( baseDirectory );




+ 10
- 5
proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Project.java View File

@@ -14,9 +14,6 @@ import org.apache.avalon.framework.component.Component;
* Abstraction used to interact with projects. * Abstraction used to interact with projects.
* Implementations may choose to structure it anyway they choose. * Implementations may choose to structure it anyway they choose.
* *
* TODO: Determine if projects should carry their own name. Breaks IOC but
* Can be useful as project files embed own name (or should that be description).
*
* @author <a href="mailto:peter@apache.org">Peter Donald</a> * @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Revision$ $Date$ * @version $Revision$ $Date$
*/ */
@@ -34,6 +31,14 @@ public interface Project
// the name of currently executing target // the name of currently executing target
//String TARGET = "myrmidon.target.name"; //String TARGET = "myrmidon.target.name";


/**
* Returns the project name.
*
* TODO: Determine if projects should carry their own name. Breaks IOC but
* Can be useful as project files embed own name (or should that be description).
*/
String getProjectName();

/** /**
* Get the imports for project. * Get the imports for project.
* *
@@ -42,14 +47,14 @@ public interface Project
TypeLib[] getTypeLibs(); TypeLib[] getTypeLibs();


/** /**
* Get names of projects referred to by this project.
* Get names of projects referenced by this project.
* *
* @return the names * @return the names
*/ */
String[] getProjectNames(); String[] getProjectNames();


/** /**
* Retrieve project reffered to by this project.
* Retrieve project referenced by this project.
* *
* @param name the project name * @param name the project name
* @return the Project or null if none by that name * @return the Project or null if none by that name


+ 5
- 0
proposal/myrmidon/src/xdocs/index.xml View File

@@ -174,6 +174,11 @@ take the following attributes:


<table> <table>
<tr><th>Attribute</th><th>Description</th><th>Default Value</th></tr> <tr><th>Attribute</th><th>Description</th><th>Default Value</th></tr>
<tr>
<td>name</td>
<td>The project name.</td>
<td>The name of the project file, with the extension removed.</td>
</tr>
<tr> <tr>
<td>basedir</td> <td>basedir</td>
<td>The base directory for the project.</td> <td>The base directory for the project.</td>


Loading…
Cancel
Save