All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xsom.build.xml Maven / Gradle / Ivy

Go to download

Old JAXB Binding Compiler. Contains source code needed for binding customization files into java sources. In other words: the *tool* to generate java classes for the given xml representation.

There is a newer version: 4.0.5
Show newest version
<?xml version="1.0"?>

<!--
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
 Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
 The contents of this file are subject to the terms of either the GNU
 General Public License Version 2 only ("GPL") or the Common Development
 and Distribution License("CDDL") (collectively, the "License").  You
 may not use this file except in compliance with the License. You can obtain
 a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 language governing permissions and limitations under the License.
 
 When distributing the software, include this License Header Notice in each
 file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 Sun designates this particular file as subject to the "Classpath" exception
 as provided by Sun in the GPL Version 2 section of the License file that
 accompanied this code.  If applicable, add the following below the License
 Header, with the fields enclosed by brackets [] replaced by your own
 identifying information: "Portions Copyrighted [year]
 [name of copyright owner]"
 
 Contributor(s):
 
 If you wish your version of this file to be governed by only the CDDL or
 only the GPL Version 2, indicate your decision by adding "[Contributor]
 elects to include this software in this distribution under the [CDDL or GPL
 Version 2] license."  If you don't indicate a single choice of license, a
 recipient has the option to distribute your version of this file under
 either the CDDL, the GPL Version 2 or to extend the choice of license to
 its licensees as provided above.  However, if you add GPL Version 2 code
 and therefore, elected the GPL Version 2 license, then the option applies
 only if the new code is made subject to such option by the copyright
 holder.
-->

<project name="XSOM" basedir="." default="jar">

  <!-- official builds should set this property -->
  <property name="build.id" value="(private build)" />
  
  <!--
    import files to CVS
    
    For example, <cvs-import src="build/doc" dest="jaxb/www/doc" />
  -->
  <macrodef name="cvs-import">
    <attribute name="src"/>
    <attribute name="dest"/>
    <attribute name="cvsroot"/>
    <sequential>
      <tstamp />
      <echo>importing to CVS...</echo>
      <cvs dest="@{src}">
        <commandline>
          <argument value="-d@{cvsroot}"/>
          <argument line="-z9 import -ko"/>
          <argument value="-W"/>
          <argument line="*.jar -kb"/>
          <argument value="-m"/>
          <argument value="deploying new jars to the java.net maven repository"/>
          
          <argument value="@{dest}"/>
          <argument line="deployment-to-maven-repository t${DSTAMP}${TSTAMP}" />
        </commandline>
      </cvs>
    </sequential>
  </macrodef>

	<!-- check if RelaxNGCC needs to be run -->
	<target name="ngcc-check">
		<uptodate property="ngcc.notrequired" targetfile="src/com/sun/xml/xsom/impl/parser/state/Schema.java">
			<srcfiles dir="src" includes="*.rng"/>
			<srcfiles dir="lib" includes="relaxngcc.jar"/>
		</uptodate>
	</target>

    <property name="relaxngcc-jar" value="lib/relaxngcc.jar"/>
    
	<!-- run RELAXNGCC -->
	<target name="ngcc" unless="ngcc.notrequired" depends="ngcc-check">
		<mkdir dir="build/automata"/>

		<!-- delete old files to avoid corruption -->
		<delete dir="build/src" />
		<mkdir dir="build/src/com/sun/xml/xsom/impl/parser/state" />

		<java jar="${relaxngcc-jar}" fork="true">

			<!-- enable debug statements -->
			<!--arg value="-d" /-->
			<!--arg value="- -print-first-follow"/-->

			<!-- dump automata -->
			<!--arg value="- -print-automata"/>
			<arg path="build/automata"/-->

			<!-- specify output directory -->
			<arg value="--target"/>
			<arg path="build/src/com/sun/xml/xsom/impl/parser/state" />

			<!-- source file -->
			<arg path="src/xmlschema.rng"/>
		</java>
	</target>

  <target name="javacc">
  <!--
    <mkdir dir="build/antlr" />
    <antlr target="scd.g" outputdirectory="build/antlr">
      <classpath>
        <fileset file="lib/antlr-2.7.6.jar" />
      </classpath>
    </antlr>
  -->
  <!--
    <mkdir dir="build/src/com/sun/xml/xsom/impl/scd" />
    <javacc
        target="SCD.jj"
        outputdirectory="build/src/com/sun/xml/xsom/impl/scd"
        javacchome="./lib"
    />
  -->
  </target>

  <!-- compile Java source files -->
	<target name="compile" depends="ngcc,javacc"
		description="compiles all the source code into build/classes">
		<mkdir dir="build/classes"/>
		<javac
			srcdir="src; build/src"
			destdir="build/classes"
			debug="on"
			optimize="on">

			<classpath>
                <pathelement path="${cpath.fromsource}"/>
				<fileset dir="lib" includes="*.jar"/>
			</classpath>
		</javac>
	</target>
	
	
	<!-- generate javadoc documentation from the working copy -->
	<target name="javadoc" depends="compile"
		description="generate javadoc">
		<mkdir dir="build/javadoc"/>
		<javadoc	locale="en_US"
					sourcepath="src"
					destdir="build/javadoc"
					windowtitle="XML Schema Object Model (XSOM)"
					public="yes"
					author="yes"
					>
				
			<package name="com.sun.xml.xsom"/>
			<package name="com.sun.xml.xsom.parser"/>
			<package name="com.sun.xml.xsom.visitor"/>
			<classpath>
				<fileset dir="lib" includes="*.jar"/>
			</classpath>
			<link href="http://java.sun.com/xml/jaxp/dist/1.1/docs/api/"
				offline="true" packagelistLoc="devdoc/XML-package"/>
			<link href="http://java.sun.com/products/jdk/1.2/docs/api/"
				offline="true" packagelistLoc="devdoc/coreAPI-package"/>

		</javadoc>
	</target>
	
	
	
	<!-- run clean to avoid files from test code to be included into the jar file -->
	<target name="jar" depends="compile" description="build xsom.jar">
		<tstamp/>
		<mkdir dir="build" />
		
		<jar jarfile="build/xsom.jar" compress="true">
			<manifest>
				<attribute name="Version" value="${DSTAMP}"/>
				<attribute name="Build-Id" value="${build.id}"/>
			</manifest>
			<fileset dir="src" includes="**/*.properties"/>
			<fileset dir="src" includes="**/datatypes.xsd"/>
			<fileset dir="build/classes" includes="**/*.class" />
		</jar>
	</target>

	<target name="jar14" depends="clean,compile"
		description="build xsom14.jar">
		
		<mkdir dir="build/classes14"/>
		<copy todir="build/classes14">
			<fileset dir="build/classes"/>
		</copy>
		
		<java classname="com.rc.retroweaver.Weaver">
			<arg value="-source"/>
			<arg path="build/classes14"/>
			<classpath>
				<fileset dir="lib/retroweaver">
					<include name="*.jar"/>
				</fileset>
			</classpath>
		</java>

    <mkdir dir="build/retroweaver"/>
    <unjar src="lib/retroweaver/retroweaver.jar" dest="build/retroweaver"/>

		<jar jarfile="build/xsom14.jar" compress="true">
			<manifest>
				<attribute name="Version" value="${DSTAMP}"/>
				<attribute name="Build-Id" value="${build.id}"/>
			</manifest>
      <metainf dir="doc" includes="retroweaver-license.html" />
			<fileset dir="src" includes="**/*.properties"/>
			<fileset dir="src" includes="**/datatypes.xsd"/>
      <!-- bundle the retroweaver runtime -->
      <fileset dir="build/retroweaver" includes="**/runtime/*.class"/>
			<fileset dir="build/classes14" includes="**/*.class" />
		</jar>
	</target>
	
	
	
	<!-- create a distribution package -->
	<target name="release" depends="jar,jar14,javadoc,src-installer"
		description="prepare the release binary bundle and the release source code bundle">
		<tstamp />
		<property name="stage" value="xsom-${DSTAMP}"/>
		
		<!-- creates distribution package -->
		<mkdir dir="package" />
		<zip	zipfile="build/${stage}.zip">
			<zipfileset dir="." includes="build/xsom.jar" fullpath="${stage}/xsom.jar" />
			<zipfileset dir="." includes="build/xsom14.jar" fullpath="${stage}/xsom14.jar" />
			<zipfileset dir="." includes="license.txt" prefix="${stage}" />
			<zipfileset dir="build/javadoc" includes="**/*.*" prefix="${stage}/javadoc" />
			<zipfileset dir="doc" includes="**/*.*" prefix="${stage}" />
			<zipfileset dir="examples" includes="**/*" prefix="${stage}/examples" />
			<zipfileset dir="." includes="lib/relaxngDatatype.jar,lib/copying-relaxngDatatype.txt" prefix="${stage}" />
		</zip>
	</target>
	
	
	
	<target name="src-zip" depends="jar">
		<tstamp />
		<mkdir dir="build" />
		<zip zipfile="build/xsom-src.zip" compress="true">
			<zipfileset dir="build/src" />
			<zipfileset dir="src" excludes="*.rng" />
		</zip>
	</target>
	

	<target name="src-full-zip" depends="jar">
            <tstamp />
            <mkdir dir="build" />
            <zip zipfile="build/xsom-full-src.zip" compress="true">
                <zipfileset dir="build/src" prefix="build/src"/>
                <zipfileset dir="." includes="nbproject**/**"/>
                <zipfileset dir="." includes="schemas**/**"/>
                <zipfileset dir="." includes="src**/**"/>
                <zipfileset dir="." includes="test**/**"/>
                <fileset file="*.xml"/>
                <fileset file="*.pom"/>
                <fileset file="*.txt"/>
            </zip>
	</target>

	
	<target name="src-installer" depends="src-zip">
		
		<tstamp />
		
		<property name="src.installer.class" value="build/XSOM_src_${DSTAMP}.class" />
		
		<!-- extract installer -->
		<unzip dest="build/installer">
			<fileset dir="lib" includes="installer.jar"/>
		</unzip>
		
		<jar destfile="build/src-installer.jar">
			<manifest>
				<attribute name="Main-class" value="com.sun.tools.xjc.installer.Main"/>
			</manifest>
			<zipfileset file="build/xsom-src.zip" fullpath="package.zip" />
			<zipfileset dir="build/installer" includes="**/*" excludes="license.txt, META-INF/MANIFEST.MF" />
			<zipfileset dir="." includes="license.txt" />
		</jar>
		
		<!-- pack it into a class -->
		<java jar="lib/sfx4j-1.0.jar" fork="true" failonerror="true">
			<arg path ="build/src-installer.jar"/>
			<arg path ="${src.installer.class}"/>
		</java>
		
		<echo>source installer produced at ${src.installer.class}</echo>
	</target>
  
  <target name="clean">
    <delete dir="build"/>
    <delete dir="j2se-integration"/>
  </target>

  <target name="push-to-maven-prepare"
    description="prepare a repository iamge for the push-to-maven target">
    <taskdef resource="maven-repository-importer.properties">
      <classpath>
        <pathelement path="lib/maven-repository-importer.jar" />
      </classpath>
    </taskdef>
    <delete dir="build/maven-repo" /><!-- clean it -->
    <!-- ${suffix} can be overridden to "" for posting releases -->
    <!--
      when building jars for Maven, we want to put suffix
      (sometimes with version like '-2.0.beta1', with date '-20051208', or with '-SNAPSHOT')
      this property lets you do that.
    -->
    <fail unless="jar.suffix">jar.suffix property needs to be defined</fail>
    <maven-repository-importer
        destdir="build/maven-repo" version="${jar.suffix}">
      <artifact
        jar=   "build/xsom.jar"
        srczip="build/xsom-src.zip"
        pom="xsom.pom" />
    </maven-repository-importer>
  </target>

  <target name="push-to-maven" depends="push-to-maven-prepare"
    description="publish artifacts into the maven repository">
    <cvs-import src="build/maven-repo" dest="xsom/repo" cvsroot=":pserver:${user.name}@cvs.dev.java.net:/cvs" />
  </target>

  <target name="integrate-package-rename-task">
    <get src="http://kohsuke.sfbay/hudson/job/package-rename-task/lastSuccessfulBuild/artifact/target/package-rename-task-1.0.jar"
         dest="lib/package-rename-task.jar"/>
  </target>

  <target name="integrate-maven-repository-importer">
    <get src="http://kohsuke.sfbay/hudson/job/maven-repository-importer/lastSuccessfulBuild/artifact/build/maven-repository-importer.jar"
         dest="lib/maven-repository-importer.jar" />
  </target>

  <target name="j2se-integration" depends="compile"
          description="prepare renamed source code for J2SE integration">
    <taskdef name="prename" classname="com.sun.wts.tools.ant.PackageRenameTask">
      <classpath>
        <pathelement path="lib/package-rename-task.jar" />
      </classpath>
    </taskdef>

    <prename srcdir="src" destdir="j2se-integration/xsom/src">
      <pattern from="com.sun.xml.xsom" to="com.sun.xml.internal.xsom" />
    </prename>
    <prename srcdir="build/src" destdir="j2se-integration/xsom/src">
      <pattern from="com.sun.xml.xsom" to="com.sun.xml.internal.xsom" />
    </prename>

    <!-- sanity test -->
    <mkdir dir="build/renamed-classes"/>
    <javac srcdir="j2se-integration/xsom/src" destdir="build/renamed-classes">
      <classpath>
        <fileset dir="lib" includes="*.jar"/>
      </classpath>
    </javac>
  </target>

  <target name="test" depends="compile">
    <mkdir dir="build/test-classes"/>
    <javac
      srcdir="test"
      destdir="build/test-classes"
      debug="on"
      optimize="on"
      classpath="lib">

      <classpath>
        <fileset dir="lib" includes="*.jar"/>
        <fileset file="build/classes"/>
      </classpath>
    </javac>

    <mkdir dir="build/test-reports"/>
    <junit printsummary="yes" haltonerror="yes" haltonfailure="yes">
      <formatter type="xml"/>
      <batchtest todir="build/test-reports">
        <fileset dir="test">
          <include name="**/*Test.java"/>
          <exclude name="**/Abstract*.java"/>
        </fileset>
      </batchtest>
      <classpath>
        <fileset dir="lib" includes="*.jar"/>
        <fileset file="build/classes"/>
        <fileset file="build/test-classes"/>
      </classpath>
    </junit>
  </target>
  
  <target name="hudson" description="hudson continuous build" depends="jar,src-zip,src-full-zip,javadoc"/>
</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy