-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathGruntfile.js
More file actions
88 lines (83 loc) · 2.91 KB
/
Gruntfile.js
File metadata and controls
88 lines (83 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var arduino = process.env.ARDUINO_PATH;
console.log(arduino);
module.exports = function(grunt) {
// configure the tasks
grunt.initConfig({
// exec: create task dynamically see end of file for where this happens.
exec: {
compile_usb: {
command: function() {
return arduino + " --verify --verbose-build --board arduino:avr:uno" +
" --pref build.path=firmware/bin/usb/uno/ firmware/build/usb/mbotFirmata/mbotFirmata.ino";
},
},
compile_bluetooth: {
command: function() {
return arduino + " --verify --verbose-build --board arduino:avr:uno" +
" --pref build.path=firmware/bin/bluetooth/uno/ firmware/build/bluetooth/mbotFirmata/mbotFirmata.ino";
},
},
},
'string-replace': {
precompile: {
files: [{
src: 'firmware/build/bluetooth/mbotFirmata/mbotFirmata.ino',
dest: 'firmware/build/bluetooth/mbotFirmata/mbotFirmata.ino',
}],
options: {
replacements: [{
pattern: /57600/g,
replacement: '115200',
}],
},
},
},
copy: {
options: {
timestamp: true,
},
firmata_usb: {
cwd: 'firmware/src/',
flatten: true,
src: [ 'mbotFirmata/*' ],
dest: 'firmware/build/usb/mbotFirmata/',
expand: true,
filter: 'isFile',
},
firmata_bluetooth: {
cwd: 'firmware/src/',
flatten: true,
src: [ 'mbotFirmata/*' ],
dest: 'firmware/build/bluetooth/mbotFirmata/',
expand: true,
filter: 'isFile',
},
},
clean: {
firmware_build: {
src: [
'firmware/build/usb',
'firmware/build/bluetooth',
]
},
compiled_bins: {
src: [
'firmware/bin/*',
]
},
post_compile: {
src: [
'firmware/bin/usb/uno/!(*ino.hex)',
'firmware/bin/bluetooth/uno/!(*ino.hex)'
]
},
},
});
// load the tasks
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask('build', ['clean:firmware_build', 'clean:compiled_bins', 'copy', 'string-replace']);
grunt.registerTask('compile', ['build', 'exec', 'clean:post_compile']);
};