split stylesheet fixtures into separate gyp action
This commit is contained in:
22
bin/build-fixtures.js
Executable file
22
bin/build-fixtures.js
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var load = require('./load-style.js');
|
||||
var mkdirp = require('mkdirp');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var transforms = {
|
||||
'fuzz-colors.min.js': require('./fuzz-colors.js'),
|
||||
'fuzz-functions.min.js': require('./fuzz-functions.js'),
|
||||
'fuzz-layers.min.js': require('./fuzz-layers.js')
|
||||
};
|
||||
|
||||
var source = load(process.argv[2]);
|
||||
var out = process.argv[3];
|
||||
mkdirp.sync(out);
|
||||
|
||||
Object.keys(transforms).forEach(function(key) {
|
||||
source.pipe(transforms[key].call())
|
||||
.pipe(fs.createWriteStream(path.join(out, key)));
|
||||
});
|
||||
@@ -1,23 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var load = require('./load-style.js');
|
||||
var mkdirp = require('mkdirp');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var transforms = {
|
||||
'style.min.js': require('./minify.js'),
|
||||
'fuzz-colors.min.js': require('./fuzz-colors.js'),
|
||||
'fuzz-functions.min.js': require('./fuzz-functions.js'),
|
||||
'fuzz-layers.min.js': require('./fuzz-layers.js')
|
||||
};
|
||||
var data = JSON.stringify(require(path.join(process.cwd(), process.argv[2])));
|
||||
var out = path.join(process.argv[3], 'style.min.js');
|
||||
|
||||
var source = load(process.argv[2]);
|
||||
var out = process.argv[3];
|
||||
mkdirp.sync(out);
|
||||
|
||||
Object.keys(transforms).forEach(function(key) {
|
||||
source.pipe(transforms[key].call())
|
||||
.pipe(fs.createWriteStream(path.join(out, key)));
|
||||
});
|
||||
mkdirp.sync(path.dirname(out));
|
||||
fs.writeFileSync(out, data);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"dependencies": {
|
||||
"brfs": "^1.1.2",
|
||||
"fuzzer": "^0.2.0",
|
||||
"glsl-optimizer": "kkaefer/glsl-optimizer#amalgamation",
|
||||
"glsl-optimizer": "mapbox/glsl-optimizer#amalgamation",
|
||||
"mkdirp": "^0.5.0",
|
||||
"through2": "^0.5.1"
|
||||
}
|
||||
|
||||
44
mapboxgl.gyp
44
mapboxgl.gyp
@@ -68,9 +68,6 @@
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/style.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-colors.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-functions.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-layers.min.js',
|
||||
],
|
||||
'action': ['<@(node)', 'bin/build-style.js', '<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)/bin']
|
||||
}
|
||||
@@ -78,6 +75,32 @@
|
||||
'direct_dependent_settings': {
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/style.min.js',
|
||||
],
|
||||
}
|
||||
},
|
||||
{
|
||||
'target_name': 'build_stylesheet_fixtures',
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'npm_install'
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'Build Stylesheet Fixtures',
|
||||
'inputs': [
|
||||
'bin/style.json',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-colors.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-functions.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-layers.min.js',
|
||||
],
|
||||
'action': ['<@(node)', 'bin/build-fixtures.js', '<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)/bin']
|
||||
}
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-colors.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-functions.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-layers.min.js',
|
||||
@@ -95,6 +118,21 @@
|
||||
{
|
||||
'files': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/style.min.js',
|
||||
],
|
||||
'destination': '<(PRODUCT_DIR)'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'copy_stylesheet_fixtures',
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'build_stylesheet_fixtures'
|
||||
],
|
||||
'copies': [
|
||||
{
|
||||
'files': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-colors.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-functions.min.js',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/bin/fuzz-layers.min.js',
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -87,7 +87,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -103,7 +103,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -121,7 +121,8 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
"../mapboxgl.gyp:copy_stylesheet_fixtures",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -137,7 +138,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -153,7 +154,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -169,7 +170,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -185,7 +186,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl"
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -207,8 +208,8 @@
|
||||
"dependencies": [
|
||||
"../deps/gtest/gtest.gyp:gtest",
|
||||
"../mapboxgl.gyp:mapboxgl",
|
||||
"../mapboxgl.gyp:copy_default_stylesheet",
|
||||
"link_gl",
|
||||
'../mapboxgl.gyp:copy_default_stylesheet',
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user