Skip to content

added beforePrepareAllPlugins #1889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/definitions/plugins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface IPluginsService {
getAllInstalledPlugins(): IFuture<IPluginData[]>;
ensureAllDependenciesAreInstalled(): IFuture<void>;
afterPrepareAllPlugins(): IFuture<void>;
beforePrepareAllPlugins(): IFuture<void>;
getDependenciesFromPackageJson(): IFuture<IPackageJsonDepedenciesResult>
}

Expand Down
1 change: 1 addition & 0 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ interface IPlatformProjectService {
preparePluginNativeCode(pluginData: IPluginData, options?: any): IFuture<void>;
removePluginNativeCode(pluginData: IPluginData): IFuture<void>;
afterPrepareAllPlugins(): IFuture<void>;
beforePrepareAllPlugins(): IFuture<void>;
getAppResourcesDestinationDirectoryPath(): IFuture<string>;
deploy(deviceIdentifier: string): IFuture<void>;
processConfigurationFilesFromAppResources(): IFuture<void>;
Expand Down
4 changes: 4 additions & 0 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
}

public afterPrepareAllPlugins(): IFuture<void> {
return Future.fromResult();
}

public beforePrepareAllPlugins(): IFuture<void> {
let buildOptions = this.getBuildOptions();
buildOptions.unshift("clean");

Expand Down
4 changes: 4 additions & 0 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
}).future<void>()();
}

public beforePrepareAllPlugins(): IFuture<void> {
return Future.fromResult();
}

private getAllLibsForPluginWithFileExtension(pluginData: IPluginData, fileExtension: string): IFuture<string[]> {
let filterCallback = (fileName: string, pluginPlatformsFolderPath: string) => path.extname(fileName) === fileExtension;
return this.getAllNativeLibrariesForPlugin(pluginData, IOSProjectService.IOS_PLATFORM_NAME, filterCallback);
Expand Down
8 changes: 8 additions & 0 deletions lib/services/plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ export class PluginsService implements IPluginsService {
return this.executeForAllInstalledPlatforms(action);
}

public beforePrepareAllPlugins(): IFuture<void> {
let action = (pluginDestinationPath: string, platform: string, platformData: IPlatformData) => {
return platformData.platformProjectService.beforePrepareAllPlugins();
};

return this.executeForAllInstalledPlatforms(action);
}

public getDependenciesFromPackageJson(): IFuture<IPackageJsonDepedenciesResult> {
return (() => {
let packageJson = this.$fs.readJson(this.getPackageJsonFilePath()).wait();
Expand Down
4 changes: 4 additions & 0 deletions lib/tools/broccoli/node-modules-dest-copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class DestCopy implements IBroccoliPlugin {
}

public rebuildChangedDirectories(changedDirectories: string[], platform: string): void {

_.each(changedDirectories, changedDirectoryAbsolutePath => {
if (!this.devDependencies[path.basename(changedDirectoryAbsolutePath)]) {
let pathToPackageJson = path.join(changedDirectoryAbsolutePath, constants.PACKAGE_JSON_FILE_NAME);
Expand Down Expand Up @@ -68,6 +69,9 @@ export class DestCopy implements IBroccoliPlugin {
});
}
});
if (!_.isEmpty(this.dependencies)) {
this.$pluginsService.beforePrepareAllPlugins().wait();
}

_.each(this.dependencies, dependency => {
this.copyDependencyDir(dependency);
Expand Down
1 change: 1 addition & 0 deletions test/npm-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function setupProject(): IFuture<any> {
prepareProject: () => Future.fromResult(),
prepareAppResources: () => Future.fromResult(),
afterPrepareAllPlugins: () => Future.fromResult(),
beforePrepareAllPlugins: () => Future.fromResult(),
getAppResourcesDestinationDirectoryPath: () => Future.fromResult(""),
processConfigurationFilesFromAppResources: () => Future.fromResult(),
ensureConfigurationFileInAppResources: () => Future.fromResult(),
Expand Down
3 changes: 3 additions & 0 deletions test/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ export class PlatformProjectServiceStub implements IPlatformProjectService {
afterPrepareAllPlugins(): IFuture<void> {
return Future.fromResult();
}
beforePrepareAllPlugins(): IFuture<void> {
return Future.fromResult();
}
deploy(deviceIdentifier: string): IFuture<void> {
return Future.fromResult();
}
Expand Down