Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ build/
target/
out/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

.*jar
*.iml
.idea

Expand Down
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ install:
- sdk install kotlin
- sdk install gradle

## install assert.h
- wget https://raw.github.com/lehmannro/assert.sh/v1.1/assert.sh && chmod +x assert.sh

- export KSCRIPT_HOME="/home/travis/build/holgerbrandl/kscript"
- export KSCRIPT_BUILD_LIBS="$KSCRIPT_HOME/build/libs"
- pwd
- export PATH=$KSCRIPT_HOME::$PATH
- export PATH=$KSCRIPT_BUILD_LIBS::$PATH

# build it
- cd $KSCRIPT_HOME && ./gradlew shadowJar
- cd $KSCRIPT_HOME && ./gradlew assemble
- cd $KSCRIPT_BUILD_LIBS

## install assert.h
- wget https://raw.github.com/lehmannro/assert.sh/v1.1/assert.sh && chmod +x assert.sh

- which kscript
- which assert.sh
Expand All @@ -67,6 +68,7 @@ install:
- kscript ${KSCRIPT_HOME}/test/resources/multi_line_deps.kts
# - resdeps.kts org.org.docopt:org.docopt:0.6.0-SNAPSHOT log4j:log4j:1.2.14
# - kscript ${KSCRIPT_HOME}/test/resources/multi_line_deps.kts
- cd $KSCRIPT_HOME

script: ./test/test_suite.sh

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ brew install holgerbrandl/tap/kscript

To build `kscript` yourself, simply clone the repo and do
```bash
./gradlew shadowJar
./gradlew assemble

## Don't forget to prefix with `./` when running the freshly compiled version
./kscript
## Run kscript from output dir
./build/libs/kscript
```

## Script Input Modes
Expand Down
49 changes: 0 additions & 49 deletions build.gradle

This file was deleted.

41 changes: 41 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
kotlin("jvm") version "1.2.30"
id("com.github.johnrengelman.plugin-shadow") version "2.0.2"
}

group = "com.github.holgerbrandl.kscript.launcher"

dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-stdlib")

compile("com.offbytwo:docopt:0.6.0.20150202")

testCompile("junit:junit:4.12")
testCompile( "io.kotlintest:kotlintest:2.0.7")
}

repositories {
jcenter()
}

val shadowJar by tasks.getting(ShadowJar::class) {
// set empty string to classifier and version to get predictable jar file name: build/libs/kscript.jar
archiveName = "kscript.jar"
doLast {
copy {
from(File(projectDir, "src/kscript"))
into(archivePath.parentFile)
}
}
}

// Disable standard jar task to avoid building non-shadow jars
val jar by tasks.getting {
enabled = false
}
// Build shadowJar when
val assemble by tasks.getting {
dependsOn(shadowJar)
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
2 changes: 1 addition & 1 deletion misc/benchmarking/benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ misc/benchmarking/benchmark_kscript.kts scriptlet_runtimes_$(git rev-parse --abb

## roll back to master and redo the benchmarking
git checkout master
./gradlew clean shadowJar
./gradlew clean assemble

misc/benchmarking/benchmark_kscript.kts scriptlet_runtimes_$(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD).txt

Expand Down
2 changes: 1 addition & 1 deletion misc/docker_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker attach `docker ps -q -l` # reattach the terminal & stdin
cd kscript
export KSCRIPT_HOME=$(pwd)

./gradlew shadowJar
./gradlew assemble

wget https://raw.githubusercontent.com/lehmannro/assert.sh/master/assert.sh
chmod u+x assert.sh
Expand Down
10 changes: 6 additions & 4 deletions misc/kscript_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# 3. Push and wait for travis CI results

export KSCRIPT_HOME="/Users/brandl/projects/kotlin/kscript";
export KSCRIPT_BUILD_LIBS="$KSCRIPT_HOME/build/libs";
export PATH=${KSCRIPT_HOME}:${PATH}
export PATH=~/go/bin/:$PATH

Expand All @@ -24,12 +25,12 @@ echo "new version is $kscript_version"

cd $KSCRIPT_HOME

./gradlew clean shadowJar
./gradlew clean assemble

## compile binary distribution (including jar and wrapper-script)
mkdir -p $KSCRIPT_ARCHIVE/kscript-${kscript_version}/bin
cp ${KSCRIPT_HOME}/kscript ${KSCRIPT_ARCHIVE}/kscript-${kscript_version}/bin
cp ${KSCRIPT_HOME}/kscript.jar ${KSCRIPT_ARCHIVE}/kscript-${kscript_version}/bin/kscript.jar
cp ${KSCRIPT_BUILD_LIBS}/kscript ${KSCRIPT_ARCHIVE}/kscript-${kscript_version}/bin
cp ${KSCRIPT_BUILD_LIBS}/kscript.jar ${KSCRIPT_ARCHIVE}/kscript-${kscript_version}/bin/kscript.jar

cd ${KSCRIPT_ARCHIVE}
rm ${KSCRIPT_ARCHIVE}/kscript-${kscript_version}.zip
Expand All @@ -42,7 +43,8 @@ open ${KSCRIPT_ARCHIVE}
#Java SE 6.0 = 50 (0x32 hex) (from https://en.wikipedia.org/wiki/Java_class_file)
#Default is 50, see https://kotlinlang.org/docs/reference/using-gradle.html#attributes-common-for-jvm-and-js
## to insepct do
#./gradlew clean shadowJar && cp build/libs/kscript-0.1-SNAPSHOT-all.jar kscript.jar
#./gradlew clean assemble
#cd ${KSCRIPT_BUILD_LIBS}
#rm -rf kscript_target_test
#cp -f kscript.jar kscript_target_test.zip
#unzip kscript_target_test.zip -d kscript_target_test
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/main/kotlin/kscript/app/ResolveIncludes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ internal fun extractIncludeTarget(incDirective: String) = when {
* Usage Example:
* ```
* cd $KSCRIPT_HOME
* ./gradlew shadowJar
* resolve_inc() { kotlin -classpath build/libs/kscript-0.1-SNAPSHOT-all.jar kscript.app.ResolveIncludes "$@";}
* ./gradlew assemble
* resolve_inc() { kotlin -classpath build/libs/kscript.jar kscript.app.ResolveIncludes "$@";}
* resolve_inc /Users/brandl/projects/kotlin/kscript/test/resources/includes/include_variations.kts
* cat $(resolve_inc /Users/brandl/projects/kotlin/kscript/test/resources/includes/include_variations.kts 2>&1)
* ```
Expand Down
2 changes: 1 addition & 1 deletion test/TestsReadme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ which assert.sh || exit 1
cd ${KSCRIPT_HOME}

## build it
./gradlew shadowJar
./gradlew assemble


## clean up the environment
Expand Down
4 changes: 2 additions & 2 deletions test/test_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ assert_end environment_tests
## dependency_lookup

# export KSCRIPT_HOME="/Users/brandl/projects/kotlin/kscript"; export PATH=${KSCRIPT_HOME}:${PATH}
resolve_deps() { kotlin -classpath kscript.jar kscript.app.DependencyUtil "$@";}
resolve_deps() { kotlin -classpath ${KSCRIPT_BUILD_LIBS}/kscript.jar kscript.app.DependencyUtil "$@";}
export -f resolve_deps


Expand Down Expand Up @@ -240,7 +240,7 @@ assert 'kscript "println(args.size)" "foo bar"' 1 ## allow for spaces
assert 'kscript "println(args[0])" "foo bar"' "foo bar" ## make sure quotes are not propagated into args


kscript_nocall() { kotlin -classpath kscript.jar kscript.app.KscriptKt "$@";}
kscript_nocall() { kotlin -classpath ${KSCRIPT_BUILD_LIBS}/kscript.jar kscript.app.KscriptKt "$@";}
export -f kscript_nocall

## temp projects with include symlinks
Expand Down