Author: mcconnell Date: Mon Jun 7 10:29:41 2004 New Revision: 20873 Added: avalon/trunk/central/system/license/ avalon/trunk/central/system/license/LICENSE.TXT avalon/trunk/central/system/license/NOTICE.TXT avalon/trunk/runtime/logkit/build.xml avalon/trunk/runtime/meta/api/build.xml avalon/trunk/runtime/meta/impl/build.xml avalon/trunk/runtime/meta/spi/build.xml avalon/trunk/runtime/meta/tools/build.xml avalon/trunk/runtime/meta/tools/etc/ avalon/trunk/runtime/meta/tools/etc/test/ avalon/trunk/runtime/meta/tools/etc/test/unit/ avalon/trunk/runtime/meta/tools/etc/test/unit/org/ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/Primary.java avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/PrimaryService.java avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/Secondary.java avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/SecondaryService.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/HomeTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java avalon/trunk/tools/project/core/src/test/build.properties avalon/trunk/tools/project/core/src/test/build.xml avalon/trunk/tools/project/core/src/test/generic.xml Removed: avalon/trunk/runtime/meta/tools/src/test/org/apache/avalon/playground/ Modified: avalon/trunk/central/system/ (props changed) avalon/trunk/central/system/index.xml avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLServiceCreator.java avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java avalon/trunk/runtime/meta/tools/src/test/org/apache/avalon/meta/MetaTestCase.java avalon/trunk/runtime/util/configuration/ (props changed) avalon/trunk/tools/project/core/build.xml avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ContextualTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java avalon/trunk/tools/project/core/src/test/projects/demo/build.properties avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml avalon/trunk/tools/project/core/src/test/projects/sample/build.properties avalon/trunk/tools/project/core/src/test/projects/sample/build.xml avalon/trunk/tools/project/core/src/test/projects/widget/build.properties Log: Add build prococedures for the meta project (excluding maven plugin generation) together with updates to the project ant build suite.
Modified: avalon/trunk/central/system/index.xml ============================================================================== --- avalon/trunk/central/system/index.xml (original) +++ avalon/trunk/central/system/index.xml Mon Jun 7 10:29:41 2004 @@ -11,7 +11,9 @@ <cache dir=".cache"/> <proxy/> <hosts> - <host>http://www.dpml.net</host> + <host>http://www.dpml.net/</host> + <host>http://www.apache.org/dist/java-repository/</host> + <host>http://www.ibiblio.org/maven/</host> </hosts> </repository> @@ -24,25 +26,54 @@ <resource> <info> - <group>avalon-framework</group> - <name>avalon-framework-api</name> - <version>4.2.0</version> + <group>log4j</group> + <name>log4j</name> + <version>1.2.8</version> <type>jar</type> </info> </resource> + <resource> <info> - <group>avalon-framework</group> - <name>avalon-framework-impl</name> - <version>4.2.0</version> + <group>servletapi</group> + <name>servletapi</name> + <version>2.3</version> <type>jar</type> </info> </resource> + <resource> <info> - <group>avalon-util</group> - <name>avalon-util-i18n</name> - <version>1.0.0</version> + <group>javamail</group> + <name>mailapi</name> + <version>1.3.1</version> + <type>jar</type> + </info> + </resource> + + <resource> + <info> + <group>jms</group> + <name>jms</name> + <version>1.1</version> + <type>jar</type> + </info> + </resource> + + <resource> + <info> + <group>ant</group> + <name>ant</name> + <version>1.6.1</version> + <type>jar</type> + </info> + </resource> + + <resource> + <info> + <group>qdox</group> + <name>qdox</name> + <version>1.3</version> <type>jar</type> </info> </resource> @@ -55,12 +86,212 @@ <projects> + <!-- + Avalon LogKit. + --> + + <project basedir="../../runtime/logkit"> + <info> + <group>avalon/logkit</group> + <name>avalon-logkit</name> + <version>2.0.0</version> + </info> + <dependencies> + <resources> + <resourceref key="log4j" runtime="false"/> + <resourceref key="servletapi" runtime="false"/> + <resourceref key="mailapi" runtime="false"/> + <resourceref key="jms" runtime="false"/> + </resources> + </dependencies> + </project> + + <!-- + Avalon Framework. + --> + + <project basedir="../../runtime/framework/api"> + <info> + <group>avalon/framework</group> + <name>avalon-framework-api</name> + <version>4.2.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-logkit"/> + </projects> + </dependencies> + </project> + + <project basedir="../../runtime/framework/impl"> + <info> + <group>avalon/framework</group> + <name>avalon-framework-impl</name> + <version>4.2.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-framework-api"/> + </projects> + </dependencies> + </project> + + <!-- + Avalon Utilities. + --> + <project basedir="../site"> <info> <group>avalon</group> <name>site</name> </info> </project> + + <project basedir="../../runtime/util/configuration"> + <info> + <group>avalon/util</group> + <name>avalon-util-configuration</name> + <version>1.0-dev</version> + </info> + <dependencies> + <resources> + <resourceref key="avalon-framework-api"/> + <resourceref key="avalon-framework-impl"/> + </resources> + </dependencies> + </project> + + <project basedir="../../runtime/util/criteria"> + <info> + <group>avalon/util</group> + <name>avalon-util-criteria</name> + <version>1.1.0</version> + </info> + </project> + + <project basedir="../../runtime/util/defaults"> + <info> + <group>avalon/util</group> + <name>avalon-util-defaults</name> + <version>1.2.1</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-util-env"/> + </projects> + </dependencies> + </project> + + <project basedir="../../runtime/util/env"> + <info> + <group>avalon/util</group> + <name>avalon-util-env</name> + <version>1.1.1</version> + </info> + </project> + + <project basedir="../../runtime/util/exception"> + <info> + <group>avalon/util</group> + <name>avalon-util-exception</name> + <version>1.0.0</version> + </info> + </project> + + <project basedir="../../runtime/util/i18n"> + <info> + <group>avalon/util</group> + <name>avalon-util-i18n</name> + <version>1.0.0</version> + </info> + </project> + + <project basedir="../../runtime/util/extension/api"> + <info> + <group>avalon/util</group> + <name>avalon-util-extension-api</name> + <version>1.2.0</version> + </info> + </project> + + <project basedir="../../runtime/util/extension/impl"> + <info> + <group>avalon/util</group> + <name>avalon-util-extension-impl</name> + <version>1.2.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-util-extension-api"/> + </projects> + </dependencies> + </project> + + <!-- + Avalon Meta. + --> + + <project basedir="../../runtime/meta/api"> + <info> + <group>avalon/meta</group> + <name>avalon-meta-api</name> + <version>1.4.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-framework-api"/> + <projectref key="avalon-framework-impl" compile="false" test="true"/> + </projects> + </dependencies> + </project> + + <project basedir="../../runtime/meta/spi"> + <info> + <group>avalon/meta</group> + <name>avalon-meta-spi</name> + <version>1.4.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-meta-api"/> + </projects> + </dependencies> + </project> + + <project basedir="../../runtime/meta/impl"> + <info> + <group>avalon/meta</group> + <name>avalon-meta-impl</name> + <version>1.4.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-meta-spi"/> + <projectref key="avalon-util-i18n"/> + <projectref key="avalon-util-configuration"/> + </projects> + </dependencies> + </project> + + <plugin basedir="../../runtime/meta/tools"> + <info> + <group>avalon/meta</group> + <name>avalon-meta-tools</name> + <version>1.4.0</version> + </info> + <dependencies> + <projects> + <projectref key="avalon-meta-impl"/> + </projects> + <resources> + <resourceref key="ant"/> + <resourceref key="qdox"/> + </resources> + </dependencies> + <tasks> + <taskdef name="meta" class="org.apache.avalon.meta.info.MetaTask"/> + </tasks> + </plugin> </projects> Added: avalon/trunk/central/system/license/LICENSE.TXT ============================================================================== --- (empty file) +++ avalon/trunk/central/system/license/LICENSE.TXT Mon Jun 7 10:29:41 2004 @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. Added: avalon/trunk/central/system/license/NOTICE.TXT ============================================================================== --- (empty file) +++ avalon/trunk/central/system/license/NOTICE.TXT Mon Jun 7 10:29:41 2004 @@ -0,0 +1,11 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +========================================================================= + +This product is developed by the Apache Avalon Project. +http://avalon.apache.org + +The names "Avalon" and "Merlin" must not be used to endorse or promote +products derived from this software without prior written permission. +For written permission, please contact [EMAIL PROTECTED] Added: avalon/trunk/runtime/logkit/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logkit/build.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logkit" default="dist" basedir="."> + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> +</project> Added: avalon/trunk/runtime/meta/api/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/api/build.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-meta-api" default="dist" basedir="."> + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> +</project> Added: avalon/trunk/runtime/meta/impl/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/impl/build.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-meta-impl" default="dist" basedir="."> + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> +</project> Modified: avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java ============================================================================== --- avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java (original) +++ avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java Mon Jun 7 10:29:41 2004 @@ -39,7 +39,7 @@ import org.apache.avalon.util.i18n.ResourceManager; import org.apache.avalon.util.i18n.Resources; -import org.apache.excalibur.configuration.ConfigurationUtil; +import org.apache.avalon.util.configuration.ConfigurationUtil; import org.xml.sax.InputSource; Modified: avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLServiceCreator.java ============================================================================== --- avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLServiceCreator.java (original) +++ avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLServiceCreator.java Mon Jun 7 10:29:41 2004 @@ -34,7 +34,7 @@ import org.apache.avalon.util.i18n.ResourceManager; import org.apache.avalon.util.i18n.Resources; -import org.apache.excalibur.configuration.ConfigurationUtil; +import org.apache.avalon.util.configuration.ConfigurationUtil; import org.xml.sax.InputSource; Modified: avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java ============================================================================== --- avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java (original) +++ avalon/trunk/runtime/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java Mon Jun 7 10:29:41 2004 @@ -41,8 +41,8 @@ import org.apache.avalon.util.i18n.ResourceManager; import org.apache.avalon.util.i18n.Resources; - -import org.apache.excalibur.configuration.ConfigurationUtil; +import org.apache.avalon.util.configuration.ConfigurationUtil; + import org.xml.sax.InputSource; /** Added: avalon/trunk/runtime/meta/spi/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/spi/build.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-meta-spi" default="dist" basedir="."> + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> +</project> Added: avalon/trunk/runtime/meta/tools/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/tools/build.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-meta-tools" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + + <target name="build" depends="standard.build"> + <x:declare/> + </target> + +</project> Added: avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/Primary.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/Primary.java Mon Jun 7 10:29:41 2004 @@ -0,0 +1,43 @@ +/* + * Copyright 2004 Apache Software Foundation + * 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 org.apache.avalon.playground; + +import org.apache.avalon.framework.context.Contextualizable; +import org.apache.avalon.framework.context.Context; +import org.apache.avalon.framework.context.ContextException; + +/** + * Demonstration of meta tags supportign the declaration of a service + * export, version, type name, lifestyle, context entries, and the use + * of the namespace compating mechanism. + * + * + * @avalon.component name="primary-component" lifestyle="singleton" + * version="1.3" + * @avalon.service type="org.apache.avalon.playground.PrimaryService" + * version="9.8" + */ +public class Primary implements PrimaryService, Contextualizable +{ + /** + * @avalon.entry key="home" type="java.io.File" + */ + public void contextualize( Context context ) throws ContextException + { + } +} Added: avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/PrimaryService.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/PrimaryService.java Mon Jun 7 10:29:41 2004 @@ -0,0 +1,28 @@ +/* + * Copyright 2004 Apache Software Foundation + * 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 org.apache.avalon.playground; + +/** + * An interface representing a service. + * + * @avalon.service version="9.8" + * @avalon.attribute key="status" value="test" + */ +public interface PrimaryService +{ +} Added: avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/Secondary.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/Secondary.java Mon Jun 7 10:29:41 2004 @@ -0,0 +1,61 @@ +/* + * Copyright 2004 Apache Software Foundation + * 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 org.apache.avalon.playground; + +import org.apache.avalon.framework.logger.Logger; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.service.Serviceable; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceException; + +/** + * @avalon.component name="secondary-component" version="2.4" + * @avalon.service type="org.apache.avalon.playground.SecondaryService" version="0.1" + */ +public class Secondary extends AbstractLogEnabled implements Serviceable, SecondaryService +{ + private Logger m_system = null; + + private PrimaryService m_primary = null; + + /** + * Supply of a logging channel to the component. + * + * @param logger the logging channel + * @avalon.logger name="system" + */ + public void enableLogging( Logger logger ) + { + super.enableLogging( logger ); + m_system = logger.getChildLogger( "system" ); + } + + /** + * Supply of dependent services to this component by the container. + * + * @param manager the service manager + * @avalon.dependency key="primary" + * type="org.apache.avalon.playground.PrimaryService" + * version="1.3" + */ + public void service( ServiceManager manager ) throws ServiceException + { + m_primary = (PrimaryService) manager.lookup( "primary" ); + m_system.info( "resolved primary service reference" ); + } +} Added: avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/SecondaryService.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/meta/tools/etc/test/unit/org/apache/avalon/playground/SecondaryService.java Mon Jun 7 10:29:41 2004 @@ -0,0 +1,26 @@ +/* + * Copyright 2004 Apache Software Foundation + * 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 org.apache.avalon.playground; + +/** + * An interface representing a service. + * @avalon.service version="0.1" + */ +public interface SecondaryService +{ +} Modified: avalon/trunk/runtime/meta/tools/src/test/org/apache/avalon/meta/MetaTestCase.java ============================================================================== --- avalon/trunk/runtime/meta/tools/src/test/org/apache/avalon/meta/MetaTestCase.java (original) +++ avalon/trunk/runtime/meta/tools/src/test/org/apache/avalon/meta/MetaTestCase.java Mon Jun 7 10:29:41 2004 @@ -96,7 +96,8 @@ public void buildMeta() throws Exception { String base = System.getProperty( "basedir" ); - m_qdox.addSourceTree( new File( base, "target/test-classes" ) ); + File basedir = new File( base ); + m_qdox.addSourceTree( basedir ); JavaSource[] sources = m_qdox.getSources(); for( int i=0; i<sources.length; i++ ) { Modified: avalon/trunk/tools/project/core/build.xml ============================================================================== --- avalon/trunk/tools/project/core/build.xml (original) +++ avalon/trunk/tools/project/core/build.xml Mon Jun 7 10:29:41 2004 @@ -60,12 +60,7 @@ </target> <target name="test" depends="test-prepare"> - <ant dir="${target.test.dir}/projects/gizmo" /> - <ant dir="${target.test.dir}/projects/widget" /> - <ant dir="${target.test.dir}/projects/demo" /> - <ant dir="${target.test.dir}/projects/sample" /> - <!-- - --> + <ant dir="${target.test.dir}" /> </target> <target name="clean"> Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/antlib.xml Mon Jun 7 10:29:41 2004 @@ -1,7 +1,8 @@ <?xml version="1.0"?> <antlib xmlns:current="ant:current"> - <taskdef name="home" classname="org.apache.avalon.tools.home.Home"/> + <taskdef name="context" classname="org.apache.avalon.tools.home.Context"/> + <taskdef name="home" classname="org.apache.avalon.tools.tasks.HomeTask"/> <taskdef name="clean" classname="org.apache.avalon.tools.tasks.CleanTask"/> <taskdef name="prepare" classname="org.apache.avalon.tools.tasks.PrepareTask"/> @@ -12,5 +13,6 @@ <taskdef name="install" classname="org.apache.avalon.tools.tasks.InstallTask"/> <taskdef name="plugin" classname="org.apache.avalon.tools.tasks.PluginTask"/> <taskdef name="xdoc" classname="org.apache.avalon.tools.tasks.XdocTask"/> + <taskdef name="reactor" classname="org.apache.avalon.tools.tasks.ReactorTask"/> </antlib> Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java Mon Jun 7 10:29:41 2004 @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Property; @@ -31,8 +32,11 @@ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ */ -public class Context +public class Context extends Task { + private static final String USER_PROPERTIES = "user.properties"; + private static final String BUILD_PROPERTIES = "build.properties"; + public static final String KEY = "project.context"; public static final String SRC_KEY = "project.src"; @@ -47,12 +51,12 @@ public static final String SRC_TEST_KEY = "project.src.test"; public static final String SRC_TEST_VALUE = "test"; + public static final String ETC_KEY = "project.etc"; + public static final String ETC_VALUE = "etc"; + public static final String TARGET_KEY = "project.target"; public static final String TARGET_VALUE = "target"; - private static final String USER_PROPERTIES = "user.properties"; - private static final String BUILD_PROPERTIES = "build.properties"; - public static final String DELIVERABLES_KEY = "project.target.deliverables"; private static final String DELIVERABLES_VALUE = "deliverables"; @@ -70,30 +74,49 @@ Context context = (Context) project.getReference( KEY ); if( null == context ) { - context = new Context( project ); + context = new Context(); + context.setProject( project ); + context.init(); + context.execute(); project.addReference( KEY, context ); } return context; } - private final File m_src; - private final File m_target; - private final File m_build; - private final File m_deliverables; - private final File m_temp; - private final File m_docs; - private final Map m_map = new Hashtable(); private final Map m_resources = new Hashtable(); - private Context( Project project ) + private String m_key; + private File m_file; + + private File m_src; + private File m_etc; + private File m_target; + private File m_build; + private File m_deliverables; + private File m_temp; + private File m_docs; + + public void setKey( String key ) { + m_key = key; + } + + public void setFile( File file ) + { + m_file = file; + } + + public void execute() + { + Project project = getProject(); setupProperties( project ); project.setNewProperty( SRC_KEY, SRC_VALUE ); project.setNewProperty( SRC_MAIN_KEY, SRC_MAIN_VALUE ); project.setNewProperty( SRC_CONFIG_KEY, SRC_CONFIG_VALUE ); project.setNewProperty( SRC_TEST_KEY, SRC_TEST_VALUE ); + project.setNewProperty( ETC_KEY, ETC_VALUE ); project.setNewProperty( TARGET_KEY, TARGET_VALUE ); project.setNewProperty( BUILD_KEY, BUILD_VALUE ); project.setNewProperty( DELIVERABLES_KEY, DELIVERABLES_VALUE ); @@ -102,6 +125,7 @@ File basedir = project.getBaseDir(); String src = project.getProperty( SRC_KEY ); + String etc = project.getProperty( ETC_KEY ); String target = project.getProperty( TARGET_KEY ); String build = project.getProperty( BUILD_KEY ); String temp = project.getProperty( TEMP_KEY ); @@ -109,6 +133,7 @@ String deliverables = project.getProperty( DELIVERABLES_KEY ); m_src = setupSrc( basedir, src ); + m_etc = setupEtc( basedir, etc ); m_target = setupTarget( basedir, target ); m_build = @@ -119,6 +144,28 @@ setBuildPath( TEMP_KEY, temp ); m_docs = setBuildPath( DOCS_KEY, docs ); + + project.addReference( KEY, this ); + } + + public String getKey() + { + if( null != m_key ) + { + return m_key; + } + else + { + String name = getProject().getProperty( "project.name" ); + if( null != name ) + { + return name; + } + else + { + return getProject().getName(); + } + } } public File getSrcDirectory() @@ -126,6 +173,11 @@ return m_src; } + public File getEtcDirectory() + { + return m_etc; + } + public File getTargetDirectory() { return m_target; @@ -209,6 +261,12 @@ return new File( basedir, path ); } + private File setupEtc( File basedir, String path ) + { + if( null == path ) return new File( basedir, ETC_VALUE ); + return new File( basedir, path ); + } + private File setupTarget( File basedir, String path ) { if( null == path ) return new File( basedir, TARGET_VALUE ); @@ -224,14 +282,21 @@ private void setupUserProperties( Project project, File basedir ) { - File user = new File( basedir, USER_PROPERTIES ); + File user = Context.getFile( basedir, USER_PROPERTIES ); readProperties( project, user ); } private void setupBuildProperties( Project project, File basedir ) { - File build = new File( basedir, BUILD_PROPERTIES ); - readProperties( project, build ); + if( null == m_file ) + { + File build = Context.getFile( basedir, BUILD_PROPERTIES ); + readProperties( project, build ); + } + else + { + readProperties( project, m_file ); + } } private void readProperties( Project project, File file ) throws BuildException Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java Mon Jun 7 10:29:41 2004 @@ -62,7 +62,7 @@ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ */ -public class Home extends Sequential +public class Home extends DataType { //------------------------------------------------------------- // static @@ -71,141 +71,61 @@ public static final String KEY = "project.home"; public static final String HOME_KEY = "project.home"; + private static final String USER_PROPERTIES = "user.properties"; + private static final String BUILD_PROPERTIES = "build.properties"; + //------------------------------------------------------------- // mutable state //------------------------------------------------------------- private boolean m_init = false; - private Context m_context; private String m_id; - private String m_key; + private Home m_home; private Repository m_repository; private File m_system; private File m_file; private final Hashtable m_resources = new Hashtable(); - private Definition m_definition; private BuildListener m_listener; //------------------------------------------------------------- - // setters + // constructor //------------------------------------------------------------- - public void setIndex( File file ) throws BuildException - { - m_file = file; - } - - public void setKey( String key ) - { - m_key = key; - } - - public void setId( String id ) + public Home( Project project, String id ) { + setProject( project ); m_id = id; + setupHome(); } //------------------------------------------------------------- // Task //------------------------------------------------------------- - public void init() throws BuildException - { - if( !m_init ) - { - Project project = getProject(); - m_context = Context.getContext( project ); - m_init = true; - } - } - - public void execute() + private String getHomeID() { - Project project = getProject(); - - if( null == m_file ) - { - String path = project.getProperty( HOME_KEY ); - if( null != path ) - { - File index = Context.getFile( project.getBaseDir(), path ); - if( index.exists() ) - { - if( index.isDirectory() ) - { - m_file = new File( index, "index.xml" ); - } - else - { - m_file = index; - } - } - else - { - final String error = - "Property value 'project.home' in task defintion [" - + getTaskName() - + "] references a non-existant file: " - + index; - throw new BuildException( error ); - } - } - else - { - final String error = - "Cannot continue due to missing index attribute in task defintion [" - + getTaskName() + "]."; - throw new BuildException( error ); - } - } - if( null == m_id ) { - project.addReference( KEY, this ); + return KEY; } else { - project.addReference( m_id, this ); + return m_id; } - - m_system = m_file.getParentFile(); - log( "home: " + m_system, Project.MSG_DEBUG ); - - Element root = ElementHelper.getRootElement( m_file ); - final Element repo = ElementHelper.getChild( root, "repository" ); - final Element resources = ElementHelper.getChild( root, "resources" ); - final Element projects = ElementHelper.getChild( root, "projects" ); - - // - // construct the repository, build the definition of the available - // resources and projects used within the system and associate a build - // listener - // - - m_repository = createRepository( repo ); - buildResourceList( resources ); - buildProjectList( projects ); - - final String key = getKey(); - m_definition = getDefinition( key, false ); - m_listener = new StandardListener( this, m_definition ); - - super.execute(); - } - private String getKey() + private Home getHome() { - if( null != m_key ) + if( m_home != null ) { - return m_key; + return m_home; } else { - return getProject().getName(); + return this; } } @@ -223,22 +143,12 @@ return m_repository; } - public File getFile() - { - return m_file; - } - public Plugin getPlugin( PluginRef ref ) throws BuildException { return (Plugin) getDefinition( ref ); } - public Definition getDefinition() - { - return m_definition; - } - public Definition getDefinition( ProjectRef ref ) throws BuildException { @@ -297,6 +207,7 @@ return null; } + /* public void build( Definition definition ) { Ant ant = (Ant) getProject().createTask( "ant" ); @@ -321,11 +232,13 @@ } return (Definition[]) targets.toArray( new Definition[0] ); } + */ //------------------------------------------------------------- // internal //------------------------------------------------------------- + /* private void getBuildSequence( List visited, List targets, Definition definition ) { if( visited.contains( definition ) ) return; @@ -351,6 +264,7 @@ targets.add( definition ); } } + */ private void buildResourceList( Element resources ) { @@ -403,4 +317,98 @@ } return repository; } + + private void setupHome() + { + Project project = getProject(); + log( "Building system definition." ); + try + { + File index = getIndexFile(); + m_system = index.getParentFile(); + setupProperties( project, m_system ); + Element root = ElementHelper.getRootElement( index ); + final Element repo = ElementHelper.getChild( root, "repository" ); + final Element resources = ElementHelper.getChild( root, "resources" ); + final Element projects = ElementHelper.getChild( root, "projects" ); + + // + // construct the repository, build the definition of the available + // resources and projects used within the system and associate a build + // listener + // + + m_repository = createRepository( repo ); + buildResourceList( resources ); + buildProjectList( projects ); + + } + catch( Throwable e ) + { + throw new BuildException( e ); + } + } + + private File getIndexFile() + { + if( null != m_file ) return m_file; + + String path = project.getProperty( KEY ); + if( null != path ) + { + File index = Context.getFile( project.getBaseDir(), path ); + if( index.exists() ) + { + if( index.isDirectory() ) + { + return new File( index, "index.xml" ); + } + else + { + return index; + } + } + else + { + final String error = + "Property value 'project.home' references a non-existant file: " + + index; + throw new BuildException( error ); + } + } + else + { + final String error = + "Cannot continue due to missing index attribute."; + throw new BuildException( error ); + } + } + + private void setupProperties( Project project, File dir ) + { + setupUserProperties( project, dir ); + setupBuildProperties( project, dir ); + } + + private void setupUserProperties( Project project, File basedir ) + { + File user = Context.getFile( basedir, USER_PROPERTIES ); + readProperties( project, user ); + } + + private void setupBuildProperties( Project project, File basedir ) + { + File build = Context.getFile( basedir, BUILD_PROPERTIES ); + readProperties( project, build ); + } + + private void readProperties( Project project, File file ) throws BuildException + { + Property props = (Property) project.createTask( "property" ); + props.setFile( file ); + props.init(); + props.execute(); + } + + } Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java Mon Jun 7 10:29:41 2004 @@ -99,7 +99,7 @@ return (ResourceRef[]) list.toArray( new ResourceRef[0] ); } - public void getResourceRefs( Definition def, List list ) + private void getResourceRefs( Definition def, List list ) { ResourceRef[] refs = def.getResourceRefs(); for( int i=0; i<refs.length; i++ ) Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ContextualTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ContextualTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ContextualTask.java Mon Jun 7 10:29:41 2004 @@ -63,6 +63,11 @@ return m_init; } + public String getKey() + { + return getContext().getKey(); + } + public Context getContext() { if( null == m_context ) Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java Mon Jun 7 10:29:41 2004 @@ -52,7 +52,7 @@ public void execute() throws BuildException { log( "creating plugin declaration" ); - final Definition def = getHome().getDefinition(); + final Definition def = getHome().getDefinition( getKey() ); try { @@ -81,7 +81,7 @@ File ants = new File( dir, TYPE + "s" ); mkDir( ants ); - Definition def = getHome().getDefinition(); + Definition def = getHome().getDefinition( getKey() ); Info info = def.getInfo(); String filename = getFilename( info ); return new File( ants, filename ); Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/HomeTask.java ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/HomeTask.java Mon Jun 7 10:29:41 2004 @@ -0,0 +1,105 @@ +/* + * Copyright 2004 Apache Software Foundation + * 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 org.apache.avalon.tools.tasks; + +import java.io.File; +import java.io.IOException; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.taskdefs.Copy; +import org.apache.tools.ant.taskdefs.Jar; +import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.Path; + +import org.apache.avalon.tools.home.Home; +import org.apache.avalon.tools.home.Context; +import org.apache.avalon.tools.project.Definition; + +/** + * Load a goal. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ + */ +public class HomeTask extends ContextualTask +{ + private String m_id; + private static Home HOME; + + /** + * Set the home ref id to the system home. If not supplied the + * default system home 'project.home' id will apply. + * + * @param id a home id + */ + public void setRefid( String id ) + { + m_id = id; + } + + public void init() + { + if( !isInitialized() ) + { + super.init(); + if( null == HOME ) + { + HOME = new Home( getProject(), Home.KEY ); + } + getProject().addReference( Home.KEY, HOME ); + } + } + + private String getHomeID() + { + if( null == m_id ) + { + return Home.KEY; + } + else + { + return m_id; + } + } + + private Home getHomeFromReference( String id ) + { + Object object = getProject().getReference( id ); + if( null == object ) + { + return null; + } + if( object instanceof Home ) + { + return (Home) object; + } + else + { + final String error = + "System home ref id '" + id + + "' declared or implied in task [" + + getTaskName() + + "] in the project [" + + getProject().getName() + + "] references a object that is not a system home."; + throw new BuildException( error ); + } + } +} Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java Mon Jun 7 10:29:41 2004 @@ -57,7 +57,7 @@ fileset.createInclude().setName( "**/*" ); File cache = getHome().getRepository().getCacheDirectory(); - String group = getHome().getDefinition().getInfo().getGroup(); + String group = getHome().getDefinition( getKey() ).getInfo().getGroup(); File target = new File( cache, group ); mkDir( target ); Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java Mon Jun 7 10:29:41 2004 @@ -57,12 +57,21 @@ public static final String TEST_TMP_KEY = "project.test.temp"; public static final String TEST_TMP_VALUE = "temp"; - public static final String DEBUG_KEY = "test.compile.debug"; + public static final String DEBUG_KEY = "project.test.compile.debug"; public static final boolean DEBUG_VALUE = true; - public static final String FORK_KEY = "test.compile.fork"; + public static final String FORK_KEY = "project.test.compile.fork"; public static final boolean FORK_VALUE = false; + public static final String HALT_ON_ERROR_KEY = "project.test.halt-on-error"; + public static final boolean HALT_ON_ERROR_VALUE = false; + + public static final String HALT_ON_FAILURE_KEY = "project.test.halt-on-failure"; + public static final boolean HALT_ON_FAILURE_VALUE = true; + + private static final String ERROR_KEY = "project.test.error"; + private static final String FAILURE_KEY = "project.test.failure"; + private File m_test; public void init() throws BuildException @@ -76,6 +85,8 @@ project.setNewProperty( TEST_SRC_KEY, "" + TEST_SRC_VALUE ); project.setNewProperty( TEST_ENV_KEY, "" + TEST_ENV_VALUE ); project.setNewProperty( TEST_TMP_KEY, "" + TEST_TMP_VALUE ); + project.setNewProperty( HALT_ON_ERROR_KEY, "" + HALT_ON_ERROR_VALUE ); + project.setNewProperty( HALT_ON_FAILURE_KEY, "" + HALT_ON_FAILURE_VALUE ); getContext().setBuildPath( TEST_KEY, TEST_VALUE ); m_test = getContext().getBuildPath( TEST_KEY ); } @@ -93,7 +104,7 @@ { File classes = new File( m_test, "classes" ); mkDir( classes ); - Definition definition = getHome().getDefinition(); + Definition definition = getHome().getDefinition( getKey() ); Path classpath = getHome().getRepository().createPath( project, definition ); @@ -106,11 +117,73 @@ File jar = getContext().getBuildPath( "jar" ); classpath.createPathElement().setLocation( jar ); compile( src, classes, classpath ); + copyCompileResource( src, classes ); classpath.createPathElement().setLocation( classes ); - test( src, classpath ); + + // + // setup test resources + // + + File temp = new File( m_test, "temp" ); + mkDir( temp ); + copyUnitTestResource( temp ); + test( src, classpath, temp ); + } + + /* + System.out.println( + "error: [" + + project.getProperty( ERROR_KEY ) + + "]" ); + System.out.println( + "failure: [" + + project.getProperty( FAILURE_KEY ) + + "]" ); + */ + } + + private void copyUnitTestResource( File dest ) + { + File build = getContext().getBuildDirectory(); + File src = getUnitTestResourcesDirectory( build ); + if( src.exists() ) + { + mkDir( dest ); + Copy copy = (Copy) getProject().createTask( "copy" ); + copy.setPreserveLastModified( true ); + copy.setTodir( dest ); + + FileSet fileset = new FileSet(); + fileset.setDir( src ); + copy.addFileset( fileset ); + copy.init(); + copy.execute(); } } + private File getUnitTestResourcesDirectory( File build ) + { + File etc = new File( build, "etc" ); + File test = new File( etc, "test" ); + File unit = new File( test, "unit" ); + return unit; + } + + private void copyCompileResource( File src, File classes ) + { + Copy copy = (Copy) getProject().createTask( "copy" ); + copy.setPreserveLastModified( true ); + copy.setTodir( classes ); + + FileSet fileset = new FileSet(); + fileset.setDir( src ); + fileset.setIncludes( "**/**" ); + fileset.setExcludes( "**/*.java,**/package.html" ); + copy.addFileset( fileset ); + copy.init(); + copy.execute(); + } + private void compile( File sources, File classes, Path classpath ) { File basedir = getProject().getBaseDir(); @@ -126,26 +199,23 @@ javac.execute(); } - private void test( File src, Path classpath ) + private void test( File src, Path classpath, File base ) { + Project project = getProject(); + FileSet fileset = new FileSet(); fileset.setDir( src ); fileset.createInclude().setName( "**/*TestCase.java" ); fileset.createExclude().setName( "**/Abstract*.java" ); - File base = new File( m_test, "temp" ); - mkDir( base ); - JUnitTask junit = (JUnitTask) getProject().createTask( "junit" ); junit.setFork( getForkProperty() ); + junit.setErrorProperty( ERROR_KEY ); + junit.setFailureProperty( FAILURE_KEY ); JUnitTask.SummaryAttribute summary = new JUnitTask.SummaryAttribute(); summary.setValue( "on" ); junit.setPrintsummary( summary ); - junit.setHaltonfailure( true ); - junit.setHaltonerror( true ); - junit.setErrorProperty( "test-errors" ); - junit.setFailureProperty( "test-failures" ); if( FORK_VALUE ) { junit.setFork( true ); @@ -156,6 +226,12 @@ junit.setReloading( true ); junit.setFiltertrace( true ); junit.createClasspath().add( classpath ); + junit.setHaltonerror( + getBooleanProperty( + HALT_ON_ERROR_KEY, HALT_ON_ERROR_VALUE ) ); + junit.setHaltonfailure( + getBooleanProperty( + HALT_ON_FAILURE_KEY, HALT_ON_FAILURE_VALUE ) ); File reports = new File( m_test, "reports" ); mkDir( reports ); @@ -179,7 +255,6 @@ Environment.Variable basedir = new Environment.Variable(); basedir.setKey( "basedir" ); basedir.setValue( base.toString() ); - junit.addSysproperty( basedir ); junit.init(); Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java Mon Jun 7 10:29:41 2004 @@ -76,8 +76,8 @@ public File getJarFile( File deliverables ) { Project project = getProject(); - Definition def = getHome().getDefinition(); - String type = getHome().getDefinition().getInfo().getType(); + Definition def = getHome().getDefinition( getKey() ); + String type = def.getInfo().getType(); File types = new File( deliverables, type + "s" ); String filename = getJarFilename( def ); return new File( types, filename ); Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java Mon Jun 7 10:29:41 2004 @@ -78,7 +78,7 @@ Path classpath = getHome().getRepository().createPath( - getProject(), getHome().getDefinition() ); + getProject(), getHome().getDefinition( getKey() ) ); compile( main, classes, classpath ); Copy copy = (Copy) getProject().createTask( "copy" ); @@ -92,6 +92,10 @@ copy.addFileset( fileset ); copy.init(); copy.execute(); + } + else + { + log( "no src main to compile : " + main.toString() ); } } Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java Mon Jun 7 10:29:41 2004 @@ -45,6 +45,11 @@ private static final String SRC_FILTERED_INCLUDES_VALUE = "**/*.java,**/*.x*,**/*.properties"; + private static final String ETC_FILTERED_INCLUDES_KEY = + "project.prepare.etc.filtered.includes"; + private static final String ETC_FILTERED_INCLUDES_VALUE = + "**/*.*"; + public void init() throws BuildException { if( !isInitialized() ) @@ -53,6 +58,8 @@ Project project = getProject(); project.setNewProperty( SRC_FILTERED_INCLUDES_KEY, SRC_FILTERED_INCLUDES_VALUE ); + project.setNewProperty( + ETC_FILTERED_INCLUDES_KEY, ETC_FILTERED_INCLUDES_VALUE ); } } @@ -66,23 +73,28 @@ mkDir( target ); } File src = getContext().getSrcDirectory(); + File etc = getContext().getEtcDirectory(); File build = getContext().getBuildDirectory(); - if( !build.exists() ) - { - log( "creating build directory" ); - mkDir( build ); - } if( src.exists() ) { String filters = project.getProperty( SRC_FILTERED_INCLUDES_KEY ); copy( src, build, true, filters, "" ); copy( src, build, false, "**/*.*", filters ); } + if( etc.exists() ) + { + File buildEtcDir = new File( build, "etc" ); + String filters = project.getProperty( ETC_FILTERED_INCLUDES_KEY ); + copy( etc, buildEtcDir, true, filters, "" ); + copy( etc, buildEtcDir, false, "**/*.*", filters ); + } } private void copy( File src, File destination, boolean filtering, String includes, String excludes ) { + mkDir( destination ); + Copy copy = (Copy) getProject().createTask( "copy" ); copy.setTodir( destination ); copy.setFiltering( filtering ); @@ -98,5 +110,4 @@ copy.init(); copy.execute(); } - } Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ReactorTask.java Mon Jun 7 10:29:41 2004 @@ -0,0 +1,241 @@ +/* + * Copyright 2004 Apache Software Foundation + * 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 org.apache.avalon.tools.tasks; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.taskdefs.Ant; +import org.apache.tools.ant.taskdefs.Copy; +import org.apache.tools.ant.taskdefs.Delete; +import org.apache.tools.ant.taskdefs.Jar; +import org.apache.tools.ant.taskdefs.Mkdir; +import org.apache.tools.ant.taskdefs.Checksum; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.FileList; +import org.apache.tools.ant.types.DirSet; +import org.apache.tools.ant.types.Path; + +import org.apache.avalon.tools.home.Context; +import org.apache.avalon.tools.home.Home; +import org.apache.avalon.tools.project.Definition; +import org.apache.avalon.tools.project.ProjectRef; +import org.apache.avalon.tools.project.PluginRef; + +/** + * Build a set of projects taking into account dependencies within the + * supplied fileset. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $ + */ +public class ReactorTask extends SystemTask +{ + private static final String BANNER = + "------------------------------------------------------------------------"; + private Path m_path; + private List m_defs; + + public void init() + { + m_path = new Path( getProject() ); + } + + public void addConfigured( final Path path ) + { + m_path.add( path ); + } + + public void addConfigured( final DirSet dirset ) + { + m_path.addDirset( dirset ); + } + + public void addConfigured( final FileSet fileset ) + { + m_path.addFileset( fileset ); + } + + public void addConfigured( final FileList list ) + { + m_path.addFilelist( list ); + } + + public void execute() throws BuildException + { + final Project project = getProject(); + m_defs = getDefinitions(); + final Definition[] defs = walkGraph(); + log( "Build sequence for project group:" ); + project.log( BANNER ); + for( int i=0; i<defs.length; i++ ) + { + final Definition def = defs[i]; + project.log( def.toString() ); + } + project.log( BANNER ); + for( int i=0; i<defs.length; i++ ) + { + final Definition def = defs[i]; + try + { + build( def ); + } + catch( Throwable e ) + { + throw new BuildException( e ); + } + } + } + + public void build( final Definition definition ) + { + final Ant ant = (Ant) getProject().createTask( "ant" ); + ant.setDir( definition.getBasedir() ); + ant.setInheritRefs( false ); + ant.setInheritAll( false ); + ant.init(); + ant.execute(); + } + + private Definition[] walkGraph() + { + final ArrayList result = new ArrayList(); + final ArrayList done = new ArrayList(); + + final int size = m_defs.size(); + for( int i = 0; i < size; i++ ) + { + final Definition def = (Definition) m_defs.get( i ); + visit( def, done, result ); + } + + final Definition[] returnValue = new Definition[result.size()]; + return (Definition[]) result.toArray( returnValue ); + } + + private void visit( final Definition def, final ArrayList done, + final ArrayList order ) + { + if( done.contains( def ) ) return; + done.add( def ); + visitProviders( def, done, order ); + order.add( def ); + } + + private void visitProviders( + final Definition def, final ArrayList done, final ArrayList order ) + { + final Definition[] providers = getProviders( def ); + for( int i = (providers.length - 1); i > -1; i-- ) + { + visit( providers[i], done, order ); + } + } + + private Definition[] getProviders( final Definition def ) + { + final ArrayList list = new ArrayList(); + final ProjectRef[] refs = def.getProjectRefs(); + for( int i=0; i<refs.length; i++ ) + { + final Definition d = getHome().getDefinition( refs[i] ); + if( m_defs.contains( d ) ) + { + list.add( d ); + } + } + final PluginRef[] prefs = def.getPluginRefs(); + for( int i=0; i<prefs.length; i++ ) + { + final Definition d = getHome().getPlugin( prefs[i] ); + if( m_defs.contains( d ) ) + { + list.add( d ); + } + } + return (Definition[]) list.toArray( new Definition[0] ); + } + + private List getDefinitions() + { + final ArrayList list = new ArrayList(); + final Project project = getProject(); + final File basedir = project.getBaseDir(); + final String[] names = m_path.list(); + for( int i=0; i<names.length; i++ ) + { + final String path = names[i]; + final File file = Context.getFile( basedir, path ); + final File dir = getDir( file ); + final File props = new File( dir, "build.xml" ); + if( file.exists() ) + { + final String key = getProjectName( dir ); + if( null != key ) + { + list.add( getHome().getDefinition( key ) ); + } + else + { + log( "Skipping dir: " + + dir + + "due to unresolve project name." ); + } + } + else + { + log( "Skipping dir: " + + dir + + "due to missing build.properties file" ); + } + } + return list; + } + + private String getProjectName( final File dir ) + { + try + { + final Properties properties = new Properties(); + final File props = new File( dir, "build.properties" ); + final InputStream stream = new FileInputStream( props ); + properties.load( stream ); + return properties.getProperty( "project.name" ); + } + catch( IOException ioe ) + { + throw new BuildException( ioe ); + } + } + + private File getDir( final File file ) + { + if( file.isDirectory() ) return file; + return file.getParentFile(); + } +} Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java ============================================================================== --- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java (original) +++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java Mon Jun 7 10:29:41 2004 @@ -68,7 +68,8 @@ if( null == object ) { final String error = - "System home ref id '" + id + "' declared or implied in task [" + "System home ref id '" + id + + "' declared or implied in task [" + getTaskName() + "] is unknown with the project [" + getProject().getName() @@ -82,7 +83,8 @@ else { final String error = - "System home ref id '" + id + "' declared or implied in task [" + "System home ref id '" + id + + "' declared or implied in task [" + getTaskName() + "] in the project [" + getProject().getName() Added: avalon/trunk/tools/project/core/src/test/build.properties ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/test/build.properties Mon Jun 7 10:29:41 2004 @@ -0,0 +1,3 @@ +project.name = test +project.home = . +project.gpg.exe = gpg \ No newline at end of file Added: avalon/trunk/tools/project/core/src/test/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/test/build.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="test" default="build" basedir="." xmlns:x="antlib:org.apache.avalon.tools"> + + <path id="targets"> + <dirset dir="projects" includes="*"/> + </path> + + <target name="build" depends=""> + <property file="build.properties"/> + <x:home/> + <x:reactor> + <path refid="targets"/> + </x:reactor> + </target> + + <target name="clean" depends=""> + <subant inheritAll="false" genericantfile="standard.xml" target="clean" + buildpathref="targets"/> + </target> + +</project> Added: avalon/trunk/tools/project/core/src/test/generic.xml ============================================================================== --- (empty file) +++ avalon/trunk/tools/project/core/src/test/generic.xml Mon Jun 7 10:29:41 2004 @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<project name="generic" basedir="."> + <import file="${basedir}/build.xml"/> +</project> + Modified: avalon/trunk/tools/project/core/src/test/projects/demo/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/demo/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/demo/build.properties Mon Jun 7 10:29:41 2004 @@ -1,2 +1,3 @@ +project.name = demo project.home = ../.. project.gpg.exe = gpg Modified: avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties Mon Jun 7 10:29:41 2004 @@ -1,2 +1,3 @@ +project.name = gizmo project.home = ../.. project.gpg.exe = gpg Modified: avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml (original) +++ avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml Mon Jun 7 10:29:41 2004 @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="UTF-8" ?> -<project name="gizmo" default="dist" basedir="."> +<project name="gizmo" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> <property file="build.properties"/> <import file="${project.home}/standard.xml"/> -</project> \ No newline at end of file +</project> Modified: avalon/trunk/tools/project/core/src/test/projects/sample/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/sample/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/sample/build.properties Mon Jun 7 10:29:41 2004 @@ -1,2 +1,3 @@ +project.name = sample project.home = ../.. project.gpg.exe = gpg Modified: avalon/trunk/tools/project/core/src/test/projects/sample/build.xml ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/sample/build.xml (original) +++ avalon/trunk/tools/project/core/src/test/projects/sample/build.xml Mon Jun 7 10:29:41 2004 @@ -6,10 +6,7 @@ <property file="build.properties"/> <import file="${project.home}/standard.xml"/> - - <x:home> - <x:plugin artifact="plugin:demo/demo#1.0"/> - </x:home> + <x:plugin artifact="plugin:demo/demo#1.0"/> <target name="build" depends="standard.build"> <d:hello/> Modified: avalon/trunk/tools/project/core/src/test/projects/widget/build.properties ============================================================================== --- avalon/trunk/tools/project/core/src/test/projects/widget/build.properties (original) +++ avalon/trunk/tools/project/core/src/test/projects/widget/build.properties Mon Jun 7 10:29:41 2004 @@ -1,2 +1,3 @@ +project.name = widget project.home = ../.. project.gpg.exe = gpg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]