Skip to content

Native source code and a Podfile without a plugin #4282

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 9 commits into from
Jan 17, 2019

Conversation

tdermendjiev
Copy link
Contributor

PR Checklist

What is the current behavior?

Native source code files are included to the XCode project only when they are in plugins. Podfiles as well.

What is the new behavior?

Podfile and source files added in App_Resources/iOS will be included as well.

Implements #3807 .

if (!this.$fs.exists(pluginPodFilePath)) {
public async applyPodfileToProject(moduleName: string, podfilePath: string, projectData: IProjectData, nativeProjectPath: string): Promise<void> {
if (!this.$fs.exists(podfilePath)) {
if (podfilePath === projectData.podfilePath) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this check?

@@ -771,20 +771,27 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
this.$logger.trace(`Images to remove from xcode project: ${imagesToRemove.join(", ")}`);
_.each(imagesToRemove, image => project.removeResourceFile(path.join(this.getAppResourcesDestinationDirectoryPath(projectData), image)));

await this.prepareNativeSourceCode("src", path.join(projectData.appDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, "src"), projectData);
Copy link
Contributor

Choose a reason for hiding this comment

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

We could extract some "src" constants.

jibon57 added a commit to jibon57/nativescript-braintree that referenced this pull request Jan 11, 2019
@@ -409,7 +410,7 @@ interface IPlatformProjectService extends NodeJS.EventEmitter, IPlatformProjectS
getAppResourcesDestinationDirectoryPath(projectData: IProjectData): string;

cleanDeviceTempFolder(deviceIdentifier: string, projectData: IProjectData): Promise<void>;
processConfigurationFilesFromAppResources(release: boolean, projectData: IProjectData): Promise<void>;
processConfigurationFilesFromAppResources(release: boolean, projectData: IProjectData, installPods: 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.

processConfigurationFilesFromAppResources(projectData: IProjectData, opts: { release: boolean,  installPods: boolean }): Promise<void>;


if (this.$fs.exists(pluginPodfilePath) && this.$fs.exists(this.getProjectPodfilePath(projectRoot))) {
if ((this.$fs.exists(podfilePath) || podfilePath === projectData.podfilePath) && this.$fs.exists(this.getProjectPodfilePath(projectRoot))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should'n we unify the behavior for plugin's pod file and pod file from App_Resources?

@@ -771,20 +771,27 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
this.$logger.trace(`Images to remove from xcode project: ${imagesToRemove.join(", ")}`);
_.each(imagesToRemove, image => project.removeResourceFile(path.join(this.getAppResourcesDestinationDirectoryPath(projectData), image)));

await this.prepareNativeSourceCode("src", path.join(projectData.appDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, "src"), projectData);
Copy link
Contributor

Choose a reason for hiding this comment

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

In case when the project has .nsconfig file, this code will not be correct

path.join(projectData.appDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME)

You should use projectData.getAppResourcesDirectoryPath()

@@ -0,0 +1,98 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

you should not commit this file

Copy link
Contributor

@Fatme Fatme left a comment

Choose a reason for hiding this comment

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

After green build

@Fatme
Copy link
Contributor

Fatme commented Jan 17, 2019

run ci

@Fatme Fatme merged commit 98558ff into master Jan 17, 2019
@Fatme Fatme deleted the tdermendzhiev/native-source-code-without-plugin branch January 17, 2019 15:09
@farfromrefug
Copy link
Contributor

would this work for modules too? i mean i would love to be able to drop sources directly in my module folder (platforms/ios/src for example) and have them being picked up during module build without the need to have a XCode project or a android studio project.

@tdermendjiev
Copy link
Contributor Author

@farfromrefug Yes, it works.

@farfromrefug
Copy link
Contributor

@tdermendjiev awesome will try asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants