← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:sassy-css-fix-review-pop-over into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:sassy-css-fix-review-pop-over into launchpad:master.

Commit message:
Make CSS generation repeatable

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/385678

`scandir` isn't guaranteed to be consistent in ordering, so sort it by name to ensure we include the same files in the same order.
Also disable compressed output to make it easier to debug while this issue is happening.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:sassy-css-fix-review-pop-over into launchpad:master.
diff --git a/Makefile b/Makefile
index 262d9a3..1d81830 100644
--- a/Makefile
+++ b/Makefile
@@ -185,7 +185,8 @@ css_combine: jsbuild_widget_css
 	# Compile the base.css file separately for tests
 	SASS_BINARY_PATH=$(NODE_SASS_BINARY) $(YARN) run node-sass --include-path $(WD)/$(ICING) --follow --output $(WD)/$(ICING)/ $(WD)/$(ICING)/css/base.scss
 	# Compile the combo.css for the main site
-	SASS_BINARY_PATH=$(NODE_SASS_BINARY) $(YARN) run node-sass --include-path $(WD)/$(ICING) --output-style compressed --follow --output $(WD)/$(ICING) $(WD)/$(ICING)/combo.scss
+	# XXX 2020-06-12 twom This should have `--output-style compressed`. Removed for debugging purposes
+	SASS_BINARY_PATH=$(NODE_SASS_BINARY) $(YARN) run node-sass --include-path $(WD)/$(ICING) --follow --output $(WD)/$(ICING) $(WD)/$(ICING)/combo.scss
 
 css_watch: jsbuild_widget_css
 	${SHHH} bin/sprite-util create-image
diff --git a/lib/lp/scripts/utilities/js/jsbuild.py b/lib/lp/scripts/utilities/js/jsbuild.py
index a1bdd2f..8424adc 100644
--- a/lib/lp/scripts/utilities/js/jsbuild.py
+++ b/lib/lp/scripts/utilities/js/jsbuild.py
@@ -352,7 +352,12 @@ class Builder:
                 combined_css.update()
 
     def do_build(self):
-        for entry in scandir.scandir(self.src_dir):
+        # We need this to be both repeatable and in the desired order
+        dir_list = sorted(
+            scandir.scandir(self.src_dir),
+            key=lambda x: x.name.lower(),
+            reverse=True)
+        for entry in dir_list:
             if not entry.is_dir():
                 continue
             self.build_assets(entry.name)