cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantanapr <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: CB-6481 Add unified hooks support for co...
Date Fri, 08 Aug 2014 13:40:57 GMT
Github user csantanapr commented on the pull request:

    https://github.com/apache/cordova-lib/pull/55#issuecomment-51601294
  
    @sgrebnov So far I have found one problem.
    When I have the hooks tags inside a platform, the second tag for "after_prepare" doesn't
work.
    This is because options.plugin get set in the Context.opts when calling "before_prepare"
affecting the search for scripts in "after_prepare"
    
    if the two tags are outside the <platform> tag then it finds the script, but inside
the <platform> tag it doesn't
    
    create a plugin.xml like this:
    
    You will notice that iosAfterPrepare.js never runs
    
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
            xmlns:android="http://schemas.android.com/apk/res/android"
            id="com.plugin.withhooks"
            version="0.0.1">
        <name>Plugin with hooks</name>
    
        <platform name="ios">
            <hook type="before_prepare" src="scripts/ios/iosBeforePrepare.js" />
            <hook type="after_prepare" src="scripts/ios/iosAfterPrepare.js" />
        </platform>
    
    </plugin>
    One way to fix it is doing a Copy in Context.js, and do a copy of opts, this way opts
can be use in other places without the chance of being modify.
    Here is a change I did:
     https://github.com/csantanapr/cordova-lib/commit/a0ef4ef172f8818c3bc770899dba5dbab06fa03e#diff-d41d8cd98f00b204e9800998ecf8427e
    
    This might be one, avoid modifying context and doing a copy of opts:
    https://github.com/MSOpenTech/cordova-lib/blob/CB-6481-hooks/cordova-lib/src/hooks/HooksRunner.js#L161
    
    
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message