Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 64688 invoked by uid 500); 29 Jun 2001 07:45:28 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 64679 invoked by uid 500); 29 Jun 2001 07:45:27 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Date: 29 Jun 2001 07:45:26 -0000 Message-ID: <20010629074526.64668.qmail@apache.org> From: donaldp@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/proposal/myrmidon/src/make primitive-tests.ant sample.ant donaldp 01/06/29 00:45:26 Modified: proposal/myrmidon build.xml proposal/myrmidon/src/java/org/apache/myrmidon/components/manager DefaultProjectManager.java proposal/myrmidon/src/make primitive-tests.ant sample.ant Log: Updated so that each project has a separate Deployer (that writes to separate TypeManager). Updated so that TypeLib (ie import of type libs in build file) will actually be obeyed and import types in as appropriate. Currently type libs are only loaded from /ext/*.atl however this will be exapnded in the future. Updated examples to reflect the new working TypeLib system and so as cross-project deployer can be verified. Updated build process so that the self testing code is placed in dist/ext and thus has to be explicitly loaded via an import Revision Changes Path 1.18 +11 -1 jakarta-ant/proposal/myrmidon/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/build.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- build.xml 2001/06/17 00:35:15 1.17 +++ build.xml 2001/06/29 07:45:20 1.18 @@ -57,6 +57,7 @@ + @@ -159,11 +160,20 @@ + - + + + + + + + + + 1.11 +84 -1 jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/manager/DefaultProjectManager.java Index: DefaultProjectManager.java =================================================================== RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/manager/DefaultProjectManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DefaultProjectManager.java 2001/06/27 00:50:06 1.10 +++ DefaultProjectManager.java 2001/06/29 07:45:22 1.11 @@ -7,6 +7,7 @@ */ package org.apache.myrmidon.components.manager; +import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; @@ -30,7 +31,11 @@ import org.apache.myrmidon.components.executor.ExecutionFrame; import org.apache.myrmidon.components.executor.Executor; import org.apache.myrmidon.framework.Condition; +import org.apache.myrmidon.components.deployer.DefaultDeployer; +import org.apache.myrmidon.components.deployer.Deployer; +import org.apache.myrmidon.components.deployer.DeploymentException; import org.apache.myrmidon.components.model.Project; +import org.apache.myrmidon.components.model.TypeLib; import org.apache.myrmidon.components.model.Target; import org.apache.myrmidon.components.type.TypeManager; import org.apache.myrmidon.listeners.ProjectListener; @@ -142,6 +147,64 @@ return context; } + private File findTypeLib( final String libraryName ) + throws TaskException + { + //TODO: In future this will be expanded to allow + //users to specify search path or automagically + //add entries to lib path (like user specific or + //workspace specific) + final String name = libraryName.replace( '/', File.separatorChar ) + ".atl"; + + final String home = System.getProperty( "myrmidon.home" ); + final File homeDir = new File( home + File.separatorChar + "ext" ); + + final File library = new File( homeDir, name ); + + if( library.exists() ) + { + if( !library.canRead() ) + { + throw new TaskException( "Unable to read library at " + library ); + } + else + { + return library; + } + } + + throw new TaskException( "Unable to locate Type Library " + libraryName ); + } + + private void deployTypeLib( final Deployer deployer, final Project project ) + throws TaskException + { + final TypeLib[] typeLibs = project.getTypeLibs(); + + for( int i = 0; i < typeLibs.length; i++ ) + { + final TypeLib typeLib = typeLibs[ i ]; + final File file = findTypeLib( typeLib.getLibrary() ); + + try + { + if( null == typeLib.getRole() ) + { + deployer.deploy( file ); + } + else + { + deployer.deployType( typeLib.getRole(), typeLib.getName(), file ); + } + } + catch( final DeploymentException de ) + { + throw new TaskException( "Error deploying type library " + + typeLib + " at " + file, de ); + } + } + } + private ExecutionFrame createExecutionFrame( final Project project ) throws TaskException { @@ -154,7 +217,27 @@ //Add in child type manager so each frame can register different //sets of tasks etc - componentManager.put( TypeManager.ROLE, m_typeManager.createChildTypeManager() ); + final TypeManager typeManager = m_typeManager.createChildTypeManager(); + componentManager.put( TypeManager.ROLE, typeManager ); + + //We need to create a new deployer so that it deploys + //to project specific TypeManager + final DefaultDeployer deployer = new DefaultDeployer(); + deployer.setLogger( getLogger() ); + + try { deployer.compose( componentManager ); } + catch( final ComponentException ce ) + { + throw new TaskException( "Error configuring deployer", ce ); + } + + //HACK: Didn't call initialize because Deployer contained in Embeddor + // Already initialized and this would be reduendent + //deployer.initialize(); + + componentManager.put( Deployer.ROLE, deployer ); + + deployTypeLib( deployer, project ); //We need to place projects and ProjectManager //in ComponentManager so as to support project-local call() 1.2 +7 -0 jakarta-ant/proposal/myrmidon/src/make/primitive-tests.ant Index: primitive-tests.ant =================================================================== RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/make/primitive-tests.ant,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- primitive-tests.ant 2001/06/10 12:56:59 1.1 +++ primitive-tests.ant 2001/06/29 07:45:24 1.2 @@ -16,9 +16,16 @@ + + + + + + + 1.12 +2 -1 jakarta-ant/proposal/myrmidon/src/make/sample.ant Index: sample.ant =================================================================== RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/make/sample.ant,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- sample.ant 2001/06/29 02:40:07 1.11 +++ sample.ant 2001/06/29 07:45:24 1.12 @@ -17,11 +17,12 @@ - + +