[gtk/ci-pages] Rename the SCSS files for our themes



commit 2ab9be54fb34c61eedbbb89b78ce9db23ba81e8a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Feb 12 20:18:27 2020 +0000

    Rename the SCSS files for our themes
    
    It seems that Meson's gnome.compile_resources() cannot deal with two
    files with the same name under different directories, which breaks the
    build parallelism because the GResource file ends up not depending on
    either the Adwaita or the HighContrast gtk-contained.css file.
    
    This commit only changes the on-disk names of the Adwaita and
    HighContrast SCSS files, and the corresponding generated CSS files; the
    files in the GResource are going to be aliased to the old file names, to
    minimise the breakage. We might want to change the theme entry points at
    some later date, if we decide to commit to this naming scheme.
    
    Fixes: #2423
    
    See Meson bug: https://github.com/mesonbuild/meson/issues/6615

 gtk/gen-gtk-gresources-xml.py                      |  8 ++---
 gtk/meson.build                                    | 25 ++++++++------
 .../{gtk-contained-dark.scss => Adwaita-dark.scss} |  0
 .../Adwaita/{gtk-contained.scss => Adwaita.scss}   |  0
 gtk/theme/Adwaita/meson.build                      | 40 ++++++++++++----------
 ...ined-inverse.scss => HighContrast-inverse.scss} |  0
 .../{gtk-contained.scss => HighContrast.scss}      |  0
 gtk/theme/HighContrast/meson.build                 | 40 ++++++++++++----------
 8 files changed, 61 insertions(+), 52 deletions(-)
---
diff --git a/gtk/gen-gtk-gresources-xml.py b/gtk/gen-gtk-gresources-xml.py
index 95bccf9268..9f3ea374ef 100644
--- a/gtk/gen-gtk-gresources-xml.py
+++ b/gtk/gen-gtk-gresources-xml.py
@@ -20,8 +20,8 @@ xml += '''
     <file>theme/Empty/gtk.css</file>
     <file>theme/Adwaita/gtk.css</file>
     <file>theme/Adwaita/gtk-dark.css</file>
-    <file>theme/Adwaita/gtk-contained.css</file>
-    <file>theme/Adwaita/gtk-contained-dark.css</file>
+    <file alias='theme/Adwaita/gtk-contained.css'>theme/Adwaita/Adwaita.css</file>
+    <file alias='theme/Adwaita/gtk-contained-dark.css'>theme/Adwaita/Adwaita-dark.css</file>
 '''
 
 for f in get_files('theme/Adwaita/assets', '.png'):
@@ -35,8 +35,8 @@ for f in get_files('theme/Adwaita/assets', '.svg'):
 xml += '''
     <file>theme/HighContrast/gtk.css</file>
     <file alias='theme/HighContrastInverse/gtk.css'>theme/HighContrast/gtk-inverse.css</file>
-    <file>theme/HighContrast/gtk-contained.css</file>
-    <file>theme/HighContrast/gtk-contained-inverse.css</file>
+    <file alias='theme/HighContrast/gtk-contained.css'>theme/HighContrast/HighContrast.css</file>
+    <file 
alias='theme/HighContrast/gtk-contained-inverse.css'>theme/HighContrast/HighContrast-inverse.css</file>
 '''
 
 for f in get_files('theme/HighContrast/assets', '.png'):
diff --git a/gtk/meson.build b/gtk/meson.build
index 295ed0af6d..4d2bed0ccf 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -751,7 +751,6 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml',
                                     ])
 
 # Build the theme files
-theme_deps = []
 sassc = find_program('sassc', required: false)
 if not sassc.found()
   subproject('sassc')
@@ -763,16 +762,22 @@ sassc_opts = [ '-a', '-M', '-t', 'compact' ]
 subdir('theme/Adwaita')
 subdir('theme/HighContrast')
 
+theme_deps = [
+  adwaita_theme_deps,
+  hc_theme_deps,
+]
+
 gtkresources = gnome.compile_resources('gtkresources',
-                                       gtk_gresources_xml,
-                                       dependencies: theme_deps,
-                                       source_dir: [
-                                         # List in order of preference
-                                         meson.current_build_dir(),
-                                         meson.current_source_dir(),
-                                       ],
-                                       c_name: '_gtk',
-                                       extra_args: '--manual-register')
+  gtk_gresources_xml,
+  dependencies: theme_deps,
+  source_dir: [
+    # List in order of preference
+    meson.current_build_dir(),
+    meson.current_source_dir(),
+  ],
+  c_name: '_gtk',
+  extra_args: '--manual-register',
+)
 
 gtk_x11_sources = files([
   'gtkapplication-x11.c',
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.scss b/gtk/theme/Adwaita/Adwaita-dark.scss
similarity index 100%
rename from gtk/theme/Adwaita/gtk-contained-dark.scss
rename to gtk/theme/Adwaita/Adwaita-dark.scss
diff --git a/gtk/theme/Adwaita/gtk-contained.scss b/gtk/theme/Adwaita/Adwaita.scss
similarity index 100%
rename from gtk/theme/Adwaita/gtk-contained.scss
rename to gtk/theme/Adwaita/Adwaita.scss
diff --git a/gtk/theme/Adwaita/meson.build b/gtk/theme/Adwaita/meson.build
index 7a799f947d..c829c9126a 100644
--- a/gtk/theme/Adwaita/meson.build
+++ b/gtk/theme/Adwaita/meson.build
@@ -1,30 +1,32 @@
-scss_files = files([
+adwaita_scss_files = files([
   '_colors-public.scss',
   '_colors.scss',
   '_common.scss',
   '_drawing.scss',
 ])
 
-theme_variants = [
+adwaita_theme_variants = [
   'dark',
 ]
 
-theme_deps += custom_target('Adwaita',
-                            input: 'gtk-contained.scss',
-                            output: 'gtk-contained.css',
-                            command: [
-                              sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                            ],
-                            depend_files: scss_files,
-                            build_by_default: true)
+adwaita_theme_deps = [
+  custom_target('Adwaita theme',
+    input: 'Adwaita.scss',
+    output: 'Adwaita.css',
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: adwaita_scss_files,
+  ),
+]
 
-foreach variant: theme_variants
-  theme_deps += custom_target('Adwaita-' + variant,
-                              input: 'gtk-contained-@0@.scss'.format(variant),
-                              output: 'gtk-contained-@0@.css'.format(variant),
-                              command: [
-                                sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                              ],
-                              depend_files: scss_files,
-                              build_by_default: true)
+foreach variant: adwaita_theme_variants
+  adwaita_theme_deps += custom_target('Adwaita theme variant: ' + variant,
+    input: 'Adwaita-@0@.scss'.format(variant),
+    output: 'Adwaita-@0@.css'.format(variant),
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: adwaita_scss_files,
+  )
 endforeach
diff --git a/gtk/theme/HighContrast/gtk-contained-inverse.scss 
b/gtk/theme/HighContrast/HighContrast-inverse.scss
similarity index 100%
rename from gtk/theme/HighContrast/gtk-contained-inverse.scss
rename to gtk/theme/HighContrast/HighContrast-inverse.scss
diff --git a/gtk/theme/HighContrast/gtk-contained.scss b/gtk/theme/HighContrast/HighContrast.scss
similarity index 100%
rename from gtk/theme/HighContrast/gtk-contained.scss
rename to gtk/theme/HighContrast/HighContrast.scss
diff --git a/gtk/theme/HighContrast/meson.build b/gtk/theme/HighContrast/meson.build
index f3230353ef..da81db45c5 100644
--- a/gtk/theme/HighContrast/meson.build
+++ b/gtk/theme/HighContrast/meson.build
@@ -1,29 +1,31 @@
-scss_files = files([
+hc_scss_files = files([
   '_colors.scss',
   '_common.scss',
   '_drawing.scss',
 ])
 
-theme_variants = [
+hc_theme_variants = [
   'inverse',
 ]
 
-theme_deps += custom_target('HighContrast',
-                            input: 'gtk-contained.scss',
-                            output: 'gtk-contained.css',
-                            command: [
-                              sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                            ],
-                            depend_files: scss_files,
-                            build_by_default: true)
+hc_theme_deps = [
+  custom_target('HighContrast theme',
+    input: 'HighContrast.scss',
+    output: 'HighContrast.css',
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: hc_scss_files,
+  )
+]
 
-foreach variant: theme_variants
-  theme_deps += custom_target('HighContrast-' + variant,
-                              input: 'gtk-contained-@0@.scss'.format(variant),
-                              output: 'gtk-contained-@0@.css'.format(variant),
-                              command: [
-                                sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                              ],
-                              depend_files: scss_files,
-                              build_by_default: true)
+foreach variant: hc_theme_variants
+  hc_theme_deps += custom_target('HighContrast theme variant: ' + variant,
+    input: 'HighContrast-@0@.scss'.format(variant),
+    output: 'HighContrast-@0@.css'.format(variant),
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: hc_scss_files,
+  )
 endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]