Read build time in local-cli for apk
This commit is contained in:
parent
b848259905
commit
737060e962
@ -27,11 +27,9 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
buildConfigField("String", "PUSHY_BUILD_TIME", "\"${minutesSinceEpoch}\"")
|
||||
resValue("string", "pushy_build_time", "${minutesSinceEpoch}")
|
||||
}
|
||||
debug {
|
||||
buildConfigField("String", "PUSHY_BUILD_TIME", "\"0\"")
|
||||
resValue("string", "pushy_build_time", "0")
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="cn.reactnative.modules.update">
|
||||
|
||||
<application>
|
||||
<meta-data android:name="pushy_build_time" android:value="@string/pushy_build_time" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -60,7 +60,7 @@ public class UpdateContext {
|
||||
}
|
||||
|
||||
public String getBuildTime() {
|
||||
return BuildConfig.PUSHY_BUILD_TIME;
|
||||
return context.getString(R.string.pushy_build_time);
|
||||
}
|
||||
|
||||
public interface DownloadFileListener {
|
||||
|
@ -7,7 +7,7 @@ import { question } from './utils';
|
||||
|
||||
import { checkPlatform, getSelectedApp } from './app';
|
||||
|
||||
import { getIPAVersion, getApkVersion } from './utils';
|
||||
import { getIPAVersion, getAppInfo } from './utils';
|
||||
const Table = require('tty-table');
|
||||
|
||||
export async function listPackage(appId) {
|
||||
@ -66,14 +66,15 @@ export const commands = {
|
||||
if (!fn) {
|
||||
throw new Error('Usage: pushy uploadApk <apkFile>');
|
||||
}
|
||||
const name = await getApkVersion(fn);
|
||||
const { versionName, buildTime } = await getAppInfo(fn);
|
||||
const { appId } = await getSelectedApp('android');
|
||||
|
||||
const { hash } = await uploadFile(fn);
|
||||
|
||||
const { id } = await post(`/app/${appId}/package/create`, {
|
||||
name,
|
||||
name: versionName,
|
||||
hash,
|
||||
buildTime,
|
||||
});
|
||||
console.log(`Apk uploaded: ${id}`);
|
||||
},
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs-extra';
|
||||
const ApkReader = require('adbkit-apkreader');
|
||||
import ipaReader from './ipaReader';
|
||||
const AppInfoParser = require('app-info-parser');
|
||||
|
||||
var read = require('read');
|
||||
|
||||
@ -52,10 +52,21 @@ export function getRNVersion() {
|
||||
};
|
||||
}
|
||||
|
||||
export async function getApkVersion(fn) {
|
||||
const reader = await ApkReader.open(fn);
|
||||
const manifest = await reader.readManifest();
|
||||
return manifest.versionName;
|
||||
export async function getAppInfo(fn) {
|
||||
const parser = new AppInfoParser(fn);
|
||||
const { versionName, application } = await parser.parse();
|
||||
let buildTime = 0;
|
||||
if (Array.isArray(application.metaData)) {
|
||||
for (const meta of application.metaData) {
|
||||
if (meta.name === 'pushy_build_time') {
|
||||
buildTime = meta.value[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buildTime == 0) {
|
||||
throw new Error('Can not get build time for this app.')
|
||||
}
|
||||
return { versionName, buildTime };
|
||||
}
|
||||
|
||||
export function getIPAVersion(fn) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/reactnativecn/react-native-pushy#readme",
|
||||
"dependencies": {
|
||||
"adbkit-apkreader": "^3.1.2",
|
||||
"app-info-parser": "^0.3.5",
|
||||
"cli-arguments": "^0.2.1",
|
||||
"decompress-zip": "^0.3.1",
|
||||
"fs-extra": "^8.1.0",
|
||||
|
134
yarn.lock
134
yarn.lock
@ -14,15 +14,6 @@ acorn@^3.1.0:
|
||||
version "3.3.0"
|
||||
resolved "http://registry.npm.taobao.org/acorn/download/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
|
||||
|
||||
adbkit-apkreader@^3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/adbkit-apkreader/-/adbkit-apkreader-3.1.2.tgz#86a0c676870aba2f16d0f0948d2c94af58417bd5"
|
||||
integrity sha512-xFlRkjEuJ8+hEo6BfUWXyaxDm54RtLCBBC4TzYc1S0SQqrE7r31QWfYaUlJH+eJiPGTUzUCd+SUs1cJaCkATnQ==
|
||||
dependencies:
|
||||
bluebird "^3.4.7"
|
||||
debug "~0.7.4"
|
||||
yauzl "^2.7.0"
|
||||
|
||||
align-text@^0.1.1, align-text@^0.1.3:
|
||||
version "0.1.4"
|
||||
resolved "http://registry.npm.taobao.org/align-text/download/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
|
||||
@ -73,6 +64,17 @@ anymatch@^1.3.0:
|
||||
arrify "^1.0.0"
|
||||
micromatch "^2.1.5"
|
||||
|
||||
app-info-parser@^0.3.5:
|
||||
version "0.3.5"
|
||||
resolved "https://registry.yarnpkg.com/app-info-parser/-/app-info-parser-0.3.5.tgz#93bec9a635b9e971f89ea9fcb71f32d771a1988d"
|
||||
integrity sha512-VFUr4jGtwEwg1c+sNeJKiDLCSl2mqw6lrJBnvL1wEYdhiDTd0sqmJvxOpnB7Zh/g2P0n04ExBSJ4JHCcp4WP3g==
|
||||
dependencies:
|
||||
bplist-parser "^0.2.0"
|
||||
bytebuffer "^5.0.1"
|
||||
cgbi-to-png "^1.0.7"
|
||||
isomorphic-unzip "^1.1.5"
|
||||
plist "^3.0.1"
|
||||
|
||||
aproba@^1.0.3:
|
||||
version "1.1.1"
|
||||
resolved "http://registry.npm.taobao.org/aproba/download/aproba-1.1.1.tgz#95d3600f07710aa0e9298c726ad5ecf2eacbabab"
|
||||
@ -536,12 +538,22 @@ base64-js@1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "http://registry.npm.taobao.org/base64-js/download/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1"
|
||||
|
||||
base64-js@^1.0.2, base64-js@^1.2.3:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1"
|
||||
integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==
|
||||
|
||||
bcrypt-pbkdf@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "http://registry.npm.taobao.org/bcrypt-pbkdf/download/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d"
|
||||
dependencies:
|
||||
tweetnacl "^0.14.3"
|
||||
|
||||
big-integer@^1.6.44:
|
||||
version "1.6.48"
|
||||
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e"
|
||||
integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==
|
||||
|
||||
big-integer@^1.6.7:
|
||||
version "1.6.32"
|
||||
resolved "http://registry.npm.taobao.org/big-integer/download/big-integer-1.6.32.tgz#5867458b25ecd5bcb36b627c30bb501a13c07e89"
|
||||
@ -567,11 +579,6 @@ bluebird@^2.9.33:
|
||||
version "2.11.0"
|
||||
resolved "http://registry.npm.taobao.org/bluebird/download/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
|
||||
|
||||
bluebird@^3.4.7:
|
||||
version "3.5.5"
|
||||
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f"
|
||||
integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==
|
||||
|
||||
boom@2.x.x:
|
||||
version "2.10.1"
|
||||
resolved "http://registry.npm.taobao.org/boom/download/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f"
|
||||
@ -590,6 +597,13 @@ bplist-parser@0.1.1:
|
||||
dependencies:
|
||||
big-integer "^1.6.7"
|
||||
|
||||
bplist-parser@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e"
|
||||
integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==
|
||||
dependencies:
|
||||
big-integer "^1.6.44"
|
||||
|
||||
brace-expansion@^1.0.0:
|
||||
version "1.1.6"
|
||||
resolved "http://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
|
||||
@ -631,10 +645,30 @@ buffer-shims@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "http://registry.npm.taobao.org/buffer-shims/download/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51"
|
||||
|
||||
buffer@^5.0.7, buffer@^5.1.0:
|
||||
version "5.4.3"
|
||||
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.3.tgz#3fbc9c69eb713d323e3fc1a895eee0710c072115"
|
||||
integrity sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==
|
||||
dependencies:
|
||||
base64-js "^1.0.2"
|
||||
ieee754 "^1.1.4"
|
||||
|
||||
bufferpack@0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/bufferpack/-/bufferpack-0.0.6.tgz#fb3d8738a0e1e4e03bcff99f9a75f9ec18a9d73e"
|
||||
integrity sha1-+z2HOKDh5OA7z/mfmnX57Bip1z4=
|
||||
|
||||
buffers@~0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "http://registry.npm.taobao.org/buffers/download/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb"
|
||||
|
||||
bytebuffer@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/bytebuffer/-/bytebuffer-5.0.1.tgz#582eea4b1a873b6d020a48d58df85f0bba6cfddd"
|
||||
integrity sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=
|
||||
dependencies:
|
||||
long "~3"
|
||||
|
||||
camelcase@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "http://registry.npm.taobao.org/camelcase/download/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
|
||||
@ -655,6 +689,16 @@ center-align@^0.1.1:
|
||||
align-text "^0.1.3"
|
||||
lazy-cache "^1.0.3"
|
||||
|
||||
cgbi-to-png@^1.0.7:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/cgbi-to-png/-/cgbi-to-png-1.0.7.tgz#c7497580f76f87c2f5d825748a9d902b4072c004"
|
||||
integrity sha512-YR80kxTPuq9oRpZUdQmNEQWrmTKLINk1cfLVfyrV7Rfr9KLtLJdcockPKbreIr4JYAq+DhHBR7w+WA/tF5VDaQ==
|
||||
dependencies:
|
||||
bufferpack "0.0.6"
|
||||
crc "^3.3.0"
|
||||
stream-to-buffer "^0.1.0"
|
||||
streamifier "^0.1.1"
|
||||
|
||||
chainsaw@~0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "http://registry.npm.taobao.org/chainsaw/download/chainsaw-0.1.0.tgz#5eab50b28afe58074d0d58291388828b5e5fbc98"
|
||||
@ -787,6 +831,13 @@ core-util-is@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
|
||||
crc@^3.3.0:
|
||||
version "3.8.0"
|
||||
resolved "https://registry.yarnpkg.com/crc/-/crc-3.8.0.tgz#ad60269c2c856f8c299e2c4cc0de4556914056c6"
|
||||
integrity sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==
|
||||
dependencies:
|
||||
buffer "^5.1.0"
|
||||
|
||||
cross-spawn@^6.0.0:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
||||
@ -843,10 +894,6 @@ debug@^2.1.1, debug@^2.2.0:
|
||||
dependencies:
|
||||
ms "0.7.2"
|
||||
|
||||
debug@~0.7.4:
|
||||
version "0.7.4"
|
||||
resolved "http://registry.npm.taobao.org/debug/download/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39"
|
||||
|
||||
debug@~2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "http://registry.npm.taobao.org/debug/download/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
|
||||
@ -1288,6 +1335,11 @@ iconv-lite@^0.4.5, iconv-lite@~0.4.13:
|
||||
version "0.4.15"
|
||||
resolved "http://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
|
||||
|
||||
ieee754@^1.1.4:
|
||||
version "1.1.13"
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
|
||||
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "http://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
@ -1436,6 +1488,14 @@ isomorphic-fetch@^2.2.1:
|
||||
node-fetch "^1.0.1"
|
||||
whatwg-fetch ">=0.10.0"
|
||||
|
||||
isomorphic-unzip@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/isomorphic-unzip/-/isomorphic-unzip-1.1.5.tgz#9e5a18e77e3e760b631ee451f643c784b4f880dd"
|
||||
integrity sha512-2McA51lWhmO3Kk438jxVcYeh6L+AOqVnl9XdX1yI7GlLA9RwEyTBgGem1rNuRIU2abAmOiv+IagThdUxASY4IA==
|
||||
dependencies:
|
||||
buffer "^5.0.7"
|
||||
yauzl "^2.8.0"
|
||||
|
||||
isstream@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "http://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
@ -1652,6 +1712,11 @@ lodash@^4.2.0:
|
||||
version "4.17.4"
|
||||
resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
|
||||
long@~3:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b"
|
||||
integrity sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=
|
||||
|
||||
longest@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "http://registry.npm.taobao.org/longest/download/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
|
||||
@ -1974,6 +2039,15 @@ plist@2.1.0:
|
||||
xmlbuilder "8.2.2"
|
||||
xmldom "0.1.x"
|
||||
|
||||
plist@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.1.tgz#a9b931d17c304e8912ef0ba3bdd6182baf2e1f8c"
|
||||
integrity sha512-GpgvHHocGRyQm74b6FWEZZVRroHKE1I0/BTjAmySaohK+cUn+hZpbqXkc3KWgW3gQYkqcQej35FohcT0FRlkRQ==
|
||||
dependencies:
|
||||
base64-js "^1.2.3"
|
||||
xmlbuilder "^9.0.7"
|
||||
xmldom "0.1.x"
|
||||
|
||||
preserve@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "http://registry.npm.taobao.org/preserve/download/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||
@ -2329,11 +2403,28 @@ stream-buffers@~2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "http://registry.npm.taobao.org/stream-buffers/download/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
|
||||
|
||||
stream-to-buffer@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/stream-to-buffer/-/stream-to-buffer-0.1.0.tgz#26799d903ab2025c9bd550ac47171b00f8dd80a9"
|
||||
integrity sha1-JnmdkDqyAlyb1VCsRxcbAPjdgKk=
|
||||
dependencies:
|
||||
stream-to "~0.2.0"
|
||||
|
||||
stream-to@~0.2.0:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/stream-to/-/stream-to-0.2.2.tgz#84306098d85fdb990b9fa300b1b3ccf55e8ef01d"
|
||||
integrity sha1-hDBgmNhf25kLn6MAsbPM9V6O8B0=
|
||||
|
||||
stream-transform@^1.0.7:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.npm.taobao.org/stream-transform/download/stream-transform-1.0.8.tgz#54f721122d310eca855a16c97939881ab5bbb76c"
|
||||
integrity sha1-VPchEi0xDsqFWhbJeTmIGrW7t2w=
|
||||
|
||||
streamifier@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/streamifier/-/streamifier-0.1.1.tgz#97e98d8fa4d105d62a2691d1dc07e820db8dfc4f"
|
||||
integrity sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=
|
||||
|
||||
string-width@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "http://registry.npm.taobao.org/string-width/download/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
|
||||
@ -2575,6 +2666,11 @@ xmlbuilder@8.2.2:
|
||||
version "8.2.2"
|
||||
resolved "http://registry.npm.taobao.org/xmlbuilder/download/xmlbuilder-8.2.2.tgz#69248673410b4ba42e1a6136551d2922335aa773"
|
||||
|
||||
xmlbuilder@^9.0.7:
|
||||
version "9.0.7"
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
|
||||
integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=
|
||||
|
||||
xmldom@0.1.x:
|
||||
version "0.1.27"
|
||||
resolved "http://registry.npm.taobao.org/xmldom/download/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9"
|
||||
@ -2635,7 +2731,7 @@ yauzl@2.4.1:
|
||||
dependencies:
|
||||
fd-slicer "~1.0.1"
|
||||
|
||||
yauzl@^2.7.0:
|
||||
yauzl@^2.8.0:
|
||||
version "2.10.0"
|
||||
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
|
||||
integrity sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=
|
||||
|
Loading…
x
Reference in New Issue
Block a user