|
| 1 | +/** |
| 2 | + * Copyright (c) 2015-present, Facebook, Inc. |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * This source code is licensed under the BSD-style license found in the |
| 6 | + * LICENSE file in the root directory of this source tree. An additional grant |
| 7 | + * of patent rights can be found in the PATENTS file in the same directory. |
| 8 | + */ |
| 9 | + |
| 10 | +#import <Foundation/Foundation.h> |
| 11 | + |
| 12 | +#import <FBControlCore/FBJSONConversion.h> |
| 13 | +#import <FBControlCore/FBDebugDescribeable.h> |
| 14 | + |
| 15 | +NS_ASSUME_NONNULL_BEGIN |
| 16 | + |
| 17 | +@class FBBinaryDescriptor; |
| 18 | + |
| 19 | +/** |
| 20 | + Concrete value wrapper around a Application artifact. |
| 21 | + */ |
| 22 | +@interface FBApplicationDescriptor : NSObject <NSCopying, NSCoding, FBJSONSerializable, FBDebugDescribeable> |
| 23 | + |
| 24 | +/** |
| 25 | + The Designated Initializer. |
| 26 | +
|
| 27 | + @param name the Name of the Application. See CFBundleName. Must not be nil. |
| 28 | + @param path The Path to the Application Bundle. Must not be nil. |
| 29 | + @param bundleID the Bundle ID of the Application. Must not be nil. |
| 30 | + @param binary the Path to the binary inside the Application. Must not be nil. |
| 31 | + @returns a new FBApplicationDescriptor instance. |
| 32 | + */ |
| 33 | +- (instancetype)initWithName:(NSString *)name path:(NSString *)path bundleID:(NSString *)bundleID binary:(FBBinaryDescriptor *)binary; |
| 34 | + |
| 35 | +/** |
| 36 | + An initializer for FBApplicationDescriptor that checks the nullability of the arguments |
| 37 | +
|
| 38 | + @param name the Name of the Application. See CFBundleName. Must not be nil. |
| 39 | + @param path The Path to the Application Bundle. May be nil. |
| 40 | + @param bundleID the Bundle ID of the Application. May be nil. |
| 41 | + @param binary the Path to the binary inside the Application. May be nil. |
| 42 | + @returns a new FBApplicationDescriptor instance, if all arguments are non-nil. Nil otherwise |
| 43 | + */ |
| 44 | ++ (nullable instancetype)withName:(NSString *)name path:(NSString *)path bundleID:(NSString *)bundleID binary:(FBBinaryDescriptor *)binary; |
| 45 | + |
| 46 | +/** |
| 47 | + The name of the Application. See CFBundleName. |
| 48 | + */ |
| 49 | +@property (nonatomic, copy, readonly) NSString *name; |
| 50 | + |
| 51 | +/** |
| 52 | + The File Path to the Application. |
| 53 | + */ |
| 54 | +@property (nonatomic, copy, readonly) NSString *path; |
| 55 | + |
| 56 | +/** |
| 57 | + The Bundle Identifier of the Application. See CFBundleIdentifier. |
| 58 | + */ |
| 59 | +@property (nonatomic, copy, readonly) NSString *bundleID; |
| 60 | + |
| 61 | +/** |
| 62 | + The Executable Binary contained within the Application's Bundle. |
| 63 | + */ |
| 64 | +@property (nonatomic, copy, readonly) FBBinaryDescriptor *binary; |
| 65 | + |
| 66 | +@end |
| 67 | + |
| 68 | +/** |
| 69 | + Conveniences for building FBApplicationDescriptor instances. |
| 70 | + */ |
| 71 | +@interface FBApplicationDescriptor (Helpers) |
| 72 | + |
| 73 | +/** |
| 74 | + Constructs a FBApplicationDescriptor for the Application at the given path. |
| 75 | +
|
| 76 | + @param path the path of the applocation to construct. |
| 77 | + @param error an error out. |
| 78 | + @returns a FBApplicationDescriptor instance if one could be constructed, nil otherwise. |
| 79 | + */ |
| 80 | ++ (nullable instancetype)applicationWithPath:(NSString *)path error:(NSError **)error; |
| 81 | + |
| 82 | +/** |
| 83 | + Returns the FBApplicationDescriptor for the current version of Xcode's Simulator.app. |
| 84 | + Will assert if the FBApplicationDescriptor instance could not be constructed. |
| 85 | +
|
| 86 | + @return A FBApplicationDescriptor instance for the Simulator.app. |
| 87 | + */ |
| 88 | ++ (instancetype)xcodeSimulator; |
| 89 | + |
| 90 | +/** |
| 91 | + Returns the System Application with the provided name. |
| 92 | +
|
| 93 | + @param appName the System Application to fetch. |
| 94 | + @param error any error that occurred in fetching the application. |
| 95 | + @returns FBApplicationDescriptor instance if one could for the given name could be found, nil otherwise. |
| 96 | + */ |
| 97 | ++ (nullable instancetype)systemApplicationNamed:(NSString *)appName error:(NSError **)error; |
| 98 | + |
| 99 | +@end |
| 100 | + |
| 101 | +NS_ASSUME_NONNULL_END |
0 commit comments