This commit is contained in:
Colin Eberhardt 2015-08-12 08:25:57 +01:00
Родитель 6d10a623d0
Коммит 6714c36824
3 изменённых файлов: 43 добавлений и 34 удалений

Просмотреть файл

@ -1,8 +1,10 @@
language: c
compiler:
- clang
- gcc
language: node_js
node_js:
- "0.12"
before_install:
- npm install grunt-cli -g
before_script:
- sudo apt-get update -q
- sudo apt-get install nodejs
script: make
- sudo apt-get install gcc

Просмотреть файл

@ -4,23 +4,25 @@ module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var config = {
libName: 'css-layout',
distFolder: 'dist',
srcFolder: 'src',
testFolder: 'src/__tests__',
cTestFiles: 'src/__tests__/Layout-test.c src/Layout.c src/Layout-test-utils.c',
cTestOutput: 'c_test',
javaLibFolder: 'src/java/lib',
javaSource: 'src/java/tests/com/facebook/csslayout/*.java',
javaTestFiles: 'org.junit.runner.JUnitCore com.facebook.csslayout.LayoutEngineTest com.facebook.csslayout.LayoutCachingTest com.facebook.csslayout.CSSNodeTest'
};
grunt.initConfig({
paths: {
libName: 'css-layout',
distFolder: 'dist',
srcFolder: 'src',
testFolder: 'src/__tests__',
cTestFiles: 'src/__tests__/Layout-test.c src/Layout.c src/Layout-test-utils.c',
cTestOutput: 'c_test',
javaLibFolder: 'src/java/lib',
javaSource: 'src/java/tests/com/facebook/csslayout/*.java',
javaTestFiles: 'org.junit.runner.JUnitCore com.facebook.csslayout.LayoutEngineTest com.facebook.csslayout.LayoutCachingTest com.facebook.csslayout.CSSNodeTest'
},
config: config,
clean: {
dist: ['<%= paths.distFolder %>'],
cTest: ['<%= paths.cTestOutput %>'],
dist: ['<%= config.distFolder %>'],
cTest: ['<%= config.cTestOutput %>'],
javaTest: ['**/*.class']
},
@ -28,7 +30,7 @@ module.exports = function(grunt) {
options: {
configFile: '.eslintrc'
},
target: ['<%= paths.srcFolder %>/Layout.js']
target: ['<%= config.srcFolder %>/Layout.js']
},
includereplace: {
@ -36,8 +38,8 @@ module.exports = function(grunt) {
prefix: '// @@',
},
main: {
src: '<%= paths.srcFolder %>/<%= paths.libName %>.js',
dest: '<%= paths.distFolder %>/<%= paths.libName %>.js'
src: '<%= config.srcFolder %>/<%= config.libName %>.js',
dest: '<%= config.distFolder %>/<%= config.libName %>.js'
}
},
@ -48,8 +50,8 @@ module.exports = function(grunt) {
},
main: {
files: {
'<%= paths.distFolder %>/<%= paths.libName %>.min.js':
['<%= paths.distFolder %>/<%= paths.libName %>.js']
'<%= config.distFolder %>/<%= config.libName %>.min.js':
['<%= config.distFolder %>/<%= config.libName %>.js']
}
}
},
@ -58,10 +60,10 @@ module.exports = function(grunt) {
main: {
options: {
files: [
'<%= paths.srcFolder %>/Layout.js',
'<%= paths.srcFolder %>/Layout-test-utils.js',
'<%= paths.testFolder %>/Layout-test.js',
'<%= paths.testFolder %>/Layout-consts-test.js'
'<%= config.srcFolder %>/Layout.js',
'<%= config.srcFolder %>/Layout-test-utils.js',
'<%= config.testFolder %>/Layout-test.js',
'<%= config.testFolder %>/Layout-consts-test.js'
],
browsers: ['Chrome'],
frameworks: ['jasmine'],
@ -72,25 +74,25 @@ module.exports = function(grunt) {
execute: {
transpile: {
src: ['<%= paths.srcFolder %>/transpile.js']
src: ['<%= config.srcFolder %>/transpile.js']
}
},
shell: {
cCompile: {
command: 'gcc -std=c99 -Werror -Wno-padded <%= paths.cTestFiles %> -lm -o "./<%= paths.cTestOutput %>"'
command: 'gcc -std=c99 -Werror -Wno-padded <%= config.cTestFiles %> -lm -o "./<%= config.cTestOutput %>"'
},
cTestExecute: {
command: './<%= paths.cTestOutput %>'
command: './<%= config.cTestOutput %>'
},
javaCompile: {
command: 'javac -cp <%= paths.javaLibFolder %>/junit4.jar:<%= paths.javaLibFolder %>/jsr305.jar:<%= paths.javaLibFolder %>/infer-annotations-1.4.jar -sourcepath ./src/java/src:./src/java/tests <%= paths.javaSource %>'
command: 'javac -cp <%= config.javaLibFolder %>/junit4.jar:<%= config.javaLibFolder %>/jsr305.jar:<%= config.javaLibFolder %>/infer-annotations-1.4.jar -sourcepath ./src/java/src:./src/java/tests <%= config.javaSource %>'
},
javaTestExecute: {
command: 'java -cp ./src/java/src:./src/java/tests:<%= paths.javaLibFolder %>/junit4.jar:<%= paths.javaLibFolder %>/infer-annotations-1.4.jar <%= paths.javaTestFiles %>'
command: 'java -cp ./src/java/src:./src/java/tests:<%= config.javaLibFolder %>/junit4.jar:<%= config.javaLibFolder %>/infer-annotations-1.4.jar <%= config.javaTestFiles %>'
},
javaPackage: {
command: 'jar cf <%= paths.distFolder %>/<%= paths.libName %>.jar <%= paths.javaSource %>'
command: 'jar cf <%= config.distFolder %>/<%= config.libName %>.jar <%= config.javaSource %>'
}
}
});
@ -109,5 +111,7 @@ module.exports = function(grunt) {
grunt.registerTask('build', ['test-javascript', 'transpile', 'clean:dist', 'package-javascript', 'package-java']);
grunt.registerTask('ci', ['eslint', 'transpile', 'clean:dist', 'package-javascript', 'package-java']);
grunt.registerTask('default', ['build']);
};

Просмотреть файл

@ -3,6 +3,9 @@
"version": "0.0.2",
"description": "Reimplementation of CSS layout using pure JavaScript",
"main": "src/main.js",
"scripts": {
"test": "grunt ci"
},
"repository": {
"type": "git",
"url": "https://github.com/facebook/css-layout.git"