Skip to content

Commit ae3ae84

Browse files
aartiPlholgerbrandlvsajip
authored
Kscript 4.1 (#354)
* Cleanup of env variables * Fixed indentation and generation of Gradle files for IntelliJ * Re-enabled idea tests * Improved runConfiguration * Support for idea project creation: correct handling for duplicated file names. * IntelliJ support fixed * Formatting of wrapper for scripts. * Fix for OsType comparison logic (#357) * build: installation tester * build: update installer.yml * build: added ability to start GitHub action build manually. * bugfix: fix for OSTYPE linux-musl which is reported on Alpine Linux. * make KOTLIN_HOME required * feature: osHandler for operations outside of Java ecosystem * feature: added nicer debug information * refactor: split of config to smaller pieces * test: split building and cleaning (faster builds for most cases) * cleanup: overall cleanups * feature: Migrated kscript to os independent paths (OsPath) * feature: KScript seems to work on a plain Windows console. * Fix #335: Get --package working with Gradle 7 by replacing the capsule plugin (#370) * Fix #335: Remove the need for the Gradle capsule plugin. * Additional fixes for packaging (better cache support) * Improved Templates.kt * Added Kotlin integration tests for packaging and simple tests * Added suites for different OSes * Renamed MAC to MACOS constant. * Fixed error in StreamGobbler in ProcessRunner * Added empty source case handling * Better implementation of OsPath.leaf and OsPath.root * Added integration tests * Improved testing tools (matchers) * Cleanup, bug fixes and small improvements. * Removed old test suite in bash * Updated TestsReadme.md * Replace .kscript dir with OS-specific dirs (#323) (#374) * Refactoring to allow deprecation. * Deprecation of old features (annotations based on comments) * Deprecation report * Updated doc. Co-authored-by: holgerbrandl@gmail.com <holgerbrandl@users.noreply.github.com> Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk> Co-authored-by: meztihn <6940823+meztihn@users.noreply.github.com
1 parent 30f994b commit ae3ae84

File tree

120 files changed

+3872
-1630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+3872
-1630
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# https://techblog.dorogin.com/case-of-windows-line-ending-in-bash-script-7236f056abe
22
* text=auto
33
*.sh text eol=lf
4+
*.bat text eol=crlf
45

56

67
# Use linux file endings for kts scripts because some of them contain shebangs and are thus partially interpreted by bash
@@ -11,4 +12,3 @@
1112
kscript text eol=lf
1213
gradlew text eol=lf
1314
mydsl text eol=lf
14-

.github/workflows/build.yml

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,71 +14,98 @@ jobs:
1414
matrix:
1515
os:
1616
- ubuntu-20.04
17-
- macos-10.15
17+
- macos-12
1818
- windows-2022
19+
variant:
20+
- posix
21+
include:
22+
- os: windows-2022
23+
variant: cygwin
24+
- os: windows-2022
25+
variant: cmd
1926
runs-on: ${{ matrix.os }}
20-
timeout-minutes: 30
27+
timeout-minutes: 60
2128

2229
steps:
23-
- uses: actions/checkout@v2
24-
- uses: actions/setup-java@v3
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
33+
- name: Setup Java
34+
uses: actions/setup-java@v3
2535
with:
2636
distribution: 'zulu'
2737
java-version: '11'
28-
- uses: fwilhe2/setup-kotlin@main
38+
39+
- name: Setup Kotlin
40+
uses: fwilhe2/setup-kotlin@main
2941
with:
3042
version: 1.6.21
3143

44+
- name: Setup Gradle
45+
uses: gradle/gradle-build-action@v2
46+
with:
47+
gradle-version: wrapper
48+
3249
- name: Install dependencies for ${{ runner.os }}
3350
shell: bash
3451
run: |
3552
if [ "$RUNNER_OS" == "Windows" ]; then
3653
choco install zip
3754
# Overwrite the WSL bash.exe
38-
cp /c/msys64/usr/bin/bash.exe /c/Windows/System32/bash.exe
55+
# cp /c/msys64/usr/bin/bash.exe /c/Windows/System32/bash.exe
56+
mv /c/Windows/System32/bash.exe /c/Windows/System32/wsl-bash.exe
3957
fi
4058
41-
- name: Run tests
42-
timeout-minutes: 10
59+
- name: Run tests for Posix (and MSYS on Windows)
60+
if: matrix.variant == 'posix'
4361
shell: bash
4462
run: |
63+
# For Windows this action is running MSYS Os type
64+
4565
echo "OsType: $OSTYPE"
46-
export PATH=./build/libs:${PATH}
4766
48-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
67+
gradle clean assemble test || { echo 'Compilation or Unit tests failed' ; exit 1; }
68+
69+
if [[ "$OSTYPE" == "linux"* ]]; then
4970
echo "Linux test..."
50-
./test/test_suite.sh
71+
gradle -DosType=$OSTYPE -DincludeTags='posix | linux' integration
5172
elif [[ "$OSTYPE" == "darwin"* ]]; then
5273
echo "MacOs test..."
53-
./gradlew clean build
54-
echo "kscript path: $(which kscript)"
55-
kscript --help
56-
kscript -d "println(1+1)"
74+
gradle -DosType=$OSTYPE -DincludeTags='posix | macos' integration
5775
elif [[ "$OSTYPE" == "cygwin" ]]; then
5876
echo "Cygwin test..."
59-
./gradlew clean build
60-
echo "kscript path: $(which kscript)"
61-
kscript --help
62-
kscript -d "println(1+1)"
77+
gradle -DosType=$OSTYPE -DincludeTags='posix | cygwin' integration
6378
elif [[ "$OSTYPE" == "msys" ]]; then
6479
echo "MSys test..."
65-
./gradlew clean build
66-
echo "kscript path: $(which kscript)"
67-
kscript --help
68-
kscript -d "println(1+1)"
69-
elif [[ "$OSTYPE" == "win32" ]]; then
70-
echo "Windows test..."
71-
./gradlew clean build
72-
echo "kscript path: $(which kscript)"
73-
kscript --help
74-
kscript -d "println(1+1)"
80+
gradle -DosType=$OSTYPE -DincludeTags='posix | msys' integration
7581
elif [[ "$OSTYPE" == "freebsd"* ]]; then
7682
echo "FreeBsd test..."
77-
./gradlew clean build
78-
echo "kscript path: $(which kscript)"
79-
kscript --help
80-
kscript -d "println(1+1)"
83+
gradle -DosType=$OSTYPE -DincludeTags='posix' integration
8184
else
8285
echo "Unknown OS"
8386
exit 1
8487
fi
88+
89+
- name: Run tests specific for Windows (cmd shell)
90+
if: matrix.variant == 'cmd'
91+
shell: cmd
92+
run: |
93+
echo "Windows test..."
94+
gradle clean assemble test
95+
if %errorlevel% neq 0 exit /b %errorlevel%
96+
gradle -DosType=windows -DincludeTags="windows" integration
97+
98+
- name: Install Cygwin (only Windows)
99+
if: matrix.variant == 'cygwin'
100+
uses: egor-tensin/setup-cygwin@v3
101+
102+
- name: Run tests specific for Cygwin
103+
if: matrix.variant == 'cygwin'
104+
shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
105+
run: |
106+
echo $OSTYPE
107+
echo "Cygwin test..."
108+
echo "Changing directory to $GITHUB_WORKSPACE ..."
109+
cd $GITHUB_WORKSPACE
110+
gradle clean assemble test || { echo 'Compilation or Unit tests failed' ; exit 1; }
111+
gradle -DosType=$OSTYPE -DincludeTags='posix | cygwin' integration

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Created with https://github.com/marketplace/actions/create-a-release
22

3+
name: release
4+
35
on:
46
push:
57
# Sequence of patterns matched against refs/tags
@@ -8,12 +10,9 @@ on:
810
tags:
911
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
1012

11-
name: Create Release
12-
1313

1414
jobs:
1515
build:
16-
name: Create Release
1716
runs-on: ubuntu-latest
1817
steps:
1918
- name: Checkout code
@@ -38,4 +37,4 @@ jobs:
3837
body: |
3938
See [CHANGES.md](https://github.com/holgerbrandl/kscript/blob/master/NEWS.md) for new features, bug-fixes and changes.
4039
draft: false
41-
prerelease: false
40+
prerelease: false

NEWS.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changes
22

3-
## 4.1.0 - TO BE RELEASED
3+
## 4.1.0
44

55
Breaking changes
66

@@ -9,14 +9,30 @@ Breaking changes
99
KSCRIPT_IDEA_COMMAND -> KSCRIPT_COMMAND_IDEA
1010
KSCRIPT_GRADLE_COMMAND -> KSCRIPT_COMMAND_GRADLE
1111

12-
Major Enhancements
13-
14-
* Initial Windows support
15-
* Fix for resolution of dependencies
16-
17-
Minor Enhancements
18-
19-
## 4.0.2
12+
Enhancements
13+
14+
* Windows support and proper Cygwin and MSys support
15+
* File argument for specific OS should be in format of that OS (eg. Cygwin: kscript /cygdrive/c/file.kts)
16+
* Multiplatform tests for different OS-es using Github actions
17+
* Ability to use configuration file for kscript (thanks to [meztihn](https://github.com/meztihn))
18+
* kscript follows XDG Spec (Issue #323) (thanks to [meztihn](https://github.com/meztihn))
19+
* Packaging scripts works again (thanks to [Vsajip](https://github.com/vsajip))
20+
* When creating IntelliJ project 'gradle' and 'idea' do not have to be in path
21+
* Integration tests rewritten from bash to JUnit
22+
* Replacements for (current annotations are deprecated):
23+
* @MavenRepository -> @Repository
24+
* @KotlinOpts -> @KotlinOptions
25+
* @CompilerOpts -> @CompilerOptions
26+
* Deprecation of comment based annotations
27+
* Report for deprecated features (--report option)
28+
29+
Bugfixes
30+
* Fix for dependency resolution
31+
* Fix for creation of Gradle files and their indentation
32+
* Fix for handling potentially duplicated file names in Idea projects
33+
* Fix for Idea runtime configuration
34+
35+
## 4.0.x (last 4.0.3)
2036

2137
Released 2022-05-18
2238

0 commit comments

Comments
 (0)