-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathplatform.d.ts
184 lines (159 loc) · 7.47 KB
/
platform.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
interface IPlatformService {
addPlatforms(platforms: string[]): IFuture<void>;
/**
* Gets list of all installed platforms (the ones for which <project dir>/platforms/<platform> exists).
* @returns {string[]} List of currently installed platforms.
*/
getInstalledPlatforms(): string[];
/**
* Gets a list of all platforms that can be used on current OS, but are not installed at the moment.
* @returns {string[]} List of all available platforms.
*/
getAvailablePlatforms(): string[];
/**
* Returns a list of all currently prepared platforms.
* @returns {string[]} List of all prepared platforms.
*/
getPreparedPlatforms(): string[];
/**
* Remove platforms from specified project (`<project dir>/platforms/<platform>` dir).
* @param {string[]} platforms Platforms to be removed.
* @returns {void}
*/
removePlatforms(platforms: string[]): void;
updatePlatforms(platforms: string[]): IFuture<void>;
/**
* Ensures that the specified platform and its dependencies are installed.
* When there are changes to be prepared, it prepares the native project for the specified platform.
* When finishes, prepare saves the .nsprepareinfo file in platform folder.
* This file contains information about current project configuration and allows skipping unnecessary build, deploy and livesync steps.
* @param {string} platform The platform to be prepared.
* @returns {boolean} true indicates that the platform was prepared.
*/
preparePlatform(platform: string, changesInfo?: IProjectChangesInfo): IFuture<boolean>;
/**
* Determines whether a build is necessary. A build is necessary when one of the following is true:
* - there is no previous build.
* - the .nsbuildinfo file in product folder points to an old prepare.
* @param {string} platform The platform to build.
* @param {IBuildConfig} buildConfig Indicates whether the build is for device or emulator.
* @returns {boolean} true indicates that the platform should be build.
*/
shouldBuild(platform: string, buildConfig?: IBuildConfig): IFuture<boolean>;
/**
* Builds the native project for the specified platform for device or emulator.
* When finishes, build saves the .nsbuildinfo file in platform product folder.
* This file points to the prepare that was used to build the project and allows skipping unnecessary builds and deploys.
* @param {string} platform The platform to build.
* @param {IBuildConfig} buildConfig Indicates whether the build is for device or emulator.
* @returns {void}
*/
buildPlatform(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
/**
* Determines whether installation is necessary. It is necessary when one of the following is true:
* - the application is not installed.
* - the .nsbuildinfo file located in application root folder is different than the local .nsbuildinfo file
* @param {Mobile.IDevice} device The device where the application should be installed.
* @returns {boolean} true indicates that the application should be installed.
*/
shouldInstall(device: Mobile.IDevice): boolean;
/**
* Installs the application on specified device.
* When finishes, saves .nsbuildinfo in application root folder to indicate the prepare that was used to build the app.
* * .nsbuildinfo is not persisted when building for release.
* @param {Mobile.IDevice} device The device where the application should be installed.
* @returns {void}
*/
installApplication(device: Mobile.IDevice): IFuture<void>;
/**
* Gets first chance to validate the options provided as command line arguments.
*/
validateOptions(platform: string): IFuture<boolean>;
/**
* Executes prepare, build and installOnPlatform when necessary to ensure that the latest version of the app is installed on specified platform.
* - When --clean option is specified it builds the app on every change. If not, build is executed only when there are native changes.
* @param {string} platform The platform to deploy.
* @param {boolean} forceInstall When true, installs the application unconditionally.
* @returns {void}
*/
deployPlatform(platform: string, forceInstall?: boolean): IFuture<void>;
/**
* Runs the application on specified platform. Assumes that the application is already build and installed. Fails if this is not true.
* @param {string} platform The platform where to start the application.
* @returns {void}
*/
runPlatform(platform: string): IFuture<void>;
/**
* The emulate command. In addition to `run --emulator` command, it handles the `--available-devices` option to show the available devices.
* @param {string} platform The platform to emulate.
* @returns {void}
*/
emulatePlatform(platform: string): IFuture<void>;
cleanDestinationApp(platform: string): IFuture<void>;
validatePlatformInstalled(platform: string): void;
validatePlatform(platform: string): void;
/**
* Returns information about the latest built application for device in the current project.
* @param {IPlatformData} platformData Data describing the current platform.
* @returns {IApplicationPackage} Information about latest built application.
*/
getLatestApplicationPackageForDevice(platformData: IPlatformData): IApplicationPackage;
/**
* Returns information about the latest built application for simulator in the current project.
* @param {IPlatformData} platformData Data describing the current platform.
* @returns {IApplicationPackage} Information about latest built application.
*/
getLatestApplicationPackageForEmulator(platformData: IPlatformData): IApplicationPackage;
/**
* Copies latest build output to a specified location.
* @param {string} platform Mobile platform - Android, iOS.
* @param {string} targetPath Destination where the build artifact should be copied.
* @param {{isForDevice: boolean}} settings Defines if the searched artifact should be for simulator.
* @returns {void}
*/
copyLastOutput(platform: string, targetPath: string, settings: {isForDevice: boolean}): void;
lastOutputPath(platform: string, settings: { isForDevice: boolean }): string;
/**
* Reads contents of a file on device.
* @param {Mobile.IDevice} device The device to read from.
* @param {string} deviceFilePath The file path.
* @returns {string} The contents of the file or null when there is no such file.
*/
readFile(device: Mobile.IDevice, deviceFilePath: string): IFuture<string>;
}
interface IPlatformData {
frameworkPackageName: string;
platformProjectService: IPlatformProjectService;
emulatorServices: Mobile.IEmulatorPlatformServices;
projectRoot: string;
normalizedPlatformName: string;
appDestinationDirectoryPath: string;
deviceBuildOutputPath: string;
emulatorBuildOutputPath?: string;
validPackageNamesForDevice: string[];
validPackageNamesForEmulator?: string[];
frameworkFilesExtensions: string[];
frameworkDirectoriesExtensions?: string[];
frameworkDirectoriesNames?: string[];
targetedOS?: string[];
configurationFileName?: string;
configurationFilePath?: string;
relativeToFrameworkConfigurationFilePath: string;
fastLivesyncFileExtensions: string[];
}
interface IPlatformsData {
availablePlatforms: any;
platformsNames: string[];
getPlatformData(platform: string): IPlatformData;
}
interface INodeModulesBuilder {
prepareNodeModules(absoluteOutputPath: string, platform: string, lastModifiedTime: Date): IFuture<void>;
cleanNodeModules(absoluteOutputPath: string, platform: string): void;
}
interface INodeModulesDependenciesBuilder {
getProductionDependencies(projectPath: string): void;
}
interface IBuildInfo {
prepareTime: string;
buildTime: string;
}