Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1465 - in development/main/magic/spells/eclipse: . etc/deliverables/eclipses src/main/net/dpml/magic/eclipse

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: andreas.ronge AT jayway.se
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1465 - in development/main/magic/spells/eclipse: . etc/deliverables/eclipses src/main/net/dpml/magic/eclipse
  • Date: Wed, 12 Jan 2005 09:21:30 +0100

Author: andreas.ronge AT jayway.se
Date: Wed Jan 12 09:21:30 2005
New Revision: 1465

Added:

development/main/magic/spells/eclipse/etc/deliverables/eclipses/module-classpath.eclipse
Modified:
development/main/magic/spells/eclipse/build.xml

development/main/magic/spells/eclipse/etc/deliverables/eclipses/classpath.eclipse

development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
Log:
Fixed build problems
Added more configuration of eclipse spell

Modified: development/main/magic/spells/eclipse/build.xml
==============================================================================
--- development/main/magic/spells/eclipse/build.xml (original)
+++ development/main/magic/spells/eclipse/build.xml Wed Jan 12 09:21:30
2005
@@ -4,14 +4,14 @@
<magic:import uri="artifact:template:dpml/magic/standard"/>

<!-- example of usage
- <magic:import uri="artifact:template:dpml/magic/eclipse"/>
- -->
+ <magic:import uri="artifact:template:dpml/magic/eclipse"/ -->

<target name="init" depends="standard.init">
<x:filter feature="plugin" token="PLUGIN-URI"/>
</target>

<target name="build" depends="standard.build">
+
<x:export class="net.dpml.magic.eclipse.EclipseTask">
<antlib resource="net/dpml/magic/eclipse/antlib.xml"
urn="plugin:dpml/magic/dpml-magic-eclipse"/>

Modified:
development/main/magic/spells/eclipse/etc/deliverables/eclipses/classpath.eclipse
==============================================================================
---
development/main/magic/spells/eclipse/etc/deliverables/eclipses/classpath.eclipse
(original)
+++
development/main/magic/spells/eclipse/etc/deliverables/eclipses/classpath.eclipse
Wed Jan 12 09:21:30 2005
@@ -1,4 +1,4 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src/main"/>
- <classpathentry kind="output" path="target/classes"/>
<classpathentry kind="src" path="src/test" output="target/test-classes"/>
+ <classpathentry kind="output" path="target/classes"/>

Added:
development/main/magic/spells/eclipse/etc/deliverables/eclipses/module-classpath.eclipse
==============================================================================
--- (empty file)
+++
development/main/magic/spells/eclipse/etc/deliverables/eclipses/module-classpath.eclipse
Wed Jan 12 09:21:30 2005
@@ -0,0 +1,6 @@
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="api/src/main"/>
+ <classpathentry kind="src" path="impl/src/main"/>
+ <classpathentry kind="src" path="test/src/test"/>
+
+ <classpathentry kind="output" path="target/eclipse-classes"/>
\ No newline at end of file

Modified:
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
==============================================================================
---
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
(original)
+++
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
Wed Jan 12 09:21:30 2005
@@ -33,6 +33,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import java.util.StringTokenizer;

import net.dpml.magic.Index;
import net.dpml.magic.model.Definition;
@@ -59,12 +60,18 @@
{

/**
- * The ant filter for the classpath.eclipse artifact
+ * The ant filter token for the classpath.eclipse artifact
*/
public static final String PROJECT_NAME = "PROJECT_NAME";

+ /**
+ * name of the generated eclipse project file
+ */
public static final String PROJECT_FILENAME = ".project";

+ /**
+ * name of the generated eclipse project classpath file
+ */
public static final String CLASSPATH_FILENAME = ".classpath";

/**
@@ -81,6 +88,10 @@

private File m_classpathFile;

+ private String m_projectKeys;
+
+ private String m_projectName;
+
/**
* Creates the two eclipse project files
*
@@ -110,6 +121,56 @@
}

/**
+ * If this property is not set then the calling ant build.xml project key
+ * will be used. A comma separated list of projects.
+ *
+ * @param projectKeys the keys to the project we want to create an
eclipse
+ * project for
+ */
+ public void setProjectKeys( String projectKeys )
+ {
+ m_projectKeys = projectKeys;
+ }
+
+ /**
+ *
+ * @return a comma separated list of project keys that this eclipse
project
+ * contains
+ */
+ public String getProjectKeys()
+ {
+ if ( m_projectKeys == null || m_projectKeys.length() == 0 )
+ {
+ Context ctx = getContext();
+ return ctx.getKey();
+ }
+ return m_projectKeys;
+ }
+
+ /**
+ * The project name for the eclipse project. If this is not set then the
+ * projectKeys will be used instead
+ *
+ * @param projectName set the name of the eclipse project
+ */
+ public void setProjectName( String projectName )
+ {
+ m_projectName = projectName;
+ }
+
+ /**
+ * @return the name of the eclipse project
+ */
+ public String getProjectName()
+ {
+ if ( m_projectName == null || m_projectName.length() == 0 )
+ {
+ return getProjectKeys();
+ }
+ return m_projectName;
+ }
+
+ /**
*
* @param projectUri the artifact uri for the eclipse project file
*/
@@ -162,19 +223,17 @@
throw new BuildException( "Can't read from resource '"
+ m_projectFile.getAbsolutePath() );

- String targetLocation = TARGET_DIR + "/" + PROJECT_FILENAME;
- File targetFile = getProject().resolveFile( targetLocation );
-
Copy copy = new Copy();
copy.setProject( getProject() );
copy.setFile( m_projectFile );
+ String targetLocation = TARGET_DIR + "/" + PROJECT_FILENAME;
+ File targetFile = getProject().resolveFile( targetLocation );
copy.setTofile( targetFile );
copy.setOverwrite( true );
copy.setFiltering( true );

FilterSet filterSet = copy.createFilterSet();
- Definition projectDef = getProjectDefinition();
- filterSet.addFilter( PROJECT_NAME, projectDef.getKey() );
+ filterSet.addFilter( PROJECT_NAME, getProjectName() );

copy.execute();
}
@@ -196,36 +255,68 @@

appendClasspathHeader( writer );

- Definition projectDef = getProjectDefinition();
+ String keys = getProjectKeys();
+
+ StringTokenizer tokenizer = new StringTokenizer( keys, ", ", false );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String key = tokenizer.nextToken();
+ createProjectClasspath( writer, key );
+ }
+
+ writer.write( "</classpath>\n" );
+ writer.flush();
+ }
+
+ //
-------------------------------------------------------------------------
+ // private methods
+ //
-------------------------------------------------------------------------
+
+ private Set getExcludeKeysSet()
+ {
+ Set excludeKeys = new HashSet();
+ String keys = getProjectKeys();
+ StringTokenizer tokenizer = new StringTokenizer( keys, ", ", false );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String key = tokenizer.nextToken();
+ excludeKeys.add( key );
+ }
+
+ return excludeKeys;
+ }
+
+ private void createProjectClasspath( Writer writer, String key )
+ throws IOException
+ {
+ Set excludeKeys = getExcludeKeysSet();
+ Definition projectDef = getProjectDefinition( key );
ResourceRef[] resourceRefs = projectDef.getResourceRefs();
Collection resources = getResources( resourceRefs );
Iterator iter = resources.iterator();
while ( iter.hasNext() )
{
Resource resource = ( Resource ) iter.next();
+
+ if ( excludeKeys.contains( resource.getKey() ) )
+ {
+ continue;
+ }
+
Info info = resource.getInfo();
String type = info.getType();
if ( !"jar".equalsIgnoreCase( type ) )
continue;
writer.write( " " + getEclipseClasspath( resource ) + "\n" );
}
-
- writer.write( "</classpath>\n" );
- writer.flush();
}

- protected Definition getProjectDefinition()
+ private Definition getProjectDefinition( String key )
{
- Context ctx = getContext();
- String key = ctx.getKey();
Index index = getIndex();
return index.getDefinition( key );
}

- //
-------------------------------------------------------------------------
- // private methods
- //
-------------------------------------------------------------------------
-
private void appendClasspathHeader( Writer writer )
throws FileNotFoundException, IOException
{
@@ -264,7 +355,7 @@
}
finally
{
- closeStream(iInStream);
+ closeStream( iInStream );
}
}

@@ -355,5 +446,5 @@
}
}
}
-
+
}
\ No newline at end of file



  • svn commit: r1465 - in development/main/magic/spells/eclipse: . etc/deliverables/eclipses src/main/net/dpml/magic/eclipse, andreas . ronge, 01/12/2005

Archive powered by MHonArc 2.6.24.

Top of Page