jmfayard

    jmfayard

    6 months ago
    Is it possible to publish a 1.0-SNAPSHOT version of the library to mvaenLocal() and to use it then in a Kotlin script?
    Big Chungus

    Big Chungus

    6 months ago
    Can't see why not. It's just a maven lib at that point. Although I'm not sure if kscripts support local maven repo out of the box.
    You might need to declare it in a script with file😕/ protocol
    louiscad

    louiscad

    6 months ago
    So long as you run the script only locally, yes you can.
    Piotr Krzemiński

    Piotr Krzemiński

    6 months ago
    In theory you can build and publish the library to Maven Local within a GitHub workflow
    jmfayard

    jmfayard

    6 months ago
    My issue is that inside
    script-gennerator
    I have a test
    GenerateKotlinScripts
    who produces Kotlin code from YAML workflows. I have 3 possibilities, each with drawbacks: • I produce a script
    examples/my-script.kts
    from
    examples/my-script.yml
    with the latest published version, for example
    0.9.0
    of github-actions-dsl-kotlin. But then I can't use features that changed since the last published version • Same but I use a version
    1.0-SNAPSHOT
    with the maven repository
    /Users/xxx/.m2
    . But then the scripts aren't directly executable, you have to publish the library to maven local, maybe re-run the test. • Or I keep scripts inside
    script-generator/src/test/resources/GenerateKotlinScripts.kts
    , that's inside the resources folder, without
    @file:DependsOn()
    and
    #!/usr/bin/env kotlin
    , but then I can't execute the script
    Big Chungus

    Big Chungus

    6 months ago
    You could publish snapshot to your GH repo's packages for your own needs and pull from there.
    That's assuming you're OK with having to authenticate the repo and it being a public repo to get GH packages for free.
    OR create a free artifactory account and use that for public access https://jfrog.com/pricing/
    Piotr Krzemiński

    Piotr Krzemiński

    6 months ago
    Yet another idea, thinking outside the box (not solving the Maven Local problem at all): use a scripting host in the tests. Never done it myself, but what I imagine is that you could pass the Kotlin script string to it along with library in the classpath, the scripting engine would just compile and run it, and you could assert any side effects in the test. At least I'd try with this approach if I were writing such tests