Thanks Jesse, I'll make changes in the project for an upcoming OpenJDK build: bug id is 6578429.

Jesse Glick wrote:

> It seems that the javac project, as least as currently visible in the dev.java.net SVN repo, is lacking the run and debug targets that would let you try running the compiler on a sample file from within NetBeans 6. So I wrote up a quick patch for this (attached). If you "Run" the project, it will try to compile its own Main.java by default; you can pick a different command line, or define one for many runs:
>
> ---%<--- j2se/make/netbeans/compiler/nbproject/private/build.properties
> run.javac.opts=-some -options -here -and /one/File.java


Since j2se/make/netbeans/common/shared.xml already has "javac.options" I'll likely change the name of that to "javac.run.options".

As an aside, note that you could also set that property in one of the properties files mentioned in j2se/make/netbeans/README.

Thanks!
    Dave

> ---%<---
>
> "Debug" works the same but of course you can set breakpoints etc.
>
> Have fun,
> -Jesse
>
>
> ------------------------------------------------------------------------
>
> Index: j2se/make/netbeans/compiler/nbproject/project.xml
> ===================================================================
> --- j2se/make/netbeans/compiler/nbproject/project.xml    (revision 92)
> +++ j2se/make/netbeans/compiler/nbproject/project.xml    (working copy)
> @@ -59,6 +59,12 @@
>              </folders>
>              <ide-actions>
>                  &standard-bindings;
> +                <action name="run">
> +                    <target>run</target>
> +                </action>
> +                <action name="debug">
> +                    <target>debug</target>
> +                </action>
>              </ide-actions>
>              <view>
>                  <items>
> @@ -68,6 +74,9 @@
>                  </items>
>                  <context-menu>
>                      &standard-actions;
> +                    <separator/>
> +                    <ide-action name="run"/>
> +                    <ide-action name="debug"/>
>                  </context-menu>
>              </view>
>          </general-data>
> Index: j2se/make/netbeans/compiler/build.xml
> ===================================================================
> --- j2se/make/netbeans/compiler/build.xml    (revision 92)
> +++ j2se/make/netbeans/compiler/build.xml    (working copy)
> @@ -40,15 +40,14 @@
>          <include name="com/sun/tools/javac/**/*.java"/>
>      </patternset>
>
> -    <fileset id="javac.resources" dir="${src.classes}">
> -        <include name="com/sun/tools/javac/resources/*.properties"/>
> -        <exclude name="**/*-template.*"/>
> -    </fileset>
> -         <target name="-prep" depends="-init">
> <property name="src.bin" value="${root}/src/share/opensource/javac/src/bin"/>
>          <property name="src.classes" value="${root}/src/share/classes"/>
>          <property name="build.bootclasses" value="${build.dir}/bootclasses"/>
> +        <fileset id="javac.resources" dir="${src.classes}">
> +            <include name="com/sun/tools/javac/resources/*.properties"/>
> +            <exclude name="**/*-template.*"/>
> +        </fileset>
>      </target>
>           <target name="check-javac.isuptodate">
> @@ -91,7 +90,7 @@
>              <arg value=""/>
>              <arg value="-d"/>
>              <arg file="${classes.dir}"/>
> -            <arg value="-g:source,lines"/>
> +            <arg value="-g:source,lines,vars"/>
>              <arg line="${src.javac.files}"/>
>          </java>
>      <copy todir="${classes.dir}">
> @@ -127,4 +126,15 @@
>          <delete file="${dist.dir}/bin/javac"/>
>          <delete file="${dist.dir}/lib/javac.jar"/>
>      </target>
> +
> +    <target name="run" depends="-prep,build">
> +        <property name="jvm.args" value=""/>
> + <property name="Main.java" location="${src.classes}/com/sun/tools/javac/Main.java"/> > + <input addproperty="run.javac.opts" message="Run javac with options:" defaultvalue="-d ${java.io.tmpdir} ${Main.java}"/> > + <java fork="true" classname="com.sun.tools.javac.Main" classpath="${classes.dir}">
> +            <jvmarg line="${jvm.args}"/>
> +            <arg line="${run.javac.opts}"/>
> +        </java>
> +    </target>
> +
>  </project>



Reply via email to