Skip to content

Commit d2b3a64

Browse files
committed
Add recipes for resolving examples files
1 parent 36d5170 commit d2b3a64

5 files changed

Lines changed: 58 additions & 8 deletions

File tree

tools/make/lib/ls/Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ PYTHON_EXAMPLES_PATTERN ?= *.$(PYTHON_FILENAME_EXT)
146146
# Define a filename pattern for R example files:
147147
R_EXAMPLES_PATTERN ?= *.$(R_FILENAME_EXT)
148148

149+
# Define a filename pattern for TypeScript example files:
150+
TYPESCRIPT_EXAMPLES_PATTERN ?= *.$(TYPESCRIPT_FILENAME_EXT)
151+
149152
# Define a filepath pattern for example files:
150153
EXAMPLES_FILTER ?= .*/.*
151154

@@ -402,12 +405,6 @@ FIND_TOOLS_TESTS_FIXTURES_EXCLUDE_FLAGS ?= \
402405
-not -path "*/snippets/*" \
403406
-not -path "*/make/lib/*"
404407

405-
# TypeScript definition exclude flags:
406-
FIND_TYPESCRIPT_DEFINITIONS_EXCLUDE_FLAGS ?= $(FIND_COMMON_EXCLUDE_FLAGS)
407-
408-
# TypeScript definition tests exclude flags:
409-
FIND_TYPESCRIPT_DEFINITIONS_TESTS_EXCLUDE_FLAGS ?= $(FIND_COMMON_EXCLUDE_FLAGS)
410-
411408
# On Mac OSX, in order to use `|` and other regular expression operators, we need to use enhanced regular expression syntax (-E); see https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/re_format.7.html#//apple_ref/doc/man/7/re_format.
412409
ifeq ($(OS), Darwin)
413410
find_kernel_prefix := -E

tools/make/lib/ls/typescript/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
# Note: keep in alphabetical order
2222
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/definitions.mk
2323
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/definitions_tests.mk
24+
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/examples.mk
2425
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/files.mk
2526
include $(TOOLS_MAKE_LIB_DIR)/ls/typescript/sources.mk

tools/make/lib/ls/typescript/definitions.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FIND_TYPESCRIPT_DEFINITIONS_FLAGS ?= \
2424
-name "$(TYPESCRIPT_DEFINITIONS_PATTERN)" \
2525
-path "$(ROOT_DIR)/**/$(TYPESCRIPT_DEFINITIONS_FOLDER)/**" \
2626
-regex "$(TYPESCRIPT_DEFINITIONS_FILTER)" \
27-
$(FIND_TYPESCRIPT_DEFINITIONS_EXCLUDE_FLAGS)
27+
$(FIND_COMMON_EXCLUDE_FLAGS)
2828

2929

3030
ifneq ($(OS), Darwin)

tools/make/lib/ls/typescript/definitions_tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS ?= \
2323
-type f \
2424
-name "$(TYPESCRIPT_DEFINITIONS_TESTS_PATTERN)" \
2525
-regex "$(TYPESCRIPT_DEFINITIONS_TESTS_FILTER)" \
26-
$(FIND_TYPESCRIPT_DEFINITIONS_TESTS_EXCLUDE_FLAGS)
26+
$(FIND_COMMON_EXCLUDE_FLAGS)
2727

2828
ifneq ($(OS), Darwin)
2929
FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS := -regextype posix-extended $(FIND_TYPESCRIPT_DEFINITIONS_TESTS_FLAGS)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2019 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# VARIABLES #
20+
21+
# Define the command flags:
22+
FIND_TYPESCRIPT_EXAMPLES_FLAGS ?= \
23+
-type f \
24+
-name "$(TYPESCRIPT_EXAMPLES_PATTERN)" \
25+
-path "$(ROOT_DIR)/**/$(EXAMPLES_FOLDER)/**" \
26+
-regex "$(EXAMPLES_FILTER)" \
27+
$(FIND_EXAMPLES_EXCLUDE_FLAGS)
28+
29+
30+
ifneq ($(OS), Darwin)
31+
FIND_TYPESCRIPT_EXAMPLES_FLAGS := -regextype posix-extended $(FIND_TYPESCRIPT_EXAMPLES_FLAGS)
32+
endif
33+
34+
# Define a command to list example files:
35+
FIND_TYPESCRIPT_EXAMPLES_CMD ?= find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_EXAMPLES_FLAGS)
36+
37+
# Define the list of example files:
38+
TYPESCRIPT_EXAMPLES ?= $(shell $(FIND_TYPESCRIPT_EXAMPLES_CMD))
39+
40+
# TODO: does not include top-level examples?
41+
42+
43+
# TARGETS #
44+
45+
# List example files.
46+
#
47+
# This target prints a newline-delimited list of example files.
48+
49+
list-examples-typescript:
50+
$(QUIET) find $(find_kernel_prefix) $(ROOT_DIR) $(FIND_TYPESCRIPT_EXAMPLES_FLAGS) $(find_print_list)
51+
52+
.PHONY: list-examples-typescript

0 commit comments

Comments
 (0)