Jean-Baptiste Queru | 2bd2b7c | 2013-04-01 14:41:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2000-2013 JetBrains s.r.o. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | target('run_cucumber_tests': "Run cucumber tests") { |
| 17 | if (!isDefined("cucumber_test_dirs")) { |
| 18 | return |
| 19 | } |
| 20 | |
| 21 | cucumber_test_dirs.each { |
| 22 | def m = findModule(it[0]) |
| 23 | def platformPrefix = it[1] |
| 24 | def testsDir = it[2] |
| 25 | def stepDefsPackage = it[3] |
| 26 | |
| 27 | |
| 28 | ant.java(failonerror: "true", classname: "com.intellij.cucumber.CucumberMain", fork: "true", dir: testsDir) { |
| 29 | jvmarg(line: "-Xmx512m") |
| 30 | jvmarg(line: "-XX:MaxPermSize=350m") |
| 31 | jvmarg(line: "-XX:+HeapDumpOnOutOfMemoryError") |
| 32 | jvmarg(line: "-ea") |
| 33 | jvmarg(line: "-Didea.platform.prefix=$platformPrefix") |
| 34 | |
| 35 | System.getProperties().entrySet().each { |
| 36 | if (it.key.startsWith("pass.")) { |
| 37 | def trimmed = it.key.substring("pass.".length()); |
| 38 | jvmarg(value: "-D${trimmed}=${it.value}"); |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | arg(value: "--format") |
| 43 | arg(value: "org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter") |
| 44 | arg(value: "--glue") |
| 45 | arg(value: stepDefsPackage) |
| 46 | arg(value: ".") |
| 47 | |
| 48 | classpath() { |
| 49 | projectBuilder.moduleRuntimeClasspath(findModule("cucumber-test-runner"), false).each { |
| 50 | pathelement(location: it) |
| 51 | } |
| 52 | projectBuilder.moduleRuntimeClasspath(m, true).each { |
| 53 | pathelement(location: it) |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | } |
| 59 | |
| 60 | } |