-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(build): Remove build products from the Blockly repository #6475
Conversation
* 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.
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.
…ites Turns out they don't have any, so this commit just classifies their gulp targets according to the established scheme.
In this case prepareDeployDir will eventually depend on package but does not for now.
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.)
Have the tests just run the package target (with debug flags) since that runs the the build target automatically.
Since they are already UMD-wrapped, have Closure Compiler write output chunks directly to RELEASE_DIR, i.e. dist/.
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 google#6218 (though the issues discussed there have not actually yet been addressed in this branch).
Write the results of create_messages.py to build/msg instead of build/msg/js.
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.
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).
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.
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.
@@ -31,7 +31,6 @@ | |||
"clean": "gulp clean", | |||
"clean:build": "gulp cleanBuildDir", | |||
"clean:release": "gulp cleanReleaseDir", | |||
"checkin": "gulp checkin", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove some more of these? e.g. now that everything properly calls prereqs, is there any reqson to call clean:build
manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I like to be able to manually clean because when I started University we got a default disk quota of 1 MiB and so one really wanted to be able to get rid of intermediate files when one was finished building something…
But yes; I want to remove a bunch of these. Just not sure which ones are actually being used regularly by our teammates. I do think that e.g. clean
is sufficient, and clean:builddir
and clean:releasedir
are excessively precise. Maybe I was just a bit drunk on command:subcommand
syntax when I added them…
Remove *_compressed.js* and msg/js/* from the blockly repository. Also remove the now-obsolete checkinBuilt gulp task.
f9a3383
to
ced4b1d
Compare
Files that have had manual merge conflict resolution performed: - gulpfile.js Files where a merge conflic was resolved by deleting the file, because it had previously been deleted in no-checkin-built: - *_compresed.js* - msg/js/*.js - tests/run_all_tests.sh Changes made (in no-checkin-built) to the following files that have been deleted or obsoleted will need to be dealt with manually; this will be done in a separate commit for clarity: - tests/run_all_tests.sh - tests/scripts/check_metadata.sh - tests/scripts/run_generators.sh
Apply changes made to run_all_tests.sh and check_metadata.sh to the corresponding parts of their JS replacements in test_tasks.js.
- Remove `clean:builddir` and `clean:releasedir` - `clean` is sufficient. - Remove duplicate `require` from `appengine_tasks.js`.
- Remove `clean:builddir` and `clean:releasedir` - `clean` is sufficient. - Remove duplicate `require` from `appengine_tasks.js`.
0c2e737
to
d36a1a7
Compare
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.)
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).
0182616
to
fbe2b82
Compare
I believe I'm now done messing around with this. Apologies for the slightly convoluted history; I changed my mind about teh contents of the last couple of commits several times… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! One last thing: could you add a comment smewhere explaining the difference between messages and langfiles? Maybe in gulpfile.js
?
The bash script tests/run_all_tests.js was deleted in PR google#6431, where it was replaced by `scripts/gulpfiles/test_tasks.js`, but it was inadvertently resurrected by PR google#6475, apparently due to an error when manually resolving conflicts for merge commit 00676ed. Begone, undead script!
This change had already been made (by PR google#6475 amongst other) to most of the tests, but there were a couple of stragglers that still mentioned messages.js. Fixes google#6824.
The basics
npm run format
andnpm run lint
The details
Resolves
Resolves #6403, #6159
Proposed Changes
package
task invoke thecleanBuildDir
(as well ascleanPackageDir
) andbuild
tasks.checkBuildDir
task as it is now redundant since a fresh build is done every time.npm test
run just thepackage
target (with debug flags), since that runs the thebuild
target automatically.npm ci
to ensure that all dependencies are up-to-date with respect topackage-lock.json
.gulp
itself might need updating. (So mightnpm
, but that is less likely to make any difference to what gets published/pushed.)RELEASE_DIR
(dist/
) since it comes out already UMD-wrapped.build:langfiles
write tobuild/msg/
instead ofbuild/msg/js
, for consistency with ultimate destination for wrapped files (dist/msg/
).tests/bootstrap.js
to, when loading in compressed mode, use the freshly-builtdist/blockly_compressed.js
instead of the probably-stale checked in version in the repository root (and similarly for all the other chunks).build/msg/en.js
instead ofmsg/messages.js
.build/
and/ordist/
.Behaviour Before Change
It was fairly easy to test or release outdated files by accident.
Behaviour After Change
It should be more or less impossible to inadvertently publish an out-of-date file. Playgrounds etc. will only load the most recently-built versions of their Blockly dependencies.
Reason for Changes
It is not generally considered good practice to check build products into a source code repository; there are other better means, such as npm packages and GitHub releases, to publish released "binaries".
Documentation
There will need to be updates made to the release process documentation.
Additional Information