Skip to content

Commit 17b86b8

Browse files
committed
Added @DependsOnMaven and @mavenrepository
1 parent e35be0e commit 17b86b8

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/main/kotlin/ScriptDirectives.kt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,48 @@
1-
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
1+
@Target(AnnotationTarget.FILE)
22
@Retention(AnnotationRetention.SOURCE)
33
@MustBeDocumented
44
@Repeatable
5-
annotation class DependsOn(vararg val args: String)
5+
annotation class DependsOn(vararg val artifactLocators: String)
66

77
// add repo to annotation
88
//annotation class DependsOn(vararg val args : String, val from = "jcenter")
99

10-
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
10+
@Target(AnnotationTarget.FILE)
1111
@Retention(AnnotationRetention.SOURCE)
1212
@MustBeDocumented
1313
annotation class EntryPoint(val value: String)
1414

1515

16-
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
16+
@Target(AnnotationTarget.FILE)
1717
@Retention(AnnotationRetention.SOURCE)
1818
@MustBeDocumented
1919
@Repeatable
2020
annotation class Include(val includePath: String)
2121

2222

23-
@Target(allowedTargets = *arrayOf(AnnotationTarget.FILE))
23+
@Target(AnnotationTarget.FILE)
2424
@Retention(AnnotationRetention.SOURCE)
2525
@MustBeDocumented
2626
@Repeatable
2727
annotation class KotlinOpts(val runOptions: String)
2828

2929

30+
// MavenRepository and DependsOnMaven are supported "as it" for compatibility with jupyter notebooks.
31+
// see https://github.com/kohesive/keplin/blob/master/keplin-maven-resolver/src/main/kotlin/uy/kohesive/keplin/kotlin/script/resolver/maven/MavenResolverAnnotations.kt
32+
// example https://github.com/kohesive/keplin/blob/a307e05eae091c99c665fe3da52a428fb0e10a6a/keplin-maven-resolver/src/test/kotlin/uy/kohesive/keplin/kotlin/script/resolver/maven/TestMavenScriptDependencies.kt#L38
3033

3134

35+
// note: in contrasts to DependsOn DependsOnMaven just supports a single artifact argument
36+
@Target(AnnotationTarget.FILE)
37+
@Retention(AnnotationRetention.SOURCE)
38+
@Repeatable
39+
annotation class DependsOnMaven(val artifactLocator: String)
40+
41+
@Target(AnnotationTarget.FILE)
42+
@Retention(AnnotationRetention.SOURCE)
43+
@Repeatable
44+
// in contrast to the original version we make the id mandatory here.
45+
// This keeps ensures compatiblity with keplin but eases parsing
46+
//annotation class MavenRepository(val id: String = "", val url: String)
47+
annotation class MavenRepository(val id: String, val url: String)
48+

0 commit comments

Comments
 (0)