cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Kotikov (JIRA)" <>
Subject [jira] [Reopened] (CB-11044) files modified by after_prepare hook are reverted
Date Fri, 08 Apr 2016 06:47:25 GMT


Vladimir Kotikov reopened CB-11044:
      Assignee: Vladimir Kotikov

> files modified by after_prepare hook are reverted
> -------------------------------------------------
>                 Key: CB-11044
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, iOS
>    Affects Versions: 5.4.0, 6.0.0, 5.4.1, 6.0.1, 6.1.0, 6.1.1
>         Environment: OSX 10.11.4, also happens in Greenhouse CI tool
>            Reporter: Grant Patterson
>            Assignee: Vladimir Kotikov
> I have a hook that uses the {{fs}} module functions {{readFileSync}} and {{writeFileSync}}
to modify files in the platforms/ directory. I'm using a hook only barely modified from {{020_replace_text.js}}
in these examples, to which the most recent Cordova documentation links:
> The CLI command I use is {{cordova run ios}} (also android)
> It all works fine in Cordova 5.3.3, but starting with 5.4.0 the hook *thinks* it wrote
the file properly, and I can re-{{readFileSync}} to confirm this, but the write does not appear
to stick. When the build is over, the file has reverted to its pre-hook state and the built
app does not have the change.
> I have tried wrapping my hook in:
> {{module.exports = function(context) {}}
> as the documentation suggests. I also moved the hook to scripts/ and tried referencing
it in config.xml, since the hooks/ directory is deprecated. None of these seem to make any
difference. It seems that anything in the www/ directory has this issue, as well as platforms/android/AndroidManifest.xml.
>  If I write to a new file in the same directory, the file does not persist, so it must
be the whole directory that's being overwritten. If I raise an exception in the hook, the
build fails and the file remains properly modified. So it's definitely something after this
hook executes that undoes it.
> Interesting development: It's something to do with my plugins; it doesn't happen in a
small sample project. I use {{<plugin>}} entries in config.xml to define which plugins
should be installed. When I delete these entries—without actually removing any of the plugins!—this
issue doesn't happen.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message