update dockerfile to fix gpg & flutter format (#130)

This commit is contained in:
Christopher Fujino
2020-04-08 17:16:52 -07:00
committed by GitHub
parent 2917af6c53
commit c9c42d5089
8 changed files with 47 additions and 26 deletions

View File

@ -1,5 +1,18 @@
# Last updated 4/8/2020 (to rebuild the docker image, update this timestamp)
FROM cirrusci/flutter:latest FROM cirrusci/flutter:latest
RUN sudo apt-get update && \
sudo apt-get upgrade --yes && \
sudo apt-get install --yes gpg-agent && \
sudo apt-get clean --yes
# This must occur after the install of gpg-agent
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" && \
sudo apt-get update && \
sudo apt-get install --yes --allow-unauthenticated clang-format-5.0 && \
sudo apt-get clean --yes
RUN yes | sdkmanager \ RUN yes | sdkmanager \
"platforms;android-27" \ "platforms;android-27" \
"build-tools;27.0.3" \ "build-tools;27.0.3" \

View File

@ -18,11 +18,6 @@ task:
depends_on: depends_on:
- analyze - analyze
- name: test+format - name: test+format
install_script:
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated clang-format-5.0
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0 format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
test_script: ./script/incremental_build.sh test test_script: ./script/incremental_build.sh test
depends_on: depends_on:

View File

@ -23,10 +23,9 @@ void _writeHostApi(Indent indent, Api api) {
indent.dec(); indent.dec();
indent.dec(); indent.dec();
indent.writeln(''); indent.writeln('');
final String returnStatement = final String returnStatement = func.returnType == 'void'
func.returnType == 'void' ? '// noop'
? '// noop' : 'return ${func.returnType}._fromMap(replyMap[\'${Keys.result}\']);';
: 'return ${func.returnType}._fromMap(replyMap[\'${Keys.result}\']);';
indent.format('''Map replyMap = await channel.send(requestMap); indent.format('''Map replyMap = await channel.send(requestMap);
if (replyMap['error'] != null) { if (replyMap['error'] != null) {
\tMap error = replyMap['${Keys.error}']; \tMap error = replyMap['${Keys.error}'];

View File

@ -127,7 +127,8 @@ void generateObjcHeader(ObjcOptions options, Root root, StringSink sink) {
for (Method func in api.methods) { for (Method func in api.methods) {
final String returnType = _className(options.prefix, func.returnType); final String returnType = _className(options.prefix, func.returnType);
final String argType = _className(options.prefix, func.argType); final String argType = _className(options.prefix, func.argType);
final String callbackType = _callbackForType(func.returnType, returnType); final String callbackType =
_callbackForType(func.returnType, returnType);
indent.writeln( indent.writeln(
'- (void)${func.name}:($argType*)input completion:($callbackType)completion;'); '- (void)${func.name}:($argType*)input completion:($callbackType)completion;');
} }

View File

@ -5,7 +5,7 @@
import 'package:pigeon/pigeon_lib.dart'; import 'package:pigeon/pigeon_lib.dart';
class SetRequest { class SetRequest {
int value; int value;
} }
@FlutterApi() @FlutterApi()

View File

@ -5,7 +5,7 @@
import 'package:pigeon/pigeon_lib.dart'; import 'package:pigeon/pigeon_lib.dart';
class SetRequest { class SetRequest {
int value; int value;
} }
@HostApi() @HostApi()

View File

@ -9,8 +9,10 @@ import 'dart:typed_data';
import 'package:bsdiff/bsdiff.dart'; import 'package:bsdiff/bsdiff.dart';
void main() { void main() {
final Uint8List originalData = Uint8List.fromList(List<int>.generate(1000, (int index) => index)); final Uint8List originalData =
final Uint8List modifiedData = Uint8List.fromList(List<int>.generate(2000, (int index) => 2 * index)); Uint8List.fromList(List<int>.generate(1000, (int index) => index));
final Uint8List modifiedData =
Uint8List.fromList(List<int>.generate(2000, (int index) => 2 * index));
print('Original data size ${originalData.length} bytes'); print('Original data size ${originalData.length} bytes');
print('Modified data size ${modifiedData.length} bytes'); print('Modified data size ${modifiedData.length} bytes');

View File

@ -183,7 +183,6 @@ class _Ref<T> {
int _search(List<int> idata, Uint8List olddata, Uint8List newdata, int newskip, int _search(List<int> idata, Uint8List olddata, Uint8List newdata, int newskip,
int start, int end, _Ref<int> pos) { int start, int end, _Ref<int> pos) {
if (end - start < 2) { if (end - start < 2) {
final int x = _matchlen(olddata, idata[start], newdata, newskip); final int x = _matchlen(olddata, idata[start], newdata, newskip);
final int y = _matchlen(olddata, idata[end], newdata, newskip); final int y = _matchlen(olddata, idata[end], newdata, newskip);
@ -205,7 +204,8 @@ int _search(List<int> idata, Uint8List olddata, Uint8List newdata, int newskip,
} }
} }
List<int> _int64bytes(int i) => (ByteData(8)..setInt64(0, i)).buffer.asUint8List(); List<int> _int64bytes(int i) =>
(ByteData(8)..setInt64(0, i)).buffer.asUint8List();
Uint8List bsdiff(List<int> olddata, List<int> newdata) { Uint8List bsdiff(List<int> olddata, List<int> newdata) {
final int oldsize = olddata.length; final int oldsize = olddata.length;
@ -223,21 +223,24 @@ Uint8List bsdiff(List<int> olddata, List<int> newdata) {
BytesBuilder buf = BytesBuilder(); BytesBuilder buf = BytesBuilder();
final _Ref<int> pos = _Ref<int>(); final _Ref<int> pos = _Ref<int>();
for (int scan = 0, len = 0, lastscan = 0, lastpos = 0, lastoffset = 0; scan < newsize; ) { for (int scan = 0, len = 0, lastscan = 0, lastpos = 0, lastoffset = 0;
scan < newsize;) {
int oldscore = 0; int oldscore = 0;
for (int scsc = scan += len; scan < newsize; scan++) { for (int scsc = scan += len; scan < newsize; scan++) {
len = _search(idata, olddata, newdata, scan, 0, oldsize, pos); len = _search(idata, olddata, newdata, scan, 0, oldsize, pos);
for (; scsc < scan + len; scsc++) { for (; scsc < scan + len; scsc++) {
if ((scsc + lastoffset < oldsize) && (olddata[scsc + lastoffset] == newdata[scsc])) { if ((scsc + lastoffset < oldsize) &&
(olddata[scsc + lastoffset] == newdata[scsc])) {
oldscore++; oldscore++;
} }
} }
if (((len == oldscore) && (len != 0)) || (len > oldscore + 8)) { if (((len == oldscore) && (len != 0)) || (len > oldscore + 8)) {
break; break;
} }
if ((scan + lastoffset < oldsize) && (olddata[scan + lastoffset] == newdata[scan])) { if ((scan + lastoffset < oldsize) &&
(olddata[scan + lastoffset] == newdata[scan])) {
oldscore--; oldscore--;
} }
} }
@ -246,7 +249,8 @@ Uint8List bsdiff(List<int> olddata, List<int> newdata) {
int lenf = 0; int lenf = 0;
int lenb = 0; int lenb = 0;
for (int sf = 0, s = 0, i = 0; (lastscan + i < scan) && (lastpos + i < oldsize); ) { for (int sf = 0, s = 0, i = 0;
(lastscan + i < scan) && (lastpos + i < oldsize);) {
if (olddata[lastpos + i] == newdata[lastscan + i]) { if (olddata[lastpos + i] == newdata[lastscan + i]) {
s++; s++;
} }
@ -258,7 +262,9 @@ Uint8List bsdiff(List<int> olddata, List<int> newdata) {
} }
if (scan < newsize) { if (scan < newsize) {
for (int sb = 0, s = 0, i = 1; (scan >= lastscan + i) && (pos.value >= i); i++) { for (int sb = 0, s = 0, i = 1;
(scan >= lastscan + i) && (pos.value >= i);
i++) {
if (olddata[pos.value - i] == newdata[scan - i]) { if (olddata[pos.value - i] == newdata[scan - i]) {
s++; s++;
} }
@ -273,7 +279,8 @@ Uint8List bsdiff(List<int> olddata, List<int> newdata) {
final int overlap = (lastscan + lenf) - (scan - lenb); final int overlap = (lastscan + lenf) - (scan - lenb);
int lens = 0; int lens = 0;
for (int ss = 0, s = 0, i = 0; i < overlap; i++) { for (int ss = 0, s = 0, i = 0; i < overlap; i++) {
if (newdata[lastscan + lenf - overlap + i] == olddata[lastpos + lenf - overlap + i]) { if (newdata[lastscan + lenf - overlap + i] ==
olddata[lastpos + lenf - overlap + i]) {
s++; s++;
} }
if (newdata[scan - lenb + i] == olddata[pos.value - lenb + i]) { if (newdata[scan - lenb + i] == olddata[pos.value - lenb + i]) {
@ -345,15 +352,19 @@ Uint8List bspatch(List<int> olddata, List<int> diffdata) {
throw Exception('Invalid magic'); throw Exception('Invalid magic');
} }
final ByteData header = ByteData.view(Uint8List.fromList(diffdata.sublist(0, 32)).buffer); final ByteData header =
ByteData.view(Uint8List.fromList(diffdata.sublist(0, 32)).buffer);
final int ctrllen = header.getInt64(8); final int ctrllen = header.getInt64(8);
final int datalen = header.getInt64(16); final int datalen = header.getInt64(16);
final int newsize = header.getInt64(24); final int newsize = header.getInt64(24);
final List<int> cpf = gzip.decoder.convert(diffdata.sublist(32, 32+ctrllen)); final List<int> cpf =
final List<int> dpf = gzip.decoder.convert(diffdata.sublist(32+ctrllen, 32+ctrllen+datalen)); gzip.decoder.convert(diffdata.sublist(32, 32 + ctrllen));
final List<int> epf = gzip.decoder.convert(diffdata.sublist(32+ctrllen+datalen, diffdata.length)); final List<int> dpf = gzip.decoder
.convert(diffdata.sublist(32 + ctrllen, 32 + ctrllen + datalen));
final List<int> epf = gzip.decoder
.convert(diffdata.sublist(32 + ctrllen + datalen, diffdata.length));
final ByteData cpfdata = ByteData.view(Uint8List.fromList(cpf).buffer); final ByteData cpfdata = ByteData.view(Uint8List.fromList(cpf).buffer);