Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1290 - in development/laboratory/maven: . magic-migrate magic-migrate/src magic-migrate/src/main magic-migrate/src/main/net magic-migrate/src/main/net/dpml magic-migrate/src/main/net/dpml/magic magic-migrate/src/main/net/dpml/magic/maven magic-migrate/src/main/net/dpml/magic/maven/migrate magic-migrate/src/plugin-resources magic-migrate/xdocs

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1290 - in development/laboratory/maven: . magic-migrate magic-migrate/src magic-migrate/src/main magic-migrate/src/main/net magic-migrate/src/main/net/dpml magic-migrate/src/main/net/dpml/magic magic-migrate/src/main/net/dpml/magic/maven magic-migrate/src/main/net/dpml/magic/maven/migrate magic-migrate/src/plugin-resources magic-migrate/xdocs
  • Date: Fri, 24 Dec 2004 22:40:51 +0100

Author: niclas
Date: Fri Dec 24 22:40:50 2004
New Revision: 1290

Added:
development/laboratory/maven/
development/laboratory/maven/magic-migrate/
development/laboratory/maven/magic-migrate/maven.xml (contents, props
changed)
development/laboratory/maven/magic-migrate/plugin.jelly
development/laboratory/maven/magic-migrate/plugin.properties (contents,
props changed)
development/laboratory/maven/magic-migrate/project.xml (contents, props
changed)
development/laboratory/maven/magic-migrate/src/
development/laboratory/maven/magic-migrate/src/main/
development/laboratory/maven/magic-migrate/src/main/net/
development/laboratory/maven/magic-migrate/src/main/net/dpml/
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/

development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/

development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
(contents, props changed)
development/laboratory/maven/magic-migrate/src/plugin-resources/
development/laboratory/maven/magic-migrate/xdocs/
Log:
Beginning of a Maven Migration plugin. This Maven Plugin converts a Maven
project to Magic, and installs the latest Magic on the system.

Added: development/laboratory/maven/magic-migrate/maven.xml
==============================================================================
--- (empty file)
+++ development/laboratory/maven/magic-migrate/maven.xml Fri Dec 24
22:40:50 2004
@@ -0,0 +1,23 @@
+<!--
+ 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 default="plugin:install" xmlns:ant="jelly:ant">
+
+
+</project>

Added: development/laboratory/maven/magic-migrate/plugin.jelly
==============================================================================
--- (empty file)
+++ development/laboratory/maven/magic-migrate/plugin.jelly Fri Dec 24
22:40:50 2004
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+ 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 xmlns:j="jelly:core"
+ xmlns:util="jelly:util"
+ xmlns:ant="jelly:ant" >
+
+ <goal name="magic" prereqs="magic:migrate" description="Migrate the Maven
projects to Magic."/>
+
+ <!-- Creates the structure in DPML_HOME.
+ It then takes the current project and adds it, and its
+ dependencies to the first index.xml file found in the
+ hierarchy above. If no index.xml is found, it creates a new one
+ in the current directory.
+ -->
+ <goal name="magic:migrate" >
+ <attainGoal name="magic:dpml" />
+
+ </goal>
+
+ <!-- Reads the current directory's project.xml and generates a module.xml
+ for Magic, and adds that module.xml as a project in the index.xml
+ in current directory. If no index.xml is found, it does nothing.
+ -->
+ <goal name="magic:module" >
+
+ </goal>
+
+ <!-- Creates the DPML_HOME structure. -->
+ <goal name="magic:dpml">
+ <property environment="env"/>
+ <j:set var="dpml_home" value="${env.DPML_HOME}"/>
+ <j:useBean var="migrate" class="net.dpml.magic.maven.migrate.Migrate"/>
+ ${migrate.createDpml( pom, dpml_home )}
+ </goal>
+
+
+ <!-- Migrates all found POMs in the directories below, into Magic index.xml
+ file.
+ -->
+ <goal name="magic:migrate">
+ <property environment="env"/>
+ <j:set var="dpml_home" value="${env.DPML_HOME}"/>
+ <j:useBean var="migrate" class="net.dpml.magic.maven.migrate.Migrate"/>
+ ${migrate.migrate( pom, dpml_home )}
+ </goal>
+
+ <!-- Creates the standard build.xml files in the directories below the
current
+ directory. If the directory contains a src/ dir, thr standard template
+ is created, otherwise the reactor template is created. If the
+ standard template is created, no further transversing of directory
+ structure will occur.
+ -->
+ <goal name="magic:create-build">
+ <property environment="env"/>
+ <j:set var="dpml_home" value="${env.DPML_HOME}"/>
+ <j:useBean var="migrate" class="net.dpml.magic.maven.migrate.Migrate"/>
+ ${migrate.createBuilds( pom, dpml_home )}
+ </goal>
+
+</project>

Added: development/laboratory/maven/magic-migrate/plugin.properties
==============================================================================
--- (empty file)
+++ development/laboratory/maven/magic-migrate/plugin.properties Fri
Dec 24 22:40:50 2004
@@ -0,0 +1,25 @@
+
+# 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.
+#
+# ------------------------------------------------------------------
+# P L U G I N P R O P E R T I E S
+# -------------------------------------------------------------------
+# DPML - Maven to Magic Migration plugin.
+# -------------------------------------------------------------------
+
+

Added: development/laboratory/maven/magic-migrate/project.xml
==============================================================================
--- (empty file)
+++ development/laboratory/maven/magic-migrate/project.xml Fri Dec 24
22:40:50 2004
@@ -0,0 +1,104 @@
+<?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>
+ <pomVersion>3</pomVersion>
+ <groupId>dpml/magic/maven</groupId>
+ <id>magic-migrate</id>
+ <currentVersion>1.0</currentVersion>
+
+ <name>Magic Migration Plugin</name>
+ <description>
+ This Plugin will liberate your projects from using Maven to the more
+ sophisticated, flexible and powerful Magic build system from Digital
+ Product Meta Library.
+ </description>
+ <shortDescription>Migration from Maven to Magic.</shortDescription>
+
+ <organization>
+ <name>Digital Product Meta Library</name>
+ </organization>
+ <inceptionYear>2004</inceptionYear>
+
+ <developers>
+ <developer>
+ <name>Niclas Hedhman</name>
+ <id>niclas</id>
+ <email>niclas AT hedhman.org</email>
+ <organization>Digital Product Meta Library</organization>
+ <roles>
+ <role>Developer</role>
+ <role>Architect</role>
+ <role>Visionary</role>
+ <role>Janitor</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>maven</groupId>
+ <artifactId>maven</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>dpml/magic</groupId>
+ <artifactId>dpml-magic</artifactId>
+ <version>LATEST</version>
+ </dependency>
+
+ <dependency>
+ <groupId>dpml/transit</groupId>
+ <artifactId>dpml-transit</artifactId>
+ <version>LATEST</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <!-- Useful if your plugin uses some beans -->
+ <sourceDirectory>src/main</sourceDirectory>
+ <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </unitTest>
+
+ <resources>
+ <resource>
+ <directory>${basedir}/src/plugin-resources</directory>
+ <targetPath>plugin-resources</targetPath>
+ </resource>
+ <resource>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>plugin.jelly</include>
+ <include>plugin.properties</include>
+ <include>project.properties</include>
+ <include>project.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+</project>

Added:
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
==============================================================================
--- (empty file)
+++
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
Fri Dec 24 22:40:50 2004
@@ -0,0 +1,154 @@
+/*
+ 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.
+*/
+
+package net.dpml.magic.maven.migrate;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.maven.project.Project;
+
+public class Migrate
+{
+ public void migrate( Project proj, String dpml )
+ {
+ }
+
+ public void createDpml( Project proj, String dpml )
+ {
+ System.out.println( "Project:" + proj.getName() );
+ System.out.println( "DPML_HOME=" + dpml );
+ if( dpml == null )
+ dpml = System.getProperty( "user.home" + "/.dpml" );
+ File dpml_home = new File( dpml );
+ dpml_home.mkdirs();
+
+ File bindir = new File( dpml_home, "bin" );
+ bindir.mkdirs();
+
+ File transitdir = new File( dpml_home, "transit/authority" );
+ transitdir.mkdirs();
+
+ File cachedir = new File( dpml_home, "main" );
+ cachedir.mkdirs();
+
+ File docsdir = new File( dpml_home, "docs" );
+ docsdir.mkdirs();
+
+ String magicPath = proj.getDependencyPath( "dpml-magic" );
+ System.out.println( "Magic path=" + magicPath );
+
+ String transitPath = proj.getDependencyPath( "dpml-transit" );
+ System.out.println( "Transit path=" + transitPath );
+
+
+ }
+
+ public void createBuilds( Project proj, String dpml )
+ throws IOException
+ {
+ File cwd = new File( "." );
+ processDir( cwd );
+ }
+
+ private void processDir( File dir )
+ throws IOException
+ {
+ File[] entries = dir.listFiles();
+ if( isProjectDir( dir ) )
+ {
+ createStandardBuild( dir, entries );
+ }
+ else
+ {
+ createReactorBuild( dir );
+ recurse( entries );
+ }
+ }
+
+ private void recurse( File[] entries )
+ {
+ for( int i = 0 ; i < entries.length ; i++ )
+ processDir( entries[i] );
+ }
+
+ private boolean isProjectDir( File dir, File[] entries )
+ {
+ for( int i=0 ; i < entries.length ; i++ )
+ {
+ if( entries[i].getName().equals( "src" ) )
+ return true;
+ }
+ return false;
+ }
+
+ private void createStandardBuild( File dir )
+ throws IOException
+ {
+ StringBuffer content = new StringBuffer( 500 );
+ content.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" );
+ content.append( "<project name=\"dpml-runtime\" default=\"default\"
basedir=\".\"\n" );
+ content.append( " xmlns:magic=\"antlib:net.dpml.magic\">\n" );
+ content.append( "\n" );
+ content.append( " <magic:import
uri=\"artifact:template:dpml/magic/standard\"/>\n" );
+ content.append( "\n" );
+ content.append( "</project>\n" );
+ write( dir, content.toString() );
+ }
+
+
+ private void createReactorBuild( File dir )
+ throws IOException
+ {
+ StringBuffer content = new StringBuffer( 500 );
+ content.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" );
+ content.append( "<project name=\"dpml-runtime\" default=\"default\"
basedir=\".\"\n" );
+ content.append( " xmlns:magic=\"antlib:net.dpml.magic\">\n" );
+ content.append( "\n" );
+ content.append( " <magic:import
uri=\"artifact:template:dpml/magic/reactor\"/>\n" );
+ content.append( "\n" );
+ content.append( "</project>\n" );
+ write( dir, content.toString() );
+ }
+
+ private void write( File dir, String content )
+ throws IOException
+ {
+ FileOutputStream fos;
+ try
+ {
+ File f = new File( dir, "build.xml" );
+ if( f.exists() )
+ throw new IOException( "File already exists: " + f );
+ fos = new FileOutputStream( f );
+ OutputStreamWriter osw = new OutputStreamWriter( fos, "UTF-8" );
+ BufferedWriter writer = new BufferedWriter( osw );
+ writer.write( content );
+ writer.flush();
+ writer.close();
+
+ } finally
+ {
+ fos.close();
+ }
+ }
+}
+
+



  • svn commit: r1290 - in development/laboratory/maven: . magic-migrate magic-migrate/src magic-migrate/src/main magic-migrate/src/main/net magic-migrate/src/main/net/dpml magic-migrate/src/main/net/dpml/magic magic-migrate/src/main/net/dpml/magic/maven magic-migrate/src/main/net/dpml/magic/maven/migrate magic-migrate/src/plugin-resources magic-migrate/xdocs, niclas, 12/24/2004

Archive powered by MHonArc 2.6.24.

Top of Page