Skip to content
Open
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
8 changes: 6 additions & 2 deletions lib/services/bundler/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ declare global {
}

interface IPlatformProjectService
extends NodeJS.EventEmitter,
IPlatformProjectServiceBase {
extends NodeJS.EventEmitter, IPlatformProjectServiceBase {
getPlatformData(projectData: IProjectData): IPlatformData;
validate(
projectData: IProjectData,
Expand Down Expand Up @@ -153,6 +152,11 @@ declare global {
options?: any,
): Promise<void>;

shouldRepreparePlugin?(
pluginData: IPluginData,
projectData: IProjectData,
): boolean;

/**
* Removes native code of a plugin (CocoaPods, jars, libs, src).
* @param {IPluginData} Plugins data describing the plugin which should be cleaned.
Expand Down
50 changes: 49 additions & 1 deletion lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const getConfigurationName = (release: boolean): string => {
return release ? Configurations.Release : Configurations.Debug;
};

export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase {
export class IOSProjectService
extends projectServiceBaseLib.PlatformProjectServiceBase
{
private static IOS_PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
private static IOS_PLATFORM_NAME = "ios";

Expand Down Expand Up @@ -1164,6 +1166,52 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
);
}

public shouldRepreparePlugin(
pluginData: IPluginData,
projectData: IProjectData,
): boolean {
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(
IOSProjectService.IOS_PLATFORM_NAME,
);

for (const fileName of this.getAllLibsForPluginWithFileExtension(
pluginData,
".a",
)) {
const staticLibPath = path.join(pluginPlatformsFolderPath, fileName);
const libraryName = path.basename(staticLibPath, ".a");
const headersSubpath = path.join(
path.dirname(staticLibPath),
"include",
libraryName,
);

if (!this.$fs.exists(headersSubpath)) {
continue;
}

const headerFiles = this.$fs
.readDirectory(headersSubpath)
.filter(
(f) =>
path.extname(f) === ".h" &&
this.$fs.getFsStats(path.join(headersSubpath, f)).isFile(),
);

if (
headerFiles.length > 0 &&
!this.$fs.exists(path.join(headersSubpath, "module.modulemap"))
) {
this.$logger.trace(
`Plugin ${pluginData.name}: modulemap missing at ${headersSubpath}, will re-prepare`,
);
return true;
}
}

return false;
}

public async removePluginNativeCode(
pluginData: IPluginData,
projectData: IProjectData,
Expand Down
Loading
Loading