Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f04b00f

Browse files
committed
[[ Extensions ]] Use packaging script for lcb extensions
In particular, generate lcb extension docs in extension package.
1 parent cfd9293 commit f04b00f

File tree

4 files changed

+42
-145
lines changed

4 files changed

+42
-145
lines changed

extensions/extensions.gyp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@
8080
'action':
8181
[
8282
'<(engine)',
83-
'../util/package_script_extension.livecodescript',
83+
'../util/package_extension.livecodescript',
8484
'dummy1',
8585
'dummy2',
8686
'dummy3',
8787
'../util/extract-docs.livecodescript',
88-
'../ide-support/revdocsparser.livecodescript',
89-
'<(RULE_INPUT_PATH)',
88+
'../ide-support/revdocsparser.livecodescript',
9089
'<(RULE_INPUT_DIRNAME)',
91-
'<(RULE_INPUT_ROOT)',
90+
'<(RULE_INPUT_ROOT).livecodescript',
9291
'<(PRODUCT_DIR)/packaged_extensions',
9392
'false',
9493
],
@@ -189,10 +188,14 @@
189188
'action':
190189
[
191190
'<@(build_command)',
191+
'<(engine)',
192+
'../util/package_extension.livecodescript',
193+
'../util/extract-docs.livecodescript',
194+
'../ide-support/revdocsparser.livecodescript',
192195
'<(PRODUCT_DIR)/packaged_extensions',
193-
'<(PRODUCT_DIR)/modules/lci',
196+
'false',
194197
'>(lc-compile_host)',
195-
"false",
198+
'<(PRODUCT_DIR)/modules/lci',
196199
'<@(_sources)',
197200
],
198201
},

util/build-extensions.sh

Lines changed: 22 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,46 @@ function err() {
88
echo "ERROR: $@" >&2
99
}
1010

11-
function extract_name {
12-
# Extract an e.g. "module foo.bar.baz" line from an LCB source file
13-
sed -nEe 's,^([[:space:]]*<name>(.*)</name>[[:space:]]*)$,\2,p' < "$1"
14-
}
15-
1611
function do_cmd {
1712
if [[ ! -z "${V}" ]]; then
1813
echo "$@"
1914
fi
15+
echo "$@"
2016
"$@"
2117
}
2218

2319
function build_widget {
24-
local WIDGET_DIR=$1
25-
local WIDGET_NAME=$(basename $1)
26-
local WIDGET_LCB="${WIDGET_DIR}/${WIDGET_NAME}.lcb"
27-
local BUILD_DIR=$2
28-
local MODULE_DIR=$3
29-
local LC_COMPILE=$4
30-
local REMOVE_SRC=$5
31-
32-
echo " LC_COMPILE ${WIDGET_DIR}/module.lcm"
33-
34-
do_cmd "${LC_COMPILE}" \
35-
-Werror \
36-
--modulepath "${MODULE_DIR}" \
37-
--manifest "${WIDGET_DIR}/manifest.xml" \
38-
--output "${WIDGET_DIR}/module.lcm" \
39-
"${WIDGET_LCB}"
40-
41-
local TARGET_DIR=$(extract_name "${WIDGET_DIR}/manifest.xml")
42-
if [[ -z "${TARGET_DIR}" ]]; then
43-
err "Could not find canonical name of ${WIDGET_NAME}"
44-
return 1
45-
fi
46-
47-
echo " PACKAGE ${TARGET_DIR}"
48-
49-
pushd "${WIDGET_DIR}" 1>/dev/null
50-
zip -q -r "${TARGET_DIR}.lce" *
51-
popd 1>/dev/null
52-
53-
mkdir -p "${BUILD_DIR}/${TARGET_DIR}"
54-
55-
unzip -q \
56-
-o "${WIDGET_DIR}/${TARGET_DIR}.lce" \
57-
-d "${BUILD_DIR}/${TARGET_DIR}"
58-
59-
rm "${WIDGET_DIR}/${TARGET_DIR}.lce"
60-
61-
if [[ "${REMOVE_SRC}" = "true" ]]; then
62-
rm "${BUILD_DIR}/${TARGET_DIR}/${WIDGET_NAME}.lcb"
63-
fi
64-
20+
do_cmd "$1" "$2" "'dummy1'" "'dummy2'" "'dummy3'" "$3" "$4" \
21+
$(dirname "${5}") $(basename "${5}") \
22+
"$6" "$7" "$8" "$9"
23+
6524
return 0
6625
}
6726

6827
# Detect verbose mode
6928
V=${V:-}
7029

71-
# Arguments 5 and above are the list of extensions to compile
72-
readonly destination_dir=$1
73-
readonly module_dir=$2
74-
readonly lc_compile=$3
75-
readonly remove_src=$4
76-
shift 4
30+
# Arguments 9 and above are the list of extensions to compile
31+
readonly server_engine=$1
32+
readonly packager=$2
33+
readonly docs_extractor=$3
34+
readonly docs_parser=$4
35+
readonly destination_dir=$5
36+
readonly remove_src=$6
37+
readonly lc_compile=$7
38+
readonly module_dir=$8
39+
40+
shift 8
7741

7842
# Find the dependency/build ordering of the extensions
7943
readonly build_order=$(${lc_compile} --modulepath ${module_dir} --deps order -- $@)
8044

8145
# Loop over the extensions that need to be (re-)built
8246
for ext in ${build_order} ; do
83-
build_widget $(dirname "${ext}") "${destination_dir}" "${module_dir}" "${lc_compile}" "${remove_src}"
47+
build_widget "${server_engine}" "${packager}" \
48+
"${docs_extractor}" "${docs_parser}" \
49+
"${ext}" \
50+
"${destination_dir}" "${remove_src}" "${lc_compile}" \
51+
"${module_dir}"
52+
8453
done

util/extract-docs.livecodescript

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,18 @@ on extractDocs
3030

3131
local tArg
3232
repeat with tArg = 4 to the number of elements of tArgs
33-
34-
if there is not a stack tArgs[tArg] then
35-
write "Error: stack not found: " & tArgs[tArg] & return to stderr
36-
quit 3
37-
end if
38-
33+
3934
local tDocs
40-
put revDocsGenerateDocsFileFromText(the script of stack tArgs[tArg],the long id of stack tArgs[tArg]) into tDocs
35+
if tArgs[tArg] ends with "lcb" then
36+
write tArgs[tArg] to stdout
37+
put revDocsGenerateDocsFileFromModularFile(tArgs[tArg]) into tDocs
38+
else
39+
if there is not a stack tArgs[tArg] then
40+
write "Error: stack not found: " & tArgs[tArg] & return to stderr
41+
quit 3
42+
end if
43+
put revDocsGenerateDocsFileFromText(the script of stack tArgs[tArg],the long id of stack tArgs[tArg]) into tDocs
44+
end if
4145

4246
put textEncode(tDocs, "UTF-8") into tDocs
4347

util/package_script_extension.livecodescript

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)