Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New integrated build system #273

Merged
merged 34 commits into from
Aug 8, 2016
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
20df8dc
Initial Commit of the new self-contained build system
techninja Jul 24, 2016
5d317b6
Fix AppName typo
techninja Jul 24, 2016
7806ac8
Mac sign app and point to correct icons
techninja Jul 24, 2016
0ee489a
Remove categories debug output
techninja Jul 25, 2016
d1485b5
Remove menus by default
techninja Jul 25, 2016
54b7984
Nix build for 32 bit linux as we won't have a compiled serialport
techninja Jul 25, 2016
d83a275
Move to cncserver without rebuild
techninja Jul 25, 2016
eb5c881
Add pebuilt serialport binaries for dev/release distribution
techninja Jul 25, 2016
38fd3f9
WIP Serialport FIxer
techninja Jul 25, 2016
4aa8edf
Complete post install serialport fixer upper
techninja Jul 25, 2016
212ceb7
Add missing fs-finder
techninja Jul 25, 2016
ee47c74
Always use path.join for Win compat!
techninja Jul 25, 2016
4919171
Normalize build JSON
techninja Jul 25, 2016
f37fc6a
Update readme, mac signing API update
techninja Jul 25, 2016
57adb74
Complete dev readme updates
techninja Jul 25, 2016
2db5edf
Add flatten packages for windows
techninja Jul 25, 2016
a1334e9
Flatten before windows build
techninja Jul 25, 2016
d9485e0
Fix incorrect windows install anim location
techninja Jul 25, 2016
3ee7a72
Finalize fix for windows resources dir
techninja Jul 25, 2016
837319e
Remove io.js mention
techninja Jul 25, 2016
7b5591b
Change icon dir
docprofsky Jul 26, 2016
aeb1723
Force deb icon path
docprofsky Jul 26, 2016
2e17a24
Correctly set app icon
docprofsky Jul 26, 2016
e8c5b3f
Merge pull request #274 from evil-mad/deb-desktop
docprofsky Jul 26, 2016
1e2209f
RoboPaint shows up in Ubuntu dash
docprofsky Jul 26, 2016
c1048b4
Add a little more readme specificity
techninja Jul 26, 2016
febfce8
Get rid of useless resources from old build
techninja Jul 26, 2016
623b2b6
64 bit linux build only
techninja Jul 26, 2016
6cd8dd2
Fix maintainer in deb
docprofsky Jul 26, 2016
eb1176b
Move deb packager to optional dependencies, necessary for windows
docprofsky Jul 28, 2016
1767bad
Add build support for Redhat RPM
techninja Jul 29, 2016
e179bdf
Add support for copying in the correct arch binaries for windows
techninja Jul 29, 2016
631c3eb
Fix erroneous commands to delete and move files
docprofsky Jul 31, 2016
0eaf56f
Correctly set icon for both Arch win builds
techninja Aug 2, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ results

npm-debug.log

/node_modules/*
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Builds directory
/build/dist

/nbproject/private
nbproject/project.properties

nbproject/project.xml
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,27 @@ Want to help be a part of RoboPaint? Maybe spruce it up, or hack it to bits into
your own thing? Here's a rough and tumble guide to getting set up:

### Pre-requisites
#### Electron (v0.34.x)
#### Electron
RoboPaint is an HTML5/Node.js application that runs in
[electron](https://electron.atom.io/). Though the main.html
code may somewhat render in a regular browser window, it's still a node.js
application that requires its low level file access and other APIs. This is
installed via `npm install` when run at the root.

#### Install Node (4.x+) for node & npm
#### Install Node for node & npm
Required for automated builds and installation content. The build and
dependency system all uses [node.js](http://nodejs.org). `npm` is installed
along with it. If you already have node installed, you can skip this part.

#### Build Tools!
* CNC Server uses the node-serialport module, a low-level partially native
module that needs to be built/compiled for every OS.
* These are pre-compiled for each release in
the [robopaint-build](https://github.com/evil-mad/robopaint-build/) repository,
which you can easily use to replace the node_modules folder within
`cncserver/node_modules/serialport/`
* *BUT*, if you're experimenting with new versions of modules, you're going to
need to be able to build your own, so continue on.
* CNC Server uses the [node-serialport module](https://github.com/EmergingTechnologyAdvisors/node-serialport),
a low-level partially native module that needs to be built/compiled for every
OS. We've included the top four common OS & architecture combinations, so if
your dev system is one of those, the file will be copied over after
`npm install` and you should be in the clear to run immediately.
* If you're experimenting with new versions of modules, or are running on a
different arch/OS, you're going to need to be able to build your own, so
continue on.

##### Windows
* You'll need the free download version of
Expand All @@ -115,22 +115,21 @@ which will have the command line tools required for builds.
as source to be built on the target machines, so you shouldn't have to install
anything new for this at all.

#### Building natively for Electron with `node-pre-gyp`
0. Run `npm install node-gyp node-pre-gyp -g` to install globally the node
native builder. (ignore this if you already have them)
1. Pull down/clone your fork of the RoboPaint repository with git (or just
download a zip of the files).
2. In your terminal/command line interface, go to that folder and run
`npm install`
* This will run through all the required module dependencies and install/build
them to the best of its ability.
#### Building natively for Electron with `electron-rebuild`
0. Pull down/clone your fork of the RoboPaint repository with git (or just
download a zip of the files).
1. In your terminal/command line interface, go to that folder and run
`npm install` to install dependencies, then `npm install electron-rebuild`
to install electron-rebuild locally.
* This will have built the node-serialport for io.js, but we actually need
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove references to io.js

the binary created with electron headers, soo..
* Follow [Jed's instructions here](https://gist.github.com/jedthehumanoid/a7f8278e0a37d259adca)
to build the binary correctly.
* Mac/Linux: run `node_modules/.bin/electron-rebuild`
* Windows: run `node_modules\.bin\electron-rebuild.cmd`
* You may see some errors, but it should re-compile everything that needs it.
4. That's it! You should now be installed and ready to hack. To update CNC server
just run `npm install cncserver` from the project root and it should pull from
the latest master.
the latest master, and you'll likely need to re-run `electron-rebuild`, or the
fix script via `npm run fix-serialport`.

### Running RoboPaint from source
* Assuming this is all working, get yourself to the root of the repo and simply
Expand Down
182 changes: 182 additions & 0 deletions build/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
/**
* @file RoboPaint Build gruntfile: provides basic configuration and build tasks
* for creating distribution release files.
*/

var path = require('path');
var fileURL = require('file-url');

module.exports = function(grunt) {
// Load the plugins...
grunt.loadNpmTasks('grunt-electron');

// Load all platform specific tasks:
switch (process.platform) {
case 'win32':
grunt.loadNpmTasks('grunt-electron-installer');
break;

case 'darwin':
grunt.loadNpmTasks('grunt-appdmg');
break;

default:
grunt.loadNpmTasks('grunt-electron-installer-debian');
break;
}

// Load the tasks in 'tasks' dir.
grunt.loadTasks('tasks');

// Set all subsequent paths to the relative to the root of the repo
grunt.file.setBase(path.resolve('..'));

var appInfo = grunt.file.readJSON('package.json');
var numericVersion = appInfo.version.split('-')[0];

// All paths/patterns to clean from dist build.
var buildIgnore = [
'build/dist',
'build/node_modules',
'build/tasks',
'build/package.json',
'build/Gruntfile.js',
'node_modules/electron-*',
'node_modules/grunt*',
].join('|');

// Build configuration:
grunt.initConfig({
name: appInfo.name,
pkg: appInfo,
electron: {
macbuild: {
options: {
name: appInfo.releaseInfo.appName,
dir: './',
out: 'build/dist',
icon: 'build/resources/mac/app.icns',
version: appInfo.electronVersion,
platform: 'darwin',
arch: 'x64',
'osx-sign': {
identity: 'Developer ID Application: Evil Mad Science LLC'
},
ignore: buildIgnore,
'app-version': appInfo.version,
overwrite: true,
prune: true,
'app-bundle-id': appInfo.name + '-main',
'helper-bundle-id': appInfo.name + '-helper',
}
},
winbuild: {
options: {
name: appInfo.releaseInfo.appName,
dir: './',
out: 'build/dist',
icon: 'build/resources/win32/app.ico',
version: appInfo.electronVersion,
platform: 'win32',
arch: 'x64,ia32',
ignore: buildIgnore,
'app-version': appInfo.version,
overwrite: true,
prune: true,
'version-string': {
CompanyName: appInfo.releaseInfo.company,
LegalCopyright: appInfo.releaseInfo.copyright,
FileDescription: appInfo.releaseInfo.appName,
OriginalFilename: appInfo.releaseInfo.appName + '.exe',
FileVersion: appInfo.electronVersion,
ProductVersion: appInfo.version,
ProductName: appInfo.releaseInfo.appName,
InternalName: appInfo.name,
},
}
},
linbuild: {
options: {
name: appInfo.name,
dir: './',
out: 'build/dist',
icon: 'build/resources/app.png',
ignore: buildIgnore,
version: appInfo.electronVersion,
platform: 'linux',
arch: 'x64,ia32',
'app-version': appInfo.version,
overwrite: true,
prune: true
}
},
},
appdmg: {
options: {
basepath: 'build/dist/' + appInfo.name + '-darwin-x64',
title: 'Install ' + appInfo.releaseInfo.appName,
icon: '../../resources/mac/app.icns',
background: '../../resources/mac/dmg_back.png',
'icon-size': 80,
contents: [
{x: 448, y: 344, type: 'link', path: '/Applications'},
{x: 192, y: 344, type: 'file', path: appInfo.releaseInfo.appName +'.app'}
]
},
target: {
dest:
'build/dist/' +
appInfo.releaseInfo.appName +
'_Mac_v' + appInfo.version + '.dmg'
}
},
'create-windows-installer': {
64: {
iconUrl: fileURL('build/resources/win32/app.ico'),
appDirectory: 'build/dist/' + appInfo.releaseInfo.appName + '-win32-x64',
outputDirectory: 'build/dist/winstall64/',
loadingGif: 'build/resources/win32/install_anim.gif',
version: numericVersion,
authors: appInfo.releaseInfo.company,
},
32: {
iconUrl: fileURL('build/resources/win32/app.ico'),
appDirectory: 'build/dist/' + appInfo.releaseInfo.appName + '-win32-ia32',
outputDirectory: 'build/dist/winstall32/',
loadingGif: 'build/resources/win32/install_anim.gif',
version: numericVersion,
authors: appInfo.releaseInfo.company,
},
},
'electron-installer-debian': {
options: {
name: appInfo.name,
productName: appInfo.releaseInfo.appName,
description: appInfo.description,
productDescription: appInfo.releaseInfo.description,
genericName: 'Robot Controller',
section: 'graphics',
priority: 'optional',
version: numericVersion,
revision: appInfo.version.split('-')[1],
categories: appInfo.releaseInfo.categories,
lintianOverrides: [
'changelog-file-missing-in-native-package',
'executable-not-elf-or-script',
'extra-license-file'
]
},

linux64: {
options: {
arch: 'amd64'
},
src: 'build/dist/' + appInfo.name + '-linux-x64',
dest: 'build/dist/'
}
}
});

// Default task(s).
grunt.registerTask('default', ['pre-build']);
};
5 changes: 5 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RoboPaint Builds
===============

RoboPaint needs to support easy installs for users on all systems, so this
folder is where the parts for that live, and where you go to build a release.
Binary file added build/bin/serialport/darwin-x64/serialport.node
Binary file not shown.
Binary file added build/bin/serialport/linux-x64/serialport.node
Binary file not shown.
Binary file added build/bin/serialport/win32-ia32/serialport.node
Binary file not shown.
Binary file added build/bin/serialport/win32-x64/serialport.node
Binary file not shown.
33 changes: 33 additions & 0 deletions build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "robopaint-build",
"version": "2.0.0",
"license": "MIT",
"author": {
"name": "James Todd",
"email": "[email protected]",
"url": "http://evilmadscience.com"
},
"homepage": "https://github.com/evil-mad/robopaint",
"dependencies": {
"file-url": "^1.1.0",
"flatten-packages": "^0.1.4",
"fs-plus": "2.x",
"grunt": "^0.4.5",
"grunt-cli": "~0.1.13",
"grunt-electron": "4.0.0",
"grunt-electron-installer-debian": "^0.3.0",
"rcedit": "^0.3.0",
"underscore-plus": "^1.6.6"
},
"repository": {
"type": "git",
"url": "https://github.com/PancakeBot/PancakePainter.git"
},
"scripts": {
"start": "node_modules/.bin/grunt build-current-os"
},
"optionalDependencies": {
"grunt-appdmg": "^0.3.1",
"grunt-electron-installer": "^2.1.0"
}
}
Binary file added build/resources/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions build/resources/linux/app.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Name=<%= productName %>
Comment=<%= description %>
GenericName=<%= genericName %>
Exec=<%= installDir %>/share/<%= name %>/<%= name %> %U
Icon=<%= iconName %>
Type=Application
StartupNotify=true
Categories=<%= categories %>;
MimeType=text/plain;
10 changes: 10 additions & 0 deletions build/resources/linux/debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: <%= name %>
Version: <%= version %>
Depends: gconf2, gconf-service, libgtk2.0-0, libudev0 | libudev1, libgcrypt11, libnotify4, libxtst6, libnss3, python, gvfs-bin, xdg-utils
Suggests: libgnome-keyring0, gir1.2-gnomekeyring-1.0
Section: <%= section %>
Priority: optional
Architecture: <%= arch %>
Installed-Size: <%= installedSize %>
Maintainer: <%= maintainer %>
Description: <%= description %>
7 changes: 7 additions & 0 deletions build/resources/linux/debian/lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
atom: arch-dependent-file-in-usr-share
atom: changelog-file-missing-in-native-package
atom: copyright-file-contains-full-apache-2-license
atom: copyright-should-refer-to-common-license-file-for-apache-2
atom: embedded-library
atom: package-installs-python-bytecode
atom: unstripped-binary-or-object
51 changes: 51 additions & 0 deletions build/resources/linux/debian/mkdeb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# mkdeb version control-file-path deb-file-path

set -e

SCRIPT=`readlink -f "$0"`
ROOT=`readlink -f $(dirname $SCRIPT)/..`
cd $ROOT

VERSION="$1"
ARCH="$2"
CONTROL_FILE="$3"
DESKTOP_FILE="$4"
ICON_FILE="$5"
DEB_PATH="$6"
SHORT_NAME="$7"
FILE_MODE=755

TARGET_ROOT="`mktemp -d`"
chmod $FILE_MODE "$TARGET_ROOT"
TARGET="$TARGET_ROOT/$SHORT_NAME-$VERSION-$ARCH"

mkdir -m $FILE_MODE -p "$TARGET/usr"
env INSTALL_PREFIX="$TARGET/usr" script/grunt install

mkdir -m $FILE_MODE -p "$TARGET/DEBIAN"
cp "$CONTROL_FILE" "$TARGET/DEBIAN/control"

mkdir -m $FILE_MODE -p "$TARGET/usr/share/applications"
cp "$DESKTOP_FILE" "$TARGET/usr/share/applications"

mkdir -m $FILE_MODE -p "$TARGET/usr/share/pixmaps"
cp "$ICON_FILE" "$TARGET/usr/share/pixmaps"

# Copy generated LICENSE.md to /usr/share/doc/atom/copyright
mkdir -m $FILE_MODE -p "$TARGET/usr/share/doc/$SHORT_NAME"
cp "$TARGET/usr/share/$SHORT_NAME/LICENSE.md" "$TARGET/usr/share/doc/$SHORT_NAME/copyright"

# Add lintian overrides
mkdir -m $FILE_MODE -p "$TARGET/usr/share/lintian/overrides"
cp "$ROOT/resources/linux/debian/lintian-overrides" "$TARGET/usr/share/lintian/overrides/$SHORT_NAME"

# Symlink bin
ln -s "/usr/share/$SHORT_NAME/$SHORT_NAME" "$TARGET/usr/bin/$SHORT_NAME"

# Remove executable bit from .node files
find "$TARGET" -type f -name "*.node" -exec chmod a-x {} \;

fakeroot dpkg-deb -b "$TARGET"
mv "$TARGET_ROOT/$SHORT_NAME-$VERSION-$ARCH.deb" "$DEB_PATH"
rm -rf "$TARGET_ROOT"
Loading