Permalink
Browse files

benchmark support in core

  • Loading branch information...
1 parent beccbb6 commit c780bb9c3bea35a76e24edd779e62dcce21811b1 @JPMoresmau committed Dec 30, 2013
Showing with 330 additions and 119 deletions.
  1. +1 −1 docs/releasenotes/net.sf.eclipsefp.haskell_2.6.0.txt
  2. +6 −6 net.sf.eclipsefp.haskell-feature/feature.xml
  3. +1 −1 net.sf.eclipsefp.haskell.buildwrapper/META-INF/MANIFEST.MF
  4. +3 −0 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/BWFacade.java
  5. +4 −1 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/types/Component.java
  6. +1 −1 net.sf.eclipsefp.haskell.core/META-INF/MANIFEST.MF
  7. +1 −1 net.sf.eclipsefp.haskell.core/plugin.xml
  8. +1 −0 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/cabalmodel/CabalSyntax.java
  9. +17 −0 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/cabalmodel/PackageDescription.java
  10. +9 −0 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/project/HaskellResource.java
  11. +8 −1 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/util/ResourceUtil.java
  12. +1 −1 net.sf.eclipsefp.haskell.debug.core/META-INF/MANIFEST.MF
  13. +1 −0 net.sf.eclipsefp.haskell.debug.core/plugin.properties
  14. +8 −0 net.sf.eclipsefp.haskell.debug.core/plugin.xml
  15. +55 −0 ....core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/BenchmarkHaskellLaunchDelegate.java
  16. +1 −1 net.sf.eclipsefp.haskell.debug.ui/META-INF/MANIFEST.MF
  17. BIN net.sf.eclipsefp.haskell.debug.ui/icons/eview16/haskell_bench.png
  18. +7 −0 net.sf.eclipsefp.haskell.debug.ui/plugin.properties
  19. +48 −0 net.sf.eclipsefp.haskell.debug.ui/plugin.xml
  20. +54 −0 ...kell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/BenchmarkLaunchOperation.java
  21. +31 −0 ...skell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/BenchmarkLaunchShortcut.java
  22. +6 −0 ...i/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/ExecutableOrTestSuiteLaunchOperation.java
  23. +45 −102 ...efp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/RunActionProvider.java
  24. +1 −0 net.sf.eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/util/UITexts.java
  25. +1 −0 ...eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/util/uitexts.properties
  26. +1 −1 net.sf.eclipsefp.haskell.ui/META-INF/MANIFEST.MF
  27. BIN net.sf.eclipsefp.haskell.ui/icons/obj16/haskell_bench.png
  28. +2 −0 ...efp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/cabal/outline/CabalOutlineLP.java
  29. +2 −1 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/UITexts.java
  30. +2 −0 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/uitexts.properties
  31. +2 −0 ...ipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/views/projectexplorer/CabalFolder.java
  32. +2 −1 ...fp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/views/projectexplorer/CabalFolderType.java
  33. +3 −0 ...ui/src/net/sf/eclipsefp/haskell/ui/internal/views/projectexplorer/HaskellResourceExtensionCP.java
  34. +3 −0 ...ui/src/net/sf/eclipsefp/haskell/ui/internal/views/projectexplorer/HaskellResourceExtensionLP.java
  35. +1 −0 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/util/HaskellUIImages.java
  36. +1 −0 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/util/IImageNames.java
@@ -13,7 +13,7 @@ Fixes:
- Remove commas when several dependent packages are missing
Features:
-
+ - Support benchmark stanzas in cabal files (https://github.com/JPMoresmau/eclipsefp/issues/109)
Internal:
@@ -2,7 +2,7 @@
<feature
id="net.sf.eclipsefp.haskell"
label="%bundleName"
- version="2.5.6.qualifier"
+ version="2.6.0.qualifier"
provider-name="%bundleVendor">
<description>
@@ -81,7 +81,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.core"
download-size="0"
install-size="0"
- version="2.5.6.qualifier"
+ version="2.6.0.qualifier"
unpack="false"/>
<plugin
@@ -95,7 +95,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.ui"
download-size="0"
install-size="0"
- version="2.5.6.qualifier"
+ version="2.6.0.qualifier"
unpack="false"/>
<plugin
@@ -116,14 +116,14 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.debug.ui"
download-size="0"
install-size="0"
- version="2.5.3.qualifier"
+ version="2.6.0.qualifier"
unpack="false"/>
<plugin
id="net.sf.eclipsefp.haskell.debug.core"
download-size="0"
install-size="0"
- version="2.5.6.qualifier"
+ version="2.6.0.qualifier"
unpack="false"/>
<plugin
@@ -158,7 +158,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.buildwrapper"
download-size="0"
install-size="0"
- version="2.5.6.qualifier"
+ version="2.6.0.qualifier"
unpack="false"/>
<plugin
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.buildwrapper;singleton:=true
-Bundle-Version: 2.5.6.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-Activator: net.sf.eclipsefp.haskell.buildwrapper.BuildWrapperPlugin
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
@@ -1210,6 +1210,9 @@ private Component parseComponent(JSONObject obj){
} else if (obj.has("TestSuite")){
buildable=obj.getBoolean("TestSuite");
return new Component(ComponentType.TESTSUITE, obj.getString("t"), getCabalFile(), buildable);
+ } else if (obj.has("Benchmark")){
+ buildable=obj.getBoolean("Benchmark");
+ return new Component(ComponentType.BENCHMARK, obj.getString("b"), getCabalFile(), buildable);
}
} catch (JSONException je){
BuildWrapperPlugin.logError(BWText.process_parse_component_error, je);
@@ -8,7 +8,8 @@
FILE,
LIBRARY,
EXECUTABLE ,
- TESTSUITE
+ TESTSUITE,
+ BENCHMARK
}
private ComponentType type;
@@ -86,6 +87,8 @@ public String toString() {
// this is equivalent to PackageDescriptionStanza getTypeName()
if (ComponentType.TESTSUITE.equals(getType())){
return "test-suite" +(getName()!=null?" "+getName():"");
+ } else if (ComponentType.BENCHMARK.equals(getType())){
+ return "benchmark" +(getName()!=null?" "+getName():"");
} else {
return getType().toString().toLowerCase() +(getName()!=null?" "+getName():"");
}
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.core;singleton:=true
-Bundle-Version: 2.5.6.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-Activator: net.sf.eclipsefp.haskell.core.HaskellCorePlugin
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
@@ -172,7 +172,7 @@
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
- properties="isProjectExecutable, isSourceFolder, isHaskellFile, isProjectTestSuite, hasProjectHLintBuilder, needsProjectHLintBuilder, hasProjectAlexBuilder, needsProjectAlexBuilder, hasProjectHappyBuilder, needsProjectHappyBuilder, hasProjectUuagcBuilder, needsProjectUuagcBuilder, isProjectYesod"
+ properties="isProjectExecutable,isProjectBenchmark, isSourceFolder, isHaskellFile, isProjectTestSuite, hasProjectHLintBuilder, needsProjectHLintBuilder, hasProjectAlexBuilder, needsProjectAlexBuilder, hasProjectHappyBuilder, needsProjectHappyBuilder, hasProjectUuagcBuilder, needsProjectUuagcBuilder, isProjectYesod"
namespace="net.sf.eclipsefp.haskell.core"
type="org.eclipse.core.resources.IResource"
class="net.sf.eclipsefp.haskell.core.expressions.HaskellPropertyTester"
@@ -18,6 +18,7 @@
SECTION_IF("if",true), //$NON-NLS-1$
SECTION_ELSE("else",true), //$NON-NLS-1$
SECTION_TESTSUITE("test-suite",true), //$NON-NLS-1$
+ SECTION_BENCHMARK("benchmark",true), //$NON-NLS-1$
FIELD_CATEGORY("category"), //$NON-NLS-1$
FIELD_EXPOSED_MODULES("exposed-modules"), //$NON-NLS-1$
@@ -73,6 +73,17 @@ public PackageDescriptionStanza getLibraryStanza() {
return result;
}
+ public List<PackageDescriptionStanza> getBenchmarkStanzas() {
+ Vector<PackageDescriptionStanza> result = new Vector<PackageDescriptionStanza>();
+ for (PackageDescriptionStanza stanza : getStanzas()) {
+ if (stanza.getType() == CabalSyntax.SECTION_BENCHMARK) {
+ result.add( stanza );
+ }
+ }
+ return result;
+ }
+
+
public PackageDescriptionStanza addStanza(final CabalSyntax type,final String name){
int startLine=stanzas.get(stanzas.size()-1).getEndLine()+1;
PackageDescriptionStanza pds=new PackageDescriptionStanza(this, type, name, startLine );
@@ -176,6 +187,9 @@ public PackageDescriptionStanza getComponentStanza(final Component c){
if (CabalSyntax.SECTION_TESTSUITE.equals(pds.getType()) && c.getType().equals( ComponentType.TESTSUITE ) && pds.getName().equals(c.getName())){
return pds;
}
+ if (CabalSyntax.SECTION_BENCHMARK.equals(pds.getType()) && c.getType().equals( ComponentType.BENCHMARK ) && pds.getName().equals(c.getName())){
+ return pds;
+ }
}
return null;
}
@@ -194,6 +208,9 @@ public PackageDescriptionStanza getSameStanza(final PackageDescriptionStanza p){
if (CabalSyntax.SECTION_TESTSUITE.equals(pds.getType()) && CabalSyntax.SECTION_TESTSUITE.equals(p.getType() ) && pds.getName().equals(p.getName())){
return pds;
}
+ if (CabalSyntax.SECTION_BENCHMARK.equals(pds.getType()) && CabalSyntax.SECTION_BENCHMARK.equals(p.getType() ) && pds.getName().equals(p.getName())){
+ return pds;
+ }
}
return null;
}
@@ -67,6 +67,15 @@ public boolean isProjectTestSuite(){
return false;
}
+
+ public boolean isProjectBenchmark(){
+ if (fResource instanceof IProject){
+ IProject project=(IProject)fResource;
+ return !ResourceUtil.getProjectBenchmarks( project ).isEmpty();
+ }
+ return false;
+ }
+
public boolean hasProjectBuilder(final String builderId) {
if (fResource instanceof IProject){
IProject project=(IProject)fResource;
@@ -115,7 +115,9 @@ public static IFile getExecutableLocation (final IProject project, final String
return getExecutablesOfComponentType( project, ComponentType.TESTSUITE );
}
-
+ public static Map<String,IFile> getProjectBenchmarks( final IProject project) {
+ return getExecutablesOfComponentType( project, ComponentType.BENCHMARK );
+ }
// public static boolean isProjectExecutable(final IProject project, final String exeName)
// {
@@ -152,6 +154,11 @@ public static IFile getExecutableLocation (final IProject project, final String
return executables.values().toArray( new IFile[ executables.size() ] );
}
+ public static IFile[] getProjectBenchmarksArray( final IProject project ) {
+ Map<String,IFile> executables = getProjectBenchmarks( project );
+ return executables.values().toArray( new IFile[ executables.size() ] );
+ }
+
/**
* Get the output folder of the Haskell project.
*
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.debug.core;singleton:=true
-Bundle-Version: 2.5.6.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-Activator: net.sf.eclipsefp.haskell.debug.core.internal.HaskellDebugCore
Bundle-Vendor: %bundleVendor
Require-Bundle: org.eclipse.core.runtime,
@@ -19,5 +19,6 @@ haskellProfilingLaunchType_name = Haskell application with profiling
customExecutableLaunchType_name = Custom executable
yesodInteractiveLaunchType_name = Yesod server
yesodTestInteractiveLaunchType_name = Yesod tests
+haskellBenchmarkLaunchType_name = Haskell benchmark
source_locator=Haskell Source Lookup Director
@@ -38,6 +38,14 @@
sourceLocatorId="net.sf.eclipsefp.haskell.debug.core.sourceLookupDirector"
sourcePathComputerId="net.sf.eclipsefp.haskell.debug.core.sourcePathComputer">
</launchConfigurationType>
+ <launchConfigurationType
+ delegate="net.sf.eclipsefp.haskell.debug.core.internal.launch.BenchmarkHaskellLaunchDelegate"
+ id="net.sf.eclipsefp.haskell.debug.core.internal.launch.BenchmarkHaskellLaunchDelegate"
+ modes="run"
+ name="%haskellBenchmarkLaunchType_name"
+ sourceLocatorId="net.sf.eclipsefp.haskell.debug.core.sourceLookupDirector"
+ sourcePathComputerId="net.sf.eclipsefp.haskell.debug.core.sourcePathComputer">
+ </launchConfigurationType>
<launchConfigurationType
delegate="net.sf.eclipsefp.haskell.debug.core.internal.launch.TestSuiteHaskellLaunchDelegate"
id="net.sf.eclipsefp.haskell.debug.core.internal.launch.TestSuiteHaskellLaunchDelegate"
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2013 by JP Moresmau
+ * This code is made available under the terms of the Eclipse Public License,
+ * version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
+ */
+package net.sf.eclipsefp.haskell.debug.core.internal.launch;
+
+import java.util.Map;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IProcess;
+
+
+/**
+ *
+ * @author JP Moresmau
+ *
+ */
+public class BenchmarkHaskellLaunchDelegate extends ExecutableOrTestSuiteHaskellLaunchDelegate {
+
+ @Override
+ protected String getExtraArguments() {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected void preProcessCreation( final ILaunchConfiguration configuration,
+ final String mode, final ILaunch launch,
+ final Map<String, String> processAttribs ) {
+ // NOOP
+
+ }
+
+ @Override
+ protected void preProcessDefinitionCreation(
+ final ILaunchConfiguration configuration, final String mode, final ILaunch launch ) {
+ // NOOP
+
+ }
+
+ @Override
+ protected void postProcessCreation( final ILaunchConfiguration configuration,
+ final String mode, final ILaunch launch, final IProcess process ) {
+ // NOOP
+
+ }
+
+ @Override
+ protected void postProcessFinished(final ILaunchConfiguration configuration) {
+ // NOOP
+
+ }
+
+
+}
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.debug.ui;singleton:=true
-Bundle-Version: 2.5.3.qualifier
+Bundle-Version: 2.6.0.qualifier
Bundle-Activator: net.sf.eclipsefp.haskell.debug.ui.internal.HaskellDebugUI
Bundle-Vendor: %bundleVendor
Require-Bundle: net.sf.eclipsefp.haskell.ghccompiler,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -19,6 +19,10 @@ htfLaunchContextLabel_label = HTF Test
ghciShortcut_label = GHCi session
ghciContextLabel_label = Run GHCi session
+benchLaunchShortcut_label = Haskell Benchmark
+benchLaunchContextLabel_label = Run Haskell Benchmark
+
+
# Yesod actions
yesodDevelShortcut_label=Yesod Development Server
yesodDevelContextLabel_label=Launch Yesod development server
@@ -36,6 +40,9 @@ adding the project source folders to GHCi's search path.
runHaskellShortcut_name = Run Haskell program
runHaskellShortcut_desc = Executes the built executable from this project.
+runBenchmarkShortcut_name = Run Haskell benchmark
+runBenchmarkShortcut_desc = Executes the built benchmark from this project.
+
runTestSuiteShortcut_name = Run Test-framework Test
runTestSuiteShortcut_desc = Executes the built test-suite from this project.
@@ -177,6 +177,11 @@
icon="icons/eview16/haskell_test.png"
id="net.sf.eclipsefp.haskell.ui.launch.launchHTFIcon">
</launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ configTypeID="net.sf.eclipsefp.haskell.debug.core.internal.launch.BenchmarkHaskellLaunchDelegate"
+ icon="icons/eview16/haskell_bench.png"
+ id="net.sf.eclipsefp.haskell.ui.launch.launchBenchIcon">
+ </launchConfigurationTypeImage>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
@@ -196,6 +201,11 @@
type="net.sf.eclipsefp.haskell.debug.core.internal.launch.TestSuiteHaskellLaunchDelegate">
</launchConfigurationTabGroup>
<launchConfigurationTabGroup
+ type="net.sf.eclipsefp.haskell.debug.core.internal.launch.BenchmarkHaskellLaunchDelegate"
+ class="net.sf.eclipsefp.haskell.debug.ui.internal.launch.ExecutableTestSuiteHaskellLaunchTabGroup"
+ id="net.sf.eclipsefp.haskell.debug.ui.internal.launch.BenchmarkHaskellLaunchTabGroup">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
class="net.sf.eclipsefp.haskell.debug.ui.internal.launch.ExecutableTestSuiteHaskellLaunchTabGroup"
id="net.sf.eclipsefp.haskell.debug.ui.internal.launch.ExecutableHaskellLaunchTabGroup"
type="net.sf.eclipsefp.haskell.debug.core.internal.launch.HTFLaunchDelegate">
@@ -251,6 +261,38 @@
</contextualLaunch>
</shortcut>
<shortcut
+ label="%benchLaunchShortcut_label"
+ icon="icons/eview16/haskell_bench.png"
+ class="net.sf.eclipsefp.haskell.debug.ui.internal.launch.BenchmarkLaunchShortcut"
+ modes="run"
+ id="net.sf.eclipsefp.haskell.debug.ui.internal.launch.BenchmarkLaunchShortcut">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IResource"/>
+ <test
+ property="net.sf.eclipsefp.haskell.core.isProjectBenchmark">
+ </test>
+ </and>
+ <instanceof value="net.sf.eclipsefp.haskell.ui.internal.views.projectexplorer.ProjectExplorerStanza"/>
+ </or>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="%benchLaunchContextLabel_label"
+ mode="run">
+ </contextLabel>
+ </contextualLaunch>
+ </shortcut>
+ <shortcut
label="%ghciShortcut_label"
icon="icons/etool16/ghci16.gif"
class="net.sf.eclipsefp.haskell.debug.ui.internal.launch.ghci.GhciLaunchShortcut"
@@ -418,6 +460,12 @@
id="net.sf.eclipsefp.haskell.debug.ui.internal.launch.ExecutableLaunchShortcut.run">
</command>
<command
+ name="%runBenchmarkShortcut_name"
+ description="%runBenchmarkShortcut_desc"
+ categoryId="org.eclipse.debug.ui.category.run"
+ id="net.sf.eclipsefp.haskell.debug.ui.internal.launch.BenchmarkLaunchShortcut.run">
+ </command>
+ <command
categoryId="org.eclipse.debug.ui.category.run"
description="%runTestSuiteShortcut_desc"
id="net.sf.eclipsefp.haskell.debug.ui.internal.launch.TestSuiteLaunchShortcut.run"
Oops, something went wrong.

0 comments on commit c780bb9

Please sign in to comment.