Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Commit

Permalink
Merge 829678a into 6cb68ee
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel "_|Nix|_" Schulhof committed Nov 2, 2016
2 parents 6cb68ee + 829678a commit 0fe1a03
Show file tree
Hide file tree
Showing 111 changed files with 2,970 additions and 5,663 deletions.
47 changes: 26 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ language: cpp
matrix:
fast_finish: true
include:
- env: NODE_VERSION=4.0 TEST_SCRIPT=ci-lint
os: linux

- env: NODE_VERSION=0.10 TEST_SCRIPT=ci
os: linux
addons: &buildpackages
Expand All @@ -17,54 +20,56 @@ matrix:
- uuid-dev
- g++-4.8

- env: NODE_VERSION=0.10 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=0.12 TEST_SCRIPT=ci
os: linux
addons: *buildpackages

- env: NODE_VERSION=0.12 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=4.0 TEST_SCRIPT=ci
os: linux
addons: *buildpackages

- env: NODE_VERSION=4.0 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=4.4 TEST_SCRIPT=ci
os: linux
addons: *buildpackages

- env: NODE_VERSION=4.4 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=4.5 TEST_SCRIPT=ci
os: linux
addons: *buildpackages

- env: NODE_VERSION=4.5 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=6 TEST_SCRIPT=ci
os: linux
addons: *buildpackages

- env: NODE_VERSION=4.0 TEST_SCRIPT=ci-lint
os: linux

- env: NODE_VERSION=0.12 TEST_SCRIPT=ci-basic
- env: NODE_VERSION=6 TEST_SCRIPT=ci
os: osx

# Allowed failures must be specified twice - once in "include" to have them
# run, and again in "allowed_failures" to not have them break the build.
# run, and again in "allow_failures" to not have them break the build.
# Below are the allowed failures:

- env: NODE_VERSION=0.10 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=0.12 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=4.0 TEST_SCRIPT=ci
os: osx
- env: NODE_VERSION=4.5 TEST_SCRIPT=ci-coverage
os: linux
addons: *buildpackages

allow_failures:
- env: NODE_VERSION=0.10 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=0.12 TEST_SCRIPT=ci
os: osx

- env: NODE_VERSION=4.0 TEST_SCRIPT=ci
os: osx
- env: NODE_VERSION=4.5 TEST_SCRIPT=ci-coverage
os: linux
addons: *buildpackages

install:
- >
Expand Down
11 changes: 11 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = function( grunt ) {
"use strict";

var path = require( "path" );
var suites;

require( "load-grunt-config" )( grunt, {
configPath: [
Expand All @@ -26,6 +27,16 @@ require( "load-grunt-config" )( grunt, {
init: true
} );

suites = process.version.match( /v0.10/ ) ? [] :
grunt.option( "ocf-suites" ) ?
grunt.option( "ocf-suites" ).split( "," ) : undefined;

if ( suites ) {
grunt.config.set( "iot-js-api-ocf.plain.tests", suites );
grunt.config.set( "iot-js-api-ocf.coverage.tests", suites );
}

require( "load-grunt-tasks" )( grunt );
grunt.task.loadNpmTasks( "iot-js-api" );

};
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
## Description
This project provides a Javascript API for [OCF][] functionality. The API follows a maintained [specification][] and is implemented as a native addon using [iotivity][] as its backend.

## Build status
## Status
<a href="https://travis-ci.org/otcshare/iotivity-node">
<img alt="Build Status" src="https://travis-ci.org/otcshare/iotivity-node.svg?branch=master"></img>
<img alt="Build Status" src="https://travis-ci.org/otcshare/iotivity-node.svg?branch=1.2.0"></img>
</a>
<a href='https://coveralls.io/github/otcshare/iotivity-node?branch=new-api'>
<img src='https://coveralls.io/repos/github/otcshare/iotivity-node/badge.svg?branch=1.2.0' alt='Coverage Status' />
</a>

## Installation
Expand Down Expand Up @@ -35,7 +38,7 @@ var device = require( "iotivity-node" )();
will give you an instance of OicDevice as described in the JS API spec.

### In more detail:
iotivity-node depends on [iotivity][] proper. It has been tested against [1.1.1][] on Linux. iotivity depends on development headers for libuuid and boost.
iotivity-node depends on [iotivity][] proper. It has been tested against [1.2.0][] on Linux. iotivity depends on development headers for libuuid and boost.

iotivity-node requires a compiler that implements the C++11 standard.

Expand Down Expand Up @@ -107,11 +110,11 @@ Make sure no firewall is running (or one is properly configured to allow iotivit

[iotivity]: http://iotivity.org/
[node]: https://nodejs.org/
[1.1.1]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=tree;hb=1.1.1
[snapshot]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=snapshot;h=1.1.1;sf=tgz
[1.2.0]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=tree;hb=1.2.0
[snapshot]: https://gerrit.iotivity.org/gerrit/gitweb?p=iotivity.git;a=snapshot;h=1.2.0;sf=tgz
[scons]: http://www.scons.org/
[install.sh]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.1.1-3/install.sh
[octbstack.pc.in]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.1.1-3/octbstack.pc.in
[install.sh]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.2.0-0/install.sh
[octbstack.pc.in]: https://raw.githubusercontent.com/otcshare/iotivity-node/1.2.0-0/octbstack.pc.in
[iotivity wiki]: https://wiki.iotivity.org/faq_s
[video]: https://www.youtube.com/watch?v=95VTB_qgYfw
[specification]: https://github.com/01org/iot-js-api-test-suite/blob/master/api/oic.md
Expand Down
16 changes: 6 additions & 10 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
# Used when externalOCTBStack is false
"internal_octbstack_cflags": [
'<!@(echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/csdk/stack/include")',
'<!@(echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/c_common/ocrandom/include")',
'<!@(echo "-I$(pwd)/deps/iotivity/include/iotivity/resource/c_common")',
'-DROUTING_EP',
'-DTCP_ADAPTER'
'<!@(echo "-I$(pwd)/deps/iotivity/include/iotivity/tinycbor")',
'-DROUTING_EP'
]
},

Expand Down Expand Up @@ -179,14 +178,13 @@
"generated/constants.cc",
"generated/enums.cc",
"generated/functions.cc",
"src/functions/oc-cancel.cc",
"src/common.cc",
"src/functions/oc-create-delete-resource.cc",
"src/functions/oc-do-resource.cc",
"src/functions/oc-do-response.cc",
"src/functions/oc-notify.cc",
"src/functions/oc-random.cc",
"src/functions/oc-register-persistent-storage-handler.cc",
"src/functions/oc-set-default-device-entity-handler.cc",
"src/functions/oc-server-resource-utils.cc",
"src/functions/oc-server-response.cc",
"src/functions/simple.cc",
"src/main.cc",
"src/structures.cc",
Expand All @@ -198,9 +196,7 @@
"src/structures/oc-header-option-array.cc",
"src/structures/oc-identity.cc",
"src/structures/oc-payload.cc",
"src/structures/oc-platform-info.cc",
"src/structures/oc-sid.cc",
"src/structures/string-primitive.cc"
"src/structures/oc-platform-info.cc"
],
"dependencies": [ "csdk", "generateconstants", "generateenums", "generatefunctions" ]
}
Expand Down
5 changes: 1 addition & 4 deletions build-csdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,12 @@ if test "x${DO_BUILD}x" = "xtruex"; then

# iotivity wants us to clone this before it'll do anything
git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor
cd extlibs/tinycbor/tinycbor
git checkout dbc0129400f22087d4be3396cc44ea922d2f07f8
cd -

ls ../../patches/*.patch | sort | while read patch; do
patch -p1 < "${patch}"
done

scons $SCONS_FLAGS logger liboctbstack libconnectivity_abstraction libcoap c_common libocsrm routingmanager || { cat config.log; exit 1; }
scons $SCONS_FLAGS logger octbstack connectivity_abstraction coap c_common ocsrm routingmanager || { cat config.log; exit 1; }

cd ../../ || exit 1
else
Expand Down
3 changes: 0 additions & 3 deletions constants-and-enums.common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,4 @@ for ONE_PATH in $INCLUDE_PATHS; do
if test -f "${ONE_PATH}/ocstackconfig.h"; then
OCSTACKCONFIG_H="${ONE_PATH}/ocstackconfig.h"
fi
if test -f "${ONE_PATH}/ocrandom.h"; then
OCRANDOM_H="${ONE_PATH}/ocrandom.h"
fi
done
6 changes: 0 additions & 6 deletions generate-constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ parseFileForConstants "${OCTYPES_H}" >> generated/constants.cc.new || \
# Separate the two sections with a newline
echo '' >> generated/constants.cc.new || ( rm -f generated/constants.cc.new && exit 1 )

# Parse octypes.h and append to the generated file
echo ' // ocrandom.h: Definitions' >> generated/constants.cc.new || \
( rm -f generated/constants.cc.new && exit 1 )
parseFileForConstants "${OCRANDOM_H}" >> generated/constants.cc.new || \
( rm -f generated/constants.cc.new && exit 1 )

# Close the function
echo '}' >> generated/constants.cc.new || ( rm -f generated/constants.cc.new && exit 1 )

Expand Down
7 changes: 4 additions & 3 deletions generate-enums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ mkdir -p generated
cat src/enums.cc.in > generated/enums.cc.new || ( rm -f generated/enums.cc.new && exit 1 )

# Parse header for enums
cat "${OCTYPES_H}" "${OCRANDOM_H}" "${OCPRESENCE_H}" | \
cat "${OCTYPES_H}" "${OCPRESENCE_H}" | \
grep -v '^$' | \
awk -v PRINT=0 -v OUTPUT="" -v ENUM_LIST="" '{
if ( $0 == "typedef enum" ) PRINT=1;
if ( PRINT == 1 ) {
if ( !( $1 ~ /^[{}]/ ) && $1 != "typedef" ) {
if ( $1 ~ /^[A-Z]/ ) {
gsub(/,/, "", $1);
OUTPUT = OUTPUT " SET_CONSTANT_NUMBER(returnValue, " $1 ");\n";
} else if ( $1 ~ /^#(if|endif)/ ) {
OUTPUT = OUTPUT $0 "\n";
Expand All @@ -49,7 +50,7 @@ cat "${OCTYPES_H}" "${OCRANDOM_H}" "${OCPRESENCE_H}" | \
ENUM_NAME = $0;
gsub( /^} */, "", ENUM_NAME );
gsub( / *;.*$/, "", ENUM_NAME );
ENUM_LIST = ENUM_LIST " SET_ENUM(exports, " ENUM_NAME ");\n";
ENUM_LIST = ENUM_LIST " SET_ENUM(target, " ENUM_NAME ");\n";
print("static Local<Object> bind_" ENUM_NAME "() {\n Local<Object> returnValue = Nan::New<Object>();\n" );
}
else if ( $1 != "typedef" && $1 != "{" ) {
Expand All @@ -63,7 +64,7 @@ cat "${OCTYPES_H}" "${OCRANDOM_H}" "${OCPRESENCE_H}" | \
}
}
END {
print( "void InitEnums(Handle<Object> exports) {\n" ENUM_LIST "}" );
print( "NAN_MODULE_INIT(InitEnums) {\n" ENUM_LIST "}" );
}' | \
sed 's/[,=]);$/);/' >> generated/enums.cc.new || ( rm -f generated/enums.cc.new && exit 1 )

Expand Down
4 changes: 2 additions & 2 deletions generate-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ echo '' >> generated/function-prototypes.h
echo '#include "../src/functions.h"' >> generated/functions.cc
echo '#include "function-prototypes.h"' >> generated/functions.cc
echo '' >> generated/functions.cc
echo 'void InitFunctions(Handle<Object> exports, Handle<Object> module) {' >> generated/functions.cc
echo 'NAN_MODULE_INIT(InitFunctions) {' >> generated/functions.cc

find src -type f | while read filename; do
cat "${filename}" | grep NAN_METHOD;
Expand All @@ -38,7 +38,7 @@ done | \
sort -u | \
while read methodname; do
echo "NAN_METHOD(bind_${methodname});" >> generated/function-prototypes.h
echo " SET_FUNCTION(exports, ${methodname});" >> generated/functions.cc
echo " SET_FUNCTION(target, ${methodname});" >> generated/functions.cc
done

echo '' >> generated/function-prototypes.h
Expand Down
6 changes: 5 additions & 1 deletion grunt-build/tasks/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ grunt.registerTask( "lint", [ "eslint" ] );

grunt.registerTask( "default", [ "test" ] );

grunt.registerTask( "test", [ "lint", "testsuite", "ocf-suite", "testdist" ] );
grunt.registerTask( "test", [ "lint", "testsuite", "iot-js-api-ocf:plain", "testdist" ] );

grunt.registerTask( "format", [ "esformatter", "clangformat" ] );

grunt.registerTask( "coverage", [ "clean:coverage", "iot-js-api-ocf:coverage", "makeReport" ] );

grunt.registerTask( "publish-coverage", [ "coverage", "coveralls:coverage" ] );

};
48 changes: 0 additions & 48 deletions grunt-build/tasks/ocf-suite.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

var testUtils = require( "../assert-to-console" );

console.log( JSON.stringify( { assertionCount: 1 } ) );

var device = require( "../../index" )( "server" );

device.enablePresence( 1000 );
device.disablePresence().then(
function() {
testUtils.assert( "ok", true, "Presence disabled successfully" );
process.exit( 0 );
},
function( error ) {
testUtils.assert( "ok", false, "Presence disabled error with code: " + error.result );
process.exit( 0 );
} );
module.exports = {
coverage: [ "coverage" ]
};
Loading

0 comments on commit 0fe1a03

Please sign in to comment.