Don't rely on external shasum program to calculate sum of the APK.

This commit is contained in:
Nathan Kerr
2015-10-23 09:30:03 -07:00
parent 21f91bda52
commit 24fe7efa28
2 changed files with 6 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ import 'dart:math';
import 'package:logging/logging.dart';
import 'package:path/path.dart' as path;
import 'package:crypto/crypto.dart';
import 'application_package.dart';
import 'build_configuration.dart';
@@ -695,9 +696,10 @@ class AndroidDevice extends Device {
}
String _getSourceSha1(ApplicationPackage app) {
String sha1 =
runCheckedSync(['shasum', '-a', '1', '-p', app.localPath]).split(' ')[0];
return sha1;
var sha1 = new SHA1();
var file = new File(app.localPath);
sha1.add(file.readAsBytesSync());
return CryptoUtils.bytesToHex(sha1.close());
}
@override

View File

@@ -19,6 +19,7 @@ dependencies:
shelf: ^0.6.2
test: ">=0.12.4+5 <0.12.5"
yaml: ^2.1.3
crypto: ^0.9.1
dev_dependencies:
mockito: "^0.10.1"