This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 189151
Collapse All | Expand All

(-)a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/resources/build-impl.xsl (-1 / +82 lines)
Lines 300-305 Link Here
300
                <taskdef resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml" classpath="${{libs.CopyLibs.classpath}}"/>
300
                <taskdef resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml" classpath="${{libs.CopyLibs.classpath}}"/>
301
            </target>
301
            </target>
302
302
303
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-check"/>
304
305
            <target name="-profile-pre-init">
306
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
307
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
308
            </target>
309
310
            <target name="-profile-post-init">
311
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
312
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
313
            </target>
314
            <target name="-profile-init-check">
315
                <xsl:attribute name="depends">-profile-pre-init, init, -profile-post-init</xsl:attribute>
316
                <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
317
                <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
318
            </target>
319
303
            <target name="init">
320
            <target name="init">
304
                <xsl:attribute name="depends">pre-init,init-private,init-userdir,init-user,init-project,do-init,post-init,init-check,-init-taskdefs</xsl:attribute>
321
                <xsl:attribute name="depends">pre-init,init-private,init-userdir,init-user,init-project,do-init,post-init,init-check,-init-taskdefs</xsl:attribute>
305
            </target>
322
            </target>
Lines 818-824 Link Here
818
        <ear2:debug-appclient subprojectname="${{app.client}}"/>
835
        <ear2:debug-appclient subprojectname="${{app.client}}"/>
819
    </target>
836
    </target>
820
    
837
    
821
            <xsl:comment>
838
        <xsl:comment>
839
    =================
840
    PROFILING SECTION
841
    =================
842
    </xsl:comment>
843
844
    <target name="profile">
845
        <xsl:attribute name="description">Profile a J2EE project in the IDE.</xsl:attribute>
846
        <condition>
847
            <xsl:attribute name="property">profiler.startserver.target</xsl:attribute>
848
            <xsl:attribute name="value">start-profiled-server-extraargs</xsl:attribute>
849
            <xsl:attribute name="else">start-profiled-server</xsl:attribute>
850
            <isset>
851
                <xsl:attribute name="property">profiler.info.jvmargs.extra</xsl:attribute>
852
            </isset>
853
        </condition>
854
        <antcall>
855
            <xsl:attribute name="target">${profiler.startserver.target}</xsl:attribute>
856
        </antcall>
857
        <antcall>
858
            <xsl:attribute name="target">run</xsl:attribute>
859
        </antcall>
860
        <antcall>
861
            <xsl:attribute name="target">start-loadgen</xsl:attribute>
862
        </antcall>
863
    </target>
864
865
    <target name="start-profiled-server">
866
        <nbstartprofiledserver>
867
            <xsl:attribute name="forceRestart">${profiler.j2ee.serverForceRestart}</xsl:attribute>
868
            <xsl:attribute name="startupTimeout">${profiler.j2ee.serverStartupTimeout}</xsl:attribute>
869
            <xsl:attribute name="javaPlatform">${profiler.info.javaPlatform}</xsl:attribute>
870
            <jvmarg>
871
                <xsl:attribute name="value">${profiler.info.jvmargs.agent}</xsl:attribute>
872
            </jvmarg>
873
            <jvmarg>
874
                <xsl:attribute name="value">${profiler.j2ee.agentID}</xsl:attribute>
875
            </jvmarg>
876
        </nbstartprofiledserver>
877
    </target>
878
879
    <target name="start-profiled-server-extraargs">
880
        <nbstartprofiledserver>
881
            <xsl:attribute name="forceRestart">${profiler.j2ee.serverForceRestart}</xsl:attribute>
882
            <xsl:attribute name="startupTimeout">${profiler.j2ee.serverStartupTimeout}</xsl:attribute>
883
            <xsl:attribute name="javaPlatform">${profiler.info.javaPlatform}</xsl:attribute>
884
            <jvmarg>
885
                <xsl:attribute name="value">${profiler.info.jvmargs.extra}</xsl:attribute>
886
            </jvmarg>
887
            <jvmarg>
888
                <xsl:attribute name="value">${profiler.info.jvmargs.agent}</xsl:attribute>
889
            </jvmarg>
890
            <jvmarg>
891
                <xsl:attribute name="value">${profiler.j2ee.agentID}</xsl:attribute>
892
            </jvmarg>
893
        </nbstartprofiledserver>
894
    </target>
895
896
    <target name="start-loadgen" if="profiler.loadgen.path">
897
            <loadgenstart>
898
                <xsl:attribute name="path">${profiler.loadgen.path}</xsl:attribute>
899
            </loadgenstart>
900
    </target>
901
902
    <xsl:comment>
822
    CLEANUP SECTION
903
    CLEANUP SECTION
823
    </xsl:comment>
904
    </xsl:comment>
824
905
(-)a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl (-2 / +118 lines)
Lines 832-837 Link Here
832
                <property name="ap.cmd.line.internal" value=""/>
832
                <property name="ap.cmd.line.internal" value=""/>
833
            </target>
833
            </target>
834
834
835
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-check"/>
836
837
            <target name="-profile-pre-init">
838
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
839
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
840
            </target>
841
842
            <target name="-profile-post-init">
843
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
844
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
845
            </target>
846
            <target name="-profile-init-check">
847
                <xsl:attribute name="depends">-profile-pre-init, init, -profile-post-init</xsl:attribute>
848
                <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
849
                <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
850
            </target>
851
835
852
836
            <target name="init">
853
            <target name="init">
837
                <xsl:attribute name="depends">-pre-init,-init-private,-init-userdir,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline</xsl:attribute>
854
                <xsl:attribute name="depends">-pre-init,-init-private,-init-userdir,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline</xsl:attribute>
Lines 1332-1338 Link Here
1332
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1349
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1333
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
1350
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
1334
            </target>
1351
            </target>
1335
            
1352
1353
            <xsl:comment>
1354
            =================
1355
            PROFILING SECTION
1356
            =================
1357
            </xsl:comment>
1358
1359
            <target name="profile">
1360
                <xsl:attribute name="description">Profile a J2EE project in the IDE.</xsl:attribute>
1361
                <condition>
1362
                    <xsl:attribute name="property">profiler.startserver.target</xsl:attribute>
1363
                    <xsl:attribute name="value">start-profiled-server-extraargs</xsl:attribute>
1364
                    <xsl:attribute name="else">start-profiled-server</xsl:attribute>
1365
                    <isset>
1366
                        <xsl:attribute name="property">profiler.info.jvmargs.extra</xsl:attribute>
1367
                    </isset>
1368
                </condition>
1369
                <antcall>
1370
                    <xsl:attribute name="target">${profiler.startserver.target}</xsl:attribute>
1371
                </antcall>
1372
                <antcall>
1373
                    <xsl:attribute name="target">run</xsl:attribute>
1374
                </antcall>
1375
                <antcall>
1376
                    <xsl:attribute name="target">start-loadgen</xsl:attribute>
1377
                </antcall>
1378
            </target>
1379
1380
            <target name="start-profiled-server">
1381
                <nbstartprofiledserver>
1382
                    <xsl:attribute name="forceRestart">${profiler.j2ee.serverForceRestart}</xsl:attribute>
1383
                    <xsl:attribute name="startupTimeout">${profiler.j2ee.serverStartupTimeout}</xsl:attribute>
1384
                    <xsl:attribute name="javaPlatform">${profiler.info.javaPlatform}</xsl:attribute>
1385
                    <jvmarg>
1386
                        <xsl:attribute name="value">${profiler.info.jvmargs.agent}</xsl:attribute>
1387
                    </jvmarg>
1388
                    <jvmarg>
1389
                        <xsl:attribute name="value">${profiler.j2ee.agentID}</xsl:attribute>
1390
                    </jvmarg>
1391
                </nbstartprofiledserver>
1392
            </target>
1393
1394
            <target name="start-profiled-server-extraargs">
1395
                <nbstartprofiledserver>
1396
                    <xsl:attribute name="forceRestart">${profiler.j2ee.serverForceRestart}</xsl:attribute>
1397
                    <xsl:attribute name="startupTimeout">${profiler.j2ee.serverStartupTimeout}</xsl:attribute>
1398
                    <xsl:attribute name="javaPlatform">${profiler.info.javaPlatform}</xsl:attribute>
1399
                    <jvmarg>
1400
                        <xsl:attribute name="value">${profiler.info.jvmargs.extra}</xsl:attribute>
1401
                    </jvmarg>
1402
                    <jvmarg>
1403
                        <xsl:attribute name="value">${profiler.info.jvmargs.agent}</xsl:attribute>
1404
                    </jvmarg>
1405
                    <jvmarg>
1406
                        <xsl:attribute name="value">${profiler.j2ee.agentID}</xsl:attribute>
1407
                    </jvmarg>
1408
                </nbstartprofiledserver>
1409
            </target>
1410
1411
            <target name="start-loadgen" if="profiler.loadgen.path">
1412
                    <loadgenstart>
1413
                        <xsl:attribute name="path">${profiler.loadgen.path}</xsl:attribute>
1414
                    </loadgenstart>
1415
            </target>
1416
1336
            <xsl:comment>
1417
            <xsl:comment>
1337
                JAVADOC SECTION
1418
                JAVADOC SECTION
1338
            </xsl:comment>
1419
            </xsl:comment>
Lines 1604-1610 Link Here
1604
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1685
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1605
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix-test</xsl:attribute>
1686
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix-test</xsl:attribute>
1606
            </target>
1687
            </target>
1607
            
1688
1689
        <xsl:comment>
1690
        =========================
1691
        TESTS PROFILING  SECTION
1692
        =========================
1693
        </xsl:comment>
1694
1695
          <target name="profile-test-single">
1696
              <xsl:attribute name="if">netbeans.home</xsl:attribute>
1697
              <xsl:attribute name="depends">profile-init,compile-test-single</xsl:attribute>
1698
              <nbprofiledirect>
1699
                  <classpath>
1700
                      <path path="${{run.test.classpath}}"/>
1701
                      <path path="${{j2ee.platform.classpath}}"/>
1702
                  </classpath>
1703
              </nbprofiledirect>
1704
1705
              <junit showoutput="true" fork="true" dir="${{profiler.info.dir}}"  jvm="${{profiler.info.jvm}}" failureproperty="tests.failed" errorproperty="tests.failed">
1706
                  <env key="${{profiler.info.pathvar}}" path="${{profiler.info.agentpath}}:${{profiler.current.path}}"/>
1707
                  <jvmarg value="${{profiler.info.jvmargs.agent}}" />
1708
                  <jvmarg line="${{profiler.info.jvmargs}}"/>
1709
                  <test name="${{profile.class}}"/>
1710
                  <classpath>
1711
                      <path path="${{run.test.classpath}}"/>
1712
                      <path path="${{j2ee.platform.classpath}}"/>
1713
                  </classpath>
1714
                  <syspropertyset>
1715
                      <propertyref prefix="test-sys-prop."/>
1716
                      <mapper type="glob" from="test-sys-prop.*" to="*"/>
1717
                  </syspropertyset>
1718
                  <formatter type="brief" usefile="false"/>
1719
                  <formatter type="xml"/>
1720
              </junit>
1721
          </target>
1722
1723
1608
            <xsl:comment>
1724
            <xsl:comment>
1609
                CLEANUP SECTION
1725
                CLEANUP SECTION
1610
            </xsl:comment>
1726
            </xsl:comment>
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl (-2 / +150 lines)
Lines 692-698 Link Here
692
                    </sequential>
692
                    </sequential>
693
                </macrodef>
693
                </macrodef>
694
            </target>
694
            </target>
695
            
695
696
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/>
697
698
            <target name="-profile-pre-init">
699
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
700
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
701
            </target>
702
703
            <target name="-profile-post-init">
704
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
705
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
706
            </target>
707
708
            <target name="-profile-init-macrodef-profile">
709
                <macrodef>
710
                  <xsl:attribute name="name">resolve</xsl:attribute>
711
                  <attribute>
712
                      <xsl:attribute name="name">name</xsl:attribute>
713
                  </attribute>
714
                  <attribute>
715
                      <xsl:attribute name="name">value</xsl:attribute>
716
                  </attribute>
717
                  <sequential>
718
                      <property name="@{{name}}" value="${{env.@{{value}}}}"/>
719
                  </sequential>
720
                </macrodef>
721
722
                <macrodef>
723
                    <xsl:attribute name="name">profile</xsl:attribute>
724
                    <attribute>
725
                        <xsl:attribute name="name">classname</xsl:attribute>
726
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
727
                    </attribute>
728
                    <element>
729
                      <xsl:attribute name="name">customize</xsl:attribute>
730
                      <xsl:attribute name="optional">true</xsl:attribute>
731
                    </element>
732
                    <sequential>
733
                        <property environment="env"/>
734
                        <resolve name="profiler.current.path" value="${{profiler.info.pathvar}}"/>
735
                        <java fork="true" classname="@{{classname}}" dir="${{profiler.info.dir}}" jvm="${{profiler.info.jvm}}">
736
                            <jvmarg value="${{profiler.info.jvmargs.agent}}"/>
737
                            <jvmarg line="${{profiler.info.jvmargs}}"/>
738
                            <env key="${{profiler.info.pathvar}}" path="${{profiler.info.agentpath}}:${{profiler.current.path}}"/>
739
                            <arg line="${{application.args}}"/>
740
                            <classpath>
741
                                <path path="${{run.classpath}}"/>
742
                            </classpath>
743
                            <syspropertyset>
744
                                <propertyref prefix="run-sys-prop."/>
745
                                <mapper type="glob" from="run-sys-prop.*" to="*"/>
746
                            </syspropertyset>
747
                            <customize/>
748
                        </java>
749
                    </sequential>
750
                  </macrodef>
751
            </target>
752
753
            <target name="-profile-init-check">
754
                <xsl:attribute name="depends">-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile</xsl:attribute>
755
                <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
756
                <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
757
            </target>
758
696
            <target name="-init-macrodef-nbjpda" depends="-init-debug-args">
759
            <target name="-init-macrodef-nbjpda" depends="-init-debug-args">
697
                <macrodef>
760
                <macrodef>
698
                    <xsl:attribute name="name">nbjpdastart</xsl:attribute>
761
                    <xsl:attribute name="name">nbjpdastart</xsl:attribute>
Lines 1334-1340 Link Here
1334
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1397
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1335
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
1398
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
1336
            </target>
1399
            </target>
1337
            
1400
1401
            <xsl:comment>
1402
                =================
1403
                PROFILING SECTION
1404
                =================
1405
            </xsl:comment>
1406
1407
            <target name="profile">
1408
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1409
                <xsl:attribute name="depends">profile-init,compile</xsl:attribute>
1410
                <xsl:attribute name="description">Profile a project in the IDE.</xsl:attribute>
1411
                <nbprofiledirect>
1412
                    <classpath>
1413
                        <path path="${{run.classpath}}"/>
1414
                    </classpath>
1415
                </nbprofiledirect>
1416
                <profile/>
1417
            </target>
1418
1419
            <target name="profile-single">
1420
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1421
                <xsl:attribute name="depends">profile-init,compile-single</xsl:attribute>
1422
                <xsl:attribute name="description">Profile a selected class in the IDE.</xsl:attribute>
1423
                <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
1424
                <nbprofiledirect>
1425
                    <classpath>
1426
                        <path path="${{run.classpath}}"/>
1427
                    </classpath>
1428
                </nbprofiledirect>
1429
              <profile classname="${{profile.class}}"/>
1430
            </target>
1431
1432
            <xsl:comment>
1433
                =========================
1434
                APPLET PROFILING  SECTION
1435
                =========================
1436
            </xsl:comment>
1437
1438
            <target name="profile-applet">
1439
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1440
                <xsl:attribute name="depends">profile-init,compile-single</xsl:attribute>
1441
                <nbprofiledirect>
1442
                    <classpath>
1443
                        <path path="${{run.classpath}}"/>
1444
                    </classpath>
1445
                </nbprofiledirect>
1446
1447
                <profile classname="sun.applet.AppletViewer">
1448
                    <customize>
1449
                        <arg value="${{applet.url}}"/>
1450
                    </customize>
1451
                </profile>
1452
            </target>
1453
1454
            <xsl:comment>
1455
                =========================
1456
                TESTS PROFILING  SECTION
1457
                =========================
1458
            </xsl:comment>
1459
1460
            <target name="profile-test-single">
1461
              <xsl:attribute name="if">netbeans.home</xsl:attribute>
1462
              <xsl:attribute name="depends">profile-init,compile-test-single</xsl:attribute>
1463
              <nbprofiledirect>
1464
                  <classpath>
1465
                      <path path="${{run.test.classpath}}"/>
1466
                  </classpath>
1467
              </nbprofiledirect>
1468
1469
              <junit showoutput="true" fork="true" dir="${{profiler.info.dir}}"  jvm="${{profiler.info.jvm}}" failureproperty="tests.failed" errorproperty="tests.failed">
1470
                  <env key="${{profiler.info.pathvar}}" path="${{profiler.info.agentpath}}:${{profiler.current.path}}"/>
1471
                  <jvmarg value="${{profiler.info.jvmargs.agent}}" />
1472
                  <jvmarg line="${{profiler.info.jvmargs}}"/>
1473
                  <test name="${{profile.class}}"/>
1474
                  <classpath>
1475
                      <path path="${{run.test.classpath}}"/>
1476
                  </classpath>
1477
                  <syspropertyset>
1478
                      <propertyref prefix="test-sys-prop."/>
1479
                      <mapper type="glob" from="test-sys-prop.*" to="*"/>
1480
                  </syspropertyset>
1481
                  <formatter type="brief" usefile="false"/>
1482
                  <formatter type="xml"/>
1483
              </junit>
1484
            </target>
1485
1338
            <xsl:comment>
1486
            <xsl:comment>
1339
                ===============
1487
                ===============
1340
                JAVADOC SECTION
1488
                JAVADOC SECTION
(-)a/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProjectTypeProfiler.java (-1 / +1 lines)
Lines 350-356 Link Here
350
                                        final FileObject profiledClass) {
350
                                        final FileObject profiledClass) {
351
        switch (type) {
351
        switch (type) {
352
            case TARGET_PROFILE:
352
            case TARGET_PROFILE:
353
                return "profile-j2ee"; // NOI18N
353
                return "profile"; // NOI18N
354
            case TARGET_PROFILE_TEST:
354
            case TARGET_PROFILE_TEST:
355
                return null; // not currently supported // "profile-test"; // NOI18N
355
                return null; // not currently supported // "profile-test"; // NOI18N
356
            case TARGET_PROFILE_TEST_SINGLE:
356
            case TARGET_PROFILE_TEST_SINGLE:
(-)a/profiler/src/org/netbeans/modules/profiler/utils/ProjectUtilities.java (-3 / +44 lines)
Lines 100-105 Link Here
100
import java.util.Set;
100
import java.util.Set;
101
import java.util.logging.Level;
101
import java.util.logging.Level;
102
import java.util.logging.Logger;
102
import java.util.logging.Logger;
103
import java.util.regex.Matcher;
104
import java.util.regex.Pattern;
103
import javax.swing.Icon;
105
import javax.swing.Icon;
104
import javax.swing.ImageIcon;
106
import javax.swing.ImageIcon;
105
import javax.swing.JButton;
107
import javax.swing.JButton;
Lines 107-112 Link Here
107
import javax.swing.event.ChangeListener;
109
import javax.swing.event.ChangeListener;
108
import org.netbeans.modules.profiler.NetBeansProfiler;
110
import org.netbeans.modules.profiler.NetBeansProfiler;
109
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
111
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
112
import org.netbeans.spi.project.ProjectServiceProvider;
113
import org.netbeans.spi.project.ui.ProjectOpenedHook;
110
import org.openide.loaders.DataObject;
114
import org.openide.loaders.DataObject;
111
import org.openide.util.lookup.Lookups;
115
import org.openide.util.lookup.Lookups;
112
import org.openide.util.lookup.ProxyLookup;
116
import org.openide.util.lookup.ProxyLookup;
Lines 120-125 Link Here
120
 */
124
 */
121
@Deprecated
125
@Deprecated
122
public final class ProjectUtilities {
126
public final class ProjectUtilities {
127
    @ProjectServiceProvider(service=ProjectOpenedHook.class, projectType={"org-netbeans-modules-java-j2seproject"})
128
    final public static class IntegrationUpdater extends ProjectOpenedHook {
129
        private Project prj;
130
131
        public IntegrationUpdater(Project prj) {
132
            this.prj = prj;
133
        }
134
135
        @Override
136
        protected void projectClosed() {
137
            // ignore
138
        }
139
140
        @Override
141
        protected void projectOpened() {
142
            Element e = ProjectUtils.getAuxiliaryConfiguration(prj)
143
                           .getConfigurationFragment("data", ProjectUtilities.PROFILER_NAME_SPACE, false); // NOI18N
144
145
            if (e != null) {
146
                unintegrateProfiler(prj);
147
            }
148
        }
149
    }
123
    //~ Static fields/initializers -----------------------------------------------------------------------------------------------
150
    //~ Static fields/initializers -----------------------------------------------------------------------------------------------
124
151
125
    private static final Logger LOGGER = Logger.getLogger(ProjectUtilities.class.getName());
152
    private static final Logger LOGGER = Logger.getLogger(ProjectUtilities.class.getName());
Lines 310-316 Link Here
310
        return buildDir;
337
        return buildDir;
311
    }
338
    }
312
339
340
    final private static Pattern PROFILER_INIT = Pattern.compile("<\\s*target\\s+.*?name\\s*=\\s*\"profile-init\"", Pattern.DOTALL | Pattern.MULTILINE);
313
    public static boolean isProfilerIntegrated(Project project) {
341
    public static boolean isProfilerIntegrated(Project project) {
342
        String buildXml = ProjectUtilities.getProjectBuildScript(project, "nbproject/build-impl.xml"); // NOI18N
343
        Matcher m = PROFILER_INIT.matcher(buildXml);
344
        if (m.find()) {
345
            return true;
346
        }
314
        Element e = ProjectUtils.getAuxiliaryConfiguration(project)
347
        Element e = ProjectUtils.getAuxiliaryConfiguration(project)
315
                           .getConfigurationFragment("data", ProjectUtilities.PROFILER_NAME_SPACE, false); // NOI18N
348
                           .getConfigurationFragment("data", ProjectUtilities.PROFILER_NAME_SPACE, false); // NOI18N
316
349
Lines 357-363 Link Here
357
    }
390
    }
358
391
359
    public static String getProjectBuildScript(final Project project) {
392
    public static String getProjectBuildScript(final Project project) {
360
        final FileObject buildFile = findBuildFile(project);
393
        return getProjectBuildScript(project, "build.xml");
394
    }
395
396
    public static String getProjectBuildScript(final Project project, final String buildXml) {
397
        final FileObject buildFile = findBuildFile(project, buildXml);
361
        if (buildFile == null) {
398
        if (buildFile == null) {
362
            return null;
399
            return null;
363
        }
400
        }
Lines 403-416 Link Here
403
        Properties props = org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities.getProjectProperties(project);
440
        Properties props = org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities.getProjectProperties(project);
404
        String buildFileName = props != null ? props.getProperty("buildfile") : null; // NOI18N
441
        String buildFileName = props != null ? props.getProperty("buildfile") : null; // NOI18N
405
        if (buildFileName != null) {
442
        if (buildFileName != null) {
406
            buildFile = project.getProjectDirectory().getFileObject(buildFileName);
443
            buildFile = findBuildFile(project, buildFileName);
407
        }
444
        }
408
        if (buildFile == null) {
445
        if (buildFile == null) {
409
            buildFile = project.getProjectDirectory().getFileObject("build.xml"); //NOI18N
446
            buildFile = findBuildFile(project, "build.xml"); //NOI18N
410
        }
447
        }
411
        return buildFile;
448
        return buildFile;
412
    }
449
    }
413
450
451
    public static FileObject findBuildFile(final Project project, final String buildFileName) {
452
        return project.getProjectDirectory().getFileObject(buildFileName);
453
    }
454
414
    public static java.util.List<SimpleFilter> getProjectDefaultInstrFilters(Project project) {
455
    public static java.util.List<SimpleFilter> getProjectDefaultInstrFilters(Project project) {
415
        java.util.List<SimpleFilter> v = new ArrayList<SimpleFilter>();
456
        java.util.List<SimpleFilter> v = new ArrayList<SimpleFilter>();
416
457
(-)a/web.project/src/org/netbeans/modules/web/project/resources/build-impl.xsl (-2 / +116 lines)
Lines 917-922 Link Here
917
                <property name="ap.cmd.line.internal" value=""/>
917
                <property name="ap.cmd.line.internal" value=""/>
918
            </target>
918
            </target>
919
919
920
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-check"/>
921
922
            <target name="-profile-pre-init">
923
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
924
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
925
            </target>
926
927
            <target name="-profile-post-init">
928
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
929
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
930
            </target>
931
            <target name="-profile-init-check">
932
                <xsl:attribute name="depends">-profile-pre-init, init, -profile-post-init</xsl:attribute>
933
                <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
934
                <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
935
            </target>
936
920
            <target name="init">
937
            <target name="init">
921
                <xsl:attribute name="depends">-pre-init,-init-private<xsl:if test="/p:project/p:configuration/libs:libraries/libs:definitions">,-init-libraries</xsl:if>,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline</xsl:attribute>
938
                <xsl:attribute name="depends">-pre-init,-init-private<xsl:if test="/p:project/p:configuration/libs:libraries/libs:definitions">,-init-libraries</xsl:if>,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline</xsl:attribute>
922
            </target>
939
            </target>
Lines 1651-1657 Link Here
1651
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1668
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1652
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
1669
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
1653
            </target>
1670
            </target>
1654
            
1671
1672
            <xsl:comment>
1673
            =================
1674
            PROFILING SECTION
1675
            =================
1676
            </xsl:comment>
1677
1678
            <target name="profile">
1679
                <xsl:attribute name="description">Profile a J2EE project in the IDE.</xsl:attribute>
1680
                <condition>
1681
                    <xsl:attribute name="property">profiler.startserver.target</xsl:attribute>
1682
                    <xsl:attribute name="value">start-profiled-server-extraargs</xsl:attribute>
1683
                    <xsl:attribute name="else">start-profiled-server</xsl:attribute>
1684
                    <isset>
1685
                        <xsl:attribute name="property">profiler.info.jvmargs.extra</xsl:attribute>
1686
                    </isset>
1687
                </condition>
1688
                <antcall>
1689
                    <xsl:attribute name="target">${profiler.startserver.target}</xsl:attribute>
1690
                </antcall>
1691
                <antcall>
1692
                    <xsl:attribute name="target">run</xsl:attribute>
1693
                </antcall>
1694
                <antcall>
1695
                    <xsl:attribute name="target">start-loadgen</xsl:attribute>
1696
                </antcall>
1697
            </target>
1698
1699
            <target name="start-profiled-server">
1700
                <nbstartprofiledserver>
1701
                    <xsl:attribute name="forceRestart">${profiler.j2ee.serverForceRestart}</xsl:attribute>
1702
                    <xsl:attribute name="startupTimeout">${profiler.j2ee.serverStartupTimeout}</xsl:attribute>
1703
                    <xsl:attribute name="javaPlatform">${profiler.info.javaPlatform}</xsl:attribute>
1704
                    <jvmarg>
1705
                        <xsl:attribute name="value">${profiler.info.jvmargs.agent}</xsl:attribute>
1706
                    </jvmarg>
1707
                    <jvmarg>
1708
                        <xsl:attribute name="value">${profiler.j2ee.agentID}</xsl:attribute>
1709
                    </jvmarg>
1710
                </nbstartprofiledserver>
1711
            </target>
1712
1713
            <target name="start-profiled-server-extraargs">
1714
                <nbstartprofiledserver>
1715
                    <xsl:attribute name="forceRestart">${profiler.j2ee.serverForceRestart}</xsl:attribute>
1716
                    <xsl:attribute name="startupTimeout">${profiler.j2ee.serverStartupTimeout}</xsl:attribute>
1717
                    <xsl:attribute name="javaPlatform">${profiler.info.javaPlatform}</xsl:attribute>
1718
                    <jvmarg>
1719
                        <xsl:attribute name="value">${profiler.info.jvmargs.extra}</xsl:attribute>
1720
                    </jvmarg>
1721
                    <jvmarg>
1722
                        <xsl:attribute name="value">${profiler.info.jvmargs.agent}</xsl:attribute>
1723
                    </jvmarg>
1724
                    <jvmarg>
1725
                        <xsl:attribute name="value">${profiler.j2ee.agentID}</xsl:attribute>
1726
                    </jvmarg>
1727
                </nbstartprofiledserver>
1728
            </target>
1729
1730
            <target name="start-loadgen" if="profiler.loadgen.path">
1731
                    <loadgenstart>
1732
                        <xsl:attribute name="path">${profiler.loadgen.path}</xsl:attribute>
1733
                    </loadgenstart>
1734
            </target>
1735
1655
            <xsl:comment>
1736
            <xsl:comment>
1656
                JAVADOC SECTION
1737
                JAVADOC SECTION
1657
            </xsl:comment>
1738
            </xsl:comment>
Lines 1934-1940 Link Here
1934
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix-test</xsl:attribute>
2015
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix-test</xsl:attribute>
1935
            </target>
2016
            </target>
1936
            
2017
            
1937
            
2018
        <xsl:comment>
2019
        =========================
2020
        TESTS PROFILING  SECTION
2021
        =========================
2022
        </xsl:comment>
2023
2024
          <target name="profile-test-single">
2025
              <xsl:attribute name="if">netbeans.home</xsl:attribute>
2026
              <xsl:attribute name="depends">profile-init,compile-test-single</xsl:attribute>
2027
              <nbprofiledirect>
2028
                  <classpath>
2029
                      <path path="${{run.test.classpath}}"/>
2030
                      <path path="${{j2ee.platform.classpath}}"/>
2031
                  </classpath>
2032
              </nbprofiledirect>
2033
2034
              <junit showoutput="true" fork="true" dir="${{profiler.info.dir}}"  jvm="${{profiler.info.jvm}}" failureproperty="tests.failed" errorproperty="tests.failed">
2035
                  <env key="${{profiler.info.pathvar}}" path="${{profiler.info.agentpath}}:${{profiler.current.path}}"/>
2036
                  <jvmarg value="${{profiler.info.jvmargs.agent}}" />
2037
                  <jvmarg line="${{profiler.info.jvmargs}}"/>
2038
                  <test name="${{profile.class}}"/>
2039
                  <classpath>
2040
                      <path path="${{run.test.classpath}}"/>
2041
                      <path path="${{j2ee.platform.classpath}}"/>
2042
                  </classpath>
2043
                  <syspropertyset>
2044
                      <propertyref prefix="test-sys-prop."/>
2045
                      <mapper type="glob" from="test-sys-prop.*" to="*"/>
2046
                  </syspropertyset>
2047
                  <formatter type="brief" usefile="false"/>
2048
                  <formatter type="xml"/>
2049
              </junit>
2050
          </target>
2051
1938
            <xsl:comment>
2052
            <xsl:comment>
1939
                
2053
                
1940
                CLEANUP SECTION
2054
                CLEANUP SECTION

Return to bug 189151