这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@DanielJette
Copy link
Contributor

Shopify in the android repo will soon be split into two modules (app and core) but the graphql_java_gen support module is not compatible with this configuration

We are getting the following error:

A problem occurred evaluating project ':GraphQLSupport'.
> Cannot change dependencies of configuration ':GraphQLSupport:classpath' after it has been resolved.

The reason for this is the dependencies block in the build.gradle. When building the support library on its own, this is a valid construct. However, when part of the monorepo, the support build.gradle file is included as a submodule and the dependency resolution strategy on modern gradle versions does not allow for submodules to modify the classpath.

So, my solution is simple. Remove the unsupported dependency statement and move the remaining contents of the build.gradle file into a new graphql.java.gen.build.gradle file. This new file will be referenced by the monorepo. Then, create a simple stub build.gradle that continues to reference the bintray dependency and then includes the new file.


apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this and the bintray block below be moved to the original build.gradle file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not necessary. We have the bintray artifacts already defined in the monorepo classpath. https://github.com/Shopify/android/blob/master/build.gradle#L447

Leaving this here allows us to publish from the monorepo, if we desire

Copy link
Member

@gantonious gantonious May 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm more thinking for third party users of this lib? More like thinking if some other random project pulls this in as a submodule and doesn't have bintray setup. Probably not a real issue given that no one has posted an issue about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if you don't do anything special, you'd never know there were two files. This is only valuable to us, in our monorepo configuration, because of the way we support custom gradle file names. For us to even use this, I'll have to open a PR pointing to the new file.

Copy link
Member

@gantonious gantonious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from my bintray comment, this looks good.

@DanielJette DanielJette merged commit a58d32e into master May 30, 2019
@DanielJette DanielJette deleted the monorepo-support branch May 30, 2019 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants