| apply plugin: 'eclipse' |
| eclipse { |
| project { |
| natures 'org.python.pydev.pythonNature' |
| buildCommand 'org.python.pydev.PyDevBuilder' |
| } |
| } |
| |
| ext.dockerImageName = 'whisk/cli' |
| apply from: '../../gradle/docker.gradle' |
| |
| task clean(type: Delete) { |
| delete 'build' |
| } |
| |
| task removeDistribution(type: Delete) { |
| delete 'build/distributions' |
| } |
| |
| task establishStructure(type: Copy) { |
| into 'build/tmp' |
| from('packagescripts') { |
| include '*.rst', '*.in', 'setup.py' |
| } |
| |
| into('openwhisk') { |
| from('.') { |
| include '*.py', 'wsk' |
| rename('^wsk$', 'wsk.py') |
| } |
| from('packagescripts') { |
| include '__init__.py' |
| } |
| } |
| } |
| distDocker.dependsOn(establishStructure) |
| |
| task distTar(dependsOn: [removeDistribution, distDocker]) << { |
| run("docker rm -f cli", true) // Ignore error as this is a cleanup measure |
| run("docker run --name cli whisk/cli") |
| run("docker cp cli:/cli/dist/ \"${buildDir}/distributions/\"") |
| run("docker rm -f cli") |
| } |
| pushImage.finalizedBy(distTar) |
| |
| def run(cmd, ignoreError = false) { |
| println("Executing '${cmd}'") |
| def proc = cmd.execute() |
| proc.waitFor() |
| if(!ignoreError && proc.exitValue() != 0) { |
| println("Command '${cmd}' failed with exitCode ${proc.exitValue()}") |
| } |
| } |