Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not try to compile java files if we don't generate any #1353

Merged

Conversation

martinbonnin
Copy link
Contributor

Should fix #1352

Copy link
Contributor

@digitalbuddha digitalbuddha left a comment

Choose a reason for hiding this comment

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

Is there a way to write a test for this? Maybe a module within repo with this setup

@martinbonnin
Copy link
Contributor Author

martinbonnin commented Jun 7, 2019

Test project added there: https://github.com/apollographql/apollo-android/blob/95b0e854eb5953d95acceabb474a8e193b9af3f3/apollo-gradle-plugin/src/test/testProject/kotlin/build.gradle

As it's using the snapshots, it will fail until new snapshosts are deployed. I'm not sure how this is handled for other plugin tests ?

@sav007
Copy link
Contributor

sav007 commented Jun 9, 2019

Do you know why integration test fails on CI? As it a composite test and should run with the latest changes to plugin without waiting for snapshot to be published.

@martinbonnin
Copy link
Contributor Author

Pretty sure I didn't do the composite thing. Right now it uses the snapshot plugin which is why it fails. I'll look into composite tests

* I had to move the creation of the apollo tasks to `afterEvaluate`. This might or might not have side effects but it's the only way I found to know reliably the value of apollo.generateKotlinModels and configure the java task
* The other integration tests simply add the api code to the java sourceSet which defeats the value of this test (testing that the porject compiles without any java file). In order to still have the api dependency, I included the snapashot so the test will always lag a bit
@martinbonnin
Copy link
Contributor Author

martinbonnin commented Jun 13, 2019

It should be good. 2 points worth noting:

  • I had to move the creation of the apollo tasks to afterEvaluate. This might or might not have side effects but it's the only way I found to know reliably the value of apollo.generateKotlinModels and configure the java task.
  • The other tests simply add the apollo-api code to the java sourceSet which defeats the value of this test (testing that the project compiles without any java file). In order to still have the api dependency, I included the snapshot so the test will run with a local apollo-plugin and a snapshot apollo-api. This might or might not be an issue...

@sav007
Copy link
Contributor

sav007 commented Jun 16, 2019

I will take a look on my sample project with snapshot version if afterEvaluate caused any issues, it shouldn't but will check.

@sav007 sav007 merged commit a1cd963 into apollographql:master Jun 16, 2019
@alexxxdev
Copy link

I will take a look on my sample project with snapshot version if afterEvaluate caused any issues, it shouldn't but will check.

@sav007 @martijnwalraven it seems
now it causes problems with compile%name%Kotlin
for any value of generateKotlinModels
project is 100% kotlin

/build/apollo-codegen/ empty & /build/generated/source/apollo doesn't exist

@AllanWang
Copy link
Contributor

^ For me the generated sources actually do exist, but they don't get resolved properly; gradle won't allow me to use it.

#1372

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.

compileJava fails with no source files if the project is 100% kotlin and generateKotlinModels = true
5 participants