(task, build, onDone)
| 1412 | } |
| 1413 | |
| 1414 | function uploadToGooglePlay (task, build, onDone) { |
| 1415 | play.edits.insert().then((appEdit) => { |
| 1416 | console.log('Created an AppEdit', JSON.stringify(appEdit)); |
| 1417 | const editId = appEdit.data.id; |
| 1418 | |
| 1419 | let remainingApkCount = 0; |
| 1420 | build.variants.forEach((variant) => { |
| 1421 | variant.abi.forEach((abi) => { |
| 1422 | remainingApkCount++; |
| 1423 | }); |
| 1424 | }); |
| 1425 | |
| 1426 | const uploadedVersionCodes = []; |
| 1427 | let onBuildUploaded = (uploadedBuildVariant) => { |
| 1428 | if (--remainingApkCount !== 0) |
| 1429 | return; |
| 1430 | |
| 1431 | // Setting track |
| 1432 | play.edits.tracks.update({ |
| 1433 | editId: editId, |
| 1434 | track: build.googlePlayTrack, |
| 1435 | // changesNotSentForReview: true, |
| 1436 | requestBody: { |
| 1437 | track: build.googlePlayTrack, |
| 1438 | releases: [{ |
| 1439 | name: build.version.name + ' ' + build.googlePlayTrack, |
| 1440 | status: build.googlePlayTrack === 'production' ? 'draft' : 'completed', |
| 1441 | releaseNotes: build.releaseNotes, |
| 1442 | versionCodes: uploadedVersionCodes |
| 1443 | }] |
| 1444 | } |
| 1445 | }).then((updatedTrack) => { |
| 1446 | console.log('Successfully updated track', JSON.stringify(updatedTrack)); |
| 1447 | play.edits.commit({ |
| 1448 | editId: editId |
| 1449 | }).then((appEdit) => { |
| 1450 | console.log('Successfully commited google play changes', JSON.stringify(appEdit)); |
| 1451 | tracePublishedGooglePlayBuild(build).then(() => { |
| 1452 | onDone(0); |
| 1453 | }); |
| 1454 | }).catch((e) => { |
| 1455 | console.error('Failed to commit changes to google play', build.googlePlayTrack, e); |
| 1456 | onDone(1); |
| 1457 | }); |
| 1458 | }).catch((updatedTrackError) => { |
| 1459 | console.error('Failed to update track', build.googlePlayTrack, updatedTrackError); |
| 1460 | onDone(1); |
| 1461 | }); |
| 1462 | }; |
| 1463 | for (let i = 0; i < build.variants.length; i++) { |
| 1464 | const variant = build.variants[i]; |
| 1465 | for (let abiIndex = 0; abiIndex < variant.abi.length; abiIndex++) { |
| 1466 | const abiVariant = variant.abi[abiIndex]; |
| 1467 | if (abiVariant === 'universal') { |
| 1468 | onBuildUploaded(variant, abiVariant); |
| 1469 | continue; |
| 1470 | } |
| 1471 | const files = build.files[variant.name][abiVariant]; |
no test coverage detected