Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1950 - in development/laboratory/spells: eclipse eclipse/task eclipse/task/src eclipse/task/src/main eclipse/task/src/main/net eclipse/task/src/main/net/dpml eclipse/task/src/main/net/dpml/magic eclipse/task/src/main/net/dpml/magic/spells eclipse/task/src/main/net/dpml/magic/spells/eclipse eclipse/test emma emma/etc emma/etc/deliverables emma/etc/deliverables/templates emma/src emma/src/main emma/src/main/net emma/src/main/net/dpml emma/src/main/net/dpml/magic emma/src/main/net/dpml/magic/emma emma/src/main/net/dpml/magic/emma/example emma/src/test emma/src/test/net emma/src/test/net/dpml emma/src/test/net/dpml/magic emma/src/test/net/dpml/magic/emma emma/src/test/net/dpml/magic/emma/test upload upload/etc upload/etc/deliverables upload/etc/deliverables/templates upload/src upload/src/main upload/src/main/net upload/src/main/net/dpml upload/src/main/net/dpml/magic upload/src/main/net/dpml/magic/spells upload/src/main/net/dpml/magic/spells/upload

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1950 - in development/laboratory/spells: eclipse eclipse/task eclipse/task/src eclipse/task/src/main eclipse/task/src/main/net eclipse/task/src/main/net/dpml eclipse/task/src/main/net/dpml/magic eclipse/task/src/main/net/dpml/magic/spells eclipse/task/src/main/net/dpml/magic/spells/eclipse eclipse/test emma emma/etc emma/etc/deliverables emma/etc/deliverables/templates emma/src emma/src/main emma/src/main/net emma/src/main/net/dpml emma/src/main/net/dpml/magic emma/src/main/net/dpml/magic/emma emma/src/main/net/dpml/magic/emma/example emma/src/test emma/src/test/net emma/src/test/net/dpml emma/src/test/net/dpml/magic emma/src/test/net/dpml/magic/emma emma/src/test/net/dpml/magic/emma/test upload upload/etc upload/etc/deliverables upload/etc/deliverables/templates upload/src upload/src/main upload/src/main/net upload/src/main/net/dpml upload/src/main/net/dpml/magic upload/src/main/net/dpml/magic/spells upload/src/main/net/dpml/magic/spells/upload
  • Date: Fri, 04 Mar 2005 10:02:58 +0100

Author: mcconnell
Date: Fri Mar 4 10:02:56 2005
New Revision: 1950

Added:
development/laboratory/spells/eclipse/
development/laboratory/spells/eclipse/build.xml
development/laboratory/spells/eclipse/index.xml
development/laboratory/spells/eclipse/task/
development/laboratory/spells/eclipse/task/build.xml
development/laboratory/spells/eclipse/task/src/
development/laboratory/spells/eclipse/task/src/main/
development/laboratory/spells/eclipse/task/src/main/net/
development/laboratory/spells/eclipse/task/src/main/net/dpml/
development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/
development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/

development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/

development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/EclipseTask.java

development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/antlib.xml
development/laboratory/spells/eclipse/test/
development/laboratory/spells/eclipse/test/build.xml
development/laboratory/spells/emma/
development/laboratory/spells/emma/build.xml
development/laboratory/spells/emma/emma-build.xml
development/laboratory/spells/emma/etc/
development/laboratory/spells/emma/etc/deliverables/
development/laboratory/spells/emma/etc/deliverables/templates/
development/laboratory/spells/emma/etc/deliverables/templates/emma.template
development/laboratory/spells/emma/index.xml
development/laboratory/spells/emma/src/
development/laboratory/spells/emma/src/main/
development/laboratory/spells/emma/src/main/net/
development/laboratory/spells/emma/src/main/net/dpml/
development/laboratory/spells/emma/src/main/net/dpml/magic/
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/antlib.xml
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/example/

development/laboratory/spells/emma/src/main/net/dpml/magic/emma/example/Echo.java
development/laboratory/spells/emma/src/test/
development/laboratory/spells/emma/src/test/net/
development/laboratory/spells/emma/src/test/net/dpml/
development/laboratory/spells/emma/src/test/net/dpml/magic/
development/laboratory/spells/emma/src/test/net/dpml/magic/emma/
development/laboratory/spells/emma/src/test/net/dpml/magic/emma/test/

development/laboratory/spells/emma/src/test/net/dpml/magic/emma/test/EchoTest.java
development/laboratory/spells/upload/
development/laboratory/spells/upload/build.xml
development/laboratory/spells/upload/etc/
development/laboratory/spells/upload/etc/deliverables/
development/laboratory/spells/upload/etc/deliverables/templates/
development/laboratory/spells/upload/etc/deliverables/templates/magic.xml
development/laboratory/spells/upload/src/
development/laboratory/spells/upload/src/main/
development/laboratory/spells/upload/src/main/net/
development/laboratory/spells/upload/src/main/net/dpml/
development/laboratory/spells/upload/src/main/net/dpml/magic/
development/laboratory/spells/upload/src/main/net/dpml/magic/spells/
development/laboratory/spells/upload/src/main/net/dpml/magic/spells/upload/

development/laboratory/spells/upload/src/main/net/dpml/magic/spells/upload/UploadTask.java
Log:


Added: development/laboratory/spells/eclipse/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/eclipse/build.xml Fri Mar 4 10:02:56
2005
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="eclipse" default="default" basedir="."
+ xmlns:x="antlib:net.dpml.magic" xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:init/>
+ <import file="${dpml.templates}/reactor.xml"/>
+
+</project>

Added: development/laboratory/spells/eclipse/index.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/eclipse/index.xml Fri Mar 4 10:02:56
2005
@@ -0,0 +1,33 @@
+
+<index>
+
+ <!-- Unrecognized element type "plugin" found in index.
+ <import index="../../index.xml"/>-->
+
+ <import index="../../../../main/magic/index.xml"/>-->
+
+ <project basedir="task">
+ <info>
+ <group>dpml/magic/spells/eclipse</group>
+ <name>dpml-magic-eclipse</name>
+ <version>1.0</version>
+ <status>SNAPSHOT</status>
+ </info>
+ <dependencies>
+ <include key="dpml-magic-core"/>
+ </dependencies>
+ </project>
+
+ <project basedir="test">
+ <info>
+ <group>dpml/magic/spells/eclipse</group>
+ <name>dpml-magic-eclipse-test</name>
+ <version>1.0</version>
+ <status>SNAPSHOT</status>
+ </info>
+ <plugins>
+ <include key="dpml-magic-eclipse"/>
+ </plugins>
+ </project>
+
+</index>

Added: development/laboratory/spells/eclipse/task/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/eclipse/task/build.xml Fri Mar 4
10:02:56 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<project name="dpml-magic-eclipse" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="antlib:net.dpml.magic">
+
+ <transit:init/>
+ <import file="${dpml.templates}/standard.xml"/>
+
+ <target name="package" depends="standard.package">
+ <x:export>
+ <antlib resource="net/dpml/magic/spells/eclipse/antlib.xml"
+ urn="antlib:net.dpml.magic.spells.eclipse"/>
+ </x:export>
+ </target>
+
+</project>

Added:
development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/EclipseTask.java
==============================================================================
--- (empty file)
+++
development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/EclipseTask.java
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2004 Cameron Taggart
+ * Copyright 2004 Dwango Wireless
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.magic.spells.eclipse;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import net.dpml.magic.Index;
+import net.dpml.magic.project.Context;
+import net.dpml.magic.model.*;
+//import org.apache.avalon.tools.model.Home;
+//import org.apache.avalon.tools.model.Info;
+//import org.apache.avalon.tools.model.Resource;
+//import org.apache.avalon.tools.model.ResourceRef;
+//import org.apache.avalon.tools.tasks.SystemTask;
+import net.dpml.magic.tasks.*;
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Create Eclipse project files.
+ *
+ * @author Cameron Taggart
+ * @version $Revision: 1.2 $ $Date: 2004/11/05 18:10:41 $
+ */
+public class EclipseTask extends ContextualTask {
+
+ private static final String pad = " ";
+
+ private static final String newline = "\n";
+
+ public void execute() throws BuildException {
+
+ createProject( getProject().resolveFile( ".project" ) );
+ createClasspath( getProject().resolveFile( ".classpath" ) );
+ }
+
+ private void createProject( File project ) {
+
+ Definition projectDef = getProjectDefinition();
+
+ StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
+ pad(sb, 0);
+ sb.append("<projectDescription>");
+ pad(sb, 1);
+ sb.append("<name>");
+ sb.append(projectDef.getKey());
+ sb.append("</name>");
+ pad(sb, 1);
+ sb.append("<comment></comment>");
+ pad(sb, 1);
+ sb.append("<projects></projects>");
+ pad(sb, 1);
+ sb.append("<buildSpec>");
+ pad(sb, 2);
+ sb.append("<buildCommand>");
+ pad(sb, 3);
+ sb.append("<name>org.eclipse.jdt.core.javabuilder</name>");
+ pad(sb, 3);
+ sb.append("<arguments></arguments>");
+ pad(sb, 2);
+ sb.append("</buildCommand>");
+ pad(sb, 1);
+ sb.append("</buildSpec>");
+ pad(sb, 1);
+
sb.append("<natures><nature>org.eclipse.jdt.core.javanature</nature></natures>");
+ pad(sb, 0);
+ sb.append("</projectDescription>");
+
+ System.out.println(sb);
+
+ write( project, sb.toString().getBytes());
+ }
+
+ private void createClasspath( File classpath ) {
+ StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
+ pad(sb, 0);
+ sb.append("<classpath>");
+ pad(sb, 1);
+ sb.append("<classpathentry kind=\"con\"
path=\"org.eclipse.jdt.launching.JRE_CONTAINER\"/>");
+ pad(sb, 1);
+ sb.append("<classpathentry kind=\"src\" path=\"src/main\"/>");
+ pad(sb, 1);
+ sb.append("<classpathentry kind=\"output\"
path=\"target/classes\"/>");
+ pad(sb, 1);
+ sb.append("<classpathentry kind=\"src\" path=\"src/test\"
output=\"target/test-classes\"/>");
+
+ Definition projectDef = getProjectDefinition();
+ ResourceRef[] rrs = projectDef.getResourceRefs();
+ ArrayList resources = getResources(rrs);
+
+ //for (int i = 0; i < rs.length; i++) {
+ for(int i=0,n=resources.size();i<n;i++){
+ pad(sb, 1);
+ Resource resource = (Resource) resources.get(i);
+ //sb.append(getEclipseClasspath(rs[i]));
+ sb.append(getEclipseClasspath(resource));
+ }
+
+ pad(sb, 0);
+ sb.append("</classpath>");
+
+ System.out.println(sb);
+
+ write(classpath, sb.toString().getBytes());
+ }
+
+ private void pad(StringBuffer sb, int n) {
+ sb.append(newline);
+ for (int i = 0; i < n; i++) {
+ sb.append(pad);
+ }
+ }
+
+ private void write(File file, byte[] ba) {
+
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(file);
+ fos.write(ba);
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("unable to write file: " +
file, e);
+ } catch (IOException e) {
+ throw new RuntimeException("unable to write file: " +
file, e);
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e1) {
+ // ignore
+ }
+ }
+ }
+
+ }
+
+ private Definition getProjectDefinition() {
+ Context ctx = getContext();
+ String key = ctx.getKey();
+ ResourceRef ref = new ResourceRef(key);
+// Home home = getHome();
+// return home.getDefinition(ref);
+ Index index = getIndex();
+ return index.getDefinition(ref);
+ }
+
+// private Resource[] getResources(ResourceRef[] rrs) {
+// Resource[] rs = new Resource[rrs.length];
+// for (int i = 0; i < rrs.length; i++) {
+// rs[i] = getHome().getResource(rrs[i]);
+// }
+// return rs;
+// }
+
+ // 2004-10-25 made it recursive, resources of resources
+ private ArrayList getResources(ResourceRef[] rrs) {
+ //Resource[] rs = new Resource[rrs.length];
+ ArrayList resources = new ArrayList();
+ for (int i = 0; i < rrs.length; i++) {
+// rs[i] = getHome().getResource(rrs[i]);
+ Resource r = getIndex().getResource(rrs[i]);
+ resources.add(r);
+ resources.addAll( getResources( r.getResourceRefs() )
); // recursive
+ }
+ return resources;
+ }
+
+ // <classpathentry kind="var"
path="MAGIC_HOME/main/ant/jars/ant-1.6.2.jar"/>
+ private String getEclipseClasspath(Resource r) {
+ Info info = r.getInfo();
+ StringBuffer sb = new StringBuffer();
+ sb.append("<classpathentry kind=\"var\"
path=\"MAGIC_HOME/main/");
+ sb.append(info.getGroup());
+ sb.append("/jars/");
+ sb.append(info.getName());
+ if (info.getVersion() != null) {
+ sb.append("-");
+ sb.append(info.getVersion());
+ }
+ sb.append(".");
+ sb.append(info.getType());
+ sb.append("\"/>");
+ return sb.toString();
+ }
+
+}
\ No newline at end of file

Added:
development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/antlib.xml
==============================================================================
--- (empty file)
+++
development/laboratory/spells/eclipse/task/src/main/net/dpml/magic/spells/eclipse/antlib.xml
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<antlib>
+
+ <!-- taskdefs -->
+ <taskdef name="eclipse"
classname="net.dpml.magic.spells.eclipse.EclipseTask"/>
+
+</antlib>

Added: development/laboratory/spells/eclipse/test/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/eclipse/test/build.xml Fri Mar 4
10:02:56 2005
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<project name="dpml-magic-eclipse-test" default="eclipse" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="antlib:net.dpml.magic"
+ xmlns:ide="antlib:net.dpml.magic.spells.eclipse">
+
+ <transit:init/>
+ <import file="${dpml.templates}/standard.xml"/>
+
+ <target name="eclipse" depends="init">
+ <ide:eclipse/>
+ </target>
+
+</project>

Added: development/laboratory/spells/emma/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/emma/build.xml Fri Mar 4 10:02:56
2005
@@ -0,0 +1,23 @@
+<project name="dpml-magic-emma" default="install" basedir="."
+ xmlns:magic="antlib:net.dpml.magic"
xmlns:x="plugin:dpml/magic/dpml-magic-core" >
+
+ <magic:import uri="artifact:template:dpml/magic/standard"/>
+
+ <!-- example of usage
+ <magic:import uri="artifact:template:dpml/magic/emma"/>
+ -->
+
+ <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="com.vladium.emma.emmaTask">
+ <antlib resource="net/dpml/magic/emma/antlib.xml"
+ urn="plugin:dpml/magic/dpml-magic-emma"/>
+ </x:export>
+ </target>
+
+</project>

Added: development/laboratory/spells/emma/emma-build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/emma/emma-build.xml Fri Mar 4 10:02:56
2005
@@ -0,0 +1,23 @@
+<project name="dpml-magic-emma" default="install" basedir="."
+ xmlns:magic="antlib:net.dpml.magic">
+
+ <magic:import uri="artifact:template:dpml/magic/emma"/>
+ <magic:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="init" depends="standard.init">
+ </target>
+ <target name="build" depends="standard.build, emma"
+ description="emma prepare task">
+
+ <path id="run.classpath" >
+
+ <fileset dir="target/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </path>
+ <mkdir dir="target/coverage"/>
+
+ </target>
+
+
+</project>
\ No newline at end of file

Added:
development/laboratory/spells/emma/etc/deliverables/templates/emma.template
==============================================================================
--- (empty file)
+++
development/laboratory/spells/emma/etc/deliverables/templates/emma.template
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="emma"
+ xmlns:magic="antlib:net.dpml.magic" >
+
+ <magic:import uri="artifact:template:dpml/magic/standard"/>
+ <target name="emma" depends="prepare" description="the wrapped emma task">
+
+ <magic:plugin uri="@PLUGIN-URI@"/>
+ <emma
+ xmlns="plugin:dpml/magic/dpml-magic-emma" enabled="true"
+ description="the wrapped emma code coverage ant task" >
+ <instr instrpathref="run.classpath"
+ destdir="target/emma-classes"
+ metadatafile="target/coverage/metadata.emma"
+ merge="true"
+ />
+ </emma>
+ </target>
+
+</project>

Added: development/laboratory/spells/emma/index.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/emma/index.xml Fri Mar 4 10:02:56
2005
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<index>
+ <import index="../../../../main/magic/index.xml"/>
+ <resource>
+ <info>
+ <group>emma</group>
+ <name>emma</name>
+ <version>2.0.4217</version>
+ <type>jar</type>
+ </info>
+ </resource>
+ <resource>
+ <info>
+ <group>emma</group>
+ <name>emma_ant</name>
+ <version>2.0.4217</version>
+ <type>jar</type>
+ </info>
+ </resource>
+ <resource>
+ <info>
+ <group>junit</group>
+ <name>junit</name>
+ <version>3.8.1</version>
+ <type>jar</type>
+ </info>
+ <gump>
+ <classpath/>
+ </gump>
+ </resource>
+
+
+ <project basedir=".">
+ <info>
+ <group>dpml/magic</group>
+ <name>dpml-magic-emma</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <type>jar</type>
+ </info>
+ <dependencies>
+ <include key="dpml-magic-core"/>
+ <include key="emma"/>
+ <include key="emma_ant"/>
+ </dependencies>
+ </project>
+ <resource>
+ <info>
+ <group>dpml/magic</group>
+ <name>dpml-magic-core</name>
+ <type>jar</type>
+ </info>
+ </resource>
+
+</index>

Added:
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/antlib.xml
==============================================================================
--- (empty file)
+++
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/antlib.xml
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<antlib>
+
+ <!-- taskdefs -->
+ <taskdef name="emma" classname="com.vladium.emma.emmaTask"/>
+
+</antlib>

Added:
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/example/Echo.java
==============================================================================
--- (empty file)
+++
development/laboratory/spells/emma/src/main/net/dpml/magic/emma/example/Echo.java
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.dpml.magic.emma.example;
+
+
+public class Echo
+{
+
+}

Added:
development/laboratory/spells/emma/src/test/net/dpml/magic/emma/test/EchoTest.java
==============================================================================
--- (empty file)
+++
development/laboratory/spells/emma/src/test/net/dpml/magic/emma/test/EchoTest.java
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.dpml.magic.emma.test;
+
+import net.dpml.magic.emma.example.Echo;
+import junit.framework.TestCase;
+
+
+public class EchoTest extends TestCase
+{
+ public void testHelloWorld()
+ {
+ Echo echo = new Echo();
+
+ }
+
+}

Added: development/laboratory/spells/upload/build.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/upload/build.xml Fri Mar 4 10:02:56
2005
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-magic-upload" default="install" basedir="."
+ xmlns:x="antlib:net.dpml.magic">
+
+ <x:home/>
+ <import file="${magic.templates}/standard.xml"/>
+
+ <target name="build" depends="standard.build">
+ <x:declare/>
+ </target>
+
+</project>

Added:
development/laboratory/spells/upload/etc/deliverables/templates/magic.xml
==============================================================================
--- (empty file)
+++ development/laboratory/spells/upload/etc/deliverables/templates/magic.xml
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<targets xmlns:x="antlib:net.dpml.tools" >
+
+ <target name="publish" depends="install">
+ <x:plugin name="upload"
uri="plugin:dpml/magic/spells/upload/dpml-magic-upload"/>
+ <upload />
+ </target>
+
+</targets>

Added:
development/laboratory/spells/upload/src/main/net/dpml/magic/spells/upload/UploadTask.java
==============================================================================
--- (empty file)
+++
development/laboratory/spells/upload/src/main/net/dpml/magic/spells/upload/UploadTask.java
Fri Mar 4 10:02:56 2005
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004 Niclas Hedhman
+ * Copyright 2004 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.magic.spells.upload;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+import org.apache.tools.ant.types.FileSet;
+
+import org.apache.tools.ant.taskdefs.optional.ssh.Scp;
+
+import net.dpml.magic.model.Definition;
+
+import net.dpml.magic.tasks.SystemTask;
+
+
+public class UploadTask extends SystemTask
+{
+ private static final String KEY_PUBLISH_USER_NAME =
"project.publish.username";
+ private static final String KEY_PUBLISH_AUTHORATIVE_DESTINATION =
"project.publish.authorative.destination";
+
+ public void init() throws BuildException
+ {
+ if( !isInitialized() )
+ {
+ super.init();
+ final Project project = getProject();
+ project.setNewProperty( KEY_PUBLISH_AUTHORATIVE_DESTINATION,
"login.ibiblio.org:/public/html/dpml" );
+ }
+ }
+
+ public void execute()
+ {
+ Project project = getProject();
+ File deliverables = getContext().getDeliverablesDirectory();
+ Definition def = getHome().getDefinition( getKey() );
+ String type = def.getInfo().getType();
+ File types = new File( deliverables, type + "s" );
+ String filename = def.getFilename();
+ File artifactFile = new File( types, filename );
+
+ String username = project.getProperty( KEY_PUBLISH_USER_NAME );
+ File[] files = new File[3];
+ files[0] = artifactFile;
+ files[1] = new File( artifactFile.getAbsolutePath() + ".md5" );
+ files[2] = new File( artifactFile.getAbsolutePath() + ".asc" );
+ String root = project.getProperty(
KEY_PUBLISH_AUTHORATIVE_DESTINATION );
+ String destination = root + "/" + def.getInfo().getGroup() + "/" +
type;
+ FileSet fileset = createFileSet( files );
+ copy( destination, fileset, username );
+ }
+
+ private FileSet createFileSet( File[] files )
+ {
+ final FileSet fileset = new FileSet();
+ fileset.setDir( new File( "/" ) );
+ StringBuffer includes = new StringBuffer();
+ for( int i = 0 ; i < files.length ; i++ )
+ {
+ if( i != 0 )
+ includes.append( ", " );
+ includes.append( files[ i ].getAbsolutePath() );
+ }
+ fileset.setIncludes( includes.toString() );
+ includes.setLength( 0 );
+ return fileset;
+ }
+
+ private void copy( String destination, FileSet fileset, String username )
+ {
+ Project project = getProject();
+ project.addTaskDefinition( "scp", Scp.class );
+ final Scp scp = (Scp) project.createTask( "scp" );
+ log( "Command: " + scp );
+ scp.setRemoteTofile( destination );
+ scp.addFileset( fileset );
+ scp.setUsername( username );
+ scp.execute();
+ }
+}



  • svn commit: r1950 - in development/laboratory/spells: eclipse eclipse/task eclipse/task/src eclipse/task/src/main eclipse/task/src/main/net eclipse/task/src/main/net/dpml eclipse/task/src/main/net/dpml/magic eclipse/task/src/main/net/dpml/magic/spells eclipse/task/src/main/net/dpml/magic/spells/eclipse eclipse/test emma emma/etc emma/etc/deliverables emma/etc/deliverables/templates emma/src emma/src/main emma/src/main/net emma/src/main/net/dpml emma/src/main/net/dpml/magic emma/src/main/net/dpml/magic/emma emma/src/main/net/dpml/magic/emma/example emma/src/test emma/src/test/net emma/src/test/net/dpml emma/src/test/net/dpml/magic emma/src/test/net/dpml/magic/emma emma/src/test/net/dpml/magic/emma/test upload upload/etc upload/etc/deliverables upload/etc/deliverables/templates upload/src upload/src/main upload/src/main/net upload/src/main/net/dpml upload/src/main/net/dpml/magic upload/src/main/net/dpml/magic/spells upload/src/main/net/dpml/magic/spells/upload, mcconnell, 03/04/2005

Archive powered by MHonArc 2.6.24.

Top of Page