GithubHelp home page GithubHelp logo

nordnet / cordova-hot-code-push-local-dev-addon Goto Github PK

View Code? Open in Web Editor NEW
24.0 7.0 31.0 159 KB

[DEPRECATED] - Cordova plugin that adds local development feature to the Hot Code Push plugin.

Home Page: https://github.com/nordnet/cordova-hot-code-push-local-dev-addon/issues/29

License: MIT License

JavaScript 15.70% Java 5.68% Objective-C 4.96% Swift 73.65%

cordova-hot-code-push-local-dev-addon's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-hot-code-push-local-dev-addon's Issues

Plugin does not work with [email protected]

I recently upgraded a project's cordova-android dependency from 5.2.2 to 7.1.1.

I discovered that 7.1.1 puts config.xml in a different place in the generated platforms/android folder.

I therefore modified our fork of this plugin to account for that. You can see the patch here:

NxtbookMedia@3e3d9a6

As you can see, I haven't bothered to keep backwards compatibility with older cordova-android versions because we don't need that at present.

Any interest in a PR?

If so, I assume it would need to maintain backwards compatibility with older cordova-android versions?

Not working on iOS with Cordova v6.3.1

Issue

I have been following the quick start guides to install this plugin, the server starts and gets notified when something changes but the app will not run in the ios simulator (starts and crashes).
In android it will run but not update.
I get errors in xcode:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/.../Library/Developer/CoreSimulator/Devices/3439EEE9-A925-46B0-99F8-3CC2451DABE1/data/Containers/Bundle/Application/38197BDC-E3E3-4A8D-993F-BB35F4A647B1/TestProject.app> (loaded)' with name 'NSMainNibFile~ipad''

With this pice of code highlighted

 @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }
Steps to reproduce
  1. Create a cordova/ionic 2 project
  2. Install both plugins and cli
  3. Follow quickstart guide
System info
Node version: v5.10.0

Cordova version: 6.3.1

Config.xml file:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.testproject" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>TestProject</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <plugin name="cordova-hot-code-push-local-dev-addon" spec="~0.2.2" />
    <chcp>
      <local-development enabled="true" />
    </chcp>
</widget>


Plugins:

cordova-hot-code-push-local-dev-addon,cordova-hot-code-push-plugin,cordova-plugin-whitelist

Android platform:

Available Android targets:
----------
id: 1 or "android-23"
     Name: Android 6.0
     Type: Platform
     API level: 23
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/x86, default/x86_64, google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
----------
id: 2 or "Google Inc.:Google APIs:23"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 6.0 (API level 23)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.

iOS platform:

Xcode 7.3
Build version 7D175

Reported by @Lindstrom1989.

Local server crash

Looks like lock is called incorrectly or is buggy. Stack trace:

Should trigger reload for build: 2017.08.04-17.38.45
a user connected
/usr/local/lib/node_modules/cordova-hot-code-push-cli/node_modules/lock/index.js:18
    var i = locked[key].indexOf(exec) //should usually be 0
                       ^

TypeError: Cannot read property 'indexOf' of undefined
    at _release (/usr/local/lib/node_modules/cordova-hot-code-push-cli/node_modules/lock/index.js:18:24)
    at /usr/local/lib/node_modules/cordova-hot-code-push-cli/node_modules/lock/index.js:11:7
    at Socket.<anonymous> (/usr/local/lib/node_modules/cordova-hot-code-push-cli/node_modules/ngrok/index.js:104:10)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at Pipe.onread (net.js:523:20)
[17:41:35] 'serve:apps-server' errored after 3.88 min
[17:41:35] Error: Command `cordova-hcp server` failed with exit code 1
    at ChildProcess.exithandler (child_process.js:203:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:817:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

This usually happens when multiple files are changed.

Error: Cannot find module '../plugman/platforms/ios'

This issue seemed to arise in cordova-hot-code-push-plugin (see nordnet/cordova-hot-code-push#295), and was fixed. The issue still seems to persist in this repo, though.

This is the output at the end of doing a cordova -d platform add ios while cordova-hot-code-push-local-dev-addon is installed:

Executing script found in plugin cordova-hot-code-push-local-dev-addon for hook "after_prepare": plugins/cordova-hot-code-push-local-dev-addon/scripts/ios_swiftActivationHook.js
Swift support activation hook:
Resolving module name for cordova-lib/src/cordova/util => ../cordova/util
Resolving module name for cordova-common/src/ConfigParser/ConfigParser => cordova-common/src/ConfigParser/ConfigParser
Resolving module name for cordova-lib/src/plugman/platforms => ../plugman/platforms
Resolving module name for cordova-lib/src/plugman/platforms/ios => ../plugman/platforms/ios
Error: Cannot find module '../plugman/platforms/ios'

Merge Dex when using with com.paypal.cordova.mobilesdk

When using with the plugin com.paypal.cordova.mobilesdk, it cannot be compile with the following error. Without either one in the project, it's working fine.

FAILED

  • What went wrong:
    Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

When installed with cordova-plugin-camera we get error code 65 for command: xcodebuild.

$ cordova plugin add cordova-hot-code-push-local-dev-addon
$ cordova build ios

gives me on macOS Sierra:

CHCP Local Development Add-on:
    Config-file is not set, local-development mode is enabled by default.
    Setting config-file to local server: https://6d322d08.ngrok.io/chcp.json
    iOS bundle version set to 2
Swift support activation hook:
    iOS project now has deployment target set to: 8.0
    iOS project option EMBEDDED_CONTENT_CONTAINS_SWIFT set as: YES
    iOS project Runpath Search Paths set to: @executable_path/Frameworks
    iOS project "Use Legacy Swift Language Version" set to: NO
    Injected swift header My_Project-Swift.h into plugin's main header.
CHCP plugin after prepare hook:
    config-file preference is not set.
Reading build config file:
Building project: /Users/me/Development/my-project/platforms/ios/My Project.xcodeproj
        Configuration: Debug
        Platform: emulator
Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/me/Development/my-project/platforms/ios/build/emulator
    SDKROOT = iphonesimulator10.0
    SHARED_PRECOMPS_DIR = /Users/me/Development/my-project/platforms/ios/build/sharedpch

Build settings from configuration file '/Users/me/Development/my-project/platforms/ios/cordova/build-debug.xcconfig':
    CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
    CODE_SIGN_IDENTITY = iPhone Developer
    ENABLE_BITCODE = NO
    GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
    HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
    IPHONEOS_DEPLOYMENT_TARGET = 8.0
    OTHER_LDFLAGS = -ObjC
    PROVISIONING_PROFILE = e1e4c804-c279-4aaa-a069-1cbdf2d51bd4
    SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h
    TARGETED_DEVICE_FAMILY = 1,2

=== BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET My Project OF PROJECT My Project WITH CONFIGURATION Debug ===

Check dependencies

Write auxiliary files
write-file /Users/me/Development/my-project/platforms/ios/build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/My\ Project.hmap
write-file /Users/me/Development/my-project/platforms/ios/build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/My\ Project-project-headers.hmap
write-file /Users/me/Development/my-project/platforms/ios/build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/Objects-normal/i386/My\ Project.LinkFileList

PhaseScriptExecution Copy\ www\ directory build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/Script-304B58A110DAC018002A0835.sh
    cd /Users/me/Development/my-project/platforms/ios
    /bin/sh -c \"/Users/me/Development/my-project/platforms/ios/build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/Script-304B58A110DAC018002A0835.sh\"

ProcessInfoPlistFile build/emulator/My\ Project.app/Info.plist My\ Project/My\ Project-Info.plist
    cd /Users/me/Development/my-project/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/me/.nvm/versions/node/v6.6.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/me/Library/Android/sdk/tools:/Users/me/Library/Android/sdk/platform-tools"
    builtin-infoPlistUtility /Users/me/Development/my-project/platforms/ios/My\ Project/My\ Project-Info.plist -genpkginfo /Users/me/Development/my-project/platforms/ios/build/emulator/My\ Project.app/PkgInfo -expandbuildsettings -format binary -platform iphonesimulator -additionalcontentfile /Users/me/Development/my-project/platforms/ios/build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/MainViewController-PartialInfo.plist -additionalcontentfile /Users/me/Development/my-project/platforms/ios/build/My\ Project.build/Debug-iphonesimulator/My\ Project.build/assetcatalog_generated_info.plist -o /Users/me/Development/my-project/platforms/ios/build/emulator/My\ Project.app/Info.plist
error: couldn't parse contents of '/Users/me/Development/my-project/platforms/ios/My Project/My Project-Info.plist': The data couldn’t be read because it isn’t in the correct format.

** BUILD FAILED **


The following build commands failed:
        ProcessInfoPlistFile build/emulator/My\ Project.app/Info.plist My\ Project/My\ Project-Info.plist
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/me/Development/my-project/platforms/ios/cordova/build-debug.xcconfig,-project,My Project.xcodeproj,-target,My Project,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,build,CONFIGURATION_BUILD_DIR=/Users/me/Development/my-project/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/me/Development/my-project/platforms/ios/build/sharedpch

"ionic build ios" failed

When I use ionic build ios this mistake appears:

Error: Cannot find module 'colors/safe'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /Users/me/Documents/my_app/plugins/cordova-hot-code-push-local-dev-addon/scripts/lib/logger.js:7:16
    at Object.<anonymous> (/Users/me/Documents/my_app/plugins/cordova-hot-code-push-local-dev-addon/scripts/lib/logger.js:93:3)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

Can build/run with the plugin installed

Hi

First I'd like to say thank you again for this plugin, I've been using it with cordova-hot-code-push for more than 1 year and it's great.

Today I have a problem with this plugin. I can't build anymore. It seems related to the plugin since build is working when I remove the local-dev-addon

Here is the end of my build log, I can provide you with more if needed.

** BUILD FAILED **

The following build commands failed:
CompileSwift normal x86_64 /Users/Guven/Work/clm-cordova/platforms/ios/YDNCRM/Plugins/cordova-hot-code-push-local-dev-addon/SocketIOClientSwift/SocketEngine.swift
CompileSwift normal x86_64 /Users/Guven/Work/clm-cordova/platforms/ios/YDNCRM/Plugins/cordova-hot-code-push-local-dev-addon/SocketIOClientSwift/SocketIOClient.swift
CompileSwift normal x86_64 /Users/Guven/Work/clm-cordova/platforms/ios/YDNCRM/Plugins/cordova-hot-code-push-local-dev-addon/SocketIOClientSwift/SocketIOClientConfiguration.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(4 failures)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Guven/Work/clm-cordova/platforms/ios/cordova/build-debug.xcconfig,-workspace,YDNCRM.xcworkspace,-scheme,YDNCRM,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone 5s,build,CONFIGURATION_BUILD_DIR=/Users/Guven/Work/clm-cordova/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Guven/Work/clm-cordova/platforms/ios/build/sharedpch

I'm running the last version of the plugin, with the last version of Cordova, and XCODE is 8.3.1

Best regards

Xcode 8 compatibility

Hi all,

I have installed xcode 8 beta and cordova-hot-code-push-local-dev-addon plugin have a problem of compatibility with new version SWIFT code.

How can solve this problem ?

Thank you,
Davide

Could not use link mode of cordova plugin.

When using symlink to install this plugin

$ cordova plugin add --link ./node_modules/cordova-hot-code-push-local-dev-addon

It modify ./node_modules/cordova-hot-code-push-local-dev-addon/src/ios/HCPLDPlugin.h
not ./platforms/ios/*/Plugins/cordova-hot-code-push-local-dev-addon/HCPLDPlugin.h.

In other words, this plugin modify ./plugins/cordova-hot-code-push-local-dev-addon/src/ios/HCPLDPlugin.h.

I think a plugin should not modify itself.
It should only modify the under ./platforms/ instead.

Plugin does not work when compiled with XCode 9

This plugin did not work for me when I built an iOS project using XCode 9.

I forked and made a few changes to fix that, which you can see here:

master...NxtbookMedia:fix-ios-support

I've never used Swift before, so there could be some missteps, but with these changes the plugin builds and works for me in XCode 9.2.

Thus far, I haven't worried about backwards compatibility with older XCodes, because I haven't needed it for my purposes thus far.

Any interest in a PR to get this project compatible with 9.2?

If so, I can probably put a little time into reworking my changes to keep compatibility with older XCodes.

Can't build iOS project with Chinese name

How to reproduce:

cordova create china m.test.com **
cd china
cordova platform add ios
cordova plugin add cordova-hot-code-push-plugin
cordova plugin add cordova-hot-code-push-local-dev-addon
cordova build ios

The problem is that hooks can't inject Swift header into project. If we use english name for the project - it works fine.

Disable ngrok?

Is it possible to disable the ngrok functionality and just have the live server push go through the local server only?

PSA: Deprecation notice 2018-09-30

ℹ️ We are not using this repo anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

⚠️ This repo will be deprecated and archived (become read-only) on 2018-09-30.

🙏 You can use this issue to link to your fork and/or alternatives to this repo.

Cant compile when other plugin is using Swift.

My project currently uses the iOS-RTC plugin which is built with Swift 2.3. So far I have not been able to get both plugins to work together, have tried modifying both scripts, changing hook type, etc.. Any idea what it will take to get this to work along the other plugin?

Update cordova hooks for iOS for Cordova 5.4

After updating Cordova to v5.4 - when building for iOS following message is displayed:

The module "ConfigParser" has been factored into "cordova-common". 
Consider update your plugin hooks.

Nothing critical, everything works, but still - need to clean it up.

Won't Connect To Local Server?

I am trying to follow the instruction on the QuickStart but always fail.
I noticed the ngrok.com is not accessible and suspected it was the cause of failure. Instead, I tried to instruct the app to connect to the local server created by cordova-hcp server, by adding:

  <chcp>
    <config-file url="http://192.168.108.98:31284/chcp.json" />
    <local-development enabled="true" />
  </chcp>

to the project's config.xml.
still no luck. then I noticed when executing ionic run, there's the following log:

D:\playground\TestHCP>ionic run
Running command: "C:\Program Files\nodejs\node.exe" D:\playground\TestHCP\hooks\after_prepare\010_add_platform_class.js D:\playground\TestHCP
add to body class: platform-android
CHCP Local Development Add-on:
    Setting config-file to local server: https://4961a61c.ngrok.com/chcp.json
    Android version code is set to 21
CHCP plugin after prepare hook:
    config-file set to http://192.168.108.98:31284/chcp.json

I am confused by the "Setting config-file to local server: https://4961a61c.ngrok.com/chcp.json" part. Moreover, I checked the config.xml under platforms\android\res\xml and found the chcp block is different than its counterpart in the root directory of the project:

  <chcp>
    <config-file url="https://4961a61c.ngrok.com/chcp.json"/>
    <local-development enabled="true"/>
  </chcp>

(the above is the one in platforms\android\res\xml ) it seems my configuration in the config.xml was overridden.

I am hoping someone may point out what's going on and what I may have been doing wrong. Thanks in advance!

New native-interface setting is discarded when using this plugin

When using this plugin, the native-interface setting in config.xml is discarded at build time (only the config-file and local-development settings of the chcp tag are retained), causing the cordova-hot-code-push-plugin to use the default setting of 1. When the chcp.json specifies a higher number than 1 for min_native_interface, every reload trigger causes the plugin to error with "Application build version is too low for this update", instead of a hot reload.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.