cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CB-6481) Add unified hooks support for cordova app and plugins
Date Mon, 11 Aug 2014 17:14:12 GMT


ASF GitHub Bot commented on CB-6481:

Github user kamrik commented on the pull request:
    Unfortunately utils.js knows nothing about the project, it re-reads all the info from
file system on each call. This results in lots of cases of re-parsing of config files or re-listing
the same dirs over and over again. On top of that we add some caching, which then results
in weird cache-invalidation bugs.
    As I see it, CordovaProject instance should be created by the CLI (or by any other consumer
of cordova-lib) exactly once per process invocation, and then passed around to be available
to almost any cordova-lib function.
        // Along the lines of
        var cordovaProject = new cordova_lib.CordovaProject(rootDir, ?)
        cordovaProject.verbose = args.verbose  // etc.
        cordova.platform(cordovaProject, 'add', ['android'])
        // Or even
        crodovaProject.platform('add', ['android'])
        // And then inside cordova-lib we use
        hooksRunner = new HooksRunner(cordovaProject);
    In most places where we pass projectRoot, it should be replaced by cordovaProject. Or
have it accessible as either "this" (e.t. in "create()") or "this.cordovaProject" (e.g. in
HooksRunner methods).

> Add unified hooks support for cordova app and plugins
> -----------------------------------------------------
>                 Key: CB-6481
>                 URL:
>             Project: Apache Cordova
>          Issue Type: New Feature
>          Components: CLI, Plugman
>            Reporter: Sergey Grebnov
>            Assignee: Sergey Grebnov
> As per "Proposal: hooks support for plugins" dev mail thread discussion
> Hi, I have an idea how we can add more flexibility to plugin developers.
> Note, right now we have Application Developers – someone who use Cordova for developing
applications and Plugin Developers – someone who creates plugins so that Application Developers
can use them. For Application Developers we expose  hooks so that they can customize their
build/package/etc process. I want us to provide similar sort of flexibility to Plugin Developers
so that they can go beyond of <source/>, <framework/>  tags and get mechanism
to add custom installation,  build logic required by a plugin. Example usage will include:
downloading/compiling additional binaries, marking source file to be copied to output dir,
changing target build platform,  etc. At present time the steps described could be only achieved
by hooks manually added by Application Developer, but the right way is to allow Plugin Developer
to expose this as part of plugin definition.
> Example configuration could look like
> ```
> <script type="postinstall" src="scripts/postinstall.js" />
> <script type="preinstall" src="scripts/preinstall.js" />
> <script type="install" src="scripts/install.js" />
> ```
> beforeinstall/preinstall – run before plugin is installed
> install/postinstall/afterinstall – run after plugin is installed
> uninstall – run after plugin is uninstalled

This message was sent by Atlassian JIRA

View raw message