Merge branch '0.21.x' into chore-merge-0.21.x

This commit is contained in:
Evgeny Kochetkov
2018-06-27 15:20:00 +03:00
30 changed files with 384 additions and 76 deletions

View File

@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. See
[standard-version](https://github.com/conventional-changelog/standard-version)
for commit guidelines.
<a name="0.21.2"></a>
## 0.21.2 (2018-06-27)
### Bug fixes
* [core] Fix transpilation error caused by values bound to collapsed variadic node. (#1306)
* [nodes] Fix implementation of [`xod/math/clip`](https://xod.io/libs/xod/math/clip). (#1307)
* [core] Fix a very rare case where constant values could be overwritten. (#1308)
<a name="0.21.1"></a>
## 0.21.1 (2018-06-25)

View File

@@ -6,5 +6,5 @@
"packages": [
"packages/*"
],
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -1,6 +1,6 @@
{
"name": "xod-arduino-deploy",
"version": "0.21.0",
"version": "0.21.2",
"description": "Utility to build and upload binaries on Arduino microcontrollers.",
"main": "dist/index.js",
"scripts": {
@@ -28,7 +28,7 @@
"serialport": "^4.0.7",
"tar": "^3.1.8",
"unbzip2-stream": "^1.2.5",
"xod-fs": "^0.21.0",
"xod-fs": "^0.21.2",
"xod-func-tools": "^0.21.0"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "xod-arduino",
"version": "0.21.1",
"version": "0.21.2",
"description": "XOD project: Arduino transpiler",
"scripts": {
"build:js": "babel src/ -d dist/ --source-maps",
@@ -26,11 +26,11 @@
"ramda-fantasy": "^0.8.0",
"sanctuary-def": "^0.14.0",
"xod-func-tools": "^0.21.0",
"xod-project": "^0.21.0"
"xod-project": "^0.21.2"
},
"devDependencies": {
"babel-plugin-inline-import": "^2.0.4",
"chai": "^4.1.2",
"xod-fs": "^0.21.0"
"xod-fs": "^0.21.2"
}
}

View File

@@ -70,8 +70,8 @@ describe('xod-arduino transpiler', () => {
);
assert.deepEqual(patchPaths, [
'xod/core/constant-number', // IVAL
'xod/core/constant-boolean', // EN
'xod/core/constant-number', // IVAL
'xod/core/constant-port', // PORT
'xod/core/continuously', // UPD
'xod/core/clock',

View File

@@ -1,6 +1,6 @@
{
"name": "xod-cli",
"version": "0.21.1",
"version": "0.21.2",
"description": "XOD project: Command Line Interface",
"scripts": {
"build:workspace": "cpx \"../../workspace/__lib__/**\" \"./__lib__\"",
@@ -28,11 +28,11 @@
"sanctuary-def": "^0.14.0",
"source-map-support": "^0.4.15",
"swagger-client": "^3.4.3",
"xod-arduino": "^0.21.1",
"xod-fs": "^0.21.0",
"xod-arduino": "^0.21.2",
"xod-fs": "^0.21.2",
"xod-func-tools": "^0.21.0",
"xod-pm": "^0.21.1",
"xod-project": "^0.21.0",
"xod-pm": "^0.21.2",
"xod-project": "^0.21.2",
"xod-tabtest": "^0.21.0"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "xod-client-browser",
"version": "0.21.1",
"version": "0.21.2",
"description": "XOD project: Client browser application",
"scripts": {
"build:tutorial-project": "node ./tools/loadTutorialProject.js",
@@ -23,16 +23,16 @@
"redux": "^3.0.5",
"redux-thunk": "^2.1.0",
"url-parse": "^1.2.0",
"xod-arduino": "^0.21.1",
"xod-client": "^0.21.1",
"xod-arduino": "^0.21.2",
"xod-client": "^0.21.2",
"xod-func-tools": "^0.21.0",
"xod-project": "^0.21.0"
"xod-project": "^0.21.2"
},
"devDependencies": {
"chai": "^4.1.2",
"node-static": "^0.7.10",
"why-did-you-update": "^0.1.0",
"xod-fs": "^0.21.0"
"xod-fs": "^0.21.2"
},
"author": "XOD Team <dev@xod.io>",
"license": "AGPL-3.0"

View File

@@ -5,7 +5,7 @@
"license": "AGPL-3.0",
"main": "src-babel/app/main.js",
"name": "xod-client-electron",
"version": "0.21.1",
"version": "0.21.2",
"scripts": {
"build:workspace": "cpx \"../../workspace/**/*\" \"src-babel/workspace\"",
"build:gui": "webpack --colors",
@@ -41,13 +41,13 @@
"redux": "^3.0.5",
"redux-thunk": "^2.1.0",
"serialport": "^4.0.7",
"xod-arduino": "^0.21.1",
"xod-arduino-deploy": "^0.21.0",
"xod-client": "^0.21.1",
"xod-deploy": "^0.21.0",
"xod-fs": "^0.21.0",
"xod-arduino": "^0.21.2",
"xod-arduino-deploy": "^0.21.2",
"xod-client": "^0.21.2",
"xod-deploy": "^0.21.2",
"xod-fs": "^0.21.2",
"xod-func-tools": "^0.21.0",
"xod-project": "^0.21.0"
"xod-project": "^0.21.2"
},
"devDependencies": {
"babel-cli": "^6.16.0",

View File

@@ -1,6 +1,6 @@
{
"name": "xod-client",
"version": "0.21.1",
"version": "0.21.2",
"description": "XOD project: Client application",
"scripts": {
"build": "babel src/ -d dist/ --source-maps",
@@ -58,11 +58,11 @@
"url-parse": "^1.1.9",
"url-search-params-polyfill": "^2.0.1",
"vec-la-fp": "^1.5.2",
"xod-arduino": "^0.21.1",
"xod-arduino": "^0.21.2",
"xod-func-tools": "^0.21.0",
"xod-patch-search": "^0.21.0",
"xod-pm": "^0.21.1",
"xod-project": "^0.21.0"
"xod-patch-search": "^0.21.2",
"xod-pm": "^0.21.2",
"xod-project": "^0.21.2"
},
"devDependencies": {
"@storybook/addon-actions": "^3.2.17",

View File

@@ -1,6 +1,6 @@
{
"name": "xod-deploy",
"version": "0.21.0",
"version": "0.21.2",
"description": "",
"main": "dist/index.js",
"scripts": {
@@ -29,7 +29,7 @@
"tar": "^4.0.1",
"unbzip2-stream": "^1.2.5",
"ws": "^3.1.0",
"xod-fs": "^0.21.0",
"xod-fs": "^0.21.2",
"xod-func-tools": "^0.21.0"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "xod-fs",
"version": "0.21.0",
"version": "0.21.2",
"description": "",
"main": "dist/index.js",
"scripts": {
@@ -19,7 +19,7 @@
"recursive-readdir": "^2.1.0",
"sanctuary-def": "^0.14.0",
"xod-func-tools": "^0.21.0",
"xod-project": "^0.21.0"
"xod-project": "^0.21.2"
},
"devDependencies": {
"chai": "^4.1.2",

View File

@@ -1,6 +1,6 @@
{
"name": "xod-patch-search",
"version": "0.21.0",
"version": "0.21.2",
"description": "",
"main": "dist/index.js",
"scripts": {
@@ -23,10 +23,10 @@
"ramda": "^0.24.1",
"ramda-fantasy": "^0.8.0",
"xod-func-tools": "^0.21.0",
"xod-project": "^0.21.0"
"xod-project": "^0.21.2"
},
"devDependencies": {
"chai": "^4.1.2",
"xod-fs": "^0.21.0"
"xod-fs": "^0.21.2"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "xod-pm",
"version": "0.21.1",
"version": "0.21.2",
"description": "",
"main": "dist/index.js",
"scripts": {
@@ -24,7 +24,7 @@
"ramda-fantasy": "^0.8.0",
"swagger-client": "^3.4.3",
"xod-func-tools": "^0.21.0",
"xod-project": "^0.21.0"
"xod-project": "^0.21.2"
},
"devDependencies": {
"chai": "^4.1.2"

View File

@@ -1,6 +1,6 @@
{
"name": "xod-project",
"version": "0.21.0",
"version": "0.21.2",
"description": "API functions to work on XOD project state",
"keywords": [],
"license": "AGPL-3.0",

View File

@@ -59,7 +59,6 @@ const getNodePinValues = def(
// 'Never' is not extracted to a constant node.
// It literally menas "do nothing", so it's just ignored.
R.reject(R.equals(INPUT_PULSE_PIN_BINDING_OPTIONS.NEVER)),
R.merge(Node.getAllBoundValues(node)),
R.map(Node.getBoundValueOrDefault(R.__, node)),
R.indexBy(Pin.getPinKey),
Patch.listPins,

View File

@@ -400,6 +400,18 @@ const getValueToBind = R.curry((nodesById, linksChain) => {
)(linksChain);
const topNode = R.last(outputNodesFromLinkChain);
// special case — top node is a constant
const topNodeIsConstant = R.compose(
PatchPathUtils.isConstantNodeType,
Node.getNodeType
)(topNode);
if (topNodeIsConstant) {
// no need to rebind anything — links chain can be safely collapsed,
// and value from constant node will freely propagate down
return Maybe.Nothing();
}
const isTopNodeTerminal = isInternalTerminalNode(topNode);
// Example:

View File

@@ -0,0 +1,139 @@
{
"patches": {
"@/main": {
"nodes": {
"rkoe9Wgf7~SyO0tZeMX": {
"boundLiterals": {
"B1x2RV3eZ": "42"
},
"id": "rkoe9Wgf7~SyO0tZeMX",
"type": "xod/core/constant-number",
"position": {
"x": 68,
"y": 0
}
},
"Bk3g9Zlf7": {
"id": "Bk3g9Zlf7",
"type": "@/foo",
"position": {
"x": 68,
"y": 102
}
}
},
"links": {
"SkpxcWlMX": {
"id": "SkpxcWlMX",
"output": {
"nodeId": "rkoe9Wgf7~SyO0tZeMX",
"pinKey": "B1x2RV3eZ"
},
"input": {
"nodeId": "Bk3g9Zlf7",
"pinKey": "rJyl5Zgfm"
}
}
},
"path": "@/main"
},
"@/must-output-42": {
"links": {
"S1cAKWez7": {
"id": "S1cAKWez7",
"output": {
"nodeId": "SyO0tZeMX",
"pinKey": "B1x2RV3eZ"
},
"input": {
"nodeId": "BJYhtWgfX",
"pinKey": "__in__"
}
}
},
"nodes": {
"BJYhtWgfX": {
"boundLiterals": {
"__in__": "21"
},
"id": "BJYhtWgfX",
"type": "xod/patch-nodes/output-number",
"position": {
"x": 68,
"y": 204
}
},
"SyO0tZeMX": {
"boundLiterals": {
"B1x2RV3eZ": "42"
},
"id": "SyO0tZeMX",
"type": "xod/core/constant-number",
"position": {
"x": 68,
"y": 0
}
}
},
"path": "@/must-output-42"
},
"@/foo": {
"attachments": [
{
"filename": "patch.cpp",
"encoding": "utf-8",
"content": "\nstruct State {\n};\n\n{{ GENERATED_CODE }}\n\nvoid evaluate(Context ctx) {\n //auto inValue = getValue<input_IN>(ctx);\n //emitValue<output_OUT>(ctx, inValue);\n}\n"
}
],
"nodes": {
"rJyl5Zgfm": {
"id": "rJyl5Zgfm",
"type": "xod/patch-nodes/input-number",
"position": {
"x": 34,
"y": 0
}
},
"SJUgcWxz7": {
"id": "SJUgcWxz7",
"type": "xod/patch-nodes/not-implemented-in-xod",
"position": {
"x": 34,
"y": 102
}
}
},
"path": "@/foo"
},
"xod/core/constant-number": {
"attachments": [
{
"filename": "patch.cpp",
"encoding": "utf8",
"content": "struct State {};\n\n{{ GENERATED_CODE }}\n\nvoid evaluate(Context ctx) {\n}\n"
}
],
"nodes": {
"B1x2RV3eZ": {
"label": "VAL",
"id": "B1x2RV3eZ",
"position": {
"x": 10,
"y": 120
},
"type": "xod/patch-nodes/output-number"
},
"H1PnRN2lW": {
"id": "H1PnRN2lW",
"position": {
"x": 10,
"y": 16
},
"type": "xod/patch-nodes/not-implemented-in-xod"
}
},
"path": "xod/core/constant-number"
}
},
"name": "constant-propagation-through-bound-output"
}

View File

@@ -0,0 +1,136 @@
{
"patches": {
"@/main": {
"nodes": {
"rkoe9Wgf7": {
"id": "rkoe9Wgf7",
"type": "@/must-output-42",
"position": {
"x": 68,
"y": 0
}
},
"Bk3g9Zlf7": {
"id": "Bk3g9Zlf7",
"type": "@/foo",
"position": {
"x": 68,
"y": 102
}
}
},
"links": {
"SkpxcWlMX": {
"id": "SkpxcWlMX",
"output": {
"nodeId": "rkoe9Wgf7",
"pinKey": "BJYhtWgfX"
},
"input": {
"nodeId": "Bk3g9Zlf7",
"pinKey": "rJyl5Zgfm"
}
}
},
"path": "@/main"
},
"@/must-output-42": {
"nodes": {
"BJYhtWgfX": {
"id": "BJYhtWgfX",
"type": "xod/patch-nodes/output-number",
"position": {
"x": 68,
"y": 204
},
"boundLiterals": {
"__in__": "21"
}
},
"SyO0tZeMX": {
"id": "SyO0tZeMX",
"type": "xod/core/constant-number",
"position": {
"x": 68,
"y": 0
},
"boundLiterals": {
"B1x2RV3eZ": "42"
}
}
},
"links": {
"S1cAKWez7": {
"id": "S1cAKWez7",
"output": {
"nodeId": "SyO0tZeMX",
"pinKey": "B1x2RV3eZ"
},
"input": {
"nodeId": "BJYhtWgfX",
"pinKey": "__in__"
}
}
},
"path": "@/must-output-42"
},
"@/foo": {
"nodes": {
"rJyl5Zgfm": {
"id": "rJyl5Zgfm",
"type": "xod/patch-nodes/input-number",
"position": {
"x": 34,
"y": 0
}
},
"SJUgcWxz7": {
"id": "SJUgcWxz7",
"type": "xod/patch-nodes/not-implemented-in-xod",
"position": {
"x": 34,
"y": 102
}
}
},
"path": "@/foo",
"attachments": [
{
"filename": "patch.cpp",
"encoding": "utf-8",
"content": "\nstruct State {\n};\n\n{{ GENERATED_CODE }}\n\nvoid evaluate(Context ctx) {\n //auto inValue = getValue<input_IN>(ctx);\n //emitValue<output_OUT>(ctx, inValue);\n}\n"
}
]
},
"xod/core/constant-number": {
"nodes": {
"B1x2RV3eZ": {
"label": "VAL",
"id": "B1x2RV3eZ",
"position": {
"x": 10,
"y": 120
},
"type": "xod/patch-nodes/output-number"
},
"H1PnRN2lW": {
"id": "H1PnRN2lW",
"position": {
"x": 10,
"y": 16
},
"type": "xod/patch-nodes/not-implemented-in-xod"
}
},
"path": "xod/core/constant-number",
"attachments": [
{
"filename": "patch.cpp",
"encoding": "utf8",
"content": "struct State {};\n\n{{ GENERATED_CODE }}\n\nvoid evaluate(Context ctx) {\n}\n"
}
]
}
},
"name": "constant-propagation-through-bound-output"
}

View File

@@ -1781,6 +1781,19 @@ describe('Flatten', () => {
flatProject
);
});
it('should allow constant node values to propagate down', () => {
const inputProject = Helper.loadXodball(
'./fixtures/constant-propagation-through-bound-output.xodball'
);
const expectedProject = Helper.loadXodball(
'./fixtures/constant-propagation-through-bound-output.flat.xodball'
);
const flatProject = flatten(inputProject, '@/main');
Helper.expectEitherRight(project => {
assert.deepEqual(project, expectedProject);
}, flatProject);
});
});
describe('implementations', () => {

View File

@@ -5,5 +5,5 @@
"description": "Low-level bits and bytes operations",
"license": "AGPL-3.0",
"name": "bits",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -5,5 +5,5 @@
"description": "Hardware drivers for popular and simple peripherals",
"license": "AGPL-3.0",
"name": "common-hardware",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -5,5 +5,5 @@
"description": "The very basic nodes of XOD",
"license": "AGPL-3.0",
"name": "core",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -5,5 +5,5 @@
"description": "Nodes of XOD to deal with GPIO (hardware pins)",
"license": "AGPL-3.0",
"name": "gpio",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -5,5 +5,5 @@
"description": "I²C (aka I2C, IIC, TWI) bus interfacing",
"license": "AGPL-3.0",
"name": "i2c",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -14,5 +14,5 @@ void evaluate(Context ctx) {
x > rMax ? rMax :
x < rMin ? rMin : x;
emitValue<output_Xc>(ctx, xc);
emitValue<output_OUT>(ctx, xc);
}

View File

@@ -5,5 +5,5 @@
"description": "Nodes of XOD for basic mathematical operations",
"license": "AGPL-3.0",
"name": "math",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -5,5 +5,5 @@
"description": "Units of measurement conversions",
"license": "AGPL-3.0",
"name": "units",
"version": "0.21.1"
"version": "0.21.2"
}

View File

@@ -1139,9 +1139,9 @@ namespace xod {
// Define/allocate persistent storages (state, timeout, output data) for all nodes
constexpr Number node_0_output_VAL = 0.25;
constexpr Logic node_0_output_VAL = true;
constexpr Logic node_1_output_VAL = true;
constexpr Number node_1_output_VAL = 0.25;
constexpr uint8_t node_2_output_VAL = 13;
@@ -1225,8 +1225,8 @@ void runTransaction() {
ctxObj._node = &node_4;
// copy data from upstream nodes into context
ctxObj._input_EN = node_1_output_VAL;
ctxObj._input_IVAL = node_0_output_VAL;
ctxObj._input_EN = node_0_output_VAL;
ctxObj._input_IVAL = node_1_output_VAL;
ctxObj._isInputDirty_RST = false;
ctxObj._isInputDirty_EN = g_isSettingUp;

View File

@@ -1543,15 +1543,15 @@ xod__core__cast_to_pulse__boolean::Node node_0 = {
true // node itself dirty
};
constexpr uint8_t node_1_output_VAL = 10;
constexpr uint8_t node_1_output_VAL = 8;
constexpr uint8_t node_2_output_VAL = 12;
constexpr uint8_t node_2_output_VAL = 9;
constexpr uint8_t node_3_output_VAL = 11;
constexpr uint8_t node_3_output_VAL = 10;
constexpr uint8_t node_4_output_VAL = 9;
constexpr uint8_t node_4_output_VAL = 11;
constexpr uint8_t node_5_output_VAL = 8;
constexpr uint8_t node_5_output_VAL = 12;
constexpr uint8_t node_6_output_VAL = 13;
@@ -1566,9 +1566,9 @@ xod__core__continuously::Node node_8 = {
true // node itself dirty
};
constexpr Number node_9_output_VAL = 1;
constexpr Logic node_9_output_VAL = true;
constexpr Logic node_10_output_VAL = true;
constexpr Number node_10_output_VAL = 1;
constexpr Number node_11_output_VAL = 1;
@@ -1701,8 +1701,8 @@ void runTransaction() {
ctxObj._node = &node_13;
// copy data from upstream nodes into context
ctxObj._input_EN = node_10_output_VAL;
ctxObj._input_IVAL = node_9_output_VAL;
ctxObj._input_EN = node_9_output_VAL;
ctxObj._input_IVAL = node_10_output_VAL;
ctxObj._isInputDirty_RST = false;
ctxObj._isInputDirty_EN = g_isSettingUp;
@@ -1780,11 +1780,11 @@ void runTransaction() {
ctxObj._node = &node_17;
// copy data from upstream nodes into context
ctxObj._input_RS = node_5_output_VAL;
ctxObj._input_EN = node_4_output_VAL;
ctxObj._input_D4 = node_1_output_VAL;
ctxObj._input_D5 = node_3_output_VAL;
ctxObj._input_D6 = node_2_output_VAL;
ctxObj._input_RS = node_1_output_VAL;
ctxObj._input_EN = node_2_output_VAL;
ctxObj._input_D4 = node_3_output_VAL;
ctxObj._input_D5 = node_4_output_VAL;
ctxObj._input_D6 = node_5_output_VAL;
ctxObj._input_D7 = node_6_output_VAL;
ctxObj._input_L1 = node_16.output_OUT;
ctxObj._input_L2 = node_7_output_VAL;

View File

@@ -1117,15 +1117,15 @@ namespace xod {
// Define/allocate persistent storages (state, timeout, output data) for all nodes
constexpr uint8_t node_0_output_VAL = 10;
constexpr uint8_t node_0_output_VAL = 8;
constexpr uint8_t node_1_output_VAL = 12;
constexpr uint8_t node_1_output_VAL = 9;
constexpr uint8_t node_2_output_VAL = 11;
constexpr uint8_t node_2_output_VAL = 10;
constexpr uint8_t node_3_output_VAL = 9;
constexpr uint8_t node_3_output_VAL = 11;
constexpr uint8_t node_4_output_VAL = 8;
constexpr uint8_t node_4_output_VAL = 12;
constexpr uint8_t node_5_output_VAL = 13;
@@ -1241,11 +1241,11 @@ void runTransaction() {
ctxObj._node = &node_10;
// copy data from upstream nodes into context
ctxObj._input_RS = node_4_output_VAL;
ctxObj._input_EN = node_3_output_VAL;
ctxObj._input_D4 = node_0_output_VAL;
ctxObj._input_D5 = node_2_output_VAL;
ctxObj._input_D6 = node_1_output_VAL;
ctxObj._input_RS = node_0_output_VAL;
ctxObj._input_EN = node_1_output_VAL;
ctxObj._input_D4 = node_2_output_VAL;
ctxObj._input_D5 = node_3_output_VAL;
ctxObj._input_D6 = node_4_output_VAL;
ctxObj._input_D7 = node_5_output_VAL;
ctxObj._input_L1 = node_9.output_OUT;
ctxObj._input_L2 = node_6_output_VAL;