Skip to content

Re-add @file:CompilerOpts annotation from 1.2 + bump to 1.4 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = 'com.github.holgerbrandl'
version = '1.3'
version = '1.4'

buildscript {
ext.kotlin_version = '1.1.60'
Expand Down Expand Up @@ -52,4 +52,4 @@ publishing {
artifactId = 'kscript-annotations'
}
}
}
}
17 changes: 10 additions & 7 deletions src/main/kotlin/ScriptDirectives.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ annotation class Include(val includePath: String)
annotation class KotlinOpts(val runOptions: String)


@Target(AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE)
@MustBeDocumented
@Repeatable
annotation class CompilerOpts(val kotlincFlags: String)


// MavenRepository and DependsOnMaven are supported "as it" for compatibility with jupyter notebooks.
// see https://github.com/kohesive/keplin/blob/master/keplin-maven-resolver/src/main/kotlin/uy/kohesive/keplin/kotlin/script/resolver/maven/MavenResolverAnnotations.kt
// example https://github.com/kohesive/keplin/blob/a307e05eae091c99c665fe3da52a428fb0e10a6a/keplin-maven-resolver/src/test/kotlin/uy/kohesive/keplin/kotlin/script/resolver/maven/TestMavenScriptDependencies.kt#L38
Expand All @@ -38,13 +45,6 @@ annotation class KotlinOpts(val runOptions: String)
@Repeatable
annotation class DependsOnMaven(val artifactLocator: String)

@Target(AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE)
@Repeatable
// in contrast to the original version we make the id mandatory here.
// This keeps ensures compatiblity with keplin but eases parsing
//annotation class MavenRepository(val id: String = "", val url: String)

/**
* Declare a maven repository that will be used by kscript to resolve dependencies
*
Expand All @@ -53,4 +53,7 @@ annotation class DependsOnMaven(val artifactLocator: String)
* @param user Optional user name
* @param password Optional password (required if user is defined)
*/
@Target(AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE)
@Repeatable
annotation class MavenRepository(val id: String, val url: String, val user: String = "", val password: String = "")