<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT  ***
***         EDIT ../build.xml INSTEAD         ***

-->
<project name="-profiler-impl" default="profile-j2ee" basedir="..">
    <target name="default" depends="profile-j2ee" description="Build and profile the project."/>
    <!--
    ======================
    INITIALIZATION SECTION
    ======================
    -->
    <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-check"/>
    <target name="-profile-pre-init">
        <!-- Empty placeholder for easier customization. -->
        <!-- You can override this target in the ../build.xml file. -->
    </target>
    <target name="-profile-post-init">
        <!-- Empty placeholder for easier customization. -->
        <!-- You can override this target in the ../build.xml file. -->
    </target>
    <target name="-profile-init-check" depends="-profile-pre-init, init, -profile-post-init">
        <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
        <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
    </target>
    <!--
    =================
    PROFILING SECTION
    =================
    -->
    <target name="profile-j2ee" description="Profile a J2EE project in the IDE.">
        <condition property="profiler.startserver.target" value="start-profiled-server-extraargs" else="start-profiled-server">
            <isset property="profiler.info.jvmargs.extra"/>
        </condition>
        <antcall target="${profiler.startserver.target}"/>
        <antcall target="run"/>
        <antcall target="start-loadgen"/>
    </target>
    <target name="start-profiled-server">
        <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" startupTimeout="${profiler.j2ee.serverStartupTimeout}" javaPlatform="${profiler.info.javaPlatform}">
            <jvmarg value="${profiler.info.jvmargs.agent}"/>
            <jvmarg value="${profiler.j2ee.agentID}"/>
        </nbstartprofiledserver>
    </target>
    <target name="start-profiled-server-extraargs">
        <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" startupTimeout="${profiler.j2ee.serverStartupTimeout}" javaPlatform="${profiler.info.javaPlatform}">
            <jvmarg value="${profiler.info.jvmargs.extra}"/>
            <jvmarg value="${profiler.info.jvmargs.agent}"/>
            <jvmarg value="${profiler.j2ee.agentID}"/>
        </nbstartprofiledserver>
    </target>
    <target name="start-loadgen" if="profiler.loadgen.path">
        <loadgenstart path="${profiler.loadgen.path}"/>
    </target>
    <!--
    =========================
    TESTS PROFILING  SECTION
    =========================
    -->
    <target name="profile-test-single" if="netbeans.home" depends="profile-init,compile-test-single">
        <nbprofiledirect>
            <classpath>
                <path path="${run.test.classpath}"/>
                <path path="${j2ee.platform.classpath}"/>
            </classpath>
        </nbprofiledirect>
        <junit showoutput="true" fork="true" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}" failureproperty="tests.failed" errorproperty="tests.failed">
            <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
            <jvmarg value="${profiler.info.jvmargs.agent}"/>
            <jvmarg line="${profiler.info.jvmargs}"/>
            <test name="${profile.class}"/>
            <classpath>
                <path path="${run.test.classpath}"/>
                <path path="${j2ee.platform.classpath}"/>
            </classpath>
            <syspropertyset>
                <propertyref prefix="test-sys-prop."/>
                <mapper type="glob" from="test-sys-prop.*" to="*"/>
            </syspropertyset>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
        </junit>
    </target>
</project>
