Questions tagged [groovydsl]

GroovyDSL is an IntelliJ framework to define the behaviour of end-user DSLs as script files which are executed by the IDE.

GroovyDSL is a framework with a domain-specific language designed to define the behaviour of end-user DSLs as script files which are executed by the IDE on the fly, bringing new reference resolution and code completion logic into the scope of a project. GroovyDSL relies on the Program Structure Interface (PSI), a set of internal classes and interfaces of IntelliJ IDEA, which allow all programming languages to be described in a uniform way.

Taken from the project page.

28 questions
9
votes
3 answers

IntelliJ + groovy DSL: How to exclude files from being compiled by groovy plugin?

I am working on a Java web project that uses Liquibase groovy DSL to managae DB changes. For the sake of this topic, it could be any other 3rd party library that uses *.groovy files as sources. The project is built with gradle. In one of my modules…
Doron Gold
  • 3,664
  • 4
  • 32
  • 44
8
votes
1 answer

versionCodeOverride equivalent for Gradle Kotlin DSL

android.applicationVariants.all { variant -> variant.outputs.each { output -> int newVersionCode = android.defaultConfig.versionCode * 10 + abiVersionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) …
PhilipSa
  • 215
  • 2
  • 9
3
votes
2 answers

Pass a Groovy List as parameter to Build command in Jenkinsfile

I want to be able to pass a List variable to the Build command in Jenkinsfile something like: stage('test') { def listName = [] build job: "/job/jobname", parameters: listName, propagate: false } When I try something like this I get an…
anuj0901
  • 573
  • 6
  • 8
3
votes
1 answer

Jenkins: groovy DSL: using the ternary operator to distinguish between FreeStyleJob and MatrixJob

I am trying to write a groovy-dsl script for Jenkins to generate two jobs: The first job is a FreestyleJob The second one is a MatrixJob Their definitions are almost the same; there are only minor differences between them. Therefore, I want to…
thiagowfx
  • 4,832
  • 6
  • 37
  • 51
3
votes
0 answers

Groovy DSL with IDE support for completion

I am in need of a DSL which has some known structure and a lot of only known at runtime structure. for eg: test "name goes here"{ description : """ description """ create user { id : 1 fn : """ x """ ln : """ y """ } assert…
user19937
  • 587
  • 1
  • 7
  • 25
2
votes
0 answers

Creating a new file inside NonCPS method in jenkins pipeline

I am trying to read a file line by line and then creating a new file from each line(except last line). For example if filename is object then new files will be object1 object2 ..so on. I am not able to use writeFile method because i am inside a…
selestian
  • 33
  • 4
2
votes
1 answer

Groovy Closure reuse vs rehydrate copy

In the DSL page of groovy they show this def email(Closure cl) { def email = new EmailSpec() def code = cl.rehydrate(email, this, this) code.resolveStrategy = Closure.DELEGATE_ONLY code() } Why are they calling rehydrate instead of just…
Hilikus
  • 9,954
  • 14
  • 65
  • 118
1
vote
2 answers

How to make a method from an object available only from a specific Closure or Scope when creating a Groovy DSL

Lets say I have a class: Foo { always() onlyScopeB() } And I have different methods, which take different closures: scopeA, scopeB foo = new Foo() scopeA{ foo.always() // this should COMPILE foo.onlyScopeB() // this should NOT…
Derrops
  • 7,651
  • 5
  • 30
  • 60
1
vote
1 answer

How to pass json parameters for Jenkins using CURL?

I'm trying to build a job by passing JSON parameter for Jenkins through Linux CLI. But I'm not able to pass the parameters in JSON. I have used -g to turn off globbing. Still the issue persists. Any help would be appreciated. curl -X POST -u…
Deepakvg
  • 71
  • 2
  • 9
1
vote
0 answers

PackageFatJar task from Groovy to Groovy DSL

I have a gradle task written in Groovy task packageFatJar(type: Jar) { group 'build' description 'package fat jar for migrations app with all dependencies' baseName = 'app-fat' zip64 = true from { configurations.compile.collect…
Seydazimov Nurbol
  • 1,404
  • 3
  • 10
  • 25
1
vote
2 answers

Spring Cloud Contract for provider - setting optional header

I've created a contract on a provider side: Contract.make { request { method 'GET' url('/cars/car?id=3') headers { header(accept(), "application/hal+json") header(SOME OTHER HEADER) } …
jb27
  • 93
  • 1
  • 1
  • 7
1
vote
1 answer

Service end point with path variable is causing 404 with cloud contract

I wrote a contract and the plugin autogenerated tests out of it. I'm seeing a very strange behavior with these autogenerated tests. Following is my service endpoint: @RequestMapping(value="/check/{id}" method= RequestMethod.GET, produces =…
1
vote
0 answers

IntelliJ IDEA GroovyDSL support for static star import

I have a utility class with an awful lot of methods that I would like to make available in my DSL. Is it possible to describe that behaviour in GDSL without listing every method explicitly? In other words, I would like to describe in GDSL what with…
Michal M
  • 1,521
  • 14
  • 35
1
vote
1 answer

How to dynamically inject child nodes in Groovy MarkupBuilder?

I'm trying to use Groovy MarkupBuilder to dynamically create my custom XML structure like below.
value1
Though I got it working with the below code,…
MFIhsan
  • 1,037
  • 3
  • 15
  • 35
0
votes
1 answer

Is there a good way to extract parts of a Groovy DSL builder into variables or helper functions, so that they can be then reused?

Here is a minimal example of a builder-style Groovy DSL for declaring e-mails. email { from("pepa@depo.cz") to("lojza@depo.cz") body { html("Ahoj") // lots of other fields here } } For example, I want to extract the…
user7610
  • 25,267
  • 15
  • 124
  • 150
1
2