You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/06/03 13:46:17 UTC

[1/2] cordova-paramedic git commit: Log start and end time for tests

Repository: cordova-paramedic
Updated Branches:
  refs/heads/master 7dde725f3 -> 28d5dac1d


Log start and end time for tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/983c6bcf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/983c6bcf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/983c6bcf

Branch: refs/heads/master
Commit: 983c6bcfec6db6b4d8b21d85ad63da0be583056d
Parents: 7dde725
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Fri Jun 3 13:46:58 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Fri Jun 3 13:46:58 2016 +0300

----------------------------------------------------------------------
 lib/paramedic.js | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/983c6bcf/lib/paramedic.js
----------------------------------------------------------------------
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 14578f8..3f06c33 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -74,9 +74,11 @@ ParamedicRunner.prototype.run = function () {
         var connectionUrl = server.getConnectionUrl(self.config.getPlatformId());
         self.writeMedicConnectionUrl(connectionUrl);
 
+        logger.normal('Start running tests at ' + (new Date()).toLocaleTimeString());
         return self.runTests();
     })
     .fin(function() {
+        logger.normal('Completed tests at ' + (new Date()).toLocaleTimeString());
         // if we do --justbuild  or run on sauce,
         // we should NOT do actions below
         if (self.config.getAction() !== 'build' && !self.config.shouldUseSauce()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] cordova-paramedic git commit: Add logic to enable package debugging mode on Windows

Posted by an...@apache.org.
Add logic to enable package debugging mode on Windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/28d5dac1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/28d5dac1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/28d5dac1

Branch: refs/heads/master
Commit: 28d5dac1d7adf2ba11027936421a71ede356fdce
Parents: 983c6bc
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Thu Jun 2 12:02:06 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Fri Jun 3 15:19:04 2016 +0300

----------------------------------------------------------------------
 debug-mode-plugin/plugin.xml                    | 34 ++++++++
 .../scripts/EnableDebuggingForPackage.ps1       | 83 ++++++++++++++++++++
 debug-mode-plugin/scripts/disable-debug-mode.js | 32 ++++++++
 debug-mode-plugin/scripts/enable-debug-mode.js  | 46 +++++++++++
 lib/paramedic.js                                | 10 ++-
 5 files changed, 202 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/28d5dac1/debug-mode-plugin/plugin.xml
----------------------------------------------------------------------
diff --git a/debug-mode-plugin/plugin.xml b/debug-mode-plugin/plugin.xml
new file mode 100644
index 0000000..a78e173
--- /dev/null
+++ b/debug-mode-plugin/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+        id="debug-mode-plugin"
+        version="1.0.0-dev">
+
+    <name>Windows debug mode plugin</name>
+    <description>Plugin to enable package debugging to allow app run without active local/remote desktop session</description>
+    <license>Apache 2.0</license>
+
+    <platform name="windows">
+        <hook type="after_plugin_install" src="scripts/enable-debug-mode.js" />
+        <hook type="before_plugin_uninstall" src="scripts/disable-debug-mode.js" />
+    </platform>
+
+</plugin>

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/28d5dac1/debug-mode-plugin/scripts/EnableDebuggingForPackage.ps1
----------------------------------------------------------------------
diff --git a/debug-mode-plugin/scripts/EnableDebuggingForPackage.ps1 b/debug-mode-plugin/scripts/EnableDebuggingForPackage.ps1
new file mode 100644
index 0000000..5ed9d09
--- /dev/null
+++ b/debug-mode-plugin/scripts/EnableDebuggingForPackage.ps1
@@ -0,0 +1,83 @@
+<#
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+#>
+
+param(
+    [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
+    [string] $ID <# package.appxmanifest//Identity@name #>
+)
+
+$code = @"
+using System;
+using System.Runtime.InteropServices;
+namespace PackageDebug
+{
+    public enum PACKAGE_EXECUTION_STATE
+    {
+        PES_UNKNOWN,
+        PES_RUNNING,
+        PES_SUSPENDING,
+        PES_SUSPENDED,
+        PES_TERMINATED
+    }
+
+    [ComImport, Guid("B1AEC16F-2383-4852-B0E9-8F0B1DC66B4D")]
+    public class PackageDebugSettings
+    {
+    }
+
+    [ComImport, Guid("F27C3930-8029-4AD1-94E3-3DBA417810C1"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public interface IPackageDebugSettings
+    {
+        int EnableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, [MarshalAs(UnmanagedType.LPWStr)] string debuggerCommandLine, IntPtr environment);
+        int DisableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int Suspend([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int Resume([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int TerminateAllProcesses([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int SetTargetSessionId(int sessionId);
+        int EnumerageBackgroundTasks([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+                                                      out uint taskCount, out int intPtr, [Out] string[] array);
+        int ActivateBackgroundTask(IntPtr something);
+        int StartServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int StopServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int StartSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, uint sessionId);
+        int StopSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int GetPackageExecutionState([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+                                            out PACKAGE_EXECUTION_STATE packageExecutionState);
+        int RegisterForPackageStateChanges([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+                               IntPtr pPackageExecutionStateChangeNotification, out uint pdwCookie);
+        int UnregisterForPackageStateChanges(uint dwCookie);
+    }
+
+    public class DebugTool
+    {
+        public static void EnableDebug(String packageFullName)
+        {
+            // Set debug mode for App and activate installed application
+            var debugSettings = (IPackageDebugSettings)(new PackageDebugSettings());
+            debugSettings.EnableDebugging(packageFullName, null, (IntPtr)null);
+        }
+    }
+}
+"@
+
+Add-Type -TypeDefinition $code
+
+$packageFullName = $(Get-AppxPackage $ID).PackageFullName
+Write-Host "Setting debug mode for application:" $ID
+[PackageDebug.DebugTool]::EnableDebug($packageFullName) | Out-Null

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/28d5dac1/debug-mode-plugin/scripts/disable-debug-mode.js
----------------------------------------------------------------------
diff --git a/debug-mode-plugin/scripts/disable-debug-mode.js b/debug-mode-plugin/scripts/disable-debug-mode.js
new file mode 100644
index 0000000..17e1b24
--- /dev/null
+++ b/debug-mode-plugin/scripts/disable-debug-mode.js
@@ -0,0 +1,32 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+module.exports = function (context) {
+    var path = require('path');
+    var shell = context.requireCordovaModule('shelljs');
+
+    var libPath        = path.resolve(context.opts.projectRoot, "platforms/windows/cordova/lib");
+    var appUtilsPath   = path.join(libPath, "WindowsStoreAppUtils.ps1");
+    var appUtilsBackupPath   = path.join(libPath, "WindowsStoreAppUtils.ps1.bak");
+    var destScriptPath = path.join(libPath, "EnableDebuggingForPackage.ps1");
+
+    // Remove the patch and copu over backup StoreAppUtils script
+    shell.rm("-f", destScriptPath);
+    shell.cp("-f", appUtilsBackupPath, appUtilsPath);
+};

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/28d5dac1/debug-mode-plugin/scripts/enable-debug-mode.js
----------------------------------------------------------------------
diff --git a/debug-mode-plugin/scripts/enable-debug-mode.js b/debug-mode-plugin/scripts/enable-debug-mode.js
new file mode 100644
index 0000000..cbde75f
--- /dev/null
+++ b/debug-mode-plugin/scripts/enable-debug-mode.js
@@ -0,0 +1,46 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+module.exports = function (context) {
+    var path = require('path');
+    var shell = context.requireCordovaModule('shelljs');
+
+    var libPath        = path.resolve(context.opts.projectRoot, "platforms/windows/cordova/lib");
+    var appUtilsPath   = path.join(libPath, "WindowsStoreAppUtils.ps1");
+    var appUtilsBackupPath   = path.join(libPath, "WindowsStoreAppUtils.ps1.bak");
+    var srcScriptPath  = path.join(__dirname, "EnableDebuggingForPackage.ps1");
+    var destScriptPath = path.join(libPath, "EnableDebuggingForPackage.ps1");
+
+    // copy over the patch
+    shell.cp("-f", srcScriptPath, libPath);
+    shell.cp("-f", appUtilsPath, appUtilsBackupPath);
+
+    // add extra code to patch
+    shell.sed(
+        "-i",
+        /^\s*\$appActivator .*$/gim,
+        "$&\n\n" +
+        "    # START ENABLE DEBUG MODE SECTION\n" +
+        "    powershell " + destScriptPath + " $$ID\n" +
+        "    $Ole32 = Add-Type -MemberDefinition '[DllImport(\"Ole32.dll\")]public static extern int CoAllowSetForegroundWindow(IntPtr pUnk, IntPtr lpvReserved);' -Name 'Ole32' -Namespace 'Win32' -PassThru\n" +
+        "    $Ole32::CoAllowSetForegroundWindow([System.Runtime.InteropServices.Marshal]::GetIUnknownForObject($appActivator), [System.IntPtr]::Zero)\n" +
+        "    # END ENABLE DEBUG MODE SECTION\n",
+        appUtilsPath
+    );
+};

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/28d5dac1/lib/paramedic.js
----------------------------------------------------------------------
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 3f06c33..d26e3ba 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -109,9 +109,13 @@ ParamedicRunner.prototype.installPlugins = function () {
     this.pluginsManager = new PluginsManager(this.tempFolder.name, this.storedCWD);
     this.pluginsManager.installPlugins(this.config.getPlugins());
     this.pluginsManager.installTestsForExistingPlugins();
-    this.pluginsManager.installSinglePlugin('cordova-plugin-test-framework');
-    this.pluginsManager.installSinglePlugin('cordova-plugin-device');
-    this.pluginsManager.installSinglePlugin(path.join(__dirname, '../paramedic-plugin'));
+
+    var additionalPlugins = ['cordova-plugin-test-framework', 'cordova-plugin-device', path.join(__dirname, '../paramedic-plugin')];
+    if (this.config.getPlatformId() === 'windows') {
+        additionalPlugins.push(path.join(__dirname, '../debug-mode-plugin'));
+    }
+
+    this.pluginsManager.installPlugins(additionalPlugins);
 };
 
 ParamedicRunner.prototype.setUpStartPage = function () {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org