@@ -44,6 +44,10 @@ allprojects {
44
44
testCompile " org.jetbrains.kotlin:kotlin-test:$kotlinVersion "
45
45
}
46
46
47
+ ext. teamcityArtifactsPath = " teamcity-artifacts"
48
+ ext. tcDir = rootDir. toPath(). resolve(ext. teamcityArtifactsPath)
49
+ ext. isTeamcityBuild = ext. tcDir. toFile(). exists()
50
+
47
51
String defaultVersion = ' 0.7.15'
48
52
project. ext. isProtectedBranch = isProtectedBranch()
49
53
String buildCounterStr = rootProject. ext. has(' build.counter' ) ?
@@ -58,7 +62,7 @@ allprojects {
58
62
ext. versionFileName = " VERSION"
59
63
60
64
if (! Pattern . matches(buildNumberRegex, buildNumber)) {
61
- def versionFile = rootDir . toPath() . resolve(ext. versionFileName). toFile()
65
+ def versionFile = ext . tcDir . resolve(ext. versionFileName). toFile()
62
66
if (versionFile. exists()) {
63
67
def lines = versionFile. readLines()
64
68
assert ! lines. empty, " There should be at least one line in VERSION file"
@@ -367,7 +371,7 @@ class CondaTaskSpec extends TaskSpec {
367
371
String password
368
372
}
369
373
370
- def condaTaskSpecs = new UploadTaskSpecs<CondaTaskSpec > (
374
+ ext . condaTaskSpecs = new UploadTaskSpecs<CondaTaskSpec > (
371
375
project : project,
372
376
stable : new CondaTaskSpec (
373
377
taskName : " condaUploadStable" ,
@@ -381,27 +385,37 @@ def condaTaskSpecs = new UploadTaskSpecs<CondaTaskSpec>(
381
385
protectedDeployTaskName : " condaUploadProtected"
382
386
)
383
387
384
- condaTaskSpecs. createTasks { taskSpec ->
385
- task([dependsOn : [cleanInstallDirConda, condaPackage]], taskSpec. taskName) {
386
- doLast {
387
- exec {
388
- commandLine ' anaconda' , ' login' ,
389
- ' --username' , condaTaskSpecs. stable. username,
390
- ' --password' , condaTaskSpecs. stable. password
391
- standardInput new ByteArrayInputStream (" yes" . bytes)
392
- }
388
+ void doCondaUpload (CondaTaskSpec taskSpec , java.nio.file.Path artifactPath ) {
389
+ exec {
390
+ commandLine ' anaconda' , ' login' ,
391
+ ' --username' , condaTaskSpecs. stable. username,
392
+ ' --password' , condaTaskSpecs. stable. password
393
+ standardInput new ByteArrayInputStream (" yes" . bytes)
394
+ }
393
395
394
- Files . walk(getSubdir(condaBuildDir, condaPackageDir, " noarch " ) ). withCloseable { stream ->
395
- def artifact = stream
396
- .filter { Files . isRegularFile(it) && it. fileName. toString(). endsWith(" .tar.bz2" ) }
397
- .findFirst()
398
- assert artifact. isPresent(), " .tar.bz2 file should be present in package/noarch dir"
396
+ Files . walk(artifactPath ). withCloseable { stream ->
397
+ def artifact = stream
398
+ .filter { Files . isRegularFile(it) && it. fileName. toString(). endsWith(" .tar.bz2" ) }
399
+ .findFirst()
400
+ assert artifact. isPresent(), " .tar.bz2 file should be present in package/noarch dir"
399
401
400
- def artifactPath = artifact. get(). toAbsolutePath(). toString()
401
- exec {
402
- commandLine(' anaconda' , ' upload' , ' -u' , taskSpec. username, artifactPath)
403
- }
404
- }
402
+ def artifactFilePath = artifact. get(). toAbsolutePath(). toString()
403
+ exec {
404
+ commandLine(' anaconda' , ' upload' , ' -u' , taskSpec. username, artifactFilePath)
405
+ }
406
+ }
407
+ }
408
+
409
+ condaTaskSpecs. createTasks { taskSpec ->
410
+ task(taskSpec. taskName) {
411
+ def artifactsDir = tcDir
412
+ if (! isTeamcityBuild) {
413
+ artifactsDir = getSubdir(condaBuildDir, condaPackageDir, " noarch" )
414
+ dependsOn([cleanInstallDirConda, condaPackage])
415
+ }
416
+
417
+ doLast {
418
+ doCondaUpload(taskSpec, artifactsDir)
405
419
}
406
420
}
407
421
}
@@ -436,12 +450,18 @@ def pyPiTaskSpecs = new UploadTaskSpecs<PyPiTaskSpec>(
436
450
)
437
451
438
452
pyPiTaskSpecs. createTasks { taskSpec ->
439
- task([type : Exec , dependsOn : [pyPiPackage]], taskSpec. taskName) {
453
+ task([type : Exec ], taskSpec. taskName) {
454
+ if (! isTeamcityBuild) {
455
+ dependsOn([pyPiPackage])
456
+ workingDir(condaBuildDir. resolve(" dist" ))
457
+ } else {
458
+ workingDir(tcDir)
459
+ }
460
+
440
461
commandLine " twine" , " upload" ,
441
462
" -u" , taskSpec. username,
442
463
" -p" , taskSpec. password,
443
464
" --repository-url" , taskSpec. repoURL,
444
- " dist/*"
445
- workingDir condaBuildDir
465
+ " *.whl"
446
466
}
447
467
}
0 commit comments