Skip to content

Commit

Permalink
dev: Use Apache 2.0 license
Browse files Browse the repository at this point in the history
  • Loading branch information
johanstokking committed Apr 4, 2018
1 parent 60ab25e commit d5d8185
Show file tree
Hide file tree
Showing 561 changed files with 7,462 additions and 598 deletions.
14 changes: 13 additions & 1 deletion .make/bump.go
@@ -1,4 +1,16 @@
// Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
// Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//+build ignore

Expand Down
14 changes: 13 additions & 1 deletion .make/general.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This makefile contains general variables that are used troughout the other makefiles

Expand Down
14 changes: 13 additions & 1 deletion .make/git.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This makefile contains variables related to the git commit, branch and tags
# as well as rules to execute git hooks
Expand Down
14 changes: 13 additions & 1 deletion .make/go/build.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Infer GOOS and GOARCH
GOOS ?= $(shell go env GOOS)
Expand Down
14 changes: 13 additions & 1 deletion .make/go/depfmt.go 100755 → 100644
@@ -1,4 +1,16 @@
// Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
// Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//+build ignore

Expand Down
14 changes: 13 additions & 1 deletion .make/go/main.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# default release dir
RELEASE_DIR ?= release#
Expand Down
14 changes: 13 additions & 1 deletion .make/go/quality.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# fmt all packages
go.fmt:
Expand Down
14 changes: 13 additions & 1 deletion .make/go/test.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# run tests
go.test: key.pem cert.pem
Expand Down
13 changes: 13 additions & 0 deletions .make/header.txt
@@ -0,0 +1,13 @@
Copyright © 2018 The Things Network Foundation, The Things Industries B.V.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
28 changes: 20 additions & 8 deletions .make/headers.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This makefile contains rules to check and fix headers in files. This can be
# used to automatically check for copyright headers and fix them easily.
Expand All @@ -8,10 +20,7 @@
# HEADER_FILES: The command to invoke to determine which file to check
# HEADER_EXTRA_FILES: Use this to add a hardcoded list of files

YEAR ?= $(shell date +%Y)
COMMENT ?= \\(\#\\|//\\)
HEADER_PREFIX = $(COMMENT) Copyright © $(YEAR)
HEADER = $(HEADER_PREFIX) The Things Network Foundation, distributed under the MIT license (see LICENSE file)
HEADER_FILE = ./.make/header.txt

empty = echo ""
no_blanks = sed '/^$$/d'
Expand All @@ -23,10 +32,13 @@ JS_LINT_FILES ?= $(empty)
only_make = grep '\.make$$'
MAKE_LINT_FILES = $(ALL_FILES) | $(only_make)

only_proto = grep '\.proto$$'
PROTO_FILES = $(ALL_FILES) | $(only_proto)

ls:
@$(MAKE_LINT_FILES)

HEADER_FILES ?= $(GO_LINT_FILES) && $(JS_LINT_FILES) && $(MAKE_LINT_FILES)
HEADER_FILES ?= $(GO_LINT_FILES) && $(JS_LINT_FILES) && $(MAKE_LINT_FILES) && $(PROTO_FILES)
HEADER_EXTRA_FILES ?=

# the files to check for a header
Expand All @@ -38,15 +50,15 @@ headers.check:
@$(log) "Checking headers in `echo $$($(__HEADER_FILES)) | $(count)` files"
@CODE=0; \
for file in `$(__HEADER_FILES)`; do \
"$(MAKE_DIR)/headers.sh" check "$(HEADER_PREFIX)" "$$file" || { $(err) "Incorrect or missing header in $$file"; CODE=1; }; \
"$(MAKE_DIR)/headers.sh" check "$(HEADER_FILE)" "$$file" || { $(err) "Incorrect or missing header in $$file"; CODE=1; }; \
done; \
exit $$CODE

# fix the headers in all the files
headers.fix:
@$(log) "Fixing headers in `echo $$($(__HEADER_FILES)) | $(count)` files"
@for file in `$(__HEADER_FILES)`; do \
"$(MAKE_DIR)/headers.sh" fix "$(HEADER)" "$$file" "$(COMMENT)"; \
"$(MAKE_DIR)/headers.sh" fix "$(HEADER_FILE)" "$$file" "$(COMMENT)"; \
code=$$?; \
if [[ $$code -eq 2 ]]; then \
$(log) "Fixed header in \`$$file\`"; \
Expand Down
25 changes: 13 additions & 12 deletions .make/headers.sh
@@ -1,18 +1,18 @@
#!/bin/bash

CMD="$1"
HEADER="$2"
HEADER_FILE="$2"
FILE="$3"
COMMENT="$4"

LINES=`echo -e ${HEADER} | wc -l`
HEADER=`cat "$HEADER_FILE"`

function check () {
exit 1
}
LINES=`echo -e "${HEADER}" | wc -l`

function fix () {
file="$1"
extension="${file##*.}"
comment=//
comment=\\\/\\\/

case "$file" in
*.make)
Expand All @@ -26,7 +26,7 @@ function fix () {
;;
esac

echo -e ${HEADER} | sed 's:^\\(.*) :'"${comment} :g" > file.new && echo >> file.new && cat "$file" >> file.new && mv file.new "$file"
echo -e "${HEADER}" | sed "s/^/${comment} /g" | sed "s/^${comment} $/${comment}/g" > file.new && echo >> file.new && cat "$file" >> file.new && mv file.new "$file"
exit 2
}

Expand All @@ -43,25 +43,26 @@ if head -n 3 "$FILE" | grep -q "generated"; then
exit 0
fi


ok=1

for i in `seq 1 ${LINES}`; do
hline=`echo -e ${HEADER} | sed $i'q;d'`
sed $i'q;d' "$FILE" | grep -q "^$hline" || ok=0
hline=`echo -e "${HEADER}" | sed $i'q;d'`
sed $i'q;d' "$FILE" | grep -q "$hline" || ok=0
done

if [[ $ok -ne 1 ]]; then
case "$CMD" in
check)
check "$FILE"
exit 1
;;
fix)
fix "$FILE"
;;
esac
else
case "$CMD" in
check)
exit 0
;;
remove)
remove "$FILE"
;;
Expand Down
14 changes: 13 additions & 1 deletion .make/js/build.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Include this makefile to enable webpack-related rules

Expand Down
14 changes: 13 additions & 1 deletion .make/js/main.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

NODE = node
NPM = npm
Expand Down
14 changes: 13 additions & 1 deletion .make/js/quality.make
@@ -1,4 +1,16 @@
# Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
# Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

.PHONY: js.quality js.quality-staged js.lint js.lint-staged

Expand Down
15 changes: 14 additions & 1 deletion .make/js/translations.js
@@ -1,4 +1,17 @@
// Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
// Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* global process */

import fs from "fs"
Expand Down
14 changes: 13 additions & 1 deletion .make/js/xls.js
@@ -1,4 +1,16 @@
// Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
// Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import XLSX from "xlsx-style"

Expand Down
14 changes: 13 additions & 1 deletion .make/js/xx.js
@@ -1,4 +1,16 @@
// Copyright © 2018 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
// Copyright © 2018 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import icu from "messageformat-parser"

Expand Down

0 comments on commit d5d8185

Please sign in to comment.