cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jongmin Ye (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-11258) iOS project.pbxproj file is overwritten after the after-plugin-install hook
Date Tue, 18 Jul 2017 20:04:00 GMT

    [ https://issues.apache.org/jira/browse/CB-11258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16092093#comment-16092093
] 

Jongmin Ye commented on CB-11258:
---------------------------------

Hello.

I found this issue on google, so I joined to let you know this is reproducible.
I am doubting what I did is correct way because I am newbie, so I wrote all I did.

# create project. 
<pre>
cordova create testProject ...
</pre>
# add plugins and ios platform
<pre>
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-whitelist
cordova platform add ios
</pre>
# add after_plugin_install hook to cordova-plugin-statusbar
<pre>
//add following line to {PROJ_HOME}/plugins/cordova-plugin-statusbar/plugin.xml
<hook type="after_plugin_install" src="hooks/after_plugin_install.js" />
//open {PROJ_HOME}/plugins/cordova-plugin-statusbar/hooks/after_plugin_install.js file and
paste below codes.
module.exports = function(context) {
    var fs = require('fs');
    var xcode = context.requireCordovaModule('xcode');
    var util = context.requireCordovaModule('cordova-lib/src/cordova/util');
    var ConfigParser = context.requireCordovaModule('cordova-lib/src/configparser/ConfigParser');
    var projectName = new ConfigParser(util.projectConfig(util.isCordova())).name();
    var projectPath = './platforms/ios/' + projectName + '.xcodeproj/project.pbxproj';
    var myProj = xcode.project(projectPath);
    myProj.parseSync();
    myProj.updateBuildProperty('ENABLE_BITCODE', 'NO');
    fs.writeFileSync(projectPath, myProj.writeSync());
    console.log('✔ BITCODE disable');
};
</pre>
# remove and add ios platform
<pre>
cordova platform rm ios
cordova platform add ios
</pre>
# Then, you will find there is no `ENABLE_BITCODE` in the project.pbxproj file.

I think only last installed plugin's project.pbxproj modification is not overwritten.
If I move  above hook to cordova-plugin-whitelist, it works.

here is env. 

cordova cli version: 7.0.1
cordova-plugin-statusbar: 2.2.3
cordova-plugin-whitelist: 1.3.2 

If you need further info or I am doing wrong, please let me know.

> iOS project.pbxproj file is overwritten after the after-plugin-install hook
> ---------------------------------------------------------------------------
>
>                 Key: CB-11258
>                 URL: https://issues.apache.org/jira/browse/CB-11258
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios
>            Reporter: Edna Morales
>              Labels: cannot-reproduce
>
> Changes to the project.pbx file made in an after-plugin-install hook get overwritten
after the hook script runs. Specifically it happens when you add the plugin first and then
the iOS platform. If done with the platform first and then the plugin, the changes remain.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message