Skip to content

Question: can @file:Include be declared in an included file? #149

Closed

Description

@oshai

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?

Activity

  1. oshai commented on Aug 15, 2018

    @oshai
    ContributorAuthor

    I think modules suggestion also related to #127

  2. holgerbrandl commented on Aug 17, 2018

    @holgerbrandl
    Collaborator

    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

  3. oshai commented on Aug 19, 2018

    @oshai
    ContributorAuthor

    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'

  4. holgerbrandl commented on Aug 20, 2018

    @holgerbrandl
    Collaborator

    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.

  5. oshai commented on Aug 20, 2018

    @oshai
    ContributorAuthor

    Thanks, I don't see any comment on the PR for some reason.

  6. holgerbrandl commented on Aug 20, 2018

    @holgerbrandl
    Collaborator

    See directly under #151
    I've tried to used the code review feature of github, but maybe not correctly.

  7. oshai commented on Aug 20, 2018

    @oshai
    ContributorAuthor

    Maybe you didn't submit it, because I still don't see comment there.

  8. holgerbrandl commented on Aug 20, 2018

    @holgerbrandl
    Collaborator

    So true. Now it should be better.

  9. oshai commented on Aug 20, 2018

    @oshai
    ContributorAuthor

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions