You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: can @file:Include be declared in an included file? #149
My utils.kt start getting big and I thought about splitting it.
I am not sure if that is possible and how (I used this util from couple of scripts)
is the @file:Include can be in the utils.kt itself? What about cyclic dependencies, will that work?
Or maybe I should move to develop a module and use it instead?
See this PR: #151
I created junit test (not shell), as you can see there was a problem with the same include twice in 2 files.
I am not sure about how relative path works? Is it always from the kts file? If this is true I guess it limits the scale of imports etc'
Yes relative paths should be resolved using the including script as "baseline" directory.
So if the kscriptlet is including utils/foo.kts and foo.kts is including ./bar.kts, the latter is expected to be sitting under utils. I'd think that the tests cover this to a certain extent already.
I commented on the PR, but once we clarified it, we can merge it in.
Activity
oshai commentedon Aug 15, 2018
I think modules suggestion also related to #127
holgerbrandl commentedon Aug 17, 2018
I guess so, see https://github.com/holgerbrandl/kscript/blob/018c63a62e14a3afb4a66f18019756540f2ba448/src/
main/kotlin/kscript/app/ResolveIncludes.kt#L30
If it does not work, could you maybe submit a unit-test/example as a PR. We don't test it at all currently (see https://github.com/holgerbrandl/kscript/blob/ca8668963e319f55c15b62c67a759eafdbf05235/test/test_suite.sh#L247)
See also #133
oshai commentedon Aug 19, 2018
See this PR: #151
I created junit test (not shell), as you can see there was a problem with the same include twice in 2 files.
I am not sure about how relative path works? Is it always from the
ktsfile? If this is true I guess it limits the scale of imports etc'holgerbrandl commentedon Aug 20, 2018
Yes relative paths should be resolved using the including script as "baseline" directory.
So if the kscriptlet is including
utils/foo.ktsandfoo.ktsis including./bar.kts, the latter is expected to be sitting underutils. I'd think that the tests cover this to a certain extent already.I commented on the PR, but once we clarified it, we can merge it in.
oshai commentedon Aug 20, 2018
Thanks, I don't see any comment on the PR for some reason.
holgerbrandl commentedon Aug 20, 2018
See directly under #151
I've tried to used the code review feature of github, but maybe not correctly.
oshai commentedon Aug 20, 2018
Maybe you didn't submit it, because I still don't see comment there.
holgerbrandl commentedon Aug 20, 2018
So true. Now it should be better.
oshai commentedon Aug 20, 2018
Thanks!