Skip to content

DSL spec v. 0.2

Nikita Skvortsov edited this page Oct 18, 2019 · 1 revision

This page describes additional entities, arrived since IDEA ext DSL v0.1

New TestNG run configuration

Allows to create TestNG run configurations, very similar to JUnit

  • packageName, className, method, group, suite, pattern - String defining a test to run. If multiple properties are set, fist not null is used
  • String workingDirectory - working directory
  • String vmParameters - jvm arguments string for tests
  • Boolean passParentEnvs - if pass parent process environment, defaults to true
  • String moduleName - name of Idea module containing tests
  • Map<String, String> envs - environment values

Sample:

runConfigurations {
  "Run Test Method"(TestNG) {
    method "my.test.ClassName#methodName"
    moduleName idea.module.name
  }
}

Gradle tasks triggers settings

Intellij IDEA allows to build tasks to multiple phases. Now this binding can be stored in gradle script.

idea.project.settings {
  taskTriggers {
    afterSync tasks.getByName("projects"), tasks.getByName("tasks")
  }
}

Available phases:

  • beforeSync - before each Gradle project sync. Will NOT be executed on initial import
  • afterSync - after each Gradle project sync. Will BE executed after initial import,
  • beforeBuild - before project build
  • afterBuild - after project build
  • beforeRebuild - before project re-build
  • afterRebuild - after project re-build

Delegating Run/Build and Test actions

This allows to activate delegation of Run/Build or Test actions to Gradle.

import static org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.CHOOSE_PER_TEST

idea.project.settings {
  delegateActions {
    delegateBuildRunToGradle = true // Delegate Run/Build to Gradle
    testRunner = CHOOSE_PER_TEST    // Test execution: PLATFORM, GRADLE or CHOOSE_PER_TEST
  }
}

Javac settings of IDEA compiler

Allows to customize javac used by IDEA to compile, e.g.

idea.project.settings {
  compiler {
    javac {
      javacAdditionalOptions "-Xmaxwarns 123 -Xdoclint"
    }
  }
}

Following settings are available:

  • Boolean preferTargetJDKCompiler - use compiler of JDK, matching target jdk of a module (if available)
  • String javacAdditionalOptions - additional command line options string
  • Boolean generateDebugInfo - generate debug information
  • Boolean generateDeprecationWarnings - show warnings information
  • Boolean generateNoWarnings - suppress all warnings
You can’t perform that action at this time.