Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using the Kotlin DSL #700

Open
jensborch opened this issue Jan 18, 2024 · 0 comments
Open

Issues using the Kotlin DSL #700

jensborch opened this issue Jan 18, 2024 · 0 comments

Comments

@jensborch
Copy link

I have tried using the Kotlin DSL as described https://axion-release-plugin.readthedocs.io/en/latest/examples/examples/, but I can't get it working.

Using the following code:

plugins {
  ...
  id("pl.allegro.tech.build.axion-release") version "1.16.1"
}

...

scmVersion {

  hooks {
     pre {
         fileUpdate {
             file("README.md")
             pattern = {previousVersion,context -> "version: $previousVersion"}
             replacement = {currentVersion,context -> "version: $currentVersion"}
         }
    }
  }
}

I get the following error:

FAILURE: Build failed with an exception.

* Where:
Build file 'build.gradle.kts' line: 126

* What went wrong:
Script compilation errors:

  Line 126:         fileUpdate {
                    ^ Unresolved reference: fileUpdate

  Line 128:             pattern = {previousVersion,context -> "version: $previousVersion"}
                        ^ Unresolved reference: pattern

  Line 128:             pattern = {previousVersion,context -> "version: $previousVersion"}
                                   ^ Cannot infer a type for this parameter. Please specify it explicitly.

  Line 128:             pattern = {previousVersion,context -> "version: $previousVersion"}
                                                   ^ Cannot infer a type for this parameter. Please specify it explicitly.

  Line 129:             replacement = {currentVersion,context -> "version: $currentVersion"}
                        ^ Unresolved reference: replacement

  Line 129:             replacement = {currentVersion,context -> "version: $currentVersion"}
                                       ^ Cannot infer a type for this parameter. Please specify it explicitly.

  Line 129:             replacement = {currentVersion,context -> "version: $currentVersion"}
                                                      ^ Cannot infer a type for this parameter. Please specify it explicitly.

7 errors

I have also tried to use:

    pre(
      "fileUpdate", mapOf(
        "encoding" to "utf-8",
        "file" to file("README.md"),
        "pattern" to KotlinClosure2({ pv: String, _: HookContext -> "version: $previousVersion" }),
        "replacement" to KotlinClosure2({ cv: String, _: HookContext -> "version: $previousVersion" })
      )
    )

but this also fails. Am I doing something wrong or is this is a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant