]> khamidou — GitHub mirrors - electron.git/commitdiff
Generate .pak for each locale.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 29 May 2014 11:08:59 +0000 (19:08 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 29 May 2014 11:08:59 +0000 (19:08 +0800)
atom.gyp
script/create-dist.py
tools/posix/make_locale_paks.sh [new file with mode: 0755]

index 211e0347f2379b9d4ebed296195ba02181f864fa..3c95bf0904a23bbb276cf4c52e67e980b39592aa 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
               ],
             },
           ]
-        }],  # OS=="mac"
+        }, {  # OS=="mac"
+          'dependencies': [
+            'make_locale_paks',
+          ],
+        }],  # OS!="mac"
         ['OS=="win"', {
           'copies': [
             {
           },
         },  # target helper
       ],
-    }],  # OS==Mac
+    }, {  # OS=="mac"
+      'targets': [
+        {
+          'target_name': 'make_locale_paks',
+          'type': 'none',
+          'actions': [
+            {
+              'action_name': 'Make Empty Paks',
+              'inputs': [
+                'tools/posix/make_locale_paks.sh',
+              ],
+              'outputs': [
+                '<(PRODUCT_DIR)/locales'
+              ],
+              'action': [
+                'tools/posix/make_locale_paks.sh',
+                '<(PRODUCT_DIR)',
+                '<@(locales)',
+              ],
+              'msvs_cygwin_shell': 0,
+            },
+          ],
+        },
+      ],
+    }],  # OS!="mac"
     ['OS=="win"', {
       'targets': [
         {
index 3354b65cc2c3dd3e78e8288f3d32d74e5ca4e06b..ba9b0f526421a7ffabd5539002af860dce4c39ef 100755 (executable)
@@ -62,9 +62,11 @@ TARGET_DIRECTORIES = {
   ],
   'win32': [
     'resources',
+    'locales',
   ],
   'linux': [
     'resources',
+    'locales',
   ],
 }
 
diff --git a/tools/posix/make_locale_paks.sh b/tools/posix/make_locale_paks.sh
new file mode 100755 (executable)
index 0000000..6f66a04
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: make_locale_paks locale_dir [...]
+#
+# This script creates the .pak files under locales directory, it is used to fool
+# the ResourcesBundle that the locale is available.
+
+set -eu
+
+if [[ ${#} -eq 0 ]]; then
+  echo "usage: ${0} build_dir [locale_pak...]" >& 2
+  exit 1
+fi
+
+PRODUCT_DIR="$1"
+shift
+
+LOCALES_DIR="${PRODUCT_DIR}/locales"
+if [[ ! -d "${LOCALES_DIR}" ]]; then
+  mkdir "${LOCALES_DIR}"
+fi
+
+cd "${LOCALES_DIR}"
+
+for pak in "${@}"; do
+  if [[ ! -f "${pak}.pak" ]]; then
+    touch "${pak}.pak"
+  fi
+done