Summary: title

Reviewed By: Nekitosss

Differential Revision: D37378378

fbshipit-source-id: f1e060d487def18470a8c39b2578a13037f68bd2
This commit is contained in:
Johnny Souza 2022-06-27 14:06:04 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 26ca040dd3
Коммит 5ff9d1ea64
4 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -76,11 +76,11 @@ typedef NS_ENUM(NSUInteger, FBCompressionFormat) {
/**
Creates a gzipped archive compressing the data provided.
@param data the data to be compressed.
@param input the data to be compressed.
@param logger the logger to log to.
@return a Future wrapping the archive data.
*/
+ (FBFuture<FBProcess<NSData *, NSData *, id> *> *)createGzipDataFromData:(NSData *)data logger:(id<FBControlCoreLogger>)logger;
+ (FBFuture<FBProcess<id, NSData *, id> *> *)createGzipDataFromProcessInput:(FBProcessInput *)input logger:(id<FBControlCoreLogger>)logger;
/**
Creates a gzips archive, returning an task that has an NSInputStream attached to stdout.

Просмотреть файл

@ -70,12 +70,13 @@ static NSString *const BSDTarPath = @"/usr/bin/bsdtar";
start];
}
+ (FBFuture<FBProcess<NSData *, NSData *, id> *> *)createGzipDataFromData:(NSData *)data logger:(id<FBControlCoreLogger>)logger
+ (FBFuture<FBProcess<id, NSData *, id> *> *)createGzipDataFromProcessInput:(FBProcessInput *)input logger:(id<FBControlCoreLogger>)logger
{
return (FBFuture<FBProcess<NSData *, NSData *, id> *> *) [[[[[[[FBProcessBuilder
return (FBFuture<FBProcess<id, NSData *, id> *> *) [[[[[[[FBProcessBuilder
withLaunchPath:@"/usr/bin/gzip"]
withArguments:@[@"-", @"--to-stdout"]]
withStdInFromData:data]
withStdIn:input]
withStdErrToLoggerAndErrorMessage:logger]
withStdOutInMemoryAsData]
withTaskLifecycleLoggingTo:logger]
@ -83,6 +84,7 @@ static NSString *const BSDTarPath = @"/usr/bin/bsdtar";
];
}
+ (FBFuture<FBProcess<NSNull *, NSInputStream *, id> *> *)createGzippedTarForPath:(NSString *)path logger:(id<FBControlCoreLogger>)logger
{
NSError *error = nil;

Просмотреть файл

@ -435,7 +435,7 @@
case FBCodeCoverageExported:
return [[self getCoverageDataExported]
onQueue:self.queue fmap:^FBFuture<NSNull *> *(NSData *coverageData) {
return [[FBArchiveOperations createGzipDataFromData:coverageData logger:self.logger]
return [[FBArchiveOperations createGzipDataFromProcessInput:[FBProcessInput inputFromData:coverageData] logger:self.logger]
onQueue:self.queue map:^NSData *(FBProcess<NSData *,NSData *,id> *task) {
return task.stdOut;
}];

Просмотреть файл

@ -340,7 +340,7 @@ extension IDBXCTestReporter {
switch config.format {
case .exported:
let data = try await getCoverageDataExported(config: config)
let archived = try await BridgeFuture.value(FBArchiveOperations.createGzipData(from: data, logger: logger))
let archived = try await BridgeFuture.value(FBArchiveOperations.createGzipData(from: FBProcessInput(from: data), logger: logger))
let archivedData = archived.stdOut ?? NSData()
return archivedData as Data