feat(Gruntfile.js): Added package-c task which creates a unified single header css-layout.h for use in C code ;
This commit is contained in:
37
Gruntfile.js
37
Gruntfile.js
@@ -6,6 +6,7 @@ module.exports = function(grunt) {
|
|||||||
var isWindows = /^win/.test(process.platform);
|
var isWindows = /^win/.test(process.platform);
|
||||||
|
|
||||||
require('load-grunt-tasks')(grunt);
|
require('load-grunt-tasks')(grunt);
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
|
|
||||||
// config
|
// config
|
||||||
var config = {
|
var config = {
|
||||||
@@ -102,6 +103,35 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
concat: {
|
||||||
|
options: {
|
||||||
|
separator: '\n',
|
||||||
|
// Replace all 'use strict' statements in the code with a single one at the top
|
||||||
|
banner: [
|
||||||
|
'/*',
|
||||||
|
' * #define CSS_LAYOUT_IMPLEMENTATION',
|
||||||
|
' * before you include this file in *one* C or C++ file to create the implementation.',
|
||||||
|
' */\n'
|
||||||
|
].join('\n'),
|
||||||
|
process: function(src, filepath) {
|
||||||
|
if (path.extname(filepath) === '.c') {
|
||||||
|
return [
|
||||||
|
'#ifdef CSS_LAYOUT_IMPLEMENTATION',
|
||||||
|
src,
|
||||||
|
'#endif // CSS_LAYOUT_IMPLEMENTATION'
|
||||||
|
].join('\n')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: ['<%= config.srcFolder %>/Layout.h', '<%= config.srcFolder %>/Layout.c'],
|
||||||
|
dest: '<%= config.distFolder %>/css-layout.h',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
shell: {
|
shell: {
|
||||||
cCompile: {
|
cCompile: {
|
||||||
command: cTestCompile
|
command: cTestCompile
|
||||||
@@ -148,12 +178,15 @@ module.exports = function(grunt) {
|
|||||||
// Packages the Java as a JAR
|
// Packages the Java as a JAR
|
||||||
grunt.registerTask('package-java', ['shell:javaPackage']);
|
grunt.registerTask('package-java', ['shell:javaPackage']);
|
||||||
|
|
||||||
|
// Packages the C code as a single header
|
||||||
|
grunt.registerTask('package-c', ['concat']);
|
||||||
|
|
||||||
// Default build, performs the full works!
|
// Default build, performs the full works!
|
||||||
grunt.registerTask('build', ['test-javascript', 'transpile', 'clean:dist', 'package-javascript', 'package-java']);
|
grunt.registerTask('build', ['test-javascript', 'transpile', 'clean:dist', 'package-javascript', 'package-java', 'package-c']);
|
||||||
|
|
||||||
// The JavaScript unit tests require Chrome (they need a faithful flexbox implementation
|
// The JavaScript unit tests require Chrome (they need a faithful flexbox implementation
|
||||||
// to test against), so under CI this step is skipped.
|
// to test against), so under CI this step is skipped.
|
||||||
grunt.registerTask('ci', ['eslint', 'transpile', 'clean:dist', 'package-javascript', 'package-java']);
|
grunt.registerTask('ci', ['eslint', 'transpile', 'clean:dist', 'package-javascript', 'package-java', 'package-c']);
|
||||||
|
|
||||||
grunt.registerTask('default', ['build']);
|
grunt.registerTask('default', ['build']);
|
||||||
};
|
};
|
||||||
|
1315
dist/css-layout.h
vendored
Normal file
1315
dist/css-layout.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@
|
|||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-cli": "^0.1.13",
|
"grunt-cli": "^0.1.13",
|
||||||
"grunt-contrib-clean": "^0.6.0",
|
"grunt-contrib-clean": "^0.6.0",
|
||||||
|
"grunt-contrib-concat": "^0.5.1",
|
||||||
"grunt-contrib-copy": "^0.8.0",
|
"grunt-contrib-copy": "^0.8.0",
|
||||||
"grunt-contrib-uglify": "^0.9.1",
|
"grunt-contrib-uglify": "^0.9.1",
|
||||||
"grunt-eslint": "^17.1.0",
|
"grunt-eslint": "^17.1.0",
|
||||||
|
@@ -12,7 +12,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// in concatenated header, don't include Layout.h it's already at the top
|
||||||
|
#ifndef CSS_LAYOUT_IMPLEMENTATION
|
||||||
#include "Layout.h"
|
#include "Layout.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
Reference in New Issue
Block a user