polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [01/13] zest-java git commit: build: move performance tests build logic into buildSrc
Date Thu, 08 Dec 2016 23:44:10 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 994d38913 -> 8854b1306


build: move performance tests build logic into buildSrc


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/447695d6
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/447695d6
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/447695d6

Branch: refs/heads/develop
Commit: 447695d6c3a46508e72913eefbe8dd18bb6b96e0
Parents: 994d389
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Tue Dec 6 19:03:28 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Tue Dec 6 19:03:54 2016 +0100

----------------------------------------------------------------------
 .../performance/PerformanceTestsPlugin.groovy   | 62 ++++++++++++++++++++
 .../src/docs/tutorials/howto-build-system.txt   |  4 +-
 tests/performance/build.gradle                  | 23 +-------
 3 files changed, 66 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/447695d6/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
b/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
new file mode 100644
index 0000000..29f1986
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.performance
+
+import groovy.transform.CompileStatic
+import org.apache.zest.gradle.TaskGroups
+import org.gradle.api.Action
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.bundling.Jar
+import org.gradle.api.tasks.testing.Test
+import org.gradle.language.base.plugins.LifecycleBasePlugin
+
+// TODO Add profiling tasks (jfr or honest? flamegraphs?)
+// TODO Add simple regression assertions, how? testing against a previous version?
+@CompileStatic
+class PerformanceTestsPlugin implements Plugin<Project>
+{
+  static class TaskNames
+  {
+    static final String PERFORMANCE_TEST = 'performanceTest'
+    static final String PERFORMANCE_PROFILE = 'performanceProfile'
+    static final String PERFORMANCE_CHECK = 'performanceCheck'
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
+    sourceSets.create 'perf'
+    project.dependencies.add 'perfCompile', sourceSets.getByName( 'main' ).output
+    project.dependencies.add 'perfCompile', sourceSets.getByName( 'test' ).output
+    project.dependencies.add 'perfCompile', project.configurations.getByName( 'testCompile'
)
+    project.dependencies.add 'perfRuntime', project.configurations.getByName( 'testRuntime'
)
+    project.tasks.getByName( LifecycleBasePlugin.CHECK_TASK_NAME ).dependsOn 'compilePerfJava'
+    project.tasks.create( TaskNames.PERFORMANCE_TEST, Test, { Test task ->
+      task.group = TaskGroups.PERFORMANCE
+      task.description = 'Runs performance tests.'
+      task.maxParallelForks = 1
+      task.forkEvery = 1L
+      task.testClassesDir = sourceSets.getByName( 'perf' ).output.classesDir
+      task.classpath = sourceSets.getByName( 'perf' ).runtimeClasspath
+      task.systemProperty 'jar.path', ( project.tasks.getByName( 'jar' ) as Jar ).archivePath
+    } as Action<Test> )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/447695d6/manual/src/docs/tutorials/howto-build-system.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-build-system.txt b/manual/src/docs/tutorials/howto-build-system.txt
index 2af9cbf..54bfd86 100644
--- a/manual/src/docs/tutorials/howto-build-system.txt
+++ b/manual/src/docs/tutorials/howto-build-system.txt
@@ -109,7 +109,7 @@ To see all available tasks on a submodule issue the following command:
 ----
 
 This example will output all gradle tasks available in the +tests/performance+ module where
you should find
-the +testPerf+ task that run the Zest™ performance test suite.
+the +performanceTest+ task that run the Zest™ performance test suite.
 
 
 == Versions ==
@@ -165,7 +165,7 @@ They can be run with the following Gradle command:
 
 [source,bash]
 -----------
-./gradlew :org.apache.zest.tests:org.apache.zest.test.performance:testPerf
+./gradlew :org.apache.zest.tests:org.apache.zest.test.performance:performanceTest
 -----------
 
 Results will then be available in the test reports.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/447695d6/tests/performance/build.gradle
----------------------------------------------------------------------
diff --git a/tests/performance/build.gradle b/tests/performance/build.gradle
index af5e790..7da0e51 100644
--- a/tests/performance/build.gradle
+++ b/tests/performance/build.gradle
@@ -15,26 +15,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-import org.apache.zest.gradle.TaskGroups
+import org.apache.zest.gradle.performance.PerformanceTestsPlugin
 
 description = "Apache Zest™ Performance Test Suite."
 
 jar { manifest { name = "Apache Zest™ Tests - Performance" } }
 
-sourceSets {
-  perf
-}
+apply plugin: PerformanceTestsPlugin
 
 dependencies {
   compile zest.core.bootstrap
   compile libraries.junit
   compile libraries.slf4j_api
 
-  perfCompile sourceSets.main.output
-  perfCompile configurations.testCompile
-  perfCompile sourceSets.test.output
-  perfRuntime configurations.testRuntime
-
   perfCompile zest.core.testsupport
   perfCompile zest.library( 'sql-dbcp' )
   perfCompile zest.extension( 'valueserialization-orgjson' )
@@ -48,15 +41,3 @@ dependencies {
   perfRuntime zest.core.runtime
   perfRuntime libraries.logback
 }
-
-check.dependsOn compilePerfJava
-
-task testPerf( type: Test, dependsOn: jar ) {
-  group = TaskGroups.PERFORMANCE
-  description = 'Runs performance tests.'
-  maxParallelForks = 1
-  forkEvery = 1
-  testClassesDir = sourceSets.perf.output.classesDir
-  classpath = sourceSets.perf.runtimeClasspath
-  systemProperties[ 'jar.path' ] = jar.archivePath
-}


Mime
View raw message