-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from ethankhall/removing-input-from-some-tasks
Fixed Java Serialization issue
- Loading branch information
Showing
6 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...ugin/src/integTest/groovy/com/linkedin/gradle/python/plugin/PythonSerializableTest.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,80 @@ | ||
/* | ||
* Copyright 2016 LinkedIn Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.linkedin.gradle.python.plugin | ||
|
||
import com.linkedin.gradle.python.plugin.testutils.DefaultProjectLayoutRule | ||
import com.linkedin.gradle.python.plugin.testutils.PyGradleTestBuilder | ||
import org.gradle.testkit.runner.GradleRunner | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import org.junit.Rule | ||
import spock.lang.Specification | ||
|
||
class PythonSerializableTest extends Specification { | ||
|
||
@Rule | ||
final DefaultProjectLayoutRule testProjectDir = new DefaultProjectLayoutRule() | ||
|
||
def "can serialize inputs and outputs"() { | ||
given: | ||
testProjectDir.buildFile << """\ | ||
|import com.linkedin.gradle.python.tasks.InstallVirtualEnvironmentTask | ||
|import com.linkedin.gradle.python.extension.PythonDetails | ||
|import com.linkedin.gradle.python.tasks.PipInstallTask | ||
| | ||
|import static com.linkedin.gradle.python.util.StandardTextValues.CONFIGURATION_PYTHON | ||
| | ||
|plugins { | ||
| id 'com.linkedin.python-sdist' | ||
|} | ||
|version = '1.2.3' | ||
|${ PyGradleTestBuilder.createRepoClosure() } | ||
|apply plugin: com.linkedin.gradle.python.plugin.WheelFirstPlugin | ||
| | ||
|dependencies { | ||
| python 'pypi:requests:2.18.1' | ||
|} | ||
| | ||
| | ||
|ext.anotherVenv = new File("\$buildDir/AnotherVenv") | ||
| | ||
|task installAnotherVenv ( type: InstallVirtualEnvironmentTask ) { | ||
| pythonDetails = new PythonDetails(project, anotherVenv) | ||
|} | ||
| | ||
|task installPythonRequirementsInAnotherVenv ( type: PipInstallTask ){ | ||
| dependsOn installAnotherVenv | ||
| mustRunAfter installAnotherVenv | ||
| pythonDetails = new PythonDetails(project, anotherVenv) | ||
| installFileCollection = project.getConfigurations().getByName(CONFIGURATION_PYTHON.getValue()) | ||
| outputs.dir anotherVenv | ||
|} | ||
""".stripMargin().stripIndent() | ||
|
||
when: | ||
def result = GradleRunner.create() | ||
.withProjectDir(testProjectDir.root) | ||
.withArguments('installPythonRequirementsInAnotherVenv') | ||
.withPluginClasspath() | ||
.withDebug(true) | ||
.build() | ||
println result.output | ||
|
||
then: | ||
|
||
result.output.contains("BUILD SUCCESS") | ||
result.task(':foo:installPythonRequirementsInAnotherVenv').outcome == TaskOutcome.SUCCESS | ||
} | ||
} |
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
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
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