From: <cr...@us...> - 2009-09-09 15:19:33
|
Revision: 5666 http://jnode.svn.sourceforge.net/jnode/?rev=5666&view=rev Author: crawley Date: 2009-09-09 15:19:21 +0000 (Wed, 09 Sep 2009) Log Message: ----------- Merge changes from 'trunk' at r5663 (builder) Modified Paths: -------------- branches/jikesRVM/builder/.classpath branches/jikesRVM/builder/.project branches/jikesRVM/builder/.settings/org.eclipse.jdt.core.prefs branches/jikesRVM/builder/build.xml branches/jikesRVM/builder/builder.iml branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/Asm.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/classpath/BaseDirs.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/classpath/CompareTask.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/classpath/Flags.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/classpath/PackageDirectory.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/classpath/SourceFile.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/classpath/TargetedFileSet.java branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractPluginTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractPluginsTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/AddressFinder.java branches/jikesRVM/builder/src/builder/org/jnode/build/AsmSourceInfo.java branches/jikesRVM/builder/src/builder/org/jnode/build/BootDiskBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/BootFloppyBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/BuildException.java branches/jikesRVM/builder/src/builder/org/jnode/build/BuildObjectResolver.java branches/jikesRVM/builder/src/builder/org/jnode/build/FieldInfo.java branches/jikesRVM/builder/src/builder/org/jnode/build/InitJarBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/InitJarsBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/JNodeClassNotFoundException.java branches/jikesRVM/builder/src/builder/org/jnode/build/ObjectEmitter.java branches/jikesRVM/builder/src/builder/org/jnode/build/PluginList.java branches/jikesRVM/builder/src/builder/org/jnode/build/PluginTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/VMwareBuilderTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/dependencies/BCELDependencyChecker.java branches/jikesRVM/builder/src/builder/org/jnode/build/documentation/DotBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/documentation/LicenseEntry.java branches/jikesRVM/builder/src/builder/org/jnode/build/documentation/PackageData.java branches/jikesRVM/builder/src/builder/org/jnode/build/documentation/PluginData.java branches/jikesRVM/builder/src/builder/org/jnode/build/documentation/PluginDocumentationTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/documentation/ToolbarEntry.java branches/jikesRVM/builder/src/builder/org/jnode/build/package.html branches/jikesRVM/builder/src/builder/org/jnode/build/x86/AsmConstBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/x86/Disasm.java branches/jikesRVM/builder/src/builder/org/jnode/build/x86/package.html branches/jikesRVM/builder/src/builder/org/jnode/jnasm/JNAsm.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/Address.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/Assembler.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/AssemblerModule.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/HardwareSupport.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/Identifier.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/Instruction.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/InstructionUtils.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/PseudoInstructions.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/Register.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/x86/AbstractX86Module.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/x86/MMX.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/x86/X86Core.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/assembler/x86/X86Support.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/preprocessor/FileResolver.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/preprocessor/Macro.java branches/jikesRVM/builder/src/builder/org/jnode/jnasm/preprocessor/Preprocessor.java branches/jikesRVM/builder/src/builder/org/jnode/linker/Elf.java branches/jikesRVM/builder/src/builder/org/jnode/linker/ElfLinker.java branches/jikesRVM/builder/src/builder/org/jnode/linker/LoadUtil.java branches/jikesRVM/builder/src/builder/org/jnode/linker/Reloc.java branches/jikesRVM/builder/src/builder/org/jnode/linker/Reloca.java branches/jikesRVM/builder/src/builder/org/jnode/linker/Section.java branches/jikesRVM/builder/src/builder/org/jnode/linker/StoreUtil.java branches/jikesRVM/builder/src/builder/org/jnode/linker/StrTab.java branches/jikesRVM/builder/src/builder/org/jnode/linker/Symbol.java Added Paths: ----------- branches/jikesRVM/builder/.checkstyle branches/jikesRVM/builder/lib/iso9660.jar branches/jikesRVM/builder/lib/jnode-configure-dist.jar branches/jikesRVM/builder/lib/sabre.jar branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/Hotswap.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/NativeCheckTask.java branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/TemplateTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/natives/ branches/jikesRVM/builder/src/builder/org/jnode/build/natives/NativeStubGenerator.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/ branches/jikesRVM/builder/src/builder/org/jnode/build/packager/MainFinder.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/PackagerTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/PluginBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/ScriptBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/plugins.properties branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/ branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Main.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Plugin.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginList.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginListEditor.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginListModel.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginNode.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginRepository.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginTreePane.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Project.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/ProjectNode.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/RootNode.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Syncable.java branches/jikesRVM/builder/src/configure/ branches/jikesRVM/builder/src/configure/org/ branches/jikesRVM/builder/src/configure/org/jnode/ branches/jikesRVM/builder/src/configure/org/jnode/configure/ branches/jikesRVM/builder/src/configure/org/jnode/configure/Configure.java branches/jikesRVM/builder/src/configure/org/jnode/configure/ConfigureException.java branches/jikesRVM/builder/src/configure/org/jnode/configure/ConfigureScript.java branches/jikesRVM/builder/src/configure/org/jnode/configure/EnumeratedType.java branches/jikesRVM/builder/src/configure/org/jnode/configure/PatternType.java branches/jikesRVM/builder/src/configure/org/jnode/configure/PropertySet.java branches/jikesRVM/builder/src/configure/org/jnode/configure/PropertyType.java branches/jikesRVM/builder/src/configure/org/jnode/configure/Screen.java branches/jikesRVM/builder/src/configure/org/jnode/configure/ScriptParser.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/ branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/DummyValueCodec.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/FileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/FileAdapterFactory.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/JavaSourceFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/JavaStringLiteralCodec.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/PropertyFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/TextFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/XMLFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/XMLPropertyFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/XMLValueCodec.java Removed Paths: ------------- branches/jikesRVM/builder/src/builder/org/jnode/build/natives/NativeStubGenerator.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/MainFinder.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/PackagerTask.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/PluginBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/ScriptBuilder.java branches/jikesRVM/builder/src/builder/org/jnode/build/packager/plugins.properties branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Main.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Plugin.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginList.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginListEditor.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginListModel.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginNode.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginRepository.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/PluginTreePane.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Project.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/ProjectNode.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/RootNode.java branches/jikesRVM/builder/src/builder/org/jnode/pluginlist/Syncable.java branches/jikesRVM/builder/src/configure/org/ branches/jikesRVM/builder/src/configure/org/jnode/ branches/jikesRVM/builder/src/configure/org/jnode/configure/ branches/jikesRVM/builder/src/configure/org/jnode/configure/Configure.java branches/jikesRVM/builder/src/configure/org/jnode/configure/ConfigureException.java branches/jikesRVM/builder/src/configure/org/jnode/configure/ConfigureScript.java branches/jikesRVM/builder/src/configure/org/jnode/configure/EnumeratedType.java branches/jikesRVM/builder/src/configure/org/jnode/configure/PatternType.java branches/jikesRVM/builder/src/configure/org/jnode/configure/PropertySet.java branches/jikesRVM/builder/src/configure/org/jnode/configure/PropertyType.java branches/jikesRVM/builder/src/configure/org/jnode/configure/Screen.java branches/jikesRVM/builder/src/configure/org/jnode/configure/ScriptParser.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/ branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/BasePropertyFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/DummyValueCodec.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/FileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/FileAdapterFactory.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/JavaSourceFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/JavaStringLiteralCodec.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/PropertyFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/PropertyValueCodec.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/TextFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/XMLFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/XMLPropertyFileAdapter.java branches/jikesRVM/builder/src/configure/org/jnode/configure/adapter/XMLValueCodec.java Copied: branches/jikesRVM/builder/.checkstyle (from rev 5663, trunk/builder/.checkstyle) =================================================================== --- branches/jikesRVM/builder/.checkstyle (rev 0) +++ branches/jikesRVM/builder/.checkstyle 2009-09-09 15:19:21 UTC (rev 5666) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <local-check-config name="JNode checkstyle" location="/all/jnode_checks.xml" type="project" description=""> + <additional-data name="protect-config-file" value="true"/> + </local-check-config> + <local-check-config name="JNode checkstyle - javadoc" location="/all/new_checks.xml" type="project" description=""> + <additional-data name="protect-config-file" value="true"/> + </local-check-config> + <fileset name="tous" enabled="true" check-config-name="JNode checkstyle - javadoc" local="true"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> + <filter name="FilesFromPackage" enabled="true"> + <filter-data value="src/builder/org/jnode/jnasm/assembler/gen"/> + </filter> + <filter name="NonSrcDirs" enabled="true"/> +</fileset-config> Modified: branches/jikesRVM/builder/.classpath =================================================================== --- branches/jikesRVM/builder/.classpath 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/.classpath 2009-09-09 15:19:21 UTC (rev 5666) @@ -1,12 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src/builder"/> - <classpathentry kind="src" path="/JNode-Core"/> - <classpathentry kind="src" path="/JNode-FS"/> - <classpathentry kind="lib" path="/JNode-Core/lib/ant.jar"/> - <classpathentry kind="lib" path="/JNode-Core/lib/log4j-1.2.8.jar"/> - <classpathentry kind="src" path="/JNode-Shell"/> + <classpathentry excluding="**/.svn/**" kind="src" path="src/builder"/> + <classpathentry excluding="**/.svn/**" kind="src" path="src/configure"/> + <classpathentry kind="src" path="/core"/> + <classpathentry kind="src" path="/fs"/> + <classpathentry kind="lib" path="/core/lib/ant.jar"/> + <classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/> + <classpathentry kind="src" path="/shell"/> <classpathentry kind="lib" path="lib/xml-apis.jar"/> <classpathentry kind="lib" path="lib/bcel-5.1.jar"/> + <classpathentry kind="lib" path="/shell/lib/nanoxml-2.2.3.jar"/> + <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/> <classpathentry kind="output" path="build/classes"/> </classpath> Modified: branches/jikesRVM/builder/.project =================================================================== --- branches/jikesRVM/builder/.project 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/.project 2009-09-09 15:19:21 UTC (rev 5666) @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>JNode-Builder</name> + <name>builder</name> <comment></comment> <projects> + <project>all</project> <project>JNode-Core</project> <project>JNode-FS</project> </projects> @@ -12,8 +13,14 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> </natures> </projectDescription> Modified: branches/jikesRVM/builder/.settings/org.eclipse.jdt.core.prefs =================================================================== --- branches/jikesRVM/builder/.settings/org.eclipse.jdt.core.prefs 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/.settings/org.eclipse.jdt.core.prefs 2009-09-09 15:19:21 UTC (rev 5666) @@ -1,12 +1,12 @@ -#Tue Apr 12 20:08:18 CEST 2005 +#Mon Jul 14 11:34:38 CEST 2008 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.6 Modified: branches/jikesRVM/builder/build.xml =================================================================== --- branches/jikesRVM/builder/build.xml 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/build.xml 2009-09-09 15:19:21 UTC (rev 5666) @@ -6,7 +6,6 @@ <property name="my-gen.dir" value="${basedir}/build/src"/> <property name="my-classes.dir" value="${my-build.dir}/classes"/> <property name="my-src.dir" value="${basedir}/src"/> - <property name="my.jar" value="${jnode-builder.jar}"/> <property name="javacc.dir" value="${basedir}/lib" /> <property name="jnasm-src.dir" value="${my-src.dir}/builder/org/jnode/jnasm"/> <property name="jnasm-preprocessor-gen.dir" value="${my-gen.dir}/org/jnode/jnasm/preprocessor/gen"/> @@ -18,6 +17,7 @@ <pathelement location="${jnode-fs.jar}"/> <pathelement location="${basedir}/lib/xml-apis.jar"/> <pathelement location="${bcel-5.1.jar}"/> + <pathelement location="${nanoxml-java.jar}"/> <path refid="cp"/> </path> @@ -26,28 +26,85 @@ <mkdir dir="${my-classes.dir}"/> <mkdir dir="${jnasm-preprocessor-gen.dir}"/> <mkdir dir="${jnasm-assembler-gen.dir}"/> + + <copy todir="${my-classes.dir}"> + <fileset dir="${my-src.dir}/builder" includes="**/*.properties"/> + </copy> </target> -<!-- Compile all subproject java files --> - <target name="compile" depends="prepare"> + <!-- Compile the Template ANT task needed for compiling the core --> + <target name="pre-compile" depends="prepare"> + <javac destdir="${my-classes.dir}" + debug="on" + optimize="on" + fork="off" + compiler="modern" + includeJavaRuntime="true" + target="${java.target}" + source="${java.source}" + encoding="${java.encoding}" + excludes="**/*-template.java,**/package-info.java" + srcdir="${my-src.dir}/builder/"> + <bootclasspath path="${jnode-core.jar}"/> + <compilerarg value="${compilerarg}"/> + <filename name="org/jnode/ant/taskdefs/TemplateTask.java" /> + </javac> + <jar jarfile="${jnode-builder.jar}" + basedir="${my-classes.dir}" + includes="org/jnode/ant/taskdefs/**"/> + </target> + + <target name="javacc" depends="prepare" > <javacc target="${jnasm-src.dir}/preprocessor/gen/JNAsmPP.jj" javacchome="${javacc.dir}" outputdirectory="${jnasm-preprocessor-gen.dir}" /> <javacc target="${jnasm-src.dir}/assembler/gen/JNAsm.jj" javacchome="${javacc.dir}" outputdirectory="${jnasm-assembler-gen.dir}" /> + <condition property="run.native2ascii"> + <or> + <isfileselected file="${jnasm-assembler-gen.dir}/JNAsm.java"> + <date datetime="${hotswap.class.tstamp}" pattern="${hotswap.class.tstamp.pattern}" when="after"/> + </isfileselected> + <isfileselected file="${jnasm-preprocessor-gen.dir}/JNAsmPP.java"> + <date datetime="${hotswap.class.tstamp}" pattern="${hotswap.class.tstamp.pattern}" when="after"/> + </isfileselected> + </or> + </condition> + </target> + + <target name="native2ascii" depends="javacc" if="run.native2ascii"> + <!-- Don't swap move & native2ascii tasks ! On Windows, we need to call them + in that order because native2ascii prevent from overwritting its source file --> + <move file="${jnasm-preprocessor-gen.dir}/JNAsmPP.java" + tofile="${jnasm-preprocessor-gen.dir}/JNAsmPP" overwrite="yes"/> + <native2ascii src="${jnasm-preprocessor-gen.dir}" includes="JNAsmPP" + dest="${jnasm-preprocessor-gen.dir}" ext=".java"/> + + <move file="${jnasm-assembler-gen.dir}/JNAsm.java" + tofile="${jnasm-assembler-gen.dir}/JNAsm" overwrite="yes"/> + <native2ascii src="${jnasm-assembler-gen.dir}" includes="JNAsm" + dest="${jnasm-assembler-gen.dir}" ext=".java"/> + </target> + +<!-- Compile all subproject java files --> + <target name="compile" depends="native2ascii"> <jnode.compile> - <src path="${my-src.dir}/builder"/> + <src path="${my-src.dir}/builder"/> + <src path="${my-src.dir}/configure"/> <src path="${my-gen.dir}"/> <classpath refid="my-cp"/> </jnode.compile> </target> -<!-- Assemble the jarfile --> +<!-- Assemble the jarfiles --> <target name="assemble" depends="compile"> - <jar jarfile="${my.jar}"> - <fileset dir="${my-classes.dir}"/> - </jar> + <jar jarfile="${jnode-builder.jar}" + basedir="${my-classes.dir}" + excludes="org/jnode/configure/**"/> + <jar jarfile="${jnode-configure.jar}" + basedir="${my-classes.dir}" + includes="org/jnode/configure/**"/> </target> <!-- Do it all --> Modified: branches/jikesRVM/builder/builder.iml =================================================================== --- branches/jikesRVM/builder/builder.iml 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/builder.iml 2009-09-09 15:19:21 UTC (rev 5666) @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<module version="4" relativePaths="true" type="JAVA_MODULE"> - <component name="ModuleRootManager" /> - <component name="NewModuleRootManager"> - <output url="file://$MODULE_DIR$/classes" /> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/builder" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/configure" isTestSource="false" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="module" module-name="core" /> @@ -29,20 +29,20 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="library" name="core" level="project" /> <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/dom4j.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/pmd/xercesImpl-2.6.2.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntry type="library" name="core" level="project" /> <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/pmd/xercesImpl-2.6.2.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/pmd/pmd-3.0.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -51,7 +51,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/pmd/pmd-3.0.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/pmd/saxpath-1.0-fcs.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -60,7 +60,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/pmd/saxpath-1.0-fcs.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/pmd/jaxen-core-1.0-fcs.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -69,7 +69,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/pmd/jaxen-core-1.0-fcs.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/pmd/xmlParserAPIs-2.6.2.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -78,7 +78,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/classycle.jar!/" /> + <root url="jar://$MODULE_DIR$/../core/lib/asm-1.5.3.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -87,7 +87,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/pmd/xmlParserAPIs-2.6.2.jar!/" /> + <root url="jar://$MODULE_DIR$/../core/lib/asm-attrs-1.5.3.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -96,13 +96,40 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/itext-1.3.jar!/" /> + <root url="jar://$MODULE_DIR$/../core/lib/asm-util-1.5.3.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntryProperties /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/bcel-5.1.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module" module-name="fs" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../core/lib/ant.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../shell/lib/nanoxml-2.2.3.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> </component> </module> Copied: branches/jikesRVM/builder/lib/iso9660.jar (from rev 5663, trunk/builder/lib/iso9660.jar) =================================================================== (Binary files differ) Copied: branches/jikesRVM/builder/lib/jnode-configure-dist.jar (from rev 5663, trunk/builder/lib/jnode-configure-dist.jar) =================================================================== (Binary files differ) Copied: branches/jikesRVM/builder/lib/sabre.jar (from rev 5663, trunk/builder/lib/sabre.jar) =================================================================== (Binary files differ) Copied: branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java (from rev 5663, trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java) =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java (rev 0) +++ branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2009-09-09 15:19:21 UTC (rev 5666) @@ -0,0 +1,397 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2009 JNode.org + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; If not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.jnode.ant.taskdefs; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Properties; +import org.apache.tools.ant.BuildException; +import org.jnode.annotation.MagicPermission; +import org.jnode.annotation.SharedStatics; +import org.objectweb.asm.Attribute; +import org.objectweb.asm.ClassAdapter; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Type; +import org.objectweb.asm.attrs.Annotation; +import org.objectweb.asm.attrs.Attributes; +import org.objectweb.asm.attrs.RuntimeVisibleAnnotations; +import org.objectweb.asm.util.TraceClassVisitor; + +/** + * That ant task will add some annotations to some compiled classes + * mentioned in a property file. + * For now, it's only necessary to add annotations to some + * openjdk classes to avoid modifying the original source code. + * + * @author Fabien DUMINY (fduminy at jnode dot org) + */ +public class AnnotateTask extends FileSetTask { + private static final String SHAREDSTATICS_TYPE_DESC = Type.getDescriptor(SharedStatics.class); + private static final String MAGICPERMISSION_TYPE_DESC = Type.getDescriptor(MagicPermission.class); + + private File annotationFile; + private String[] classesFiles; + + private String buildStartTime = ""; + private String pattern = ""; + private long startTime = 0; + private String baseDir; + + private Properties annotations = new Properties(); + + protected void doExecute() throws BuildException { + try { + SimpleDateFormat format = new SimpleDateFormat(pattern); + startTime = format.parse(buildStartTime).getTime(); + } catch (Exception e) { + throw new BuildException("invalid buildStartTime or pattern", e); + } + + try { + if (readProperties()) { + for (String file : classesFiles) { + File classFile = new File(baseDir, file); + processFile(classFile); + } + } + } catch (IOException ioe) { + throw new BuildException(ioe); + } + } + + /** + * Defines the annotation property file where are specified annotations to add. + * + * @param annotationFile + */ + public final void setAnnotationFile(File annotationFile) { + this.annotationFile = annotationFile; + } + + /** + * Define the time at which build started. + * + * @param buildStartTime + */ + public final void setBuildStartTime(String buildStartTime) { + this.buildStartTime = buildStartTime; + } + + /** + * Define the pattern with which buildStartTime is defined. + * + * @param pattern + */ + public final void setPattern(String pattern) { + this.pattern = pattern; + } + + public void setBaseDir(String baseDir) { + this.baseDir = baseDir; + } + + /** + * Read the properties file. For now, it simply contains a list of + * classes that need the SharedStatics annotation. + * + * @return + * @throws BuildException + */ + private boolean readProperties() throws BuildException { + readProperties("annotationFile", annotationFile, annotations); + if (annotations.isEmpty()) { + System.err.println("WARNING: annotationFile is empty (or doesn't exist)"); + return false; + } + + classesFiles = (String[]) annotations.keySet().toArray(new String[annotations.size()]); + + // we must sort the classes in reverse order so that + // classes with longest package name will be used first + // (that is only necessary for classes whose name is the same + // but package is different ; typical such class name : "Constants") + Arrays.sort(classesFiles, Collections.reverseOrder()); + + return true; + } + + /** + * Generic method that read properties from a given file. + * + * @param name + * @param file + * @param properties + * @throws BuildException + */ + private void readProperties(String name, File file, Properties properties) throws BuildException { + if (file == null) { + throw new BuildException(name + " is mandatory"); + } + + if (!file.exists()) { + return; + } + + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + properties.load(fis); + } catch (IOException e) { + throw new BuildException(e); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + throw new BuildException(e); + } + } + } + } + + /** + * Get the list of annotations for the given class file. + * + * @param classFile list of annotations with ',' as separator. null if no annotation for that class. + * @return + */ + private String getAnnotations(File classFile) { + String annotations = null; + String classFilePath = classFile.getAbsolutePath(); + for (String f : classesFiles) { + if (classFilePath.endsWith(f)) { + annotations = this.annotations.getProperty(f); + break; + } + } + + return annotations; + } + + /** + * Actually process a class file (called from parent class). + */ + @Override + protected void processFile(File classFile) throws IOException { + if (classFile.lastModified() < startTime) { + return; + } + + String annotations = getAnnotations(classFile); + if (annotations == null) { + return; + } + + File tmpFile = new File(classFile.getParentFile(), classFile.getName() + ".tmp"); + FileInputStream fis = null; + boolean classIsModified = false; + + try { + fis = new FileInputStream(classFile); + classIsModified = addAnnotation(classFile, fis, tmpFile, annotations); + } finally { + if (fis != null) { + fis.close(); + } + } + + if (classIsModified) { + if (trace) { + traceClass(classFile, "before"); + + traceClass(tmpFile, "after"); + } + + if (!classFile.delete()) { + throw new IOException("can't delete " + classFile.getAbsolutePath()); + } + + if (!tmpFile.renameTo(classFile)) { + throw new IOException("can't rename " + tmpFile.getAbsolutePath()); + } + } + } + + /** + * Simple debug method that trace a class file. + * It can be used to visually check that the annotations has been + * properly added + * + * @param file + * @param message + * @throws IOException + */ + private void traceClass(File file, String message) throws IOException { + System.out.println("===== (" + message + ") trace for " + file.getAbsolutePath() + " ====="); + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + + ClassReader cr = new ClassReader(fis); + TraceClassVisitor tcv = new TraceClassVisitor(null, new PrintWriter(System.out)); + cr.accept(tcv, Attributes.getDefaultAttributes(), true); + } finally { + if (fis != null) { + fis.close(); + } + } + System.out.println("----- end trace -----"); + } + + /** + * Add an annotation to a class file. + * + * @param classFile + * @param inputClass + * @param tmpFile + * @param annotations + * @return {@code true} if the class file was modified + * @throws BuildException + */ + private boolean addAnnotation(File classFile, InputStream inputClass, File tmpFile, String annotations) + throws BuildException { + boolean classIsModified = false; + FileOutputStream outputClass = null; + + ClassWriter cw = new ClassWriter(false); + try { + ClassReader cr = new ClassReader(inputClass); + + List<String> annotationTypeDescs = new ArrayList<String>(2); + if (annotations.contains("SharedStatics")) { + annotationTypeDescs.add(SHAREDSTATICS_TYPE_DESC); + } + if (annotations.contains("MagicPermission")) { + annotationTypeDescs.add(MAGICPERMISSION_TYPE_DESC); + } + + MarkerClassVisitor mcv = new MarkerClassVisitor(cw, annotationTypeDescs); + cr.accept(mcv, Attributes.getDefaultAttributes(), true); + + if (mcv.classIsModified()) { + System.out.println("adding annotations " + annotations + " to file " + classFile.getName()); + classIsModified = true; + + outputClass = new FileOutputStream(tmpFile); + + byte[] b = cw.toByteArray(); + outputClass.write(b); + } + } catch (Exception ex) { + ex.printStackTrace(); + throw new BuildException("Unable to add annotations to file " + classFile.getName(), ex); + } finally { + if (outputClass != null) { + try { + outputClass.close(); + } catch (IOException e) { + System.err.println("Can't close stream for file " + classFile.getName()); + } + + long timestamp = classFile.lastModified(); + tmpFile.setLastModified(timestamp); + } + } + + return classIsModified; + } + + /** + * Visitor for a class file that actually do the job of adding annotations in the class. + * + * @author fabien + */ + private static class MarkerClassVisitor extends ClassAdapter { + private final List<String> annotationTypeDescs; + + private boolean classIsModified = false; + + public MarkerClassVisitor(ClassVisitor cv, List<String> annotationTypeDescs) { + super(cv); + + this.annotationTypeDescs = annotationTypeDescs; + } + + @Override + public void visit(int version, int access, String name, + String superName, String[] interfaces, String sourceFile) { + super.visit(org.objectweb.asm.Constants.V1_5, access, + name, superName, interfaces, sourceFile); + } + + @Override + public void visitAttribute(Attribute attr) { + if (attr instanceof RuntimeVisibleAnnotations) { + RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr; + for (Object annotation : rva.annotations) { + if (annotation instanceof Annotation) { + Annotation ann = (Annotation) annotation; + for (String annTypeDesc : annotationTypeDescs) { + if (ann.type.equals(annTypeDesc)) { + // we have found one of the annotations -> we won't need to add it again ! + annotationTypeDescs.remove(annTypeDesc); + break; + } + } + } + } + } + + super.visitAttribute(attr); + } + + @SuppressWarnings("unchecked") + public void visitEnd() { + if (!annotationTypeDescs.isEmpty()) { + // we have not found the annotation -> we will add it and so modify the class + classIsModified = true; + RuntimeVisibleAnnotations attr = new RuntimeVisibleAnnotations(); + + for (String annTypeDesc : annotationTypeDescs) { + + Annotation ann = new Annotation(annTypeDesc); + ann.add("name", ""); + + attr.annotations.add(ann); + } + + cv.visitAttribute(attr); + } + + super.visitEnd(); + } + + public boolean classIsModified() { + return classIsModified; + } + } +} Modified: branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/Asm.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/Asm.java 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/Asm.java 2009-09-09 15:19:21 UTC (rev 5666) @@ -1,8 +1,7 @@ /* * $Id$ * - * JNode.org - * Copyright (C) 2003-2006 JNode.org + * Copyright (C) 2003-2009 JNode.org * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -28,7 +27,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; - import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; @@ -37,8 +35,8 @@ import org.apache.tools.ant.taskdefs.condition.Os; /** - * Description of the Class - * + * Description of the Class. + * * @author epr * @version $Revision$ */ @@ -56,7 +54,7 @@ /** * Returns the dir. - * + * * @return File */ public File getDir() { @@ -65,9 +63,8 @@ /** * Sets the dir. - * - * @param dir - * The dir to set + * + * @param dir The dir to set */ public void setDir(File dir) { this.dir = dir; @@ -97,12 +94,12 @@ private File srcdir; private boolean enableJNasm; - + private String version; - + /** - * Add an includedir - * + * Add an includedir. + * * @param dir */ public void addConfiguredIncludeDir(IncludeDir dir) { @@ -110,17 +107,15 @@ } /** - * Description of the Method - * + * Description of the Method. + * * @param srcFile * @param dstFile - * @throws BuildException - * Description of Exception - * @throws IOException - * Description of the Exception + * @throws BuildException Description of Exception + * @throws IOException Description of the Exception */ private void doNasm(File srcFile, File dstFile) throws BuildException, - IOException { + IOException { Execute exec = new Execute(); ArrayList<String> cmdLine = new ArrayList<String>(); @@ -136,16 +131,16 @@ cmdLine.add(dstFile.toString()); if (bits == 64) { - cmdLine.add("-m"); - cmdLine.add("amd64"); + cmdLine.add("-m"); + cmdLine.add("amd64"); // Set preprocessor cmdLine.add("-r"); cmdLine.add("nasm"); } - - cmdLine.add("-D"); - cmdLine.add("BITS" + bits); - + + cmdLine.add("-D"); + cmdLine.add("BITS" + bits); + if (version != null) { cmdLine.add("-D"); cmdLine.add("JNODE_VERSION='" + version + "'"); @@ -171,7 +166,7 @@ log("cmdLine=" + cmdLine, Project.MSG_VERBOSE); exec.setCommandline(cmdLine.toArray(new String[cmdLine - .size()])); + .size()])); dstFile.getParentFile().mkdirs(); int rc = exec.execute(); @@ -179,32 +174,31 @@ if (rc != 0) { destdir.delete(); throw new BuildException("Asm failed on " - + srcFile.getAbsolutePath()); + + srcFile.getAbsolutePath()); } } /** - * Description of the Method - * - * @throws BuildException - * Description of Exception + * Description of the Method. + * + * @throws BuildException Description of Exception */ public void execute() throws BuildException { if (srcdir == null) { throw new BuildException("Error: srcdir attribute must be set!", - getLocation()); + getLocation()); } else if (!srcdir.isDirectory()) { throw new BuildException("Error: srcdir directory is not valid!", - getLocation()); + getLocation()); } if (destdir == null) { throw new BuildException("Error: destdir attribute must be set!", - getLocation()); + getLocation()); } else if (!destdir.isDirectory()) { throw new BuildException("Error: destdir directory is not valid!", - getLocation()); + getLocation()); } try { @@ -217,12 +211,10 @@ } /** - * Description of the Method - * - * @throws BuildException - * Description of Exception - * @throws IOException - * Description of the Exception + * Description of the Method. + * + * @throws BuildException Description of Exception + * @throws IOException Description of the Exception */ protected void executeAsm() throws BuildException, IOException { @@ -233,7 +225,7 @@ if (compileMap.size() > 0) { log("Compiling " + compileMap.size() + " source files to " - + destdir); + + destdir); for (File srcFile : compileMap.keySet()) { File dstFile = compileMap.get(srcFile); @@ -244,7 +236,7 @@ /** * Gets the number of bits of the target platform. - * + * * @return 32/64 */ public final int getBits() { @@ -253,7 +245,7 @@ /** * Returns the destdir. - * + * * @return File */ public File getDestdir() { @@ -262,7 +254,7 @@ /** * Returns the ext. - * + * * @return String */ public String getExtension() { @@ -271,7 +263,7 @@ /** * Returns the listFile. - * + * * @return File */ public File getListFile() { @@ -280,7 +272,7 @@ /** * Returns the outputFormat. - * + * * @return String */ public String getOutputFormat() { @@ -289,7 +281,7 @@ /** * Returns the srcdir. - * + * * @return File */ public File getSrcdir() { @@ -299,19 +291,15 @@ /** * Scans the directory looking for source files to be compiled. The results * are returned in the class variable compileList - * - * @param srcDir - * Description of Parameter - * @param destDir - * Description of Parameter - * @param files - * Description of Parameter + * + * @param srcDir Description of Parameter + * @param destDir Description of Parameter + * @param files Description of Parameter * @param compileMap - * @throws IOException - * Description of the Exception + * @throws IOException Description of the Exception */ protected void scanDir(File srcDir, File destDir, String[] files, - Map<File, File> compileMap) throws IOException { + Map<File, File> compileMap) throws IOException { long now = System.currentTimeMillis(); for (int c = 0; c < files.length; c++) { @@ -323,33 +311,33 @@ int diff = fileDirString.compareTo(rootDirString); String destSubDir = fileDirString.substring( - fileDirString.length() - diff, fileDirString.length()) - .replace('\\', '/'); + fileDirString.length() - diff, fileDirString.length()) + .replace('\\', '/'); // log(destSubDir); File fileDir = new File(destDir.toString() + destSubDir); String objName = aFile.getName().substring(0, - aFile.getName().indexOf(".asm")) - + "." + ext; + aFile.getName().indexOf(".asm")) + + "." + ext; File objFile = new File(fileDir, objName); // check if the file has been modified in the future, error? if (aFile.lastModified() > now) { log("Warning: file modified in the future: " + aFile.getName(), - Project.MSG_WARN); + Project.MSG_WARN); } if (!objFile.exists() - || aFile.lastModified() > objFile.lastModified()) { + || aFile.lastModified() > objFile.lastModified()) { if (!objFile.exists()) { log("Compiling " + aFile.getPath() + " because class file " - + objFile.getPath() + " does not exist", - Project.MSG_VERBOSE); + + objFile.getPath() + " does not exist", + Project.MSG_VERBOSE); } else { log("Compiling " + aFile.getPath() - + " because it is out of date with respect to " - + objFile.getPath(), Project.MSG_VERBOSE); + + " because it is out of date with respect to " + + objFile.getPath(), Project.MSG_VERBOSE); } compileMap.put(aFile, objFile); @@ -360,9 +348,8 @@ /** * Sets the number of bits of the target platform. - * - * @param bits - * 32/64 + * + * @param bits 32/64 */ public final void setBits(int bits) { if ((bits != 32) && (bits != 64)) { @@ -372,10 +359,9 @@ } /** - * Sets the Destdir attribute of the JspC object - * - * @param destDir - * The new Destdir value + * Sets the Destdir attribute of the JspC object. + * + * @param destDir The new Destdir value */ public void setDestdir(File destDir) { this.destdir = destDir; @@ -383,9 +369,8 @@ /** * Sets the ext. - * - * @param ext - * The ext to set + * + * @param ext The ext to set */ public void setExtension(String ext) { this.ext = ext; @@ -393,9 +378,8 @@ /** * Sets the listFile. - * - * @param listFile - * The listFile to set + * + * @param listFile The listFile to set */ public void setListFile(File listFile) { this.listFile = listFile; @@ -403,9 +387,8 @@ /** * Sets the outputFormat. - * - * @param outputFormat - * The outputFormat to set + * + * @param outputFormat The outputFormat to set */ public void setOutputFormat(String outputFormat) { this.outputFormat = outputFormat; @@ -413,9 +396,8 @@ /** * Sets the srcdir. - * - * @param srcdir - * The srcdir to set + * + * @param srcdir The srcdir to set */ public void setSrcdir(File srcdir) { this.srcdir = srcdir; Copied: branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java (from rev 5663, trunk/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java) =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java (rev 0) +++ branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java 2009-09-09 15:19:21 UTC (rev 5666) @@ -0,0 +1,96 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2009 JNode.org + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; If not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.jnode.ant.taskdefs; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.FileSet; + +/** + * Abstract class for ant task that process one or more FileSet + * The concrete classes only have to implement the <i>process</i> method + * for doing the concrete work on a file. + * + * @author Fabien DUMINY (fduminy at jnode.org) + */ +public abstract class FileSetTask extends Task { + protected boolean trace = false; + protected boolean failOnError = true; + + private final ArrayList<FileSet> fileSets = new ArrayList<FileSet>(); + + public final void setTrace(boolean trace) { + this.trace = trace; + } + + public final void setFailOnError(boolean failOnError) { + this.failOnError = failOnError; + } + + public void addFileSet(FileSet fs) { + fileSets.add(fs); + } + + public final void execute() throws BuildException { + try { + doExecute(); + } catch (BuildException be) { + if (failOnError) { + throw be; + } else { + be.printStackTrace(); + } + } catch (Throwable t) { + if (failOnError) { + throw new BuildException(t); + } else { + t.printStackTrace(); + } + } + } + + protected void doExecute() throws BuildException { + // default implementation : simply iterate on all files + processFiles(); + } + + protected final void processFiles() throws BuildException { + final Project project = getProject(); + try { + for (FileSet fs : fileSets) { + final String[] files = fs.getDirectoryScanner(project) + .getIncludedFiles(); + final File projectDir = fs.getDir(project); + for (String fname : files) { + processFile(new File(projectDir, fname)); + } + } + } catch (IOException e) { + throw new BuildException(e); + } + } + + protected abstract void processFile(File file) throws IOException; +} Modified: branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java 2009-09-09 15:13:41 UTC (rev 5665) +++ branches/jikesRVM/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java 2009-09-09 15:19:21 UTC (rev 5666) @@ -1,8 +1,7 @@ /* * $Id$ * - * JNode.org - * Copyright (C) 2003-2006 JNode.org + * Copyright (C) 2003-2009 JNode.org * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -28,143 +27,127 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; - import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.FileSet; /** * @author Ewout Prangsma (ep...@us...) */ -public class HeaderTask extends Task { +public class HeaderTask extends FileSetTask { - private final ArrayList<FileSet> fileSets = new ArrayList<FileSet>(); + private File headerFile; + private String[] header; - private File headerFile; - - private boolean update = false; - public void addFileSet(FileSet fs) { - fileSets.add(fs); - } - - private boolean compareHeader(String[] lines, String[] header) { - final int linesCnt = lines.length; - final int hdrCnt = header.length; - - for (int i = 0; i < linesCnt; i++) { - final String line = lines[i]; - if (i < hdrCnt) { - if (!compareLine(line, header[i])) { - return false; - } - } else { - String trimmedLine = line.trim(); - if (trimmedLine.startsWith("package")) { - return true; - } - if (trimmedLine.length() > 0) { - return false; - } - } - } - - return false; - } - - private boolean compareLine(String line, String hdrLine) { - if ((line.indexOf('$') >= 0) && (hdrLine.indexOf('$') >= 0)) { - return true; - } - return line.trim().equals(hdrLine.trim()); - } + private boolean update = false; - public void execute() throws BuildException { - if (headerFile == null) { - throw new BuildException("HeaderFile must be set"); - } - try { - final String[] header = readFile(headerFile); + private boolean compareHeader(String[] lines, String[] header) { + final int linesCnt = lines.length; + final int hdrCnt = header.length; - for (FileSet fs : fileSets) { - final String[] files = fs.getDirectoryScanner(getProject()) - .getIncludedFiles(); - final int fileCount = files.length; - for (int j = 0; j < fileCount; j++) { - final String fname = files[j]; - processFile(new File(fs.getDir(getProject()), fname), header); - } + for (int i = 0; i < linesCnt; i++) { + final String line = lines[i]; + if (i < hdrCnt) { + if (!compareLine(line, header[i])) { + return false; + } + } else { + String trimmedLine = line.trim(); + if (trimmedLine.startsWith("package")) { + ... [truncated message content] |