Author: chirino
Date: Wed Jul 23 08:22:32 2008
New Revision: 679111
URL: http://svn.apache.org/viewvc?rev=679111&view=rev
Log:
Adding maven mojos needed for the build and some missing poms. The Jute stuff was updated so that the output directory can be configured.
Added:
activemq/sandbox/zookeeper/pom.xml (with props)
activemq/sandbox/zookeeper/zookeeper-c/pom.xml (with props)
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JuteMojo.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGenMojo.java
Removed:
activemq/sandbox/zookeeper/zookeeper-core/src/main/java/org/apache/zookeeper/version/util/
Modified:
activemq/sandbox/zookeeper/zookeeper-core/src/test/java/org/apache/zookeeper/test/ClientBase.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CGenerator.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CppGenerator.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JFile.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JRecord.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JavaGenerator.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGen.java
activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/javacc/rcc.jj
Added: activemq/sandbox/zookeeper/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/pom.xml?rev=679111&view=auto
==============================================================================
--- activemq/sandbox/zookeeper/pom.xml (added)
+++ activemq/sandbox/zookeeper/pom.xml Wed Jul 23 08:22:32 2008
@@ -0,0 +1,507 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-pom</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ZooKeeper</name>
+ <description>
+ ZooKeeper is a service for coordinating processes of distributed applications. Historically distributed processes are coordinated
+ using group messaging, shared registers, or distributed lock services. ZooKeeper incorporates elements from all these servers,
+ but incorporates them into a replicated centralized service. The interface exposed by ZooKeeper incorporates the wait-free aspects
+ of group messaging and shared registers with an eventing mechanism similar to those of locking services to provide a simple,
+ yet powerful coordination service.
+ </description>
+
+ <properties>
+ <junit-version>4.4</junit-version>
+ <log4j-version>1.2.15</log4j-version>
+ </properties>
+
+ <prerequisites>
+ <maven>2.0.8</maven>
+ </prerequisites>
+
+ <!-- TODO: need to update this once the ZooKeeper site is on Apache Servers -->
+ <url>http://hadoop.apache.org/</url>
+
+ <mailingLists>
+ <mailingList>
+ <name>Development List</name>
+ <subscribe>zookeeper-dev-subscribe@hadoop.apache.org</subscribe>
+ <unsubscribe>zookeeper-dev-unsubscribe@hadoop.apache.org</unsubscribe>
+ <post>zookeeper-dev@hadoop.apache.org</post>
+ </mailingList>
+ <mailingList>
+ <name>User List</name>
+ <subscribe>zookeeper-user-subscribe@hadoop.apache.org</subscribe>
+ <unsubscribe>zookeeper-user-unsubscribe@hadoop.apache.org</unsubscribe>
+ <post>zookeeper-user@hadoop.apache.org</post>
+ </mailingList>
+ </mailingLists>
+
+ <modules>
+ <module>zookeeper-jute</module>
+ <module>zookeeper-jute-compiler</module>
+ <module>zookeeper-core</module>
+ <module>zookeeper-jmx</module>
+ <module>zookeeper-all</module>
+ <module>zookeeper-c</module>
+ </modules>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/hadoop/zookeeper/trunk</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk</developerConnection>
+ <url>http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/</url>
+ </scm>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jute</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jute-compiler</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-core</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jmx</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-all</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.jmx</groupId>
+ <artifactId>jmxri</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jdmk</groupId>
+ <artifactId>jmxtools</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit-version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.0-alpha-4</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <properties>
+ <projectName>${projectName}</projectName>
+ </properties>
+ <resourceBundles>
+ <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-stage-plugin</artifactId>
+ <version>1.0-alpha-1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.geronimo.genesis.plugins</groupId>
+ <artifactId>tools-maven-plugin</artifactId>
+ <version>1.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rat-maven-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+ <configuration>
+ <excludeSubProjects>false</excludeSubProjects>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <failIfNoTests>false</failIfNoTests>
+ <systemProperties>
+ <property>
+ <name>build.test.dir</name>
+ <value>${project.build.directory}/test-data</value>
+ </property>
+ </systemProperties>
+ <includes>
+ <include>**/*Test.*</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <index>true</index>
+ <compress>true</compress>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <outputDirectory>${basedir}/eclipse-classes</outputDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rat-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.geronimo.genesis.plugins</groupId>
+ <artifactId>tools-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>verify-legal-files</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>verify-legal-files</goal>
+ </goals>
+ <configuration>
+ <!-- Fail the build if no legal files were found -->
+ <strict>true</strict>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-stage-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ <link>http://java.sun.com/j2ee/1.5/docs/api/</link>
+ <link>http://junit.sourceforge.net/javadoc/</link>
+ <link>http://logging.apache.org/log4j/docs/api/</link>
+ </links>
+ <linksource>true</linksource>
+ <maxmemory>900m</maxmemory>
+ <source>1.5</source>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <test>false</test>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <useReleaseProfile>false</useReleaseProfile>
+ <goals>deploy</goals>
+ <arguments>-Prelease</arguments>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+
+ <!-- We want a source jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- We want to sign the artifact, the POM, and all attached artifacts -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <passphrase>${gpg.passphrase}</passphrase>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- We want to deploy the artifact to a staging location for perusal -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <altDeploymentRepository>${staging.altRepository}/${siteId}</altDeploymentRepository>
+ <updateReleaseInfo>true</updateReleaseInfo>
+ </configuration>
+ </plugin>
+
+ <!-- We want the JavaDoc JAR published with the release -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>full</id>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <test>false</test>
+ </configuration>
+ </plugin>
+
+ <!-- We want a source jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- We want the JavaDoc JAR published with the release -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
Propchange: activemq/sandbox/zookeeper/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/sandbox/zookeeper/zookeeper-c/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-c/pom.xml?rev=679111&view=auto
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-c/pom.xml (added)
+++ activemq/sandbox/zookeeper/zookeeper-c/pom.xml Wed Jul 23 08:22:32 2008
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-pom</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-c</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ZooKeeper :: C</name>
+ <description></description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper-jute-compiler</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>jute</id>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <sourceDirectory>${basedir}/..</sourceDirectory>
+ <outputDirectory>${basedir}/generated</outputDirectory>
+ <language>c</language>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: activemq/sandbox/zookeeper/zookeeper-c/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Modified: activemq/sandbox/zookeeper/zookeeper-core/src/test/java/org/apache/zookeeper/test/ClientBase.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-core/src/test/java/org/apache/zookeeper/test/ClientBase.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-core/src/test/java/org/apache/zookeeper/test/ClientBase.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-core/src/test/java/org/apache/zookeeper/test/ClientBase.java Wed Jul 23 08:22:32 2008
@@ -52,6 +52,7 @@
protected void setUp() throws Exception {
LOG.info("Client test setup");
+ baseTest.mkdirs();
tmpDir = File.createTempFile("test", ".junit", baseTest);
tmpDir = new File(tmpDir + ".dir");
tmpDir.mkdirs();
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CGenerator.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CGenerator.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CGenerator.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CGenerator.java Wed Jul 23 08:22:32 2008
@@ -34,15 +34,18 @@
private String mName;
private ArrayList mInclFiles;
private ArrayList mRecList;
+ private final File outputDirectory;
/** Creates a new instance of CppGenerator
*
* @param name possibly full pathname to the file
* @param ilist included files (as JFile)
* @param rlist List of records defined within this file
+ * @param outputDirectory
*/
- CGenerator(String name, ArrayList ilist, ArrayList rlist) {
+ CGenerator(String name, ArrayList ilist, ArrayList rlist, File outputDirectory) {
mFullName = name;
+ this.outputDirectory = outputDirectory;
mName = (new File(name)).getName();
mInclFiles = ilist;
mRecList = rlist;
@@ -54,8 +57,9 @@
* record-level code is generated by JRecord.
*/
void genCode() throws IOException {
- FileWriter c = new FileWriter(mName+".c");
- FileWriter h = new FileWriter(mName+".h");
+ outputDirectory.mkdirs();
+ FileWriter c = new FileWriter(new File(outputDirectory, mName+".c"));
+ FileWriter h = new FileWriter(new File(outputDirectory, mName+".h"));
h.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
h.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CppGenerator.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CppGenerator.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CppGenerator.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/CppGenerator.java Wed Jul 23 08:22:32 2008
@@ -34,15 +34,18 @@
private String mName;
private ArrayList mInclFiles;
private ArrayList mRecList;
+ private final File outputDirectory;
/** Creates a new instance of CppGenerator
*
* @param name possibly full pathname to the file
* @param ilist included files (as JFile)
* @param rlist List of records defined within this file
+ * @param outputDirectory
*/
- CppGenerator(String name, ArrayList ilist, ArrayList rlist) {
+ CppGenerator(String name, ArrayList ilist, ArrayList rlist, File outputDirectory) {
mFullName = name;
+ this.outputDirectory = outputDirectory;
mName = (new File(name)).getName();
mInclFiles = ilist;
mRecList = rlist;
@@ -54,8 +57,9 @@
* record-level code is generated by JRecord.
*/
void genCode() throws IOException {
- FileWriter cc = new FileWriter(mName+".cc");
- FileWriter hh = new FileWriter(mName+".hh");
+ outputDirectory.mkdirs();
+ FileWriter cc = new FileWriter(new File(outputDirectory, mName+".cc"));
+ FileWriter hh = new FileWriter(new File(outputDirectory, mName+".hh"));
hh.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
hh.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JFile.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JFile.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JFile.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JFile.java Wed Jul 23 08:22:32 2008
@@ -18,6 +18,7 @@
package org.apache.jute.compiler;
+import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -54,16 +55,17 @@
/** Generate record code in given language. Language should be all
* lowercase.
+ * @param outputDirectory
*/
- public void genCode(String language) throws IOException {
+ public void genCode(String language, File outputDirectory) throws IOException {
if ("c++".equals(language)) {
- CppGenerator gen = new CppGenerator(mName, mInclFiles, mRecords);
+ CppGenerator gen = new CppGenerator(mName, mInclFiles, mRecords, outputDirectory);
gen.genCode();
} else if ("java".equals(language)) {
- JavaGenerator gen = new JavaGenerator(mName, mInclFiles, mRecords);
+ JavaGenerator gen = new JavaGenerator(mName, mInclFiles, mRecords, outputDirectory);
gen.genCode();
} else if ("c".equals(language)) {
- CGenerator gen = new CGenerator(mName, mInclFiles, mRecords);
+ CGenerator gen = new CGenerator(mName, mInclFiles, mRecords, outputDirectory);
gen.genCode();
} else {
System.out.println("Cannnot recognize language:"+language);
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JRecord.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JRecord.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JRecord.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JRecord.java Wed Jul 23 08:22:32 2008
@@ -357,10 +357,10 @@
}
- public void genJavaCode() throws IOException {
+ public void genJavaCode(File outputDirectory) throws IOException {
String pkg = getJavaPackage();
String pkgpath = pkg.replaceAll("\\.", "/");
- File pkgdir = new File(pkgpath);
+ File pkgdir = new File(outputDirectory, pkgpath);
if (!pkgdir.exists()) {
// create the pkg directory
boolean ret = pkgdir.mkdirs();
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JavaGenerator.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JavaGenerator.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JavaGenerator.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JavaGenerator.java Wed Jul 23 08:22:32 2008
@@ -33,17 +33,20 @@
private String mName;
private ArrayList mInclFiles;
private ArrayList mRecList;
+ private final File outputDirectory;
/** Creates a new instance of JavaGenerator
*
* @param name possibly full pathname to the file
* @param incl included files (as JFile)
* @param records List of records defined within this file
+ * @param outputDirectory
*/
- JavaGenerator(String name, ArrayList incl, ArrayList records) {
+ JavaGenerator(String name, ArrayList incl, ArrayList records, File outputDirectory) {
mName = name;
mInclFiles = incl;
mRecList = records;
+ this.outputDirectory = outputDirectory;
}
/**
@@ -53,7 +56,7 @@
void genCode() throws IOException {
for (Iterator i = mRecList.iterator(); i.hasNext(); ) {
JRecord rec = (JRecord) i.next();
- rec.genJavaCode();
+ rec.genJavaCode(outputDirectory);
}
}
}
Added: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JuteMojo.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JuteMojo.java?rev=679111&view=auto
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JuteMojo.java (added)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/jute/compiler/JuteMojo.java Wed Jul 23 08:22:32 2008
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jute.compiler;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.jute.compiler.generated.ParseException;
+import org.apache.jute.compiler.generated.Rcc;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * A Maven Mojo so that the Jute compiler can be used with maven.
+ *
+ * @goal compile
+ * @phase process-sources
+ */
+public class JuteMojo extends AbstractMojo {
+
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * The directory where the jute files (<code>*.jute</code>) are located.
+ *
+ * @parameter expression="${sourceDirectory}" default-value="${basedir}/src/main/jute"
+ */
+ private File sourceDirectory;
+
+ /**
+ * The directory where the output files will be located.
+ *
+ * @parameter expression="${outputDirectory}" default-value="${project.build.directory}/generated-sources/jute"
+ */
+ private File outputDirectory;
+
+ /**
+ *
+ * @parameter default-value="java"
+ * @required
+ */
+ private String language;
+
+ public void execute() throws MojoExecutionException {
+
+ List<File> recFiles = Arrays.asList(sourceDirectory.listFiles(new FileFilter(){
+ public boolean accept(File pathname) {
+ return pathname.getName().endsWith(".jute");
+ }
+ }));
+
+ if (!"c++".equals(language) && !"java".equals(language) && !"c".equals(language)) {
+ throw new MojoExecutionException("Cannot recognize language:" + language);
+ }
+ if (recFiles.size() == 0) {
+ getLog().warn("No jute record files found in directory: "+sourceDirectory.getPath());
+ return;
+ }
+ for (File file : recFiles) {
+ JFile result;
+ try {
+ result = Rcc.parseFile(file);
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException("File " + file.getPath()+" Not found.", e);
+ } catch (ParseException e) {
+ throw new MojoExecutionException(e.toString(), e);
+ }
+ getLog().info(file.getPath()+ " Parsed Successfully");
+ try {
+ result.genCode(language, outputDirectory);
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.toString(), e);
+ }
+ }
+
+ this.project.addCompileSourceRoot( outputDirectory.getAbsolutePath() );
+ }
+
+
+}
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGen.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGen.java?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGen.java (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGen.java Wed Jul 23 08:22:32 2008
@@ -32,10 +32,10 @@
System.exit(1);
}
- static void generateFile(int maj, int min, int micro, int rev,
+ static void generateFile(File outputDir, int maj, int min, int micro, int rev,
String buildDate) {
String path = PACKAGE_NAME.replaceAll("\\.", "/");
- File pkgdir = new File(path);
+ File pkgdir = new File(outputDir, path);
if (!pkgdir.exists()) {
// create the pkg directory
boolean ret = pkgdir.mkdirs();
@@ -100,7 +100,7 @@
int min = Integer.parseInt(v[1]);
int micro = Integer.parseInt(v[2]);
int rev = Integer.parseInt(args[1]);
- generateFile(maj, min, micro, rev, args[2]);
+ generateFile(new File("."), maj, min, micro, rev, args[2]);
} catch (NumberFormatException e) {
System.err
.println("All version-related parameters must be valid integers!");
Added: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGenMojo.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGenMojo.java?rev=679111&view=auto
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGenMojo.java (added)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/java/org/apache/zookeeper/version/util/VerGenMojo.java Wed Jul 23 08:22:32 2008
@@ -0,0 +1,145 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.zookeeper.version.util;
+
+import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringStack;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.TimeZone;
+
+import org.apache.jute.compiler.generated.ParseException;
+import org.apache.jute.compiler.generated.Rcc;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * A Maven Mojo so that the version file can be generated with maven.
+ *
+ * @goal version-gen
+ * @phase process-sources
+ */
+public class VerGenMojo extends AbstractMojo {
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * The svn directory that will be used to get the revision number for the build
+ *
+ * @parameter expression="${sourceDirectory}" default-value="${basedir}"
+ */
+ private File svnDirectory;
+
+ /**
+ * The svn executable that will be used to get the revision number for the build
+ *
+ * @parameter default-value="svn"
+ */
+ private String svnxExecutable;
+
+ /**
+ * The directory where the output files will be located.
+ *
+ * @parameter expression="${outputDirectory}" default-value="${project.build.directory}/generated-sources/version-gen"
+ */
+ private File outputDirectory;
+
+ public void execute() throws MojoExecutionException {
+
+ int maj=0, min=0, micro=0, rev=0;
+
+ // Get the version number from the maven project.
+ String version = project.getVersion();
+ String[] v = version.split("\\.|\\-");
+ try {
+ maj = Integer.parseInt(v[0]);
+ try {
+ min = Integer.parseInt(v[1]);
+ try {
+ micro = Integer.parseInt(v[2]);
+ } catch (NumberFormatException e){
+ }
+ } catch (NumberFormatException e){
+ }
+ } catch (NumberFormatException e){
+ }
+
+ // Format the date properly
+ SimpleDateFormat formater = new SimpleDateFormat("MM/dd/yyyy HH:mm zz");
+ formater.setTimeZone(TimeZone.getTimeZone("GMT"));
+ String date = formater.format(new Date());
+
+ VerGen.generateFile(outputDirectory, maj, min, micro, rev, date);
+
+ // Use the svn command to figure out the revision number.
+ String svnDir;
+ try {
+ svnDir = svnDirectory.getCanonicalPath();
+ } catch (IOException e1) {
+ throw new MojoExecutionException("Invalid directory: "+svnDirectory.getPath(), e1);
+ }
+ try {
+ Commandline cli = new Commandline();
+ cli.setExecutable( svnxExecutable );
+ cli.addArguments(new String[]{ "info", svnDir});
+ CommandLineUtils.StringStreamConsumer out=new CommandLineUtils.StringStreamConsumer();
+ int rc = CommandLineUtils.executeCommandLine(cli, out, out);
+ getLog().debug("svn info '"+svnDir+"' rc="+rc);
+ if( rc == 0 ) {
+ String output = out.getOutput();
+ getLog().debug("svn output="+output);
+ String label = "Revision: ";
+ int pos = output.indexOf(label);
+ if( pos >= 0 ) {
+ StringTokenizer tok = new StringTokenizer(output.substring(pos+label.length()));
+ rev = Integer.parseInt(tok.nextToken());
+ }
+ }
+
+ } catch (Throwable e) {
+ getLog().warn("Unabled to determin svn revsion of directory: "+svnDir);
+ }
+
+ this.project.addCompileSourceRoot( outputDirectory.getAbsolutePath() );
+ }
+
+
+}
Modified: activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/javacc/rcc.jj
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/javacc/rcc.jj?rev=679111&r1=679110&r2=679111&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/javacc/rcc.jj (original)
+++ activemq/sandbox/zookeeper/zookeeper-jute-compiler/src/main/javacc/rcc.jj Wed Jul 23 08:22:32 2008
@@ -33,15 +33,16 @@
import java.io.IOException;
public class Rcc {
- private static String language = "java";
- private static ArrayList recFiles = new ArrayList();
- private static JFile curFile;
- private static Hashtable recTab;
+ private static Hashtable recTab = new Hashtable();
private static String curDir = System.getProperty("user.dir");
private static String curFileName;
private static String curModuleName;
public static void main(String args[]) {
+ String language = "java";
+ ArrayList recFiles = new ArrayList();
+ JFile curFile=null;
+
for (int i=0; i<args.length; i++) {
if ("-l".equalsIgnoreCase(args[i]) ||
"--language".equalsIgnoreCase(args[i])) {
@@ -63,34 +64,39 @@
curFileName = (String) recFiles.get(i);
File file = new File(curDir, curFileName);
try {
- FileReader reader = new FileReader(file);
- Rcc parser = new Rcc(reader);
- try {
- recTab = new Hashtable();
- curFile = parser.Input();
- System.out.println((String) recFiles.get(i) +
- " Parsed Successfully");
- } catch (ParseException e) {
- System.out.println(e.toString());
- System.exit(1);
- }
- try {
- reader.close();
- } catch (IOException e) {
- }
+ curFile = parseFile(file);
} catch (FileNotFoundException e) {
- System.out.println("File " + (String) recFiles.get(i) +
- " Not found.");
+ System.out.println("File " + (String) recFiles.get(i) + " Not found.");
+ System.exit(1);
+ } catch (ParseException e) {
+ System.out.println(e.toString());
System.exit(1);
}
+ System.out.println((String) recFiles.get(i) + " Parsed Successfully");
try {
- curFile.genCode(language);
+ curFile.genCode(language, new File("."));
} catch (IOException e) {
System.out.println(e.toString());
System.exit(1);
}
}
}
+
+ public static JFile parseFile(File file) throws FileNotFoundException, ParseException {
+ curDir = file.getPath();
+ curFileName = file.getName();
+ FileReader reader = new FileReader(file);
+ try {
+ Rcc parser = new Rcc(reader);
+ recTab = new Hashtable();
+ return parser.Input();
+ } finally {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ }
+ }
+ }
}
PARSER_END(Rcc)
|