Commit 77a56395 authored by JC Brand's avatar JC Brand

Move build instructions from Gruntfile to Makefile

Also, remove build-no-locales-no-otr.js
parent 16cdd444
/*global process */
module.exports = function(grunt) { module.exports = function(grunt) {
var path = require('path');
grunt.initConfig({ grunt.initConfig({
jst: { jst: {
compile: { compile: {
...@@ -38,35 +36,4 @@ module.exports = function(grunt) { ...@@ -38,35 +36,4 @@ module.exports = function(grunt) {
}); });
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jst'); grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-json');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.registerTask('jsmin', 'Create a new release', function () {
var done = this.async();
var child_process = require('child_process');
var exec = child_process.exec;
var callback = function (err, stdout, stderr) {
grunt.log.write(stdout);
if (err) {
grunt.log.write('build failed with error code '+err.code);
grunt.log.write(stderr);
done(false);
} else
done();
};
var rjsext = (process.platform === 'win32') ? '.cmd' : '';
var rjs = '"' + path.resolve('./node_modules/.bin/r.js' + rjsext) + '"';
exec(rjs + ' -o src/build.js && ' +
rjs + ' -o src/build.js optimize=none out=builds/converse.js && ' +
rjs + ' -o src/build-no-jquery.js &&' +
rjs + ' -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
rjs + ' -o src/build-no-dependencies.js &&' +
rjs + ' -o src/build-no-dependencies.js optimize=none out=builds/converse-no-dependencies.js && ' +
rjs + ' -o src/build-no-locales-no-otr.js && ' +
rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js', callback);
// 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'
});
grunt.registerTask('minify', 'Create a new minified builds', ['cssmin', 'jsmin']);
}; };
...@@ -21,8 +21,6 @@ JSHINTEXCEPTIONS = $(GENERATED) \ ...@@ -21,8 +21,6 @@ JSHINTEXCEPTIONS = $(GENERATED) \
src/crypto.js \ src/crypto.js \
src/build-no-jquery.js \ src/build-no-jquery.js \
src/build-no-dependencies.js \ src/build-no-dependencies.js \
src/build-no-locales-no-otr.js \
src/build-no-otr.js \
src/build.js \ src/build.js \
src/bigint.js src/bigint.js
CHECKSOURCES = $(filter-out $(JSHINTEXCEPTIONS),$(SOURCES)) CHECKSOURCES = $(filter-out $(JSHINTEXCEPTIONS),$(SOURCES))
...@@ -109,38 +107,58 @@ stamp-bower: stamp-npm bower.json ...@@ -109,38 +107,58 @@ stamp-bower: stamp-npm bower.json
$(BOWER) install $(BOWER) install
touch stamp-bower touch stamp-bower
stamp-bundler: stamp-bundler: Gemfile
mkdir -p .bundle mkdir -p .bundle
gem install --user bundler --bindir .bundle/bin gem install --user bundler --bindir .bundle/bin
$(BUNDLE) install --path .bundle --binstubs .bundle/bin $(BUNDLE) install --path .bundle --binstubs .bundle/bin
touch stamp-bundler touch stamp-bundler
.PHONY: clean .PHONY: clean
clean:: clean:
rm -f stamp-npm stamp-bower stamp-bundler -rm -f stamp-npm stamp-bower stamp-bundler
rm -rf node_modules components .bundle -rm -rf node_modules components .bundle
.PHONY: dev .PHONY: dev
dev: stamp-bower stamp-bundler converse dev: stamp-bower stamp-bundler build
######################################################################## ########################################################################
## Builds ## Builds
.PHONY: css .PHONY: css
css: converse.css css: css/converse.css
converse.css:: stamp-bundler stamp-bower css/converse.css:: stamp-bundler stamp-bower sass
$(SASS) -I ./components/bourbon/app/assets/stylesheets/ sass/converse.scss css/converse.css $(SASS) -I ./components/bourbon/app/assets/stylesheets/ sass/converse.scss css/converse.css
.PHONY: watch .PHONY: watch
watch: stamp-bundler watch: stamp-bundler
$(SASS) --watch -I ./components/bourbon/app/assets/stylesheets/ sass/converse.scss:css/converse.css $(SASS) --watch -I ./components/bourbon/app/assets/stylesheets/ sass/converse.scss:css/converse.css
BUILDS = builds/converse.js \
builds/converse.min.js \
builds/converse.nojquery.js \
builds/converse.nojquery.min.js \
builds/converse-no-dependencies.min.js \
builds/converse-no-dependencies.js
# XXX This can be updated to use uglify to minimize instead of letting r.js run twice per file
builds/converse.min.js: stamp-bower src locale components *.js
$(RJS) -o src/build.js
builds/converse.js: stamp-bower src locale components *.js
$(RJS) -o src/build.js optimize=none out=builds/converse.js
builds/converse.nojquery.min.js: stamp-bower src locale components *.js
$(RJS) -o src/build-no-jquery.js
builds/converse.nojquery.js: stamp-bower src locale components *.js
$(RJS) -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js
builds/converse-no-dependencies.min.js: stamp-bower src locale components *.js
$(RJS) -o src/build-no-dependencies.js
builds/converse-no-dependencies.js: stamp-bower src locale components *.js
$(RJS) -o src/build-no-dependencies.js optimize=none out=builds/converse-no-dependencies.js
.PHONY: jsmin .PHONY: jsmin
jsmin: jsmin: $(BUILDS)
$(GRUNT) jsmin
.PHONY: watch .PHONY: cssmin
cssmin: stamp-npm cssmin: stamp-npm
$(GRUNT) cssmin $(GRUNT) cssmin
...@@ -152,17 +170,18 @@ converse:: stamp-npm ...@@ -152,17 +170,18 @@ converse:: stamp-npm
.PHONY: build .PHONY: build
build:: stamp-npm build:: stamp-npm
$(GRUNT) jst $(GRUNT) jst
$(GRUNT) minify $(GRUNT) cssmin
make jsmin
######################################################################## ########################################################################
## Tests ## Tests
.PHONY: jshint .PHONY: jshint
jshint: stamp-npm jshint: stamp-bower
$(JSHINT) --config jshintrc $(CHECKSOURCES) $(JSHINT) --config jshintrc $(CHECKSOURCES)
.PHONY: watch .PHONY: watch
check: stamp-npm jshint check: stamp-bower jshint
$(PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html $(PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html
######################################################################## ########################################################################
......
# You can set these variables from the command line. # You can set these variables from the command line.
GRUNT ?= node_modules\.bin\grunt.cmd GRUNT ?= node_modules\.bin\grunt.cmd
BOWER ?= node_modules\.bin\bower.cmd BOWER ?= node_modules\.bin\bower.cmd
PHANTOMJS ?= node_modules\.bin\phantomjs.cmd PHANTOMJS ?= node_modules\.bin\phantomjs.cmd
RJS ?= ./node_modules/.bin/r.js.cmd
SASS ?= sass SASS ?= sass
RMRF ?= rmdir /q /s RMRF ?= rmdir /q /s
RMF ?= del /q RMF ?= del /q
...@@ -51,9 +52,16 @@ dev: clean ...@@ -51,9 +52,16 @@ dev: clean
css:: css::
$(SASS) sass/converse.scss > css/converse.css $(SASS) sass/converse.scss > css/converse.css
build:: .PHONY: build
build:: stamp-npm
$(GRUNT) jst $(GRUNT) jst
$(GRUNT) minify $(GRUNT) cssmin
$(RJS) -o src/build.js
$(RJS) -o src/build.js optimize=none out=builds/converse.js
$(RJS) -o src/build-no-jquery.js
$(RJS) -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js
$(RJS) -o src/build-no-dependencies.js
$(RJS) -o src/build-no-dependencies.js optimize=none out=builds/converse-no-dependencies.js
######################################################################## ########################################################################
## Tests ## Tests
......
...@@ -10815,8 +10815,7 @@ define("converse", [ ...@@ -10815,8 +10815,7 @@ define("converse", [
require(["converse"]); require(["converse"]);
/*global jQuery, _, moment */ /*global jQuery, _, moment, Strophe, $build, $iq, $msg, $pres, SHA1, Base64, MD5, DSA, OTR */
define('jquery', [], function () { return jQuery; }); define('jquery', [], function () { return jQuery; });
define('jquery.browser', [], function () { return jQuery; }); define('jquery.browser', [], function () { return jQuery; });
define('typeahead', [], function () { return jQuery; }); define('typeahead', [], function () { return jQuery; });
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
baseUrl: "../", baseUrl: "../",
name: "components/almond/almond.js", name: "components/almond/almond.js",
out: "../builds/converse.nojquery.min.js", out: "../builds/converse.nojquery.min.js",
include: ['main'], include: ['converse'],
exclude: ['jquery', 'jquery-private'], exclude: ['jquery', 'jquery-private'],
insertRequire: ['converse'],
mainConfigFile: '../main.js' mainConfigFile: '../main.js'
}) })
({
baseUrl: "../",
name: "components/almond/almond.js",
out: "../builds/converse-no-locales-no-otr.min.js",
include: ['main'],
mainConfigFile: '../main.js',
paths: {
"moment_with_locales": "components/momentjs/moment",
"locales": "locale/nolocales"
}
})
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