Skip to content

chore: remove installPods property from platform's project interface #4299

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 6 commits into from
Jan 30, 2019
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
2 changes: 1 addition & 1 deletion lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $injector.require("androidPluginBuildService", "./services/android-plugin-build-
$injector.require("iOSEntitlementsService", "./services/ios-entitlements-service");
$injector.require("iOSProjectService", "./services/ios-project-service");
$injector.require("iOSProvisionService", "./services/ios-provision-service");
$injector.require("xCConfigService", "./services/xcconfig-service");
$injector.require("xcconfigService", "./services/xcconfig-service");

$injector.require("cocoapodsService", "./services/cocoapods-service");

Expand Down
38 changes: 38 additions & 0 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,13 @@ interface IVerifyXcprojOptions {
* Designed for getting information about xcproj.
*/
interface IXcprojService {
/**
* Returns the path to the xcodeproj file
* @param projectData Information about the project.
* @param platformData Information about the platform.
* @return {string} The full path to the xcodeproj
*/
getXcodeprojPath(projectData: IProjectData, platformData: IPlatformData): string;
/**
* Checks whether the system needs xcproj to execute ios builds successfully.
* In case the system does need xcproj but does not have it, prints an error message.
Expand All @@ -856,6 +863,11 @@ interface IXcprojService {
* @return {Promise<XcprojInfo>} collected info about xcproj.
*/
getXcprojInfo(): Promise<IXcprojInfo>;
/**
* Checks if xcproj is available and throws an error in case when it is not available.
* @return {Promise<boolean>}
*/
checkIfXcodeprojIsRequired(): Promise<boolean>;
}

/**
Expand All @@ -880,6 +892,32 @@ interface IXcprojInfo {
xcprojAvailable: boolean;
}

interface IXcconfigService {
/**
* Returns the path to the xcconfig file
* @param projectRoot The path to root folder of native project (platforms/ios)
* @param opts
* @returns {string}
*/
getPluginsXcconfigFilePath(projectRoot: string, opts: IRelease): string;

/**
* Returns the value of a property from a xcconfig file.
* @param xcconfigFilePath The path to the xcconfig file
* @param propertyName The name of the property which value will be returned
* @returns {string}
*/
readPropertyValue(xcconfigFilePath: string, propertyName: string): string;

/**
* Merges the content of source file into destination file
* @param sourceFile The content of thes source file
* @param destinationFile The content of the destination file
* @returns {Promise<void>}
*/
mergeFiles(sourceFile: string, destinationFile: string): Promise<void>;
}

/**
* Describes helper used during execution of deploy commands.
*/
Expand Down
21 changes: 19 additions & 2 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,18 @@ interface IPlatformProjectService extends NodeJS.EventEmitter, IPlatformProjectS
*/
removePluginNativeCode(pluginData: IPluginData, projectData: IProjectData): Promise<void>;

afterPrepareAllPlugins(projectData: IProjectData): Promise<void>;
beforePrepareAllPlugins(projectData: IProjectData, dependencies?: IDependencyData[]): Promise<void>;

handleNativeDependenciesChange(projectData: IProjectData, opts: IRelease): Promise<void>;

/**
* Gets the path wheren App_Resources should be copied.
* @returns {string} Path to native project, where App_Resources should be copied.
*/
getAppResourcesDestinationDirectoryPath(projectData: IProjectData): string;

cleanDeviceTempFolder(deviceIdentifier: string, projectData: IProjectData): Promise<void>;
processConfigurationFilesFromAppResources(projectData: IProjectData, opts: { release: boolean, installPods: boolean }): Promise<void>;
processConfigurationFilesFromAppResources(projectData: IProjectData, opts: { release: boolean }): Promise<void>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opts: IRelease


/**
* Ensures there is configuration file (AndroidManifest.xml, Info.plist) in app/App_Resources.
Expand Down Expand Up @@ -483,6 +484,14 @@ interface ICocoaPodsService {
*/
getPodfileFooter(): string;

/**
* Merges the Podfile's content from App_Resources in the project's Podfile.
* @param projectData Information about the project.
* @param platformData Information about the platform.
* @returns {Promise<void>}
*/
applyPodfileFromAppResources(projectData: IProjectData, platformData: IPlatformData): Promise<void>;

/**
* Prepares the Podfile content of a plugin and merges it in the project's Podfile.
* @param {string} moduleName The module which the Podfile is from.
Expand Down Expand Up @@ -524,6 +533,14 @@ interface ICocoaPodsService {
* @returns {Promise<ISpawnResult>} Information about the spawned process.
*/
executePodInstall(projectRoot: string, xcodeProjPath: string): Promise<ISpawnResult>;

/**
* Merges pod's xcconfig file into project's xcconfig file
* @param projectData
* @param platformData
* @param opts
*/
mergePodXcconfigFile(projectData: IProjectData, platformData: IPlatformData, opts: IRelease): Promise<void>;
}

interface IRubyFunction {
Expand Down
8 changes: 4 additions & 4 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
}
}

public async afterPrepareAllPlugins(projectData: IProjectData): Promise<void> {
return;
}

public async beforePrepareAllPlugins(projectData: IProjectData, dependencies?: IDependencyData[]): Promise<void> {
const shouldUseNewRoutine = this.runtimeVersionIsGreaterThanOrEquals(projectData, "3.3.0");

Expand Down Expand Up @@ -609,6 +605,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
}
}

public async handleNativeDependenciesChange(projectData: IProjectData, opts: IRelease): Promise<void> {
return;
}

private filterUniqueDependencies(dependencies: IDependencyData[]): IDependencyData[] {
const depsDictionary = dependencies.reduce((dict, dep) => {
const collision = dict[dep.name];
Expand Down
25 changes: 23 additions & 2 deletions lib/services/cocoapods-service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EOL } from "os";
import * as path from "path";
import { PluginNativeDirNames, PODFILE_NAME } from "../constants";
import { PluginNativeDirNames, PODFILE_NAME, NS_BASE_PODFILE } from "../constants";

export class CocoaPodsService implements ICocoaPodsService {
private static PODFILE_POST_INSTALL_SECTION_NAME = "post_install";
Expand All @@ -11,7 +11,8 @@ export class CocoaPodsService implements ICocoaPodsService {
private $errors: IErrors,
private $xcprojService: IXcprojService,
private $logger: ILogger,
private $config: IConfiguration) { }
private $config: IConfiguration,
private $xcconfigService: IXcconfigService) { }

public getPodfileHeader(targetName: string): string {
return `use_frameworks!${EOL}${EOL}target "${targetName}" do${EOL}`;
Expand Down Expand Up @@ -52,6 +53,26 @@ export class CocoaPodsService implements ICocoaPodsService {
return podInstallResult;
}

public async mergePodXcconfigFile(projectData: IProjectData, platformData: IPlatformData, opts: IRelease) {
const podFilesRootDirName = path.join("Pods", "Target Support Files", `Pods-${projectData.projectName}`);
const podFolder = path.join(platformData.projectRoot, podFilesRootDirName);
if (this.$fs.exists(podFolder)) {
const podXcconfigFilePath = opts && opts.release ? path.join(podFolder, `Pods-${projectData.projectName}.release.xcconfig`)
: path.join(podFolder, `Pods-${projectData.projectName}.debug.xcconfig`);
const pluginsXcconfigFilePath = this.$xcconfigService.getPluginsXcconfigFilePath(platformData.projectRoot, opts);
await this.$xcconfigService.mergeFiles(podXcconfigFilePath, pluginsXcconfigFilePath);
}
}

public async applyPodfileFromAppResources(projectData: IProjectData, platformData: IPlatformData): Promise<void> {
const { projectRoot, normalizedPlatformName } = platformData;
const mainPodfilePath = path.join(projectData.appResourcesDirectoryPath, normalizedPlatformName, PODFILE_NAME);
const projectPodfilePath = this.getProjectPodfilePath(projectRoot);
if (this.$fs.exists(projectPodfilePath) || this.$fs.exists(mainPodfilePath)) {
await this.applyPodfileToProject(NS_BASE_PODFILE, mainPodfilePath, projectData, projectRoot);
}
}

public async applyPodfileToProject(moduleName: string, podfilePath: string, projectData: IProjectData, nativeProjectPath: string): Promise<void> {
if (!this.$fs.exists(podfilePath)) {
this.removePodfileFromProject(moduleName, podfilePath, projectData, nativeProjectPath);
Expand Down
Loading