You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/04/08 22:06:41 UTC

[1/2] git commit: Modify execution policy restrictions removal logic. Using PS native cmdlet to remove restrictions.

Repository: cordova-windows
Updated Branches:
  refs/heads/master a3d0be201 -> 1bc10364d


Modify execution policy restrictions removal logic. Using PS native cmdlet to remove restrictions.


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

Branch: refs/heads/master
Commit: a66536df930200192f95d106244c34bd2b8ac151
Parents: ca106cf
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Apr 7 13:14:21 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Apr 7 18:16:34 2014 +0400

----------------------------------------------------------------------
 .../template/cordova/lib/WindowsStoreAppUtils   | 116 -------------------
 .../cordova/lib/WindowsStoreAppUtils.ps1        | 116 +++++++++++++++++++
 windows8/template/cordova/lib/deploy.js         |  39 ++-----
 3 files changed, 123 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a66536df/windows8/template/cordova/lib/WindowsStoreAppUtils
----------------------------------------------------------------------
diff --git a/windows8/template/cordova/lib/WindowsStoreAppUtils b/windows8/template/cordova/lib/WindowsStoreAppUtils
deleted file mode 100644
index 5d8c7a9..0000000
--- a/windows8/template/cordova/lib/WindowsStoreAppUtils
+++ /dev/null
@@ -1,116 +0,0 @@
-<#
-       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.
-#>
-$code = @"
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-namespace StoreAppRunner 
-{
-    public enum ActivateOptions
-    {
-        None = 0,
-        DesignMode = 0x1,
-        NoErrorUI = 0x2,
-        NoSplashScreen = 0x4
-    }
-
-    [ComImport]
-    [Guid("2e941141-7f97-4756-ba1d-9decde894a3d")]
-    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-    public interface IApplicationActivationManager
-    {
-        IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] ActivateOptions options, [Out] out UInt32 processId);
-        IntPtr ActivateForFile([In] String appUserModelId, [In] IntPtr itemArray, [In] String verb, [Out] out UInt32 processId);
-        IntPtr ActivateForProtocol([In] String appUserModelId, [In] IntPtr itemArray, [Out] out UInt32 processId);
-    }
-    [ComImport]
-    [Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]
-    public class ApplicationActivationManager : IApplicationActivationManager
-    {
-        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
-        public extern IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] ActivateOptions options, [Out] out UInt32 processId);
-        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
-        public extern IntPtr ActivateForFile([In] String appUserModelId, [In] IntPtr itemArray, [In] String verb, [Out] out UInt32 processId);
-        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
-        public extern IntPtr ActivateForProtocol([In] String appUserModelId, [In] IntPtr itemArray, [Out] out UInt32 processId);
-    }
-}
-"@
-
-function Uninstall-App {
-    param(
-        [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
-        [string] $ID <# package.appxmanifest//Identity@name #>
-    )
-
-    $package = Get-AppxPackage $ID
-
-    if($package) {
-        Remove-AppxPackage $package.PackageFullName
-    }
-}
-
-#
-# Checks whether the machine is missing a valid developer license.
-#
-function CheckIfNeedDeveloperLicense
-{
-    $Result = $true
-    try
-    {
-        $Result = (Get-WindowsDeveloperLicense | Where-Object { $_.IsValid }).Count -eq 0
-    }
-    catch {}
-
-    return $Result
-}
-
-function Install-App {
-    param(
-        [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
-        [string] $Path <# Full path to Add-AppDevPackage.ps1 #>
-    )
-
-    if (CheckIfNeedDeveloperLicense)
-    {
-        # we can't run the script with -force param if license installation step is required
-        Invoke-Expression ("& `"$Path`"")
-    }
-    else
-    {
-        Invoke-Expression ("& `"$Path`" -force")
-    }
-}
-
-function Start-Locally {
-    param(
-        [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
-        [string] $ID <# package.appxmanifest//Identity@name #>
-    )
-
-    $package = Get-AppxPackage $ID
-    $manifest = Get-appxpackagemanifest $package
-    $applicationUserModelId = $package.PackageFamilyName + "!" + $manifest.package.applications.application.id
-
-    Write-Host "ActivateApplication: " $applicationUserModelId
-
-    add-type -TypeDefinition $code
-    $appActivator = new-object StoreAppRunner.ApplicationActivationManager
-    $appActivator.ActivateApplication($applicationUserModelId,$null,[StoreAppRunner.ActivateOptions]::None,[ref]0)
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a66536df/windows8/template/cordova/lib/WindowsStoreAppUtils.ps1
----------------------------------------------------------------------
diff --git a/windows8/template/cordova/lib/WindowsStoreAppUtils.ps1 b/windows8/template/cordova/lib/WindowsStoreAppUtils.ps1
new file mode 100644
index 0000000..5d8c7a9
--- /dev/null
+++ b/windows8/template/cordova/lib/WindowsStoreAppUtils.ps1
@@ -0,0 +1,116 @@
+<#
+       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.
+#>
+$code = @"
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+namespace StoreAppRunner 
+{
+    public enum ActivateOptions
+    {
+        None = 0,
+        DesignMode = 0x1,
+        NoErrorUI = 0x2,
+        NoSplashScreen = 0x4
+    }
+
+    [ComImport]
+    [Guid("2e941141-7f97-4756-ba1d-9decde894a3d")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public interface IApplicationActivationManager
+    {
+        IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] ActivateOptions options, [Out] out UInt32 processId);
+        IntPtr ActivateForFile([In] String appUserModelId, [In] IntPtr itemArray, [In] String verb, [Out] out UInt32 processId);
+        IntPtr ActivateForProtocol([In] String appUserModelId, [In] IntPtr itemArray, [Out] out UInt32 processId);
+    }
+    [ComImport]
+    [Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]
+    public class ApplicationActivationManager : IApplicationActivationManager
+    {
+        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+        public extern IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] ActivateOptions options, [Out] out UInt32 processId);
+        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+        public extern IntPtr ActivateForFile([In] String appUserModelId, [In] IntPtr itemArray, [In] String verb, [Out] out UInt32 processId);
+        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+        public extern IntPtr ActivateForProtocol([In] String appUserModelId, [In] IntPtr itemArray, [Out] out UInt32 processId);
+    }
+}
+"@
+
+function Uninstall-App {
+    param(
+        [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
+        [string] $ID <# package.appxmanifest//Identity@name #>
+    )
+
+    $package = Get-AppxPackage $ID
+
+    if($package) {
+        Remove-AppxPackage $package.PackageFullName
+    }
+}
+
+#
+# Checks whether the machine is missing a valid developer license.
+#
+function CheckIfNeedDeveloperLicense
+{
+    $Result = $true
+    try
+    {
+        $Result = (Get-WindowsDeveloperLicense | Where-Object { $_.IsValid }).Count -eq 0
+    }
+    catch {}
+
+    return $Result
+}
+
+function Install-App {
+    param(
+        [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
+        [string] $Path <# Full path to Add-AppDevPackage.ps1 #>
+    )
+
+    if (CheckIfNeedDeveloperLicense)
+    {
+        # we can't run the script with -force param if license installation step is required
+        Invoke-Expression ("& `"$Path`"")
+    }
+    else
+    {
+        Invoke-Expression ("& `"$Path`" -force")
+    }
+}
+
+function Start-Locally {
+    param(
+        [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
+        [string] $ID <# package.appxmanifest//Identity@name #>
+    )
+
+    $package = Get-AppxPackage $ID
+    $manifest = Get-appxpackagemanifest $package
+    $applicationUserModelId = $package.PackageFamilyName + "!" + $manifest.package.applications.application.id
+
+    Write-Host "ActivateApplication: " $applicationUserModelId
+
+    add-type -TypeDefinition $code
+    $appActivator = new-object StoreAppRunner.ApplicationActivationManager
+    $appActivator.ActivateApplication($applicationUserModelId,$null,[StoreAppRunner.ActivateOptions]::None,[ref]0)
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a66536df/windows8/template/cordova/lib/deploy.js
----------------------------------------------------------------------
diff --git a/windows8/template/cordova/lib/deploy.js b/windows8/template/cordova/lib/deploy.js
index 10def79..6b2f08e 100644
--- a/windows8/template/cordova/lib/deploy.js
+++ b/windows8/template/cordova/lib/deploy.js
@@ -25,7 +25,6 @@ var args = WScript.Arguments;
 var ROOT = WScript.ScriptFullName.split('\\cordova\\lib\\deploy.js').join('');
 // path to WindowsStoreAppUtils.ps1; provides helper functions to install/unistall/start Windows Store app
 var WINDOWS_STORE_UTILS = '\\cordova\\lib\\WindowsStoreAppUtils.ps1';
-var WINDOWS_STORE_UTILS_SRC = '\\cordova\\lib\\WindowsStoreAppUtils';
 
 //build types
 var NONE = 0,
@@ -64,7 +63,7 @@ function Log(msg, error) {
     else {
         WScript.StdOut.WriteLine(msg);
     }
-} 
+}
 
 var ForReading = 1, ForWriting = 2, ForAppending = 8;
 var TristateUseDefault = 2, TristateTrue = 1, TristateFalse = 0;
@@ -99,35 +98,13 @@ function exec_verbose(command) {
     }
 }
 
-// returns the contents of a file
-function read(filename) {
-    if (fso.FileExists(filename)) {
-        var f=fso.OpenTextFile(filename, 1,2);
-        var s=f.ReadAll();
-        f.Close();
-        return s;
-    }
-    else {
-        Log('Cannot read non-existant file : ' + filename, true);
-        WScript.Quit(2);
-    }
-    return null;
-}
-
-// writes content to a file
-function write(filename, content) {
-    var f=fso.OpenTextFile(filename, 2,2);
-    f.Write(content);
-    f.Close();
-}
-
 function localMachine(path) {
     Log('Deploying to local machine ...');
     makeAppStoreUtils(path);
     uninstallApp(path);
     installApp(path);
 
-    var command = "powershell \". .\\" + WINDOWS_STORE_UTILS + "; Start-Locally " + PACKAGE_NAME;
+    var command = "powershell -ExecutionPolicy RemoteSigned \". .\\" + WINDOWS_STORE_UTILS + "; Start-Locally " + PACKAGE_NAME;
     Log(command);
     exec_verbose(command);
 }
@@ -155,14 +132,12 @@ function target(path, device_id) {
 }
 
 function makeAppStoreUtils(path) {
-
     if (fso.FileExists(path + WINDOWS_STORE_UTILS)) {
+        Log("Removing execution restrictions from AppStoreUtils...");
+        var command = "powershell \"Unblock-File " + path + WINDOWS_STORE_UTILS + "\"";
+        exec_verbose(command);
         return;
     }
-
-    Log("Making PowerShell script for Windows Store Apps..");
-
-    write(path + WINDOWS_STORE_UTILS, read(path + WINDOWS_STORE_UTILS_SRC));
 }
 
 // uninstalls previous application instance (if exists)
@@ -171,7 +146,7 @@ function uninstallApp(path) {
     Log("\tDirectory : " + path);
 
     wscript_shell.CurrentDirectory = path;
-    var command = "powershell \". .\\" + WINDOWS_STORE_UTILS + "; Uninstall-App " + PACKAGE_NAME;
+    var command = "powershell -ExecutionPolicy RemoteSigned \". .\\" + WINDOWS_STORE_UTILS + "; Uninstall-App " + PACKAGE_NAME;
     Log(command);
     exec_verbose(command);
 }
@@ -197,7 +172,7 @@ function installApp(path) {
             {
                 if(fso.GetExtensionName(files.item()) == "ps1")
                 {
-                    var command = "powershell \". .\\" + WINDOWS_STORE_UTILS + "; Install-App " + "'" + files.item() + "'";
+                    var command = "powershell -ExecutionPolicy RemoteSigned \". .\\" + WINDOWS_STORE_UTILS + "; Install-App " + "'" + files.item() + "'";
                     Log(command);
                     exec_verbose(command);
                     return;


[2/2] git commit: Merge branch 'CB-5038' of https://github.com/MSOpenTech/cordova-windows

Posted by pu...@apache.org.
Merge branch 'CB-5038' of https://github.com/MSOpenTech/cordova-windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/1bc10364
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/1bc10364
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/1bc10364

Branch: refs/heads/master
Commit: 1bc10364d7f834a3ecdf5a2ab657482a2ced3d65
Parents: a3d0be2 a66536d
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Apr 8 13:06:17 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Apr 8 13:06:17 2014 -0700

----------------------------------------------------------------------
 .../template/cordova/lib/WindowsStoreAppUtils   | 116 -------------------
 .../cordova/lib/WindowsStoreAppUtils.ps1        | 116 +++++++++++++++++++
 windows8/template/cordova/lib/deploy.js         |  39 ++-----
 3 files changed, 123 insertions(+), 148 deletions(-)
----------------------------------------------------------------------