Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #712 from phonegap/v0.4.0-merge
Browse files Browse the repository at this point in the history
V0.4.0 merge

Former-commit-id: f12501d
  • Loading branch information
hermwong authored Oct 26, 2016
2 parents e894eb9 + c1ea886 commit 76ee1b8
Show file tree
Hide file tree
Showing 51 changed files with 2,874 additions and 1,935 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ npm-debug.log

# Project
build/
www/bin/node*
www/node_modules/
installers/osx64/*.zip
installers/win32/*.zip
res/installers/osx/license.txt
res/installers/win/license.txt
sign-config.json

# Node WebKit
cache/
1 change: 1 addition & 0 deletions BUNDLED_NODE_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v6.3.1
53 changes: 41 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module.exports = function(grunt) {
var VERSION = '0.3.5';
var VERSION = '0.4.0';
var osxArchive = './installers/osx64/PhoneGap-Desktop-Beta-' + VERSION + '-mac.zip';
var winArchive = './installers/win32/PhoneGap-Desktop-Beta-' + VERSION + '-win.zip';

var isRelease = false;

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
'electron': {
Expand All @@ -11,7 +13,7 @@ module.exports = function(grunt) {
name: 'PhoneGap',
dir: './www',
out: './build',
version: '1.0.1',
version: '1.3.0',
platform: 'darwin',
arch: 'x64',
icon: './www/img/app-icons/icon.icns',
Expand All @@ -23,11 +25,11 @@ module.exports = function(grunt) {
name: 'PhoneGap',
dir: './www',
out: './build',
version: '1.0.1',
version: '1.3.0',
platform: 'win32',
arch: 'ia32',
icon: './www/img/app-icons/icon.ico',
asar: true
asar: { unpackDir:'{bin,node_modules/adm-zip,node_modules/adm-zip/**}' }
}
}
},
Expand Down Expand Up @@ -70,22 +72,31 @@ module.exports = function(grunt) {

// Register the task to install dependencies.
grunt.task.registerTask('install-dependencies', function() {
var exec = require('child_process').exec,
callback = this.async();
var execSync = require('child_process').execSync;

execSync('node src/js/download-node.js');

var npmInstall = 'npm install';
if (isRelease) {
npmInstall += ' --production';
}

exec('npm install --production', { cwd: './www' }, function(e, stdout, stderr) {
console.log(stdout);
callback();
});
execSync(npmInstall, { cwd: './www' });

// npm/phonegap workarounds are for Windows, Mac can install normally
if (process.platform == 'darwin' && isRelease) {
execSync('npm install npm@3.10.3 phonegap@6.3.1', { cwd: './www' });
}
});

// OSX code signing
grunt.task.registerTask('code-sign-osx', function() {
var shell = require('shelljs');
shell.exec("codesign --verbose --deep --force --sign 'Mac Developer: Herman Wong (M6QFED29S9)' build/PhoneGap-darwin-x64/PhoneGap.app");
var signConfig = grunt.file.readJSON("sign-config.json")
shell.exec("codesign --verbose --deep --force --sign " + "'"+signConfig.certName+"'" + " build/PhoneGap-darwin-x64/PhoneGap.app");
shell.exec("codesign --verbose --verify build/PhoneGap-darwin-x64/PhoneGap.app");
shell.exec("codesign -vv -d build/PhoneGap-darwin-x64/PhoneGap.app");
shell.exec("codesign --verbose --force --sign 'Mac Developer: Herman Wong (M6QFED29S9)' build/PhoneGap-darwin-x64/PhoneGap.app/Contents/MacOS/PhoneGap");
shell.exec("codesign --verbose --force --sign " + "'"+signConfig.certName+"'" + " build/PhoneGap-darwin-x64/PhoneGap.app/Contents/MacOS/PhoneGap");
shell.exec("codesign --verbose --verify build/PhoneGap-darwin-x64/PhoneGap.app/Contents/MacOS/PhoneGap");
});

Expand All @@ -101,12 +112,27 @@ module.exports = function(grunt) {
shell.rm('-rf', './installers');
});

// Clean node binary
grunt.task.registerTask('clean-node-binary', function() {
var shell = require('shelljs');

var nodePath = './www/bin/node';
if (process.platform == 'win32') {
nodePath += '.exe';
}
shell.rm('-rf', nodePath);
});

// Clean node dependencies
grunt.task.registerTask('clean-node-modules', function() {
var shell = require('shelljs');
shell.rm('-rf', './www/node_modules');
});

grunt.task.registerTask('set-release-flag', function() {
isRelease = true;
});

// start the local server for update checker
grunt.task.registerTask('start-localhost', function() {
var shell = require('shelljs');
Expand Down Expand Up @@ -151,6 +177,7 @@ module.exports = function(grunt) {
grunt.registerTask(
'default',
[
'clean-node-binary',
'clean-node-modules',
'copy-dev-config',
'install-dependencies',
Expand All @@ -167,9 +194,11 @@ module.exports = function(grunt) {
grunt.registerTask(
'release',
[
'clean-node-binary',
'clean-node-modules',
'clean-installers-dir',
'copy-release-config',
'set-release-flag',
'install-dependencies',
'copy-eula',
'clean-build-dir',
Expand Down
7 changes: 7 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Installation for Windows ##

If you are using the zip file to run the Desktop App, you will need to run the
"postInstall.bat" file to install the required dependencies. The file is in
"PhoneGap-win32-ia32/resources/app.asar.unpacked/bin". Right click on the file
and select "Run as administrator", once the script has finished running you will
be able to use the app.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
## Phonegap Desktop App [![Build Status](https://travis-ci.org/phonegap/phonegap-app-desktop.svg?branch=master)](https://travis-ci.org/phonegap/phonegap-app-desktop) [![bitHound Score](https://www.bithound.io/github/phonegap/phonegap-app-desktop/badges/score.svg)](https://www.bithound.io/github/phonegap/phonegap-app-desktop)

#### Installation for OSX
## Quick Start - Developer Mode

1. Run `npm install` from the root of this project to set up the project dependencies
2. `cd` into the `www` folder and run `npm install` for the app dependencies
3. `cd ..` back to the root and run `npm run reload` to start up the live reload server for live code updates
4. Run `electron www` from the root folder or `electron .` from the `www` folder

**NOTE:** Steps 1 & 2 only need to be done if you've never run a local build or when the dependencies are updated.

## Build Setup for OSX

```
install the latest XCode from the Mac App Store
Expand Down Expand Up @@ -38,12 +47,20 @@ $ npm install
# Follow instructions in the Build section.
```

#### Build
## Build Commands

```
# builds development version
grunt
# builds release version
grunt -release
grunt release
```

## Installation for Windows

If you are using the zip file to run the Desktop App, you will need to run the
`postInstall.bat` file to install the required dependencies. The file is in
`PhoneGap-win32-ia32/resources/app.asar.unpacked/bin`. Right click on the file
and select "Run as administrator", once the script has finished running you will
be able to use the app.
Binary file added docs/img/sign0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/sign9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 173 additions & 0 deletions docs/win-code-signing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Windows Code Signing

This document covers the process to code sign the PhoneGap Desktop app for Windows 10 on Windows 8.1.

## <u>Windows 10 Code Signing</u>

* If you’re using vmware, map a shared folder to the phonegap-app-desktop folder on Mac

* Set your `path` variable to ensure you can use the `signtool` tools from the command line for testing:

1. Right click on start menu icon and choose *System*

2. In the left menu, choose *Advanced system settings*

3. Click the *Environment Variables* button

4. In the System variables - highlight the `path` variable and add the following

`;C:\Program Files (x86)\Windows Kits\10\bin\x64`

**Note:** Ensure it’s preceded by a semicolon(;) to separate it from the previous path

* Open the **Windows Powershell** program (locate it in the Applications list or via search)

* Use the following command to create a new self signed certificate:

`New-SelfSignedCertificate -DnsName "phonegap.cert" -CertStoreLocation Cert:\CurrentUser\My -KeySpec "KeyExchange" -KeyUsage "CertSign" -Type "CodeSigningCert" -Subject "Adobe PhoneGap Team"`

**Output**

Directory: Microsoft.PowerShell.Security \Certificate::CurrentUser\My
Thumbprint Subject
---------- -------
FFAE62AE14CBB14F6B8C830428232D32064BF9FD CN=phonegap.cert


**Reference:** [https://technet.microsoft.com/library/hh848633](https://technet.microsoft.com/library/hh848633)

* Create a variable to store the certificate password

$CertPwd = ConvertTo-SecureString -String "phonegap" -Force –AsPlainText

* Export it to a .**pfx** certificate (required for signing) with the password variable created above and the thumbprint shown in the output

`Export-PfxCertificate -cert cert:\CurrentUser\my\FFAE62AE14CBB14F6B8C830428232D32064BF9FD -FilePath phonegap.pfx -Password $CertPwd`

**Output**

Directory: C:\Users\myUser

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a 6/30/2016 2:51 PM 2573 phonegap.pfx

* Next you need to import it into your *Trusted Root Certification Authorities* store in Windows before you can use it to sign the app using the **Microsoft Management Console**. It can be run from the Powershell by typing `mmc`. The whole workflow described above is shown below for reference:

![](img/sign0.png)

* Once the Management Console opens, go to **File -> Add/Remove Snap-In…**![image alt text](sign1.png)

* Click on **Certificates** then click the **Add >** button ![](img/sign2.png)

* In the pop-up choose **Current User** and hit Finish**![](img/sign3.png)

* You will see the Certificates Snap-in showing under the Console. Click on it to reveal a new list of items on the right as shown below:

![](img/sign4.png)

* Right click on **Trusted Root Certification Authorities** then choose **All Tasks -> Import...**

![](img/sign5.png)

* In the pop-up dialog, keep the **Current User** selection for Store Location and press Next

![](img/sign6.png)

* Locate your **.pfx** from the file system (you’ll need to change the default **.cer/.crt** file type drop-down to reveal the **Personal Information Exchange** files it in your file explorer) and click **Open**.

* Click **Next** and you will be prompted to enter the password you used when you created it. Also click the checkbox to make it exportable for future use.

![](img/sign7.png)

* Ensure you are putting it in the **Trusted Root Certification Authorities** store as shown below and then click Finish in the final dialog:

![](img/sign8.png)

* You will receive a Security Warning dialog, just click *Yes*

* Once complete, double check to ensure that it has the **Intended Purpose** field set to **Code Signing**

![](img/sign9.png)

* You could now test it out by manually signing an **.exe** using the following command, otherwise move on to the next section to configure [Inno Setup](http://www.jrsoftware.org/) to use the newly created certificate.

**Note:** this will require you to have `signtool` installed which is part of the Windows SDK.

` signtool sign /f "phonegap.pfx" /p phonegap "Z:\phonegap-app-desktop\installers\win32\PhoneGapSetup-win32.exe"
`

**Output**

Done Adding Additional Store

Successfully signed: Z:\phonegap-app-desktop\installers\win32\PhoneGapSetup-win32.exe

## <u>Configure Inno Setup for Code Signing</u>

Now you need to configure Inno Setup for code signing using your **mypfx.pfx** file created above. You will need to configure the command with a new singing tool setting and then use that setting in the **pg-desktop.iss** script.

**Note:** this will require you to have `signtool` installed which is part of the Windows SDK.


* Select **Tools -> Configure Sign Tools**

![](img/sign10.png)

* Click the **Add** button and enter a name for your signing setting (ie: **mySigner**)

* Enter the following in the **Command for the Signing Tool** and modify the parameters to match the location of your *.pfx*:

"C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /f "C:\Users\holly\phonegap.pfx" /p phonegap $p

* Now edit the **pg-desktop.iss** file to use the **mySigner** command in the `[Setup]` section with the following line:

`SignTool=mySigner /d $qPhoneGap Desktop$q /du $qhttp://phonegap.com$q $f`

![](img/sign11.png)

## <u>Windows 8.1 Code Signing</u>

* Map a shared folder in vmware to the phonegap-app-desktop folder on Mac

* You may or may not need to do the following

1. Set environment variables to ensure you can use the `makecert` and `signtool` tools

* Right click on start menu icon and choose *System*

* In left menu, choose *Advanced system settings*

* Click the *Environment Variables* button

* In the System variables - highlight the `path` variable and add the following

`;C:\Program Files (x86)\Windows Kits\***_8.1_***\bin\u0064*`

*Ensure it’s preceded by a semicolon(;) from the previous path*

* Open a command prompt

* Create a certificate with `makecert` tool in Windows

`makecert -n "CN=PhoneGapCA" -r -sv PhoneGapCA.pvk PhoneGapCA.cer`

Follow the dialog pop-ups and enter your desired password (*phonegap* is the default for this example)

* Now officially sign using a trusted cert

`makecert -sk SignedByCA -iv PhoneGapCA.pvk -n "CN=SignedByCA" -ic PhoneGapCA.cer SignedByCA.cer -sr currentuser -ss My`

Follow the dialog pop-ups and enter the password from previous step (*phonegap*)

* Double click the **PhoneGapCA.cer** and follow the prompts to ensure it’s trusted. Use the same password from the create. **

* Create the pfx with:

`pvk2pfx.exe ^ -pvk PhoneGapCA.pvk ^ -spc PhoneGapCA.cer ^ -pfx PhoneGapCA.pfx ^ -po phonegap`


**Official Certificate**

The above is using a self-signed certificate. In the future we need to purchase one via an official code signing authority.
Loading

0 comments on commit 76ee1b8

Please sign in to comment.