diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9695d381..480430f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,5 @@ name: build -# https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/adding-a-workflow-status-badge - on: push: branches: [ master ] @@ -11,6 +9,7 @@ on: jobs: build: strategy: + fail-fast: false matrix: os: - ubuntu-20.04 @@ -18,19 +17,16 @@ jobs: - windows-2022 runs-on: ${{ matrix.os }} timeout-minutes: 30 -# defaults: -# run: -# shell: bash -# working-directory: $GITHUB_WORKSPACE steps: - uses: actions/checkout@v2 - # https://stackoverflow.com/questions/56726429/how-to-run-multiple-commands-in-one-github-actions-docker - - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - uses: actions/setup-java@v3 with: - java-version: 11 + distribution: 'zulu' + java-version: '11' + - uses: fwilhe2/setup-kotlin@main + with: + version: 1.6.21 - name: Install dependencies for ${{ runner.os }} shell: bash @@ -41,75 +37,10 @@ jobs: cp /c/msys64/usr/bin/bash.exe /c/Windows/System32/bash.exe fi -# - name: Update system dependencies -# run: | -# sudo apt-get update -# sudo apt-get install -y curl unzip zip wget - - - name: Install sdkman - shell: bash - run: | - bash -c "curl -s "https://get.sdkman.io" | bash" - source "$HOME/.sdkman/bin/sdkman-init.sh" - - - name: Install kotlin - shell: bash - run: | - source "$HOME/.sdkman/bin/sdkman-init.sh" - sdk install kotlin 1.4.31 - - - name: Install gradle - shell: bash - run: | - source "$HOME/.sdkman/bin/sdkman-init.sh" - sdk install gradle 6.7 - - - # https://stackoverflow.com/questions/50104666/gradle-difference-between-test-and-check - - name: Build and test with Gradle -# working-directory: $GITHUB_WORKSPACE - shell: bash - run: | - echo $GITHUB_WORKSPACE - chmod +x gradlew - ./gradlew clean check --stacktrace --info - - - - name: Build kscript - run: ./gradlew assemble - - - name: Install assert.sh - shell: bash - run: | - curl -sLO https://raw.github.com/lehmannro/assert.sh/v1.1/assert.sh - chmod +x assert.sh - - # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path - - name: Update PATH to include kscript - shell: bash - run: echo "${GITHUB_WORKSPACE}/build/libs" >> $GITHUB_PATH - - - run: which kscript - shell: bash - - - name: Print --version - shell: bash - run: | - source "$HOME/.sdkman/bin/sdkman-init.sh" - kscript --version - - - name: Create mock idea executable - shell: bash - run: | - touch idea - chmod +x idea - echo "${PWD}" >> $GITHUB_PATH - - name: Run tests timeout-minutes: 10 shell: bash if: ${{ runner.os != 'Windows' }} run: | - source "$HOME/.sdkman/bin/sdkman-init.sh" export KSCRIPT_HOME="$GITHUB_WORKSPACE" ./test/test_suite.sh diff --git a/NEWS.md b/NEWS.md index ede88495..74342f4e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,135 +2,158 @@ ## 4.0.0 -Rewrite by https://github.com/aartiPl +Rewrite by https://github.com/aartiPl Functionality: - * Recursive inclusion of dependant scripts without hardcoded limits + +* Recursive inclusion of dependant scripts without hardcoded limits Improved test_suite.sh - * Automatic setting up of test environment (assert.sh, test directories) - * Automatic compilation - * idea - script to help to test idea use cases - * Script setup_environment.sh can be used for local testing - * Some script tests moved to Unit Tests - * Ability to start test suites by name + +* Automatic setting up of test environment (assert.sh, test directories) +* Automatic compilation +* idea - script to help to test idea use cases +* Script setup_environment.sh can be used for local testing +* Some script tests moved to Unit Tests +* Ability to start test suites by name Improved Unit Tests + * Several new Unit tests * New Unit Tests can be created much easier (Major point why modularization makes sense) Improved Logging + * Silent mode / Development mode logging Modularisation of source code + * Removed duplication * Code divided in logical pieces and moved to packages * Script resolution creates immutable objects Build script -* Updated Gradle to version 7.3 and shadowJar to 6.1.0 + +* Updated Gradle to version 7.4.3 and shadowJar to 7.1.2 * Fixes in build file Performance + * Much less IO operations - that should contribute to better performance - + Misc -* Updated Kotlin to 1.5.31, but only for compiler, not kotlin-scripting. It's far from optimal, but it is not possible to move fully to Kotlin 1.5 or even 1.6, because of the issues with resolution of artifacts in latest kotlin-scripting. I have put report here: https://youtrack.jetbrains.com/issue/KT-49511 + +* Updated Kotlin to 1.5.31, but only for compiler, not kotlin-scripting. It's far from optimal, but it is not possible + to move fully to Kotlin 1.5 or even 1.6, because of the issues with resolution of artifacts in latest + kotlin-scripting. I have put report here: https://youtrack.jetbrains.com/issue/KT-49511 * Fixed a lot of IDE warnings in code * Packaging - gradle file converted to Kotlin; still does not work, but it was like that before anyway -* Changes for kscript dir allow simple implementation of config file if needed. (.kscript/kscript.config); Not implemented by me, but might be useful e.g. for storing preambles +* Changes for kscript dir allow simple implementation of config file if needed. (.kscript/kscript.config); Not + implemented by me, but might be useful e.g. for storing preambles INCOMPATIBLE CHANGES: + * In annotations the only allowed delimiter is coma "," (to allow options with arguments, separated by space) -* Resolution of env variables is more restrictive - only vars expected by kscript can be resolved (for security - it's not good to include arbitrary strings from user env into the script) +* Resolution of env variables is more restrictive - only vars expected by kscript can be resolved (for security - it's + not good to include arbitrary strings from user env into the script) * Reworked caching mechanism -## 3.2 +## 3.2 Not released - incorporated in 4.0 Major changes & enhancements -* Improved for relative script inclusions (Thanks to PR by **aartiPI** [#330](https://github.com/holgerbrandl/kscript/pull/330)) -* Fixed bootstrap header support ([#324](https://github.com/holgerbrandl/kscript/issues/324)) +* Improved for relative script inclusions (Thanks to PR by ** + aartiPI** [#330](https://github.com/holgerbrandl/kscript/pull/330)) +* Fixed bootstrap header support ([#324](https://github.com/holgerbrandl/kscript/issues/324)) ## 3.1 Major changes & enhancements -* Removed jcenter as default dependency repository -* Updated tests and build integration to function without jcenter +* Removed jcenter as default dependency repository +* Updated tests and build integration to function without jcenter ## 3.0 Major Enhancements -* New dependency resolver based on [kotlin-scripting](https://kotlinlang.org/docs/reference/whatsnew14.html#scripting-and-repl) + +* New dependency resolver based + on [kotlin-scripting](https://kotlinlang.org/docs/reference/whatsnew14.html#scripting-and-repl) * Java11 support (fixes #239) Minor improvements + * Forward jvm target to --idea generated build.gradle.kts (#258) * Add maven repo credentials to build.gradle.kts generated by --idea (#262) -* Add option to launch temp intellij as custom command through env property (#264). E.g on ubuntu we could use `export KSCRIPT_IDEA_COMMAND=/snap/bin/intellij-idea-ultimate` to enable `kscript --idea ` +* Add option to launch temp intellij as custom command through env property (#264). E.g on ubuntu we could + use `export KSCRIPT_IDEA_COMMAND=/snap/bin/intellij-idea-ultimate` to enable `kscript --idea ` * Fixed idea project symlinks for complex projects (#268) * Fixed bootstrap script env variable issue (#271) * Fixed parsing of named arguments in @MavenRepository (fixes #274) * Added executable docker container to release plan (fixes #224) * Updated Kotlin to 1.4.10 (#283) * Updated gradle in temporary projects to 6.7 (#282) -* Add Kotlin run configuration for .kt based scripts. (#284) +* Add Kotlin run configuration for .kt based scripts. (#284) * Use absolute paths to avoid issues with relative paths and relativize (#285) Incompatible API changes -* Pom dependencies must be now declared as `org.javamoney:moneta:pom:1.3` (and no longer as `org.javamoney:moneta:1.3@pom`) + +* Pom dependencies must be now declared as `org.javamoney:moneta:pom:1.3` (and no longer + as `org.javamoney:moneta:1.3@pom`) * Dynamic version dependencies must be now declared as `log4j:log4j:[1.2,)` (and no longer as `log4j:log4j:1.2+`) ## 2.9 - Support environment variables in repository credentials ([#248](https://github.com/holgerbrandl/kscript/issues/159)) + * Make INCLUDE directive files relative to script dir * Create a default Run Configuration for Idea ([#244](https://github.com/holgerbrandl/kscript/issues/159)) Minor enhancements & fixes: + * Support whitespace around maven repo credentials (fixes [#228](https://github.com/holgerbrandl/kscript/issues/159)) * Make INCLUDE directive files relative to script dir * Fixed support for gitbash * Fixed bootstrap header ([#234](https://github.com/holgerbrandl/kscript/issues/159)) * Improved and documented basic testing support ([#247](https://github.com/holgerbrandl/kscript/issues/159)) - ## 2.8 Improvements & Fixes -* [#214](https://github.com/holgerbrandl/kscript/pull/214) Added credentials support for `@file:MavenRepository` annotation (thanks to [@meonlol](https://github.com/meonlol) - for providing the PR and his patience) +* [#214](https://github.com/holgerbrandl/kscript/pull/214) Added credentials support for `@file:MavenRepository` + annotation (thanks to [@meonlol](https://github.com/meonlol) + for providing the PR and his patience) ## 2.7 Improvements & Fixes + * [#159](https://github.com/holgerbrandl/kscript/issues/159) Use aether instead of maven to pull dependencies * [#210](https://github.com/holgerbrandl/kscript/issues/210): Updated gradle capsule plugin * [#102](https://github.com/holgerbrandl/kscript/issues/102): Removed `--self-update` * Use resource from repo for resolve boostrap header * [#203](https://github.com/holgerbrandl/kscript/issues/203): Fix cache check bug on Windows -* [#199](https://github.com/holgerbrandl/kscript/issues/199): Allow to bootstrap kscript installation with `--add-bootstrap-header` +* [#199](https://github.com/holgerbrandl/kscript/issues/199): Allow to bootstrap kscript installation + with `--add-bootstrap-header` * [#200](https://github.com/holgerbrandl/kscript/issues/200): Expose script file name to script - ## v2.6 - Major Improvements * [#166](https://github.com/holgerbrandl/kscript/issues/166): Support dynamic versions ending with `+` * [#185](https://github.com/holgerbrandl/kscript/issues/185): Support "~" in INCLUDE () * [#187](https://github.com/holgerbrandl/kscript/issues/187): Added support for shortened URLs -* [#146](https://github.com/holgerbrandl/kscript/issues/146): Allow kscript cache directory to be configurable via `KSCRIPT_CACHE_DIR` environment variable +* [#146](https://github.com/holgerbrandl/kscript/issues/146): Allow kscript cache directory to be configurable + via `KSCRIPT_CACHE_DIR` environment variable * [#175](https://github.com/holgerbrandl/kscript/issues/175): `cygwin` support improvements * Improved `kshell` launcher to also launch scripts with invalid code Notable Bug Fixes + * Confusing error when filename starts with a number * Fixed usage `@file:CompilerOpts` in combination with `@file:Include` * Renamed `kshell_from_kscript` to `kshell_kts` @@ -151,12 +174,14 @@ Minor Enhancements * Allow to include same file from multiple files * Fixed: Space-containing argument propagation - ## v2.4 Major Enhancements: -* Allow to set `kotlinc` compiler flags with `@file:CompilerOpts` or `//COMPILER_OPTS` (#84). See [here](https://github.com/holgerbrandl/kscript#deploy-scripts-as-standalone-binaries). -* Provide a way to _package_ kscripts (#63). See [here](https://github.com/holgerbrandl/kscript#configure-the-runtime--with-kotlin_opts). + +* Allow to set `kotlinc` compiler flags with `@file:CompilerOpts` or `//COMPILER_OPTS` (#84). + See [here](https://github.com/holgerbrandl/kscript#deploy-scripts-as-standalone-binaries). +* Provide a way to _package_ kscripts (#63). + See [here](https://github.com/holgerbrandl/kscript#configure-the-runtime--with-kotlin_opts). Minor Enhancements: @@ -171,42 +196,46 @@ Minor Enhancements: * Simplify Gradle config for script bootstrapping with IDEA (#86) * Added Gradle wrapper to the project (#87 and #88) - ## v2.3 - Major Enhancements: * Replaced `javac` with `kotlinc` for faster script compilation * Added symlink support -* Allow to derive [custom DSL interpreters](https://github.com/holgerbrandl/kscript/blob/master/docs/user_guide.md#create-interpreters-for-custom-dsls) from kscript (fixes [#67](https://github.com/holgerbrandl/kscript/issues/67)) -* Implemented `@file:Include` and `@EntryPoint` as [documented](https://github.com/holgerbrandl/kscript#annotation-driven-script-configuration) in README (fixes [#73](https://github.com/holgerbrandl/kscript/issues/73)) +* Allow to + derive [custom DSL interpreters](https://github.com/holgerbrandl/kscript/blob/master/docs/user_guide.md#create-interpreters-for-custom-dsls) + from kscript (fixes [#67](https://github.com/holgerbrandl/kscript/issues/67)) +* Implemented `@file:Include` and `@EntryPoint` + as [documented](https://github.com/holgerbrandl/kscript#annotation-driven-script-configuration) in README ( + fixes [#73](https://github.com/holgerbrandl/kscript/issues/73)) * Added [gitter](https://gitter.im/holgerbrandl/kscript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) channel Minor Enhancements: -* Consolidate imports and dependencies when `//INCLUDE` is used (fixes [#75](https://github.com/holgerbrandl/kscript/pull/75)) … + +* Consolidate imports and dependencies when `//INCLUDE` is used ( + fixes [#75](https://github.com/holgerbrandl/kscript/pull/75)) … * Support artifact should have better namespace (fixes [#57](https://github.com/holgerbrandl/kscript/issues/57)) * Fixed [#76](https://github.com/holgerbrandl/kscript/issues/76): Unspecific error when dependency resolution fails * Fixed [#66](https://github.com/holgerbrandl/kscript/issues/66): It should die more gracefully if `idea` is not present * Fixed [#81](https://github.com/holgerbrandl/kscript/issues/81): Allow package declarations for scripts -* Fixed [#78](https://github.com/holgerbrandl/kscript/issues/78): When using `--idea` the script argument should be symlinked +* Fixed [#78](https://github.com/holgerbrandl/kscript/issues/78): When using `--idea` the script argument should be + symlinked * Fixed [#79](https://github.com/holgerbrandl/kscript/pull/79): Provide setup instructions if idea launcher is missing * Simplified build instructions (fixes [#60](https://github.com/holgerbrandl/kscript/issues/60)) * Document dependencies of kscript (fixes [#69](https://github.com/holgerbrandl/kscript/issues/69)) - ## v2.2 * Logging of maven artifact downloads to stderr (fixes [#23](https://github.com/holgerbrandl/kscript/issues/23)) * Added `-s` / `--silent` to suppress all logging -* Fixed [#55](https://github.com/holgerbrandl/kscript/issues/55): dependency resolution fails on travis ci and within docker containers -* Added alternative `@DependsOnMaven(val artifactId: String)` annotaiton to declare dependencies. This has been implemented to make kscripts compatible with https://github.com/ligee/kotlin-jupyter +* Fixed [#55](https://github.com/holgerbrandl/kscript/issues/55): dependency resolution fails on travis ci and within + docker containers +* Added alternative `@DependsOnMaven(val artifactId: String)` annotaiton to declare dependencies. This has been + implemented to make kscripts compatible with https://github.com/ligee/kotlin-jupyter * Added support for custom maven repositories (fixes [#22](https://github.com/holgerbrandl/kscript/issues/22)) - See [README.md](README.md) for usage details. - ## v2.1 * support for annotation-driven script configuration @@ -217,59 +246,67 @@ See [README.md](README.md) for usage details. * Reimplemented in kotlin (fixes [#36](https://github.com/holgerbrandl/kscript/issues/36)) * Added cygwin support (fixes [#39](https://github.com/holgerbrandl/kscript/issues/39)) * Added `//INCLUDE` directive (fixes [#34](https://github.com/holgerbrandl/kscript/issues/34) -* Fixed: interactive mode is not correctly started when using stdin as script argument ([#40](https://github.com/holgerbrandl/kscript/issues/40) +* Fixed: interactive mode is not correctly started when using stdin as script + argument ([#40](https://github.com/holgerbrandl/kscript/issues/40) * Fixed compatibility with java9 ([#41](https://github.com/holgerbrandl/kscript/issues/41)) - ## v1.5.1 * Fixed `--self-update` * More robust self-update on OSses with file-locking (e.g. windows) - - ## v1.5 * removed `curl` dependency * more streamlined dependency lookup - ## v1.4 Major new features -* Redesigned [support library](https://github.com/holgerbrandl/kscript-support-api) for streamlined tabular data processing. See [here](http://holgerbrandl.github.io/kotlin/2017/05/08/kscript_as_awk_substitute.html) for an overview. +* Redesigned [support library](https://github.com/holgerbrandl/kscript-support-api) for streamlined tabular data + processing. See [here](http://holgerbrandl.github.io/kotlin/2017/05/08/kscript_as_awk_substitute.html) for an + overview. ## v1.3 Major new features -* Dramatically reduced overhead by using dependency lookup cache more efficiently. After the initial scriptlet-jar-building, `kscript` runs with almost **zero overhead** now (fixes [#4](https://github.com/holgerbrandl/kscript/issues/4)) -* Dependencies can now declared in multiple lines for better readability (fixes [#2](https://github.com/holgerbrandl/kscript/issues/2)) +* Dramatically reduced overhead by using dependency lookup cache more efficiently. After the initial + scriptlet-jar-building, `kscript` runs with almost **zero overhead** now ( + fixes [#4](https://github.com/holgerbrandl/kscript/issues/4)) +* Dependencies can now declared in multiple lines for better readability ( + fixes [#2](https://github.com/holgerbrandl/kscript/issues/2)) * Automatic inclusion of support library for one-liners (fixes [#19](https://github.com/holgerbrandl/kscript/issues/19)) -* Direct script arguments `kscript 'println("hello kotlin")'` (fixes [#18](https://github.com/holgerbrandl/kscript/issues/18)) +* Direct script arguments `kscript 'println("hello kotlin")'` ( + fixes [#18](https://github.com/holgerbrandl/kscript/issues/18)) * More robust dependency resolution with more informative error messages - Support API improvements -* Kotlin DocOpt helpers to build CLIs ([example](https://github.com/holgerbrandl/kscript-support-api/blob/master/src/test/kotlin/kscript/test/DocOptTest.kt)) -* New [utilities](https://github.com/holgerbrandl/kscript-support-api/blob/master/src/main/kotlin/kscript/StreamUtil.kt) to automatically resolve arguments files and stdin to `Sequence`. -The `