-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not try to compile java files if we don't generate any (#1353)
* do not try to compile java files if we don't generate any Should fix #1352 * add a test * cleanup the test when done * make integration tests use the actual plugin code and not the snapshot * 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
- v4.1.1
- v4.1.0
- v4.0.1
- v4.0.0
- v4.0.0-rc.2
- v4.0.0-rc.1
- v4.0.0-dev.3
- v4.0.0-dev.2
- v4.0.0-dev.1
- v4.0.0-dev.0
- v4.0.0-beta.7
- v4.0.0-beta.6
- v4.0.0-beta.5
- v4.0.0-beta.4
- v4.0.0-beta.3
- v4.0.0-beta.2
- v4.0.0-beta.1
- v4.0.0-alpha.3
- v4.0.0-alpha.2
- v4.0.0-alpha.1
- v3.8.5
- v3.8.4
- v3.8.3
- v3.8.2
- v3.8.1
- v3.8.0
- v3.7.5
- v3.7.4
- v3.7.3
- v3.7.2
- v3.7.1
- v3.7.0
- v3.6.2
- v3.6.1
- v3.6.0
- v3.5.0
- v3.4.0
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.0
- v3.0.0-rc03
- v3.0.0-rc02
- v3.0.0-rc01
- v3.0.0-dev14
- v3.0.0-dev13
- v3.0.0-dev12
- v3.0.0-dev11
- v3.0.0-dev10
- v3.0.0-dev9
- v3.0.0-dev8
- v3.0.0-dev7
- v3.0.0-dev6
- v3.0.0-dev5
- v3.0.0-dev4
- v3.0.0-dev3
- v3.0.0-dev2
- v3.0.0-beta05
- v3.0.0-beta04
- v3.0.0-beta03
- v3.0.0-beta02
- v3.0.0-beta01
- v3.0.0-alpha07
- v3.0.0-alpha06
- v3.0.0-alpha05
- v3.0.0-alpha04
- v3.0.0-alpha03
- v3.0.0-alpha02
- v3.0.0-alpha01
- v2.5.14
- v2.5.13
- v2.5.12
- v2.5.11
- v2.5.10
- v2.5.9
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.0.1
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.2
1 parent
3351482
commit a1cd963
Showing
7 changed files
with
5,941 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...adle-plugin/src/test/groovy/com/apollographql/apollo/gradle/integration/KotlinSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.apollographql.apollo.gradle.integration | ||
|
||
import org.apache.commons.io.FileUtils | ||
import org.gradle.testkit.runner.GradleRunner | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class KotlinSpec extends Specification { | ||
@Shared File testProjectDir | ||
|
||
def setupSpec() { | ||
def integrationTestsDir = new File(System.getProperty("user.dir"), "build/integrationTests/") | ||
testProjectDir = new File(integrationTestsDir, "kotlin") | ||
FileUtils.deleteDirectory(testProjectDir) | ||
FileUtils.forceMkdir(testProjectDir) | ||
|
||
File readOnlyDir = new File(System.getProperty("user.dir"), "src/test/testProject/kotlin/") | ||
if (!readOnlyDir.isDirectory()) { | ||
throw new IllegalArgumentException("Couldn't find test project") | ||
} | ||
|
||
FileUtils.copyDirectory(readOnlyDir, testProjectDir) | ||
} | ||
|
||
// ApolloExtension tests | ||
def "compilation succeeeds"() { | ||
when: | ||
def result = GradleRunner.create().withProjectDir(testProjectDir) | ||
.withPluginClasspath() | ||
.withArguments("assemble", "-Dapollographql.skipRuntimeDep=true") | ||
.forwardStdError(new OutputStreamWriter(System.err)) | ||
.forwardStdOutput(new OutputStreamWriter(System.out)) | ||
.build() | ||
|
||
then: | ||
result.task(":assemble").outcome == TaskOutcome.SUCCESS | ||
} | ||
|
||
def cleanupSpec() { | ||
FileUtils.deleteDirectory(testProjectDir) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
apollo-gradle-plugin/src/test/testProject/kotlin/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
buildscript { | ||
apply from: "../../../../gradle/testFixturesDeps.gradle" | ||
|
||
repositories { | ||
google() // the apollo android plugin depends on the android plugins who are hosted there | ||
mavenCentral() | ||
jcenter() | ||
} | ||
} | ||
|
||
plugins { | ||
id 'org.jetbrains.kotlin.jvm' version '1.3.31' | ||
id 'com.apollographql.android' | ||
} | ||
|
||
repositories { | ||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib" | ||
implementation dep.apolloApi | ||
} | ||
|
||
compileKotlin { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
compileTestKotlin { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
|
||
apollo { | ||
generateKotlinModels = true | ||
} |
9 changes: 9 additions & 0 deletions
9
...o-gradle-plugin/src/test/testProject/kotlin/src/main/graphql/com/example/AllFilms.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
query Films { | ||
allFilms { | ||
films { | ||
id | ||
title | ||
releaseDate | ||
} | ||
} | ||
} |
5,843 changes: 5,843 additions & 0 deletions
5,843
apollo-gradle-plugin/src/test/testProject/kotlin/src/main/graphql/com/example/schema.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters