apollo-kotlin: [Bug] Apollo isn't generating sources on Windows.

Hello there,

Summary I’ve a project with multiple services and two schemas and this setup is working fine for UNIX-like system but it does absolutely nothing when running on Windows. The sources aren’t generated and it also doesn’t output an error if I create a query that shouldn’t exist.

Version Tested in 2.2.0 and 2.4.0.

Description

Given I have a module notifications and I have this configuration with 2 services properly working on MacOS/Linux:

apollo {
    service("coffee") {
        sourceFolder = "$projectDir/src/main/graphql/com/zeez/app/coffee"
        schemaPath = "$rootDir/common/src/main/graphql/com/zeez/app/coffee/schema.json"
    }

    service("tea") {
        sourceFolder = "$projectDir/src/main/graphql/com/zeez/app/tea"
        schemaPath = "$rootDir/common/src/main/graphql/com/zeez/app/tea/schema.json"
    }
}

Then I’ve a common module defined this way:

apollo {
    service("coffee") {
        sourceFolder = "$projectDir/src/main/graphql/com/zeez/app/coffee"
        rootPackageName = "com.zeez.app.coffee"
    }

    service("tea") {
        sourceFolder = "$projectDir/src/main/graphql/com/zeez/app/tea"
        rootPackageName = "com.zeez.app.tea"
    }
}

As I said, this setup is working fine for UNIX-like system but didn’t work on Windows. I think it is because how the sourceFolder and schemaPath are resolved.

On Windows the output of the sourceFolder or schemaPath above are something like this:

C:/Zeez/notifications/src/main/graphql/com/zeez/app/coffee

Where on MacOS it will be:

/Users/Bla/Zeez/notifications/src/main/graphql/com/zeez/app/coffee

Additional information If I write anything in the Query.graphql or even if I put anything in the schema.json the task will pass with success.

Am I doing something wrong or a missing configuration?

Thank you everyone.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Whoopps, I take that back, I made a typo in sourceFolder. Generating sources with a relative path in schemaPath is working. See https://github.com/martinbonnin/apollo-android-samples/tree/main/relativeWindowsPath for an example.

Side note: considering you have a common module that holds your schema and other modules that consume it, it looks like your project could benefit from multi-modules support that just landed in 2.4.0. It’s still experimental but I’d love to hear what you think about it.

@martinbonnin using schemaFile indeed does work.

Thank you for your effort in helping me. I’ll check later if it is working properly and doesn’t break any existing behavior, but my guess is that it is working pretty well.

Thank you, Martin.