cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Jamin" <t.ja...@jamin-tannert.de>
Subject AW: Contribution: <lib-file> support for WP7 and WP8
Date Thu, 20 Mar 2014 12:51:02 GMT
Hello Sergey,

that does not work. <framework> is only allowed for iPhone and has another
intention. Do you not agree that <lib-file> is predestined to add a lib? I
think the name stands on its own and is very meaningful. If I understand the
android.js implementation of <lib-file> right <lib-file> works for android
as I want it to work for WP7/8.

I am curious about your opinion.

Best regarts,

Tobias

-----Ursprüngliche Nachricht-----
Von: Sergey Grebnov (Akvelon) [mailto:v-segreb@microsoft.com] 
Gesendet: Donnerstag, 20. März 2014 13:13
An: dev@cordova.apache.org
Betreff: RE: Contribution: <lib-file> support for WP7 and WP8

Greetings Tobias,

Thank you for your code but it seems we already have <framework> tag support
for this on WP7/8. Please let me know if it works for you
https://github.com/apache/cordova-plugman/blob/master/src/platforms/wp8.js#L
87

<framework src="src\wp8\MyReference.dll" custom="true"/>

<lib-file> has different meaning and is used to add SDKReference
https://github.com/apache/cordova-plugman/blob/master/src/platforms/windows8
.js#L87 
https://github.com/apache/cordova-plugman/blob/master/src/util/w8jsproj.js#L
35 

Thx!
Sergey
-----Original Message-----
From: Tobias Jamin [mailto:t.jamin@jamin-tannert.de] 
Sent: Thursday, March 20, 2014 3:56 PM
To: dev@cordova.apache.org
Subject: Contribution: <lib-file> support for WP7 and WP8

Hi Cordova devs,

while writing my first cordova plugin for Windows Phone I noticed the
missing support for <lib-file> for the WP7/WP8 Platforms. The solution is so
damn easy and I would be glad if you take my solution into the cordova code.
The implementation for <lib-file> for WP is very similar to the
implementation of <source-file>. The only difference is the invocation of
addReference instead of addSourceFile (and removeReference instead of
removeSourceFile).

FILE:
plugman\src\platforms\wp8.js

OLD CODE:
    "lib-file": {
        install:function(source_el, plugin_dir, project_dir, plugin_id) {
            require('../../plugman').emit('verbose', 'lib-file.install is
not supported for wp8');
        },
        uninstall:function(source_el, project_dir, plugin_id) {
            require('../../plugman').emit('verbose', 'lib-file.uninstall is
not supported for wp8');
        }
    }

NEW CODE:
    "lib-file": {
        install:function(lib_el, plugin_dir, project_dir, plugin_id,
project_file) {
            var dest = path.join('Plugins', plugin_id,
lib_el.attrib['target-dir'] ? lib_el.attrib['target-dir'] : '',
path.basename(lib_el.attrib['src']));
            var target_path = common.resolveTargetPath(project_dir, dest);
            if (fs.existsSync(target_path)) throw new Error('"' +
target_path + '" already exists!');
            common.copyFile(plugin_dir, lib_el.attrib['src'], project_dir,
dest);
            // add reference to this file to csproj.
            project_file.addReference(dest);
        },
        uninstall:function(lib_el, project_dir, plugin_id, project_file) {
            var dest = path.join('Plugins', plugin_id,
lib_el.attrib['target-dir'] ? lib_el.attrib['target-dir'] : '',
path.basename(lib_el.attrib['src']));
            common.removeFile(project_dir, dest);
            // remove reference to this file from csproj.
            project_file.removeReference(dest);
        }
    }

The implementation for WP7 is exactly the same as for WP8.

Greetings from Germany,

Tobias Jamin





Mime
View raw message