[polari/wip/resources: 3/3] build: Move JS sources into resources



commit 839a3350cc7f0023d585987b0bfcd96bf58d71d7
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Oct 31 01:57:39 2013 +0100

    build: Move JS sources into resources

 .gitignore               |    1 +
 src/Makefile.am          |   47 +++++++++++++++------------------------------
 src/application.js       |    3 --
 src/config.js.in         |    1 -
 src/polari.c             |    2 +-
 src/polari.gresource.xml |   20 +++++++++++++++++++
 6 files changed, 38 insertions(+), 36 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 56adedc..b99abb0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,4 +38,5 @@ po/polari.pot
 po/stamp-it
 src/*.gresource
 src/config.js
+src/resources.[ch]
 src/polari
diff --git a/src/Makefile.am b/src/Makefile.am
index 60347de..987b6f4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,7 @@
 EXTRA_DIST =
 CLEANFILES =
 INTROSPECTION_GIRS =
+BUILT_SOURCES =
 
 girdir = $(pkgdatadir)/gir-1.0
 typelibdir = $(pkglibdir)/girepository-1.0
@@ -20,43 +21,21 @@ do_subst = sed -e 's|@localedir[ ]|$(localedir)|g' \
                -e 's|@PACKAGE_VERSION[ ]|$(PACKAGE_VERSION)|g' \
                $(NULL)
 
-jsdir = $(pkgdatadir)/js/
-dist_js_DATA = \
-       accountsMonitor.js \
-       application.js \
-       appNotifications.js \
-       chatroomManager.js \
-       chatView.js \
-       connections.js \
-       ircParser.js \
-       joinDialog.js \
-       main.js \
-       mainWindow.js \
-       messageDialog.js \
-       notify.js \
-       pasteManager.js \
-       roomList.js \
-       tabCompletion.js \
-       userList.js \
-       utils.js \
-       $(NULL)
-
 config.js: config.js.in Makefile
        $(AM_V_GEN) $(do_subst) $< > $@
 
-nodist_js_DATA = \
-       config.js \
-       $(NULL)
-
 bin_PROGRAMS = polari
 
 polari_SOURCES = \
        polari.c \
        $(NULL)
 
+nodist_polari_SOURCES = \
+       $(resource_built_sources)       \
+       $(NULL)
+
 AM_CPPFLAGS = \
        -DPOLARI_TYPELIBDIR=\""$(pkglibdir)/girepository-1.0"\" \
-       -DPOLARI_JSDIR=\""$(pkglibdir)/js"\" \
        -DLOCALEDIR=\""$(datadir)/locale"\" \
        -DGETTEXT_PACKAGE=\""$(GETTEXT_PACKAGE)"\" \
        $(POLARI_CFLAGS) \
@@ -68,19 +47,25 @@ polari_LDADD = \
        $(NULL)
 
 resource_files=$(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/polari.gresource.xml)
-polari.gresource: polari.gresource.xml $(resource_files)
-       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $<
+resources.h: polari.gresource.xml $(resource_files) config.js
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name polari_resources $<
+resources.c: polari.gresource.xml $(resource_files) config.js
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name polari_resources $<
+
+resource_built_sources = resources.h resources.c
+
+BUILT_SOURCES += $(resource_built_sources)
 
-resourcedir=$(pkgdatadir)
-resource_DATA=polari.gresource
+resource_dist_files = $(filter-out config.js, $(resource_files))
 
 EXTRA_DIST += \
        config.js.in \
+       $(resource_dist_files) \
        polari.gresource.xml \
        $(resource_files) \
        $(NULL)
 
 CLEANFILES += \
        config.js \
-       $(resource_DATA) \
+       $(resource_built_sources)
        $(NULL)
diff --git a/src/application.js b/src/application.js
index 3a6d137..f5706fa 100644
--- a/src/application.js
+++ b/src/application.js
@@ -47,9 +47,6 @@ const Application = new Lang.Class({
         let w = new Polari.FixedSizeFrame(); // register gtype
         w.destroy();
 
-        let resource = Gio.Resource.load(Config.RESOURCE_DIR + '/polari.gresource');
-        resource._register();
-
         this._chatroomManager = ChatroomManager.getDefault();
         this._accountsMonitor = AccountsMonitor.getDefault();
 
diff --git a/src/config.js.in b/src/config.js.in
index 2f5082f..910c823 100644
--- a/src/config.js.in
+++ b/src/config.js.in
@@ -1,2 +1 @@
-const RESOURCE_DIR = "@pkgdatadir@";
 const PACKAGE_VERSION = "@PACKAGE_VERSION@";
diff --git a/src/polari.c b/src/polari.c
index 9e7743b..3a181bc 100644
--- a/src/polari.c
+++ b/src/polari.c
@@ -4,7 +4,7 @@
 int
 main (int argc, char *argv)
 {
-  const char *search_path[] = { POLARI_JSDIR, NULL };
+  const char *search_path[] = { "resource:///org/gnome/polari", NULL };
   GError *error = NULL;
   GjsContext *context;
   int status;
diff --git a/src/polari.gresource.xml b/src/polari.gresource.xml
index 2e2e819..e0097be 100644
--- a/src/polari.gresource.xml
+++ b/src/polari.gresource.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/polari">
+    <!-- data -->
     <file alias="app-menu.ui" preprocess="xml-stripblanks">resources/app-menu.ui</file>
     <file alias="connection-details-dialog.ui" 
preprocess="xml-stripblanks">resources/connection-details-dialog.ui</file>
     <file alias="connection-list-dialog.ui" 
preprocess="xml-stripblanks">resources/connection-list-dialog.ui</file>
@@ -8,5 +9,24 @@
     <file alias="main-window.ui" preprocess="xml-stripblanks">resources/main-window.ui</file>
     <file alias="message-user-dialog.ui" preprocess="xml-stripblanks">resources/message-user-dialog.ui</file>
     <file alias="application.css">resources/application.css</file>
+    <!-- sources -->
+    <file>accountsMonitor.js</file>
+    <file>application.js</file>
+    <file>appNotifications.js</file>
+    <file>chatroomManager.js</file>
+    <file>chatView.js</file>
+    <file>config.js</file>
+    <file>connections.js</file>
+    <file>ircParser.js</file>
+    <file>joinDialog.js</file>
+    <file>main.js</file>
+    <file>mainWindow.js</file>
+    <file>messageDialog.js</file>
+    <file>notify.js</file>
+    <file>pasteManager.js</file>
+    <file>roomList.js</file>
+    <file>tabCompletion.js</file>
+    <file>userList.js</file>
+    <file>utils.js</file>
   </gresource>
 </gresources>


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