mirror of
https://github.com/google/blockly.git
synced 2026-01-11 19:07:08 +01:00
* feat(build): Make build tasks invoke their prerequisites
- Divide gulp targets into three kinds: main sequence,
manually invokable, and script-only. The first two categories
automatically invoke their prerequisites.
- Give (most of) the affected gulp targets shorter and more memorable
names that could become their npm script names in future.
* feat(build): Make package tasks invoke their prerequisites
Have the package task invoke the cleanBuildDir (as well as
cleanPackageDir) and build tasks. Remove the checkBuildDir
task as it is now redundant since a fresh build is done every
time.
* feat(build): Make git tasks invoke their prerequisites
* feat(build): Make cleanup, license [sic] tasks invoke their prerequisites
Turns out they don't have any, so this commit just classifies
their gulp targets according to the established scheme.
* feat(build): Make appengine tasks invoke their prerequisites
In this case prepareDeployDir will eventually depend on package
but does not for now.
* feat(build): Have npm scripts run npm ci first where applicable
Have any npm script that have external effects (e.g. publishing an
npm package, pushing a new version to appengine, or updating GitHub
Pages) start by running npm ci to ensure that all dependencies are
up-to-date with respect to package-lock.json.
(This is done by npm and not a gulp script because gulp itself
might need updating. So might npm, but that is less likely to
make any difference to what gets published/pushed.)
* chore(build): have tests use package target
Have the tests just run the package target (with debug flags)
since that runs the the build target automatically.
* feat(tests): Write Closure Compiler output directly to dist/
Since they are already UMD-wrapped, have Closure Compiler write
output chunks directly to RELEASE_DIR, i.e. dist/.
* chore(tests): Use freshly-build files in compressed mode.
Use the freshly-built build/*_compresssed.js files when bootstrapping
in compressed mode, rather than using the checked-in files in the
repository root.
This helps ensure that compressed and uncompressed mode will be
testing (as closely as possible) the same code.
Obsoletes #6218 (though the issues discussed there have not actually
yet been addressed in this branch).
* chore(build): Write intermediate langfiles to build/msg
Write the results of create_messages.py to build/msg instead of
build/msg/js.
* fix(build): Use build/msg/en.js instead of msg/messages.js in tests
This has no direct effect but fixes a long-standing misdesign
where we are testing against the input to, rather than the output
of, the language file processing pipeline.
* feat(demos): Use freshly-built files
Use the freshly-built dist/*_compresssed.js and build/msg/* files
rather than using the checked-in files in the repository root.
This helps ensure that these demos are using the most recent
version of Blockly (even in the develop branch).
* fix(build): Update appengine deployment to include built files
Modify the prepareDemos task as follows:
- Use the git index instead of HEAD, so that most local changes
will be applied (without copying whatever .gitignored cruft
might be in the local directory).
- Run clean and build and then copy build/msg and
dist/*_compressed.js* to the deploy directory.
This fixes the problem created by the previous commit, wherein the
demos relied on built files that were not being deployed to
appengine.
* fix(build): Update GitHub Pages deployment to include built files
Modify the updateGithubPages task to run clean and build and
then git add build/msg dist/*_compressed.js*, so that they will
be included in the deployed pages.
This fixes the problem created by the previous^2 commit,
wherein the demos relied on built files that were not being
deployed to GitHub Pages.
* chore(build): Remove build products from repository
Remove *_compressed.js* and msg/js/* from the blockly repository.
Also remove the now-obsolete checkinBuilt gulp task.
* chore(build): Apply relevant changes to test_tasks.js
Apply changes made to run_all_tests.sh and check_metadata.sh to
the corresponding parts of their JS replacements in
test_tasks.js.
* chore(build): Make updates suggested in PR #6475
- Remove `clean:builddir` and `clean:releasedir` - `clean`
is sufficient.
- Remove duplicate `require` from `appengine_tasks.js`.
* feat(build): Use shorter npm script names
Since scripts that run build tasks now automatically run their
prerequisite tasks, the previous naming scheme of task `build`
running all the `build:subtask`s no longe really makes very
much sense.
Additionally, following a chat discussion, there seems to be a
rough consensus to use "messages" to refer to the .json input
files, and "langfiles" to the generated .js output files.
Consequently, simplify npm script names by renaming as follows:
- "generate:langfiles" -> "messages"
- "build:langfiles" -> "langfiles"
- "build:js" -> "tsc"
- "build:deps" -> "deps"
- "build:compiled" -> "minify"
- "build:compressed": delete this synonym for "build:compiled",
("minify" was chosen as agnostic to Closure Compiler vs. WebPack.)
* chores(build): Add deprecation notice for old scripts
To reduce potential confusion/frustration, restore the previous
npm scripts but have them display a deprecation notice instead
(note that npm prints the script contents before running it, so
echo is not needed).
* docs(build): Add comments distinguishing 'messages' from 'langfiles'
139 lines
4.2 KiB
Bash
Executable File
139 lines
4.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Checks the size of generated files and verifies they aren't growing
|
|
# unreasonably. Assumes the compressed files have already been built.
|
|
|
|
# The ..._EXPECTED values should be updated with each release.
|
|
# Run this script to get the new values.
|
|
|
|
# Location of the pre-built compressed files.
|
|
#
|
|
# (TODO(#5007): Should fetch this from scripts/gulpfiles/config.js
|
|
# instead of hardcoding it here.
|
|
readonly RELEASE_DIR='dist'
|
|
|
|
# These values should be updated with each release. (Note that the
|
|
# historic values are tab-delimited.)
|
|
|
|
# Size of blockly_compressed.js
|
|
# Q2 2019 2.20190722.0 812688
|
|
# Q3 2019 3.20191014.0 538781
|
|
# Q4 2019 3.20200123.0 609855
|
|
# Q1 2020 3.20200402.0 619341
|
|
# Q2 2020 3.20200625.0 621811
|
|
# Q3 2020 3.20200924.0 641216
|
|
# Q4 2020 4.20201217.0 653624
|
|
# Q1 2021 5.20210325.0 653957
|
|
# Q2 2021 6.20210701.0 664497
|
|
# Q3 2021 6.20210701.0 731695 (mid-quarter goog.module conversion)
|
|
# Q3 2021 6.20210701.0 808807 (late-quarter goog.module conversion)
|
|
# Q4 2021 7.20211209.0-beta.0 920002
|
|
# Q4 2021 7.20211209.0 929665
|
|
# Q2 2022 8.0.0 928056
|
|
# Q3 2022 8.0.0 1040413 (mid-quarter typescript conversion)
|
|
# Q4 2022 8.0.0 870104
|
|
readonly BLOCKLY_SIZE_EXPECTED=870104
|
|
|
|
# Size of blocks_compressed.js
|
|
# Q2 2019 2.20190722.0 75618
|
|
# Q3 2019 3.20191014.0 76455
|
|
# Q4 2019 3.20200123.0 75629
|
|
# Q1 2020 3.20200402.0 75805
|
|
# Q2 2020 3.20200625.0 76360
|
|
# Q3 2020 3.20200924.0 76429
|
|
# Q4 2020 4.20201217.0 76693
|
|
# Q1 2021 5.20210325.0 76693
|
|
# Q2 2021 6.20210701.0 76669
|
|
# Q3 2021 6.20210701.0 76669
|
|
# Q4 2021 7.20211209.0-beta.0 82054
|
|
# Q4 2021 7.20211209.0 86966
|
|
# Q2 2022 8.0.0 90769
|
|
# Q3 2022 8.0.0 102176 (mid-quarter typescript conversion)
|
|
# Q4 2022 8.0.0 102213
|
|
readonly BLOCKS_SIZE_EXPECTED=102213
|
|
|
|
# Size of blockly_compressed.js.gz
|
|
# Q2 2019 2.20190722.0 180925
|
|
# Q3 2019 3.20191014.0 119064
|
|
# Q4 2019 3.20200123.0 131897
|
|
# Q1 2020 3.20200402.0 134133
|
|
# Q2 2020 3.20200625.0 135181
|
|
# Q3 2020 3.20200924.0 138003
|
|
# Q4 2020 4.20201217.0 138115
|
|
# Q1 2021 5.20210325.0 136118
|
|
# Q2 2021 6.20210701.0 142112
|
|
# Q3 2021 6.20210701.0 147476 (mid-quarter goog.module conversion)
|
|
# Q3 2021 6.20210701.0 152025 (late-quarter goog.module conversion)
|
|
# Q4 2021 7.20211209.0-beta.0 169863
|
|
# Q4 2021 7.20211209.0 171759
|
|
# Q2 2022 8.0.0 173997
|
|
# Q3 2022 8.0.0 185766 (mid-quarter typescript conversion)
|
|
# Q4 2022 8.0.0 175140
|
|
readonly BLOCKLY_GZ_SIZE_EXPECTED=175140
|
|
|
|
# Size of blocks_compressed.js.gz
|
|
# Q2 2019 2.20190722.0 14552
|
|
# Q3 2019 3.20191014.0 15064
|
|
# Q4 2019 3.20200123.0 14897
|
|
# Q1 2020 3.20200402.0 14966
|
|
# Q2 2020 3.20200625.0 15195
|
|
# Q3 2020 3.20200924.0 15231
|
|
# Q4 2020 4.20201217.0 15224
|
|
# Q1 2021 5.20210325.0 15285
|
|
# Q2 2021 6.20210701.0 15275
|
|
# Q3 2021 6.20210701.0 15284
|
|
# Q4 2021 7.20211209.0-beta.0 16616
|
|
# Q4 2021 7.20211209.0 15760
|
|
# Q2 2022 8.0.0 16192
|
|
# Q3 2022 8.0.0 17016 (mid-quarter typescript conversion)
|
|
# Q4 2022 8.0.0 17188
|
|
readonly BLOCKS_GZ_SIZE_EXPECTED=17188
|
|
|
|
# ANSI colors
|
|
readonly BOLD_GREEN='\033[1;32m'
|
|
readonly BOLD_RED='\033[1;31m'
|
|
readonly ANSI_RESET='\033[0m'
|
|
|
|
# Terminate immediately with non-zero status if any command exits
|
|
# with non-zero status, printing a nice message.
|
|
set -e
|
|
function fail {
|
|
echo -e "${BOLD_RED}Error while checking metadata.${ANSI_RESET}" >&2
|
|
}
|
|
trap fail ERR
|
|
|
|
# GZip them for additional size comparisons (keep originals, force
|
|
# overwite previously-gzipped copies).
|
|
echo "Zipping the compressed files"
|
|
gzip -kf "${RELEASE_DIR}/blockly_compressed.js"
|
|
gzip -kf "${RELEASE_DIR}/blocks_compressed.js"
|
|
|
|
# Check the sizes of the files
|
|
|
|
has_failed=0
|
|
|
|
compare_size() {
|
|
local name="$1"
|
|
local expected="$2"
|
|
local compare=$(echo "${expected} * 1.1 / 1" | bc)
|
|
|
|
local size=$(wc -c <"${name}")
|
|
|
|
if (( $size > $compare))
|
|
then
|
|
echo -ne "${BOLD_RED}Failed: Size of ${name} has grown more than 10%. " >&2
|
|
echo -e "${size} vs ${expected} ${ANSI_RESET}" >&2
|
|
has_failed=1
|
|
else
|
|
echo -ne "${BOLD_GREEN}Size of ${name} at ${size} compared to previous " >&2
|
|
echo -e "${expected}.${ANSI_RESET}"
|
|
fi
|
|
}
|
|
|
|
compare_size "${RELEASE_DIR}/blockly_compressed.js" $BLOCKLY_SIZE_EXPECTED
|
|
compare_size "${RELEASE_DIR}/blocks_compressed.js" $BLOCKS_SIZE_EXPECTED
|
|
compare_size "${RELEASE_DIR}/blockly_compressed.js.gz" $BLOCKLY_GZ_SIZE_EXPECTED
|
|
compare_size "${RELEASE_DIR}/blocks_compressed.js.gz" $BLOCKS_GZ_SIZE_EXPECTED
|
|
|
|
exit $has_failed
|