cordova-cli icon indicating copy to clipboard operation
cordova-cli copied to clipboard

cordova plugin add --link ../plugin/ does not provide a cohesive local plugin workflow

Open shamilovtim opened this issue 6 years ago • 5 comments

Bug Report

Problem

Currently to re-compile the *.js of a local plugin the following chain of commands needs to performed:

cordova plugin rm cordova-plugin-name && cordova plugin add --link ../plugin

It seems that while the native files are symlinked properly, there is a compilation step to the plugin *.js code that doesn't occur with neither build or prepare or compile. This requires repeatedly adding and removing plugins when changes are made to *.js code.

What is expected to happen?

Symlinking plus compilation (build) should provide an all in one solution for local plugin development.

What does actually happen?

When .js files are changed the changes do not reflect in an *.xcworkspace project. To make the *.js changes reflect, the plugin needs to be rm and then add -link /plugin/ again.

Information

My particular plugin uses Cordova-iOS 5, CocoaPods and xCode .xcworkspace workflow.

Environment, Platform, Device

CLI xCode 11.2 iPhone X Emulator

Version information

"cordova-ios": "^5.1.1" "cordova-lib":@9.0.1 xCode 11.2 iPhone X Emulator

Checklist

  • [X] I searched for existing GitHub issues
  • [X] I updated all Cordova tooling to most recent version
  • [X] I included all the necessary information above

shamilovtim avatar Dec 23 '19 22:12 shamilovtim

with regard to #347 my symlinks seem to look and work fine so that's not what's at issue here. the main issue is that whatever happens in the plugin *.js does not reflect after a build without adding and removing the plugin. the question is, why isn't build performing the proper compilation steps and moving the plugin's *.js wherever it needs to go?

shamilovtim avatar Dec 23 '19 22:12 shamilovtim

in addition to what i've described, java symlinks break Gradle.

there's no (functioning) --force option so removing and adding a plugin is necessary

shamilovtim avatar Dec 25 '19 19:12 shamilovtim

doesn't seem to bother ~building~ copying changes for platform specific plugin code either

e.g. I update .java file in symlinked plugin dir, do a build but code in ./platform/android/etc is unchanged

Using ionic so the following works for me as a workaround.

$  rm -rf platforms/ && ionic cordova build android

p-m-j avatar Jun 17 '20 12:06 p-m-j

Still a problem using "cordova-android": "~9.0.0".

While it may just have been yarn & Cordova (npm) fighting it out, but I found it was even better to avoid cordova plugin add --link ../new_plugin and just do ln -s ../new_plugin plugins/new_plugin overtop of anything there.

Then every change I make (So tedious), follow @rustybox https://github.com/apache/cordova-cli/issues/497#issuecomment-645343601

zmoshansky avatar Jun 30 '21 23:06 zmoshansky

Same issue where --link didn't work for me. I did it manually as described above and that helped. As I'm not using ionic, this is my current workflow for each change:

cordova platform remove android && cordova platform add android && cordova build

Skyedra avatar Aug 24 '23 22:08 Skyedra