8982e4916f
Note: all of the changes to .debug.js and .min.js come from upstream I also simplified our patch, because we are now almost unforked upstream code (we just have a couple of fixes they haven't merged yet). In particular we can't use _ShadowDOMPolyfill$isGeneratedWrapper so we go back to 'GeneratedWrapper'. I'm trying to align our build logic more closely to: https://github.com/Polymer/platform/blob/master/gruntfile.js#L10, hence the use of their build.json files. This fixes: https://code.google.com/p/dart/issues/detail?id=13054 R=efortuna@google.com Review URL: https://codereview.chromium.org//23548014 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27210 260f80e4-7a28-3924-810f-c04153c831b5
115 lines
2.9 KiB
JavaScript
115 lines
2.9 KiB
JavaScript
/*
|
|
* Copyright 2013 The Polymer Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style
|
|
* license that can be found in the LICENSE file.
|
|
*/
|
|
module.exports = function(grunt) {
|
|
// Recursive module builder:
|
|
var path = require('path');
|
|
function readManifest(filename, modules) {
|
|
modules = modules || [];
|
|
var lines = grunt.file.readJSON(filename);
|
|
var dir = path.dirname(filename);
|
|
lines.forEach(function(line) {
|
|
var fullpath = path.join(dir, line);
|
|
if (line.slice(-5) == '.json') {
|
|
// recurse
|
|
readManifest(fullpath, modules);
|
|
} else {
|
|
modules.push(fullpath);
|
|
}
|
|
});
|
|
return modules;
|
|
}
|
|
|
|
// Karma setup:
|
|
var browsers;
|
|
(function() {
|
|
try {
|
|
var config = grunt.file.readJSON('local.json');
|
|
if (config.browsers) {
|
|
browsers = config.browsers;
|
|
}
|
|
} catch (e) {
|
|
var os = require('os');
|
|
browsers = ['Chrome', 'Firefox'];
|
|
if (os.type() === 'Darwin') {
|
|
browsers.push('ChromeCanary');
|
|
}
|
|
if (os.type() === 'Windows_NT') {
|
|
browsers.push('IE');
|
|
}
|
|
}
|
|
})();
|
|
grunt.initConfig({
|
|
karma: {
|
|
options: {
|
|
configFile: 'conf/karma.conf.js',
|
|
keepalive: true,
|
|
browsers: browsers
|
|
},
|
|
buildbot: {
|
|
browsers: browsers,
|
|
reporters: ['crbot'],
|
|
logLevel: 'OFF'
|
|
},
|
|
ShadowDOM: {
|
|
browsers: browsers
|
|
}
|
|
},
|
|
concat: {
|
|
ShadowDOM: {
|
|
src: readManifest('build.json'),
|
|
dest: '../lib/shadow_dom.debug.js',
|
|
nonull: true
|
|
}
|
|
},
|
|
uglify: {
|
|
ShadowDOM: {
|
|
options: {
|
|
compress: {
|
|
// TODO(sjmiles): should be false by default (?)
|
|
// https://github.com/mishoo/UglifyJS2/issues/165
|
|
unsafe: false
|
|
}
|
|
//compress: true, Xmangle: true, beautify: true, unsafe: false
|
|
},
|
|
files: {
|
|
'../lib/shadow_dom.min.js': ['../lib/shadow_dom.debug.js']
|
|
}
|
|
}
|
|
},
|
|
|
|
yuidoc: {
|
|
compile: {
|
|
name: '<%= pkg.name %>',
|
|
description: '<%= pkg.description %>',
|
|
version: '<%= pkg.version %>',
|
|
url: '<%= pkg.homepage %>',
|
|
options: {
|
|
exclude: 'third_party',
|
|
paths: '.',
|
|
outdir: 'docs',
|
|
linkNatives: 'true',
|
|
tabtospace: 2,
|
|
themedir: '../docs/doc_themes/simple'
|
|
}
|
|
}
|
|
},
|
|
pkg: grunt.file.readJSON('package.json')
|
|
});
|
|
|
|
// plugins
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-yuidoc');
|
|
grunt.loadNpmTasks('grunt-karma-0.9.1');
|
|
|
|
// tasks
|
|
grunt.registerTask('default', ['concat', 'uglify']);
|
|
grunt.registerTask('minify', ['concat', 'uglify']);
|
|
grunt.registerTask('docs', ['yuidoc']);
|
|
grunt.registerTask('test', ['karma:ShadowDOM']);
|
|
grunt.registerTask('test-buildbot', ['karma:buildbot']);
|
|
};
|