Skip to content

Commit e35be0e

Browse files
committed
initial commit
0 parents  commit e35be0e

File tree

4 files changed

+202
-0
lines changed

4 files changed

+202
-0
lines changed

.gitignore

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Gradle template
3+
.gradle
4+
/build/
5+
6+
# Ignore Gradle GUI config
7+
gradle-app.setting
8+
9+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
10+
!gradle-wrapper.jar
11+
12+
# Cache of project
13+
.gradletasknamecache
14+
15+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
16+
# gradle/wrapper/gradle-wrapper.properties
17+
### Kotlin template
18+
# Compiled class file
19+
*.class
20+
21+
# Log file
22+
*.log
23+
24+
# BlueJ files
25+
*.ctxt
26+
27+
# Mobile Tools for Java (J2ME)
28+
.mtj.tmp/
29+
30+
# Package Files #
31+
*.jar
32+
*.war
33+
*.ear
34+
*.zip
35+
*.tar.gz
36+
*.rar
37+
38+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
39+
hs_err_pid*
40+
### JetBrains template
41+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
42+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
43+
44+
# User-specific stuff:
45+
.idea/**/workspace.xml
46+
.idea/**/tasks.xml
47+
.idea/dictionaries
48+
49+
# Sensitive or high-churn files:
50+
.idea/**/dataSources/
51+
.idea/**/dataSources.ids
52+
.idea/**/dataSources.xml
53+
.idea/**/dataSources.local.xml
54+
.idea/**/sqlDataSources.xml
55+
.idea/**/dynamic.xml
56+
.idea/**/uiDesigner.xml
57+
58+
# Gradle:
59+
.idea/**/gradle.xml
60+
.idea/**/libraries
61+
62+
# CMake
63+
cmake-build-debug/
64+
65+
# Mongo Explorer plugin:
66+
.idea/**/mongoSettings.xml
67+
68+
## File-based project format:
69+
*.iws
70+
71+
## Plugin-specific files:
72+
73+
# IntelliJ
74+
out/
75+
76+
# mpeltonen/sbt-idea plugin
77+
.idea_modules/
78+
79+
# JIRA plugin
80+
atlassian-ide-plugin.xml
81+
82+
# Cursive Clojure plugin
83+
.idea/replstate.xml
84+
85+
# Crashlytics plugin (for Android Studio and IntelliJ)
86+
com_crashlytics_export_strings.xml
87+
crashlytics.properties
88+
crashlytics-build.properties
89+
fabric.properties
90+

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Annotation directives for `kscript`
2+
3+
For details see https://github.com/holgerbrandl/kscript
4+
5+
Example
6+
7+
```kotlin
8+
#!/usr/bin/env kscript
9+
10+
@file:DependsOn("de.mpicbg.scicomp:kutils:0.4")
11+
@file:DependsOn("com.beust:klaxon:0.24", "com.github.kittinunf.fuel:fuel:1.3.1")
12+
13+
14+
@file:Include("util.kt")
15+
16+
@file:EntryPoint("Foo.bar") // applies on for kt-files
17+
18+
// define kotlin options
19+
@file:KotlinOpts("-J-Xmx5g")
20+
@file:KotlinOpts("-J-server")
21+
22+
23+
print("1+1")
24+
25+
26+
```

build.gradle

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
kotlin_version = '1.1.4'
2+
3+
group = 'com.github.holgerbrandl'
4+
version = '1.0'
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
buildscript {
11+
ext.kotlin_version = '1.1.2'
12+
13+
repositories {
14+
mavenCentral()
15+
}
16+
dependencies {
17+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18+
}
19+
}
20+
21+
apply plugin: 'java'
22+
apply plugin: 'kotlin'
23+
apply plugin: 'maven-publish'
24+
25+
repositories {
26+
jcenter()
27+
}
28+
29+
task sourcesJar(type: Jar, dependsOn: classes) {
30+
classifier = 'sources'
31+
from sourceSets.main.allSource
32+
}
33+
34+
task javadocJar(type: Jar, dependsOn: javadoc) {
35+
classifier = 'javadoc'
36+
from javadoc.destinationDir
37+
}
38+
39+
artifacts {
40+
archives sourcesJar
41+
archives javadocJar
42+
}
43+
44+
45+
46+
publishing {
47+
publications {
48+
maven(MavenPublication) {
49+
from components.java
50+
artifact sourcesJar { classifier "sources" }
51+
52+
artifactId = 'kscript-annotations'
53+
}
54+
}
55+
}

src/main/kotlin/ScriptDirectives.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
2+
@Retention(AnnotationRetention.SOURCE)
3+
@MustBeDocumented
4+
@Repeatable
5+
annotation class DependsOn(vararg val args: String)
6+
7+
// add repo to annotation
8+
//annotation class DependsOn(vararg val args : String, val from = "jcenter")
9+
10+
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
11+
@Retention(AnnotationRetention.SOURCE)
12+
@MustBeDocumented
13+
annotation class EntryPoint(val value: String)
14+
15+
16+
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
17+
@Retention(AnnotationRetention.SOURCE)
18+
@MustBeDocumented
19+
@Repeatable
20+
annotation class Include(val includePath: String)
21+
22+
23+
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
24+
@Retention(AnnotationRetention.SOURCE)
25+
@MustBeDocumented
26+
@Repeatable
27+
annotation class KotlinOpts(val runOptions: String)
28+
29+
30+
31+

0 commit comments

Comments
 (0)