[
https://issues.apache.org/jira/browse/CB-6414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13963640#comment-13963640
]
ASF GitHub Bot commented on CB-6414:
------------------------------------
Github user kamrik commented on the pull request:
https://github.com/apache/cordova-plugman/pull/72#issuecomment-39915727
Looks like the root of the problem is in config_keeper. The files there are
identified by the "fake path" [see note], so when the same file is referenced
as "config.xml" and "res/xml/config.xml", config keeper considers them to be
two different files and changes for one of them get overwritten by the changes
to the other.
I think it would be better to solve the problem in config_keeper rather
than here, otherwise we might hit it again later with another file that might
get referenced as two different names.
Maybe we could even go a level higher and avoid referring to the same file
by two different names when generating the munge.
Anyway, if you decide to go with the current solution, please add a commend
about what it does. Otherwise it is very cryptic.
[note]
Fake path is constructed as project_root/file_name. It is used because
deducing the full real path requires globbing which is very slow (tens of
milliseconds in some cases). The assumption was that the same file will alway
be referred to with the same file_name in the munges. This assumption is broken
in this case.
> Cordova plugman will ignore config_munge features for config.xml if two are
> listed in plugin.xml
> ------------------------------------------------------------------------------------------------
>
> Key: CB-6414
> URL: https://issues.apache.org/jira/browse/CB-6414
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugman
> Affects Versions: 3.4.0
> Environment: Android
> Reporter: Josh Bavari
> Assignee: Josh Bavari
> Priority: Minor
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> When using a phonegap plugin like the Facebook Connect plugin, there are two
> series of listed config transforms, as such:
> The <config-file> element,
> <config-file target="config.xml" parent="/*">
> <access origin="https://m.facebook.com" />
> <access origin="https://graph.facebook.com" />
> <access origin="https://api.facebook.com" />
> <access origin="https://*.fbcdn.net" />
> <access origin="https://*.akamaihd.net" />
> </config-file>
> As well as the transform for Android:
> <config-file target="config.xml" parent="/*">
> <feature name="FacebookConnectPlugin">
> <param name="android-package"
> value="org.apache.cordova.facebook.ConnectPlugin" />
> </feature>
> </config-file>
> Which after running 'cordova prepare android':
> "config_munge": {
> "res/xml/config.xml": {
> "/*": {
> "<feature name=\"Camera\"><param name=\"android-package\"
> value=\"org.apache.cordova.camera.CameraLauncher\" /></feature>": 1,
> "<feature name=\"Contacts\"><param name=\"android-package\"
> value=\"org.apache.cordova.contacts.ContactManager\" /></feature>": 1,
> "<feature name=\"Device\"><param name=\"android-package\"
> value=\"org.apache.cordova.device.Device\" /></feature>": 1,
> "<feature name=\"Notification\"><param
> name=\"android-package\" value=\"org.apache.cordova.dialogs.Notification\"
> /></feature>": 1,
> "<feature name=\"File\"><param name=\"android-package\"
> value=\"org.apache.cordova.file.FileUtils\" /><param name=\"onload\"
> value=\"true\" /></feature>": 1,
> "<feature name=\"FileTransfer\"><param
> name=\"android-package\"
> value=\"org.apache.cordova.filetransfer.FileTransfer\" /></feature>": 1,
> "<feature name=\"Geolocation\"><param
> name=\"android-package\" value=\"org.apache.cordova.geolocation.GeoBroker\"
> /></feature>": 1,
> "<feature name=\"InAppBrowser\"><param
> name=\"android-package\"
> value=\"org.apache.cordova.inappbrowser.InAppBrowser\" /></feature>": 1,
> "<feature name=\"Media\"><param name=\"android-package\"
> value=\"org.apache.cordova.media.AudioHandler\" /></feature>": 1,
> "<feature name=\"Capture\"><param name=\"android-package\"
> value=\"org.apache.cordova.mediacapture.Capture\" /></feature>": 1,
> "<feature name=\"NetworkStatus\"><param
> name=\"android-package\"
> value=\"org.apache.cordova.networkinformation.NetworkManager\" /></feature>":
> 1,
> "<feature name=\"SplashScreen\"><param
> name=\"android-package\"
> value=\"org.apache.cordova.splashscreen.SplashScreen\" /></feature>": 1
> }
> },
> "AndroidManifest.xml": {
> "/*": {
> "<uses-permission
> android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />": 5,
> "<uses-permission
> android:name=\"android.permission.READ_CONTACTS\" />": 1,
> "<uses-permission
> android:name=\"android.permission.WRITE_CONTACTS\" />": 1,
> "<uses-permission
> android:name=\"android.permission.GET_ACCOUNTS\" />": 1,
> "<uses-permission
> android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />": 1,
> "<uses-permission
> android:name=\"android.permission.ACCESS_FINE_LOCATION\" />": 1,
> "<uses-permission
> android:name=\"android.permission.RECORD_AUDIO\" />": 2,
> "<uses-permission
> android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" />": 1,
> "<uses-permission
> android:name=\"android.permission.READ_PHONE_STATE\" />": 1,
> "<uses-permission
> android:name=\"android.permission.RECORD_VIDEO\" />": 1,
> "<uses-permission
> android:name=\"android.permission.ACCESS_NETWORK_STATE\" />": 1
> },
> "application": {
> "<meta-data android:name=\"com.facebook.sdk.ApplicationId\"
> android:value=\"@string/fb_app_id\" />": 1,
> "<activity android:label=\"@string/fb_app_name\"
> android:name=\"com.facebook.LoginActivity\" />": 1
> }
> },
> "res/values/facebookconnect.xml": {
> "/*": {
> "<string name=\"fb_app_id\">448</string>": 1,
> "<string name=\"fb_app_name\">RaiseMore</string>": 1
> }
> },
> "config.xml": {
> "/*": {
> "<access origin=\"https://m.facebook.com\" />": 1,
> "<access origin=\"https://graph.facebook.com\" />": 1,
> "<access origin=\"https://api.facebook.com\" />": 1,
> "<access origin=\"https://*.fbcdn.net\" />": 1,
> "<access origin=\"https://*.akamaihd.net\" />": 1,
> "<feature name=\"FacebookConnectPlugin\"><param
> name=\"android-package\" value=\"org.apache.cordova.facebook.ConnectPlugin\"
> /></feature>": 1
> }
> }
> },
> Which then leads to the final config.xml that only has the config munge from
> the facebook plugin:
> <?xml version='1.0' encoding='utf-8'?>
> <widget id="io.cordova.hellocordova" version="0.0.1"
> xmlns="http://www.w3.org/ns/widgets"
> xmlns:cdv="http://cordova.apache.org/ns/1.0">
> <preference name="loglevel" value="DEBUG" />
> <feature name="App">
> <param name="android-package" value="org.apache.cordova.App" />
> </feature>
> <access origin="https://m.facebook.com" />
> <access origin="https://graph.facebook.com" />
> <access origin="https://api.facebook.com" />
> <access origin="https://*.fbcdn.net" />
> <access origin="https://*.akamaihd.net" />
> <feature name="FacebookConnectPlugin">
> <param name="android-package"
> value="org.apache.cordova.facebook.ConnectPlugin" />
> </feature>
> <name>HelloCordova</name>
> <description>
> A sample Apache Cordova application that responds to the deviceready
> event.
> </description>
> <author email="[email protected]" href="http://cordova.io">
> Apache Cordova Team
> </author>
> <content src="index.html" />
> <access origin="*" />
> <preference name="Orientation" value="landscape" />
> </widget>
--
This message was sent by Atlassian JIRA
(v6.2#6252)