Commit 36ef0b64 authored by JC Brand's avatar JC Brand

Merge pull request #308 from gbonvehi/winbuild

Added new Makefile.win, it only has dev/build/check targets
parents 9c0feea1 972fe46b
module.exports = function(grunt) { module.exports = function(grunt) {
var path = require('path');
var cfg = require('./package.json'); var cfg = require('./package.json');
grunt.initConfig({ grunt.initConfig({
jst: { jst: {
...@@ -62,6 +63,10 @@ module.exports = function(grunt) { ...@@ -62,6 +63,10 @@ module.exports = function(grunt) {
dest: 'css/converse.min.css', dest: 'css/converse.min.css',
src: ['css/converse.css'] src: ['css/converse.css']
} }
},
touch: {
npm: ['stamp-npm'],
bower: ['stamp-bower']
} }
}); });
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
...@@ -69,6 +74,7 @@ module.exports = function(grunt) { ...@@ -69,6 +74,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jst'); grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-json'); grunt.loadNpmTasks('grunt-json');
grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-touch');
grunt.registerTask('test', 'Run Tests', function () { grunt.registerTask('test', 'Run Tests', function () {
var done = this.async(); var done = this.async();
...@@ -107,23 +113,26 @@ module.exports = function(grunt) { ...@@ -107,23 +113,26 @@ module.exports = function(grunt) {
var child_process = require('child_process'); var child_process = require('child_process');
var exec = child_process.exec; var exec = child_process.exec;
var callback = function (err, stdout, stderr) { var callback = function (err, stdout, stderr) {
grunt.log.write(stdout);
if (err) { if (err) {
grunt.log.write('build failed with error code '+err.code); grunt.log.write('build failed with error code '+err.code);
grunt.log.write(stderr); grunt.log.write(stderr);
} done(false);
grunt.log.write(stdout); } else
done(); done();
}; };
exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' + var rjsext = (process.platform === 'win32') ? '.cmd' : '';
'./node_modules/requirejs/bin/r.js -o src/build.js optimize=none out=builds/converse.js && ' + var rjs = path.resolve('./node_modules/.bin/r.js' + rjsext);
'./node_modules/requirejs/bin/r.js -o src/build-no-jquery.js &&' + exec(rjs + ' -o src/build.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' + rjs + ' -o src/build.js optimize=none out=builds/converse.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' + rjs + ' -o src/build-no-jquery.js &&' +
'./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' + rjs + ' -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-otr.js &&' + rjs + ' -o src/build-no-locales-no-otr.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js && ' + rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-website-no-otr.js &&' + rjs + ' -o src/build-no-otr.js &&' +
'./node_modules/requirejs/bin/r.js -o src/build-website.js', callback); rjs + ' -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js && ' +
rjs + ' -o src/build-website-no-otr.js &&' +
rjs + ' -o src/build-website.js', callback);
// XXX: It might be possible to not have separate build config files. For example: // XXX: It might be possible to not have separate build config files. For example:
// 'r.js -o src/build.js paths.converse-dependencies=src/deps-no-otr paths.locales=locale/nolocales out=builds/converse-no-locales-no-otr.min.js' // 'r.js -o src/build.js paths.converse-dependencies=src/deps-no-otr paths.locales=locale/nolocales out=builds/converse-no-locales-no-otr.min.js'
}); });
......
# You can set these variables from the command line. # You can set these variables from the command line.
GRUNT ?= node_modules/.bin/grunt
BOWER ?= node_modules/.bin/bower BOWER ?= node_modules/.bin/bower
BUILDDIR = ./docs BUILDDIR = ./docs
PAPER = PAPER =
...@@ -48,12 +49,6 @@ po2json: ...@@ -48,12 +49,6 @@ po2json:
######################################################################## ########################################################################
## Release management ## Release management
jsmin:
./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js
cssmin:
grunt cssmin
release: release:
sed -i s/Project-Id-Version:\ Converse\.js\ [0-9]\.[0-9]\.[0-9]/Project-Id-Version:\ Converse.js\ $(VERSION)/ locale/converse.pot sed -i s/Project-Id-Version:\ Converse\.js\ [0-9]\.[0-9]\.[0-9]/Project-Id-Version:\ Converse.js\ $(VERSION)/ locale/converse.pot
sed -i s/\"version\":\ \"[0-9]\.[0-9]\.[0-9]\"/\"version\":\ \"$(VERSION)\"/ bower.json sed -i s/\"version\":\ \"[0-9]\.[0-9]\.[0-9]\"/\"version\":\ \"$(VERSION)\"/ bower.json
...@@ -85,18 +80,18 @@ clean:: ...@@ -85,18 +80,18 @@ clean::
dev: clean dev: clean
npm install npm install
${BOWER} update; $(BOWER) update;
bundler install --path=. bundler install --path=.
######################################################################## ########################################################################
## Builds ## Builds
css:: css::
${SASS} sass/converse.scss > css/converse.css $(SASS) sass/converse.scss > css/converse.css
build:: build::
./node_modules/.bin/grunt jst $(GRUNT) jst
./node_modules/.bin/grunt minify $(GRUNT) minify
######################################################################## ########################################################################
## Tests ## Tests
......
# You can set these variables from the command line.
GRUNT ?= node_modules\.bin\grunt.cmd
BOWER ?= node_modules\.bin\bower
PHANTOMJS ?= node_modules\.bin\phantomjs
SASS ?= sass
RMRF ?= rmdir /q /s
RMF ?= del /q
.PHONY: all help clean css minjs build
all: dev
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " dev to set up the development environment"
@echo " build create minified builds containing converse.js and all its dependencies"
########################################################################
## Install dependencies
stamp-npm: package.json
npm install
$(GRUNT) touch:npm
stamp-bower: stamp-npm bower.json
$(BOWER) install
$(GRUNT) touch:bower
clean::
@if EXIST stamp-npm $(RMF) stamp-npm
@if EXIST stamp-bower $(RMF) stamp-bower
@if EXIST node_modules\. $(RMRF) node_modules
@if EXIST components\. $(RMRF) components
dev: clean
npm install
$(BOWER) update
bundler install --path=.
########################################################################
## Builds
css::
$(SASS) sass/converse.scss > css/converse.css
build::
$(GRUNT) jst
$(GRUNT) minify
########################################################################
## Tests
check:: stamp-npm
$(PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html
...@@ -12,6 +12,7 @@ Changelog ...@@ -12,6 +12,7 @@ Changelog
* #292 Better support for XEP-0085 Chat State Notifications. [jcbrand] * #292 Better support for XEP-0085 Chat State Notifications. [jcbrand]
* #295 Document "allow_registration". [gbonvehi] * #295 Document "allow_registration". [gbonvehi]
* #304 Added Polish translations. [ser] * #304 Added Polish translations. [ser]
* New Makefile.win to build in Windows environments. [gbonvehi]
0.8.6 (2014-12-07) 0.8.6 (2014-12-07)
------------------ ------------------
......
...@@ -12,6 +12,8 @@ follow the instructions below to create this folder and fetch Converse's ...@@ -12,6 +12,8 @@ follow the instructions below to create this folder and fetch Converse's
3rd-party dependencies. 3rd-party dependencies.
.. note:: .. note::
Windows environment: We recommend installing the required tools using `Chocolatey <https://chocolatey.org/>`_
You will need Node.js (nodejs.install), Git (git.install) and optionally to build using Makefile, GNU Make (make)
If you have trouble setting up a development environment on Windows, If you have trouble setting up a development environment on Windows,
please read `this post <http://librelist.com/browser//conversejs/2014/11/5/openfire-converse-and-visual-studio-questions/#b28387e7f8f126693b11598a8acbe810>`_ please read `this post <http://librelist.com/browser//conversejs/2014/11/5/openfire-converse-and-visual-studio-questions/#b28387e7f8f126693b11598a8acbe810>`_
in the mailing list.: in the mailing list.:
...@@ -27,6 +29,9 @@ version `here <https://nodejs.org/download>`_. ...@@ -27,6 +29,9 @@ version `here <https://nodejs.org/download>`_.
Also make sure you have ``Git`` installed. `Details <http://git-scm.com/book/en/Getting-Started-Installing-Git>`_. Also make sure you have ``Git`` installed. `Details <http://git-scm.com/book/en/Getting-Started-Installing-Git>`_.
.. note::
Windows users should use Chocolatey as recommended above.:
Once you have *Node.js* and *git* installed, run the following command inside the Converse.js Once you have *Node.js* and *git* installed, run the following command inside the Converse.js
directory: directory:
...@@ -34,13 +39,18 @@ directory: ...@@ -34,13 +39,18 @@ directory:
make dev make dev
On Windows you need to specify Makefile.win to be used by running:
::
make -f Makefile.win dev
Or alternatively, if you don't have GNU Make: Or alternatively, if you don't have GNU Make:
:: ::
npm install npm install
bower update bower update
This will first install the Node.js development tools (like Grunt and Bower) This will first install the Node.js development tools (like Grunt and Bower)
and then use Bower to install all of Converse.js's front-end dependencies. and then use Bower to install all of Converse.js's front-end dependencies.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment