module.exports = function (grunt) {
    require('load-grunt-tasks')(grunt);
    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-contrib-uglify');

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        shell: {
            options: {
                stderr: false
            },
            target: {
                command: 'echo Use build:emscripten or build:native'
            },
            native: {
                command: [
                    'echo Building native',
                    'cd build',
                    'cmake -DOTUCHA_EMSCRIPTEN_ENABLED=OFF -DOTUCHA_DO_NOT_WARN_GL_H=ON ../src'
                ].join('&&')
            },
            xcode: {
                command: [
                    'echo Building Xcode',
                    'cd xbuild',
                    'cmake -DOTUCHA_EMSCRIPTEN_ENABLED=OFF -DOTUCHA_DO_NOT_WARN_GL_H=ON -G Xcode ../src',
                    'open -a Xcode otucha.xcodeproj'
                ].join('&&')
            },
            emscripten_cmake: {
                options: {
                    failOnError: false
                },
                command: [
                    'cd embuild',
                    'emcmake cmake ../src'
                ].join('&&')
            },
            emscripten_make: {
                command: [
                    'cd embuild',
                    'make'
                ].join('&&')
            }
        },
        bowercopy: {
            server: {
                options: {
                    srcPrefix: 'src',
                    destPrefix: 'www'
                },
                files: {
                    'server.js': 'server.js'
                }
            },
            html: {
                options: {
                    srcPrefix: 'embuild',
                    destPrefix: 'www'
                },
                files: {
                    'index.html': 'otucha.html'
                }
            },
            js: {
                options: {
                    srcPrefix: 'embuild',
                    destPrefix: 'www'
                },
                files: {
                    'otucha.js': 'otucha.js',
                }
            },
            dist: {
                options: {
                    srcPrefix: 'dist',
                    destPrefix: 'www'
                },
                files: {
                    'otucha.js': 'otucha.js',
                    'index.html': 'index.html'
                }
            }
        },
        uglify: {
            options: {
                sourceMap: false,
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyy-mm-dd-HH-MM-ss") %> */\n',
                compress: true,
                mangle: true
            },
            build: {
                files: {
                    'www/otucha.js': [
                        'embuild/otucha.js'
                    ]
                }
            }
        }
    });

    grunt.registerTask('default', function () {
        grunt.task.run(['build']);
    });
    grunt.registerTask('build', ['build:native']);
    grunt.registerTask('build:native', function () {
        grunt.file.mkdir('build');
        grunt.task.run(['shell:native']);
    });
    grunt.registerTask('build:xcode', function () {
        grunt.file.mkdir('xbuild');
        grunt.task.run(['shell:xcode']);
    });
    grunt.registerTask('build:js', function () {
        if (grunt.option('jsUseDist')) {
            grunt.task.run(['bowercopy:dist']);
        } else {
            if (!grunt.file.exists('embuild/CMakeCache.txt')) {
                grunt.file.mkdir('embuild');
                grunt.task.run('shell:emscripten_cmake');
                grunt.task.run('shell:emscripten_cmake');
            }
            grunt.task.run('shell:emscripten_make');
            grunt.task.run('bowercopy:html');
            if (grunt.option('jsMin')) {
                grunt.task.run('uglify');
            } else {
                grunt.task.run('bowercopy:js');
            }
        }
        grunt.task.run('bowercopy:server');
    });
}

@@ -682,32 +682,342 @@
 %0A            %7D,%0A
+            coverage: %7B%0A                command: %5B%0A                    'echo Building coverage',%0A                    'cd cbuild',%0A                    'cmake -DOTUCHA_EMSCRIPTEN_ENABLED=OFF -DOTUCHA_DO_NOT_WARN_GL_H=ON -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug ../src'%0A                %5D.join('&&')%0A            %7D,%0A
             xcod
@@ -3564,32 +3564,175 @@
 ive'%5D);%0A    %7D);%0A
+    grunt.registerTask('build:coverage', function () %7B%0A        grunt.file.mkdir('cbuild');%0A        grunt.task.run(%5B'shell:coverage'%5D);%0A    %7D);%0A
     grunt.regist

Add coverage build option