Skip to content

Commit ce4d191

Browse files
committed
* Added @file:Import() directive
* Deprecated Include, KotlinOpts, CompilerOpts, DependsOnMaven, MavenRepository * Added replacement annotations * Updated Gradle version and library group
1 parent 6ef4cf6 commit ce4d191

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

src/main/kotlin/ScriptDirectives.kt

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@Retention(AnnotationRetention.SOURCE)
55
@MustBeDocumented
66
@Repeatable
7-
annotation class DependsOn(vararg val artifactLocators: String)
7+
annotation class DependsOn(vararg val artifactCoordinates: String)
88

99
@Target(AnnotationTarget.FILE)
1010
@Retention(AnnotationRetention.SOURCE)
@@ -15,43 +15,58 @@ annotation class EntryPoint(val value: String)
1515
@Retention(AnnotationRetention.SOURCE)
1616
@MustBeDocumented
1717
@Repeatable
18-
annotation class Include(val includePath: String)
18+
@Deprecated(
19+
"@file:Include(paths) is deprecated in favor of @file:Import()",
20+
ReplaceWith("@file:Import(paths)"),
21+
DeprecationLevel.WARNING
22+
)
23+
annotation class Include(vararg val paths: String)
1924

2025
@Target(AnnotationTarget.FILE)
2126
@Retention(AnnotationRetention.SOURCE)
2227
@MustBeDocumented
2328
@Repeatable
24-
annotation class Import(val includePath: String)
29+
annotation class Import(vararg val paths: String)
2530

2631
@Target(AnnotationTarget.FILE)
2732
@Retention(AnnotationRetention.SOURCE)
2833
@MustBeDocumented
2934
@Repeatable
30-
annotation class KotlinOpts(val runOptions: String)
35+
@Deprecated(
36+
"@file:KotlinOpts(options) is deprecated in favor of @file:KotlinOptions()",
37+
ReplaceWith("@file:KotlinOptions(options)"),
38+
DeprecationLevel.WARNING
39+
)
40+
annotation class KotlinOpts(vararg val options: String)
3141

3242
@Target(AnnotationTarget.FILE)
3343
@Retention(AnnotationRetention.SOURCE)
3444
@MustBeDocumented
3545
@Repeatable
36-
annotation class KotlinOptions(val runOptions: String)
46+
annotation class KotlinOptions(vararg val options: String)
3747

3848
@Target(AnnotationTarget.FILE)
3949
@Retention(AnnotationRetention.SOURCE)
4050
@MustBeDocumented
4151
@Repeatable
42-
annotation class CompilerOpts(val kotlincFlags: String)
52+
@Deprecated(
53+
"@file:CompilerOpts(options) is deprecated in favor of @file:CompilerOptions()",
54+
ReplaceWith("@file:CompilerOptions(options)"),
55+
DeprecationLevel.WARNING
56+
)
57+
annotation class CompilerOpts(vararg val options: String)
4358

4459
@Target(AnnotationTarget.FILE)
4560
@Retention(AnnotationRetention.SOURCE)
4661
@MustBeDocumented
4762
@Repeatable
48-
annotation class CompilerOptions(val kotlincFlags: String)
63+
annotation class CompilerOptions(vararg val options: String)
4964

5065
@Target(AnnotationTarget.FILE)
5166
@Retention(AnnotationRetention.SOURCE)
5267
@MustBeDocumented
5368
@Repeatable
54-
annotation class Repository(val url: String)
69+
annotation class Repository(val url: String, val user: String = "", val password: String = "")
5570

5671
// MavenRepository and DependsOnMaven are supported "as it" for compatibility with jupyter notebooks.
5772
// see https://github.com/kohesive/keplin/blob/master/keplin-maven-resolver/src/main/kotlin/uy/kohesive/keplin/kotlin/script/resolver/maven/MavenResolverAnnotations.kt
@@ -61,9 +76,19 @@ annotation class Repository(val url: String)
6176
@Target(AnnotationTarget.FILE)
6277
@Retention(AnnotationRetention.SOURCE)
6378
@Repeatable
64-
annotation class DependsOnMaven(val artifactLocator: String)
79+
@Deprecated(
80+
"@file:DependsOnMaven(artifactCoordinates) is deprecated in favor of @file:DependsOn()",
81+
ReplaceWith("@file:DependsOn(artifactCoordinates)"),
82+
DeprecationLevel.WARNING
83+
)
84+
annotation class DependsOnMaven(val artifactCoordinates: String)
6585

6686
@Target(AnnotationTarget.FILE)
6787
@Retention(AnnotationRetention.SOURCE)
6888
@Repeatable
89+
@Deprecated(
90+
"@file:MavenRepository(id, url, user, password) is deprecated in favor of @file:Repository()",
91+
ReplaceWith("@file:Repository(url, user, password)"),
92+
DeprecationLevel.WARNING
93+
)
6994
annotation class MavenRepository(val id: String, val url: String, val user: String = "", val password: String = "")

0 commit comments

Comments
 (0)