build: Module build implementation
authorYoumin Ha <youmin.ha@samsung.com>
Tue, 18 Dec 2012 01:06:07 +0000 (10:06 +0900)
committerYoumin Ha <youmin.ha@samsung.com>
Thu, 7 Mar 2013 12:10:30 +0000 (21:10 +0900)
For module build by SDK, refactored widget js file names and directory
structure. all widget codes are in src/js/widgets/, and other codes are
in src/js. The prefix of all source file names is jquery.mobile.tizen.
Added tools/moduledep.js, which constructs module dependency and build
result.

Change-Id: I904f3b7e462257bf1ca19ab33527592304e2ca23

45 files changed:
Makefile
src/js/jquery.mobile.label.js [moved from src/widgets/common/js/jquery.mobile.label.js with 85% similarity]
src/js/jquery.mobile.tizen.clrlib.js [moved from src/widgets/common/js/jquery.mobile.tizen.clrlib.js with 94% similarity]
src/js/jquery.mobile.tizen.configure.js [moved from src/widgets/common/js/jquery.mobile.tizen.configure.js with 58% similarity]
src/js/jquery.mobile.tizen.core.js [moved from src/widgets/common/js/jquery.mobile.tizen.core.js with 92% similarity]
src/js/jquery.mobile.tizen.loader.js [moved from src/loader/loader.js with 97% similarity]
src/js/jquery.mobile.tizen.loadprototype.js [moved from src/widgets/common/js/jquery.mobile.tizen.loadprototype.js with 95% similarity]
src/js/jquery.mobile.tizen.scrollview.js [moved from src/widgets/common/js/jquery.mobile.tizen.scrollview.js with 99% similarity]
src/js/util/ensurens.js [moved from src/widgets/common/js/ensurens.js with 84% similarity]
src/js/util/range.js [moved from src/widgets/datetimepicker/js/range.js with 84% similarity]
src/js/widgets/jquery.mobile.tizen.button.js [moved from src/widgets/button/js/jquery.mobile.tizen.button.js with 81% similarity]
src/js/widgets/jquery.mobile.tizen.checkbox.js [moved from src/widgets/checkbox/js/jquery.mobile.tizen.checkbox.js with 74% similarity]
src/js/widgets/jquery.mobile.tizen.circularview.js [moved from src/widgets/circularview/js/jquery.mobile.tizen.circularview.js with 97% similarity]
src/js/widgets/jquery.mobile.tizen.datetimepicker.js [moved from src/widgets/datetimepicker/js/jquery.mobile.tizen.datetimepicker.js with 97% similarity]
src/js/widgets/jquery.mobile.tizen.extendablelist.js [moved from src/widgets/extendablelist/js/jquery.mobile.tizen.extendablelist.js with 98% similarity]
src/js/widgets/jquery.mobile.tizen.fastscroll.js [moved from src/widgets/fastscroll/js/jquery.mobile.tizen.fastscroll.js with 95% similarity]
src/js/widgets/jquery.mobile.tizen.gallery.js [moved from src/widgets/gallery/js/jquery.mobile.tizen.gallery.js with 97% similarity]
src/js/widgets/jquery.mobile.tizen.listdivider.js [moved from src/widgets/listdivider/js/jquery.mobile.tizen.listdivider.js with 88% similarity]
src/js/widgets/jquery.mobile.tizen.multimediaview.js [moved from src/widgets/multimediaview/js/jquery.mobile.tizen.multimediaview.js with 98% similarity]
src/js/widgets/jquery.mobile.tizen.notification.js [moved from src/widgets/notification/js/jquery.mobile.tizen.notification.js with 96% similarity]
src/js/widgets/jquery.mobile.tizen.pagelayout.js [moved from src/widgets/pagelayout/js/jquery.mobile.tizen.pagelayout.js with 97% similarity]
src/js/widgets/jquery.mobile.tizen.popupwindow.ctxpopup.js [moved from src/widgets/popupwindow_ctxpopup/js/jquery.mobile.tizen.ctxpopup.js with 95% similarity]
src/js/widgets/jquery.mobile.tizen.popupwindow.js [moved from src/widgets/popupwindow/js/jquery.mobile.tizen.popupwindow.js with 97% similarity]
src/js/widgets/jquery.mobile.tizen.progress.js [moved from src/widgets/progress/js/jquery.mobile.tizen.progress.js with 93% similarity]
src/js/widgets/jquery.mobile.tizen.progressbar.js [moved from src/widgets/progressbar/js/jquery.mobile.tizen.progressbar.js with 90% similarity]
src/js/widgets/jquery.mobile.tizen.scrollview.handler.js [moved from src/widgets/handler/js/jquery.tizen.scrollview.handler.js with 96% similarity]
src/js/widgets/jquery.mobile.tizen.searchbar.js [moved from src/widgets/searchbar/js/jquery.mobile.tizen.searchbar.js with 96% similarity]
src/js/widgets/jquery.mobile.tizen.slider.js [moved from src/widgets/slider/js/jquery.mobile.tizen.slider.js with 97% similarity]
src/js/widgets/jquery.mobile.tizen.swipe.js [moved from src/widgets/swipe/js/jquery.mobile.tizen.swipe.js with 96% similarity]
src/js/widgets/jquery.mobile.tizen.tabbar.js [moved from src/widgets/tabbar/js/jquery.mobile.tizen.tabbar.js with 95% similarity]
src/js/widgets/jquery.mobile.tizen.tokentextarea.js [moved from src/widgets/tokentextarea/js/jquery.mobile.tizen.tokentextarea.js with 98% similarity]
src/js/widgets/jquery.mobile.tizen.triangle.js [moved from src/widgets/triangle/js/jquery.mobile.tizen.triangle.js with 90% similarity]
src/js/widgets/jquery.mobile.tizen.virtualgrid.js [moved from src/widgets/virtualgrid/js/jquery.mobile.tizen.virtualgrid.js with 99% similarity]
src/js/widgets/jquery.mobile.tizen.virtuallistview.js [moved from src/widgets/virtuallist/js/jquery.mobile.tizen.virtuallistview.js with 98% similarity]
src/js/widgets/jquery.mobile.tizen.widgetex.js [moved from src/widgets/000_widgetex/js/widgetex.js with 97% similarity]
src/js/widgets/less/ctxpopup.less [new file with mode: 0644]
src/js/widgets/less/popupwindow.less [moved from src/widgets/popupwindow/less/popupwindow.less with 100% similarity]
src/js/widgets/less/triangle.less [moved from src/widgets/triangle/less/jquery.mobile.tizen.triangle.less with 100% similarity, mode: 0644]
src/js/widgets/proto-html/ctxpopup.prototype.html [moved from src/widgets/popupwindow_ctxpopup/proto-html/ctxpopup.prototype.html with 100% similarity]
src/js/widgets/proto-html/popupwindow.prototype.html [moved from src/widgets/popupwindow/proto-html/popupwindow.prototype.html with 100% similarity]
src/widgets/common/js/jquery.mobile.tizen.pinch.js [deleted file]
src/widgets/popupwindow_ctxpopup/css/jquery.mobile.tizen.ctxpopup.css [deleted file]
src/widgets/popupwindow_ctxpopup/less/jquery.mobile.tizen.ctxpopup.less [deleted file]
tools/inline-protos.sh
tools/moduledep.js [new file with mode: 0644]

index 40d39a7..664d3b7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,14 +20,15 @@ FRAMEWORK_ROOT = ${OUTPUT_ROOT}/${PROJECT_NAME}/${VERSION}
 LATEST_ROOT = ${OUTPUT_ROOT}/${PROJECT_NAME}/latest
 
 JS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/js
+JS_LIB_OUTPUT_DIR = ${JS_OUTPUT_ROOT}/src
 export THEME_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/themes
 CSS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/themes/${THEME_NAME}
 CSS_IMAGES_OUTPUT_DIR = ${CSS_OUTPUT_ROOT}/images
 WIDGET_CSS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/widget-css
 PROTOTYPE_HTML_OUTPUT_DIR = proto-html
 
-WIDGETS_DIR = $(CURDIR)/src/widgets
-
+JS_DIR = $(CURDIR)/src/js
+WIDGETS_DIR = ${JS_DIR}/widgets
 THEMES_DIR = $(CURDIR)/src/themes
 LIBS_DIR = $(CURDIR)/libs
 
@@ -65,7 +66,7 @@ JQM_LIB_PATH = $(CURDIR)/libs/js/${JQM_VERSION}
 JQUERY = jquery-1.8.2.js
 JQUERY_MIN = $(subst .js,.min.js,$(JQUERY))
 
-all: libs_prepare third_party widgets libs_cleanup loader themes version version_compat compress
+all: libs_prepare third_party js libs_cleanup themes version version_compat compress
 
 libs_prepare:
        # Prepare libs/ build...
@@ -97,7 +98,36 @@ third_party: init jqm
            cp ${LIBS_DIR}/js/${JQUERY} ${JS_OUTPUT_ROOT}/jquery.js
            cp ${LIBS_DIR}/js/${JQUERY_MIN} ${JS_OUTPUT_ROOT}/jquery.min.js
 
-widgets: init third_party
+js: init third_party globalize
+       # Building JS files...
+       mkdir -p ${JS_LIB_OUTPUT_DIR}; \
+       cp -a ${JS_DIR}/* ${JS_LIB_OUTPUT_DIR}/; \
+       /usr/bin/node $(CURDIR)/tools/moduledep.js -c ${JS_LIB_OUTPUT_DIR} > ${JS_LIB_OUTPUT_DIR}/../depData.json; \
+       find ${JS_LIB_OUTPUT_DIR} -iname '*.js' | sort | \
+       while read JSFILE; do \
+               echo " # Building $$JSFILE"; \
+               sed -i -e '/^\/\/>>excludeStart\(.*\);/,/^\/\/>>excludeEnd\(.*\);/d' $$JSFILE; \
+               if test ${JSLINT_LEVEL} -ge 1; then \
+                       ${JSLINT} $$JSFILE; \
+                       if test ${JSLINT_LEVEL} -ge 2 -a $$? -ne 0; then \
+                               exit 1; \
+                       fi; \
+               fi; \
+               if test "x${INLINE_PROTO}x" = "x1x"; then \
+                       echo "          $$f (include inline-proto if exists)"; \
+                       ./tools/inline-protos.sh $$JSFILE > $$JSFILE.compiled; \
+                       rm -f $$JSFILE; \
+                       mv $$JSFILE.compiled $$JSFILE; \
+               else \
+                       echo "          $$f"; \
+               fi; \
+       done; \
+       /usr/bin/node $(CURDIR)/tools/moduledep.js -d ${JS_LIB_OUTPUT_DIR} ${JS_LIB_OUTPUT_DIR}/../depData.json >> ${FW_JS}; \
+       cp -a ${JS_DIR}/* ${JQM_LIB_PATH}/js/* ${JS_LIB_OUTPUT_DIR}/; \
+       /usr/bin/node $(CURDIR)/tools/moduledep.js -c ${JS_LIB_OUTPUT_DIR} > ${JS_LIB_OUTPUT_DIR}/../depData.json; \
+       find ${JS_LIB_OUTPUT_DIR} -iname '*.js' | xargs sed -i -e '/^\/\/>>excludeStart\(.*\);/,/^\/\/>>excludeEnd\(.*\);/d';
+
+widgets: init third_party globalize
        # Building widgets...
        @@ls -l ${WIDGETS_DIR} | grep '^d' | awk '{print $$NF;}' | \
            while read REPLY; do \
@@ -145,25 +175,19 @@ widgets: init third_party
                 fi; \
            done
 
-
-loader: widgets globalize
-       cat 'src/loader/loader.js' >> ${FW_JS}
-
-
-globalize: widgets
-       cat 'libs/js/globalize/lib/globalize.js' >> ${FW_JS}
+globalize:
+       cat 'libs/js/globalize/lib/globalize.js' >> ${FW_LIB_JS}
        # copy globalize libs...
        cp -a libs/js/globalize/lib/cultures ${FRAMEWORK_ROOT}/js/
 
-
 themes:
        make -C src/themes || exit $?
 
-version: loader themes
+version: js themes
        echo '(function($$){$$.tizen.frameworkData.pkgVersion="$(PKG_VERSION)";}(jQuery));' >> ${FW_JS}
        echo "$(PKG_VERSION)" > ${FRAMEWORK_ROOT}/../VERSION
 
-compress: widgets loader themes
+compress: js themes
        # Javacript code compressing
        @@echo "        # Compressing...."; \
        echo '/*' > ${FW_MIN}; \
@@ -196,14 +220,14 @@ docs: init
        cat docs/index.footer >> docs/index.html
 
 
-version_compat: third_party widgets
+version_compat: third_party js
        # Creating compatible version dirs...
        for v_compat in ${VERSION_COMPAT}; do \
                ln -sf ${VERSION} ${FRAMEWORK_ROOT}/../$$v_compat; \
        done;
        ln -sf ${VERSION} ${FRAMEWORK_ROOT}/../latest
 
-demo: widgets 
+demo: js
        mkdir -p ${OUTPUT_ROOT}/demos
        cp -av demos/* ${OUTPUT_ROOT}/demos/
        cp -f src/template/bootstrap.js ${OUTPUT_ROOT}/demos/gallery/
similarity index 85%
rename from src/widgets/common/js/jquery.mobile.label.js
rename to src/js/jquery.mobile.label.js
index 2199614..365d444 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Add markup for labels
+//>>label: Label
+//>>group: Tizen:Core
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  *
  * This software is licensed under the MIT licence (as defined by the OSI at
@@ -28,6 +36,7 @@
 
 // Add markup for labels
 
+
 (function($, undefined) {
 
 $(document).bind("pagecreate create", function(e) {
@@ -38,3 +47,8 @@ $(document).bind("pagecreate create", function(e) {
 });
 
 })(jQuery);
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
+
similarity index 94%
rename from src/widgets/common/js/jquery.mobile.tizen.clrlib.js
rename to src/js/jquery.mobile.tizen.clrlib.js
index c243c3b..1f8eb2c 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Color code converter
+//>>label: Color library
+//>>group: Tizen:Core
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 ensureNS("jQuery.mobile.tizen.clrlib");
 
 jQuery.extend( jQuery.mobile.tizen.clrlib, 
@@ -210,3 +218,7 @@ jQuery.extend( jQuery.mobile.tizen.clrlib,
         return $.mobile.tizen.clrlib.HSVToHSL($.mobile.tizen.clrlib.RGBToHSV(rgb));
     }
 });
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: jQuery Mobile configuration for Tizen widgets
+//>>label: Configuration
+//>>group: Tizen:Core
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * set TIZEN specific configures
  */
@@ -18,3 +26,8 @@
        $.mobile.buttonMarkup.hoverDelay = 0;
 
 })( jQuery, this );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
+
similarity index 92%
rename from src/widgets/common/js/jquery.mobile.tizen.core.js
rename to src/js/jquery.mobile.tizen.core.js
index ac8beb7..28adb3c 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Tizen core library
+//>>label: Tizen core
+//>>group: Tizen:Core
+
+define( [ 'jquery.mobile.core', 'jquery.mobile.tizen.configure', 'util/ensurens' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery Mobile Widget @VERSION
  *
@@ -149,3 +157,7 @@ jQuery.extend(jQuery.mobile.tizen, {
 });
 
 })();
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
similarity index 97%
rename from src/loader/loader.js
rename to src/js/jquery.mobile.tizen.loader.js
index 8378f32..d884eb6 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Loader doing theme loading, viewport setting, globalize loading, etc.
+//>>label: Loader
+//>>group: Tizen:Core
+
+define( [ 'jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /**
  * @class core
  * loader.js
@@ -458,7 +466,7 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica
        };
 
        function export2TizenNS ( $, tizen ) {
-               if ( undefined == typeof $.tizen ) {
+               if ( !$.tizen ) {
                        $.tizen = { };
                }
 
@@ -485,3 +493,7 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica
        });
 
 } ( jQuery, window.Globalize, window ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Loads widget's prototype
+//>>label: Widget prototype loader
+//>>group: Tizen:Core
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 (function($, undefined) {
 
 ensureNS("jQuery.mobile.tizen");
@@ -138,3 +146,7 @@ jQuery.extend( jQuery.mobile.tizen,
     }
 });
 })(jQuery);
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Implements scroll by javascript
+//>>label: Scrollview
+//>>group: Tizen:Core
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
 * jQuery Mobile Framework : scrollview plugin
 * Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com)
        });
 
 }( jQuery, window, document ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
similarity index 84%
rename from src/widgets/common/js/ensurens.js
rename to src/js/util/ensurens.js
index 08732d6..71c8c83 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Make namespace for modules
+//>>label: Ensurens
+//>>group: Tizen:Utilities
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  *
  * This software is licensed under the MIT licence (as defined by the OSI at
@@ -38,3 +46,7 @@ function ensureNS(ns) {
         eval (nsSoFar + " = " + nsSoFar + " || {};");
     }
 }
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
similarity index 84%
rename from src/widgets/datetimepicker/js/range.js
rename to src/js/util/range.js
index e8c7420..3291002 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Makes array with given range
+//>>label: Range
+//>>group: Tizen:Utilities
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL licenses
  * http://phpjs.org/functions/range
@@ -54,3 +62,6 @@ function range( low, high, step ) {
     return matrix;
 }
 
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Tizen button
+//>>label: Button
+//>>group: Tizen:Widgets
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /**
        @class Button
        The button widget shows a control on the screen that you can use to generate an action event when it is pressed and released. This widget is coded with standard HTML anchor and input elements and then enhanced by jQueryMobile to make it more attractive and usable on a mobile device. Buttons can be used in Tizen as described in the jQueryMobile documentation for buttons.
@@ -22,3 +30,7 @@
        Defines an icon for a button. Tizen supports 12 icon styles: reveal, closed, opened, info, rename, call, warning, plus, minus, cancel, send, and favorite.
 
 */
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);\r
+//>>description: Checkbox widget\r
+//>>label: Checkbox\r
+//>>group: Tizen:Widgets\r
+\r
+define( [ ], function ( ) {\r
+//>>excludeEnd("jqmBuildExclude");\r
+\r
 /**\r
        @class Checkbox\r
        The check box widget shows a list of options on the screen where one or more can be selected. Check boxes can be used in Tizen as described in the jQueryMobile documentation for check boxes.<br/> To add a check box widget to the application, use the following code:\r
@@ -14,4 +22,8 @@
 /**\r
        @property {String} class\r
        Defines the check box style. <br/> The default value is check. If the value is set to favorite, a star-shaped check box is created.\r
-*/
\ No newline at end of file
+*/\r
+\r
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);\r
+} );\r
+//>>excludeEnd("jqmBuildExclude");\r
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Container widget showing children circulary
+//>>label: Circularview
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
        } );
 
 }( jQuery, window, document ) ); // End Component
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows date and time, and make them able to be changed by user
+//>>label: Datetime picker
+//>>group: Tizen:Widgets
+
+define( [ 'jquery.mobile.tizen.widgetex', 'jquery.mobile.tizen.popupwindow', 'jquery.mobile.tizen.popupwindow.ctxpopup' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*global Globalize:false, range:false, regexp:false*/
 /*
  * jQuery Mobile Widget @VERSION
        });
 
 } ( jQuery, this ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Listview which can be extended more and more
+//>>label: Extendable list
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /****************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
        });
 
 }( jQuery ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows list index and scroll to the index directly
+//>>label: Fastscroll
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery Mobile Widget @VERSION
  *
        } );
 
 } ( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows images one by one, and moves them by flicking
+//>>label: Gallery
+//>>group: Tizen:Widgets
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
        } );
 
 }( jQuery, this ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Divider listitem in listview
+//>>label: List divider
+//>>group: Tizen:Widgets
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
 * style : normal, check
 * option :
@@ -73,3 +81,7 @@
                $( $.tizen.listdivider.prototype.options.initSelector, e.target ).listdivider();
        });
 }( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows multimedia and its controls
+//>>label: Multimedia view
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                $.tizen.multimediaview.prototype.enhanceWithin( e.target );
        });
 } ( jQuery, document, window ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows notification popup over header/footer
+//>>label: Notification
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                $( e.target ).find(":jqmData(role='notification')").notification('destroy');
        });
 }( jQuery, this ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Set a layout of pages
+//>>label: Pagelayout
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                });
 
 }( jQuery ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows popup at any place in the page content, with various styles
+//>>label: Context popup
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', 'jquery.mobile.tizen.popupwindow', 'jquery.mobile.tizen.triangle' ], function ( core, _popupwindow, _triangle ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery Mobile Widget @VERSION
  *
                $.tizen.ctxpopup.prototype.enhanceWithin( e.target );
        } );
 }( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows popup on the page
+//>>label: Popup
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', 'jquery.mobile.tizen.widgetex' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery Mobile Widget @VERSION
  *
                });
        });
 }( jQuery ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows progressbar or progress circle
+//>>label: Progress
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                $( e.target ).find( ":jqmData(role='progress')" ).progress();
        } );
 }( jQuery, this ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows progressbar
+//>>label: Progressbar
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery UI Progressbar @VERSION
  *
        } );
 
 }( jQuery, this ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows a scroll-handler with a scrollview
+//>>label: Scrollview Handler
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                widget.scrollview( "enableHandler", "true" );
        });
 } ( jQuery, document ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows searchbar, for text search
+//>>label: Searchbar
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', 'jquery.mobile.tizen.pagelayout' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
        } );
 
 }( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows slider bar to input number by dragging
+//>>label: Slider
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery Mobile Widget @VERSION
  *
        });
 
 }( jQuery, this ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows background listitem by swiping left/right on a listitem
+//>>label: Swipe list
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * jQuery Mobile Widget @VERSION
  *
        });
 
 }( jQuery ));
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows buttons divided automatically on the header
+//>>label: Tabbar
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', 'jquery.mobile.tizen.pagelayout' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                $( $.tizen.tabbar.prototype.options.initSelector, e.target ).tabbar();
        });
 }( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Make words to selectable tokens
+//>>label: Token textarea
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                $( ":jqmData(role='tokentextarea')" ).tokentextarea( "refresh" );
        });
 } ( jQuery, window, document ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows triangle, used by context popup
+//>>label: Triangle
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', 'jquery.mobile.tizen.widgetex' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  * This software is licensed under the MIT licence (as defined by the OSI at
  * http://www.opensource.org/licenses/mit-license.php)
        });
 
 }(jQuery) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows grid swapping its contents automatically
+//>>label: Virtual grid
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
                $( ":jqmData(role='virtualgrid')" ).virtualgrid();
        } );
 } (jQuery, window, document) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Shows listview swapping its contents automatically
+//>>label: Virtual listview
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core', '../jquery.mobile.tizen.scrollview' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /* ***************************************************************************
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
        });
 
 } ( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
similarity index 97%
rename from src/widgets/000_widgetex/js/widgetex.js
rename to src/js/widgets/jquery.mobile.tizen.widgetex.js
index 1bbfe04..5cf70a1 100644 (file)
@@ -1,3 +1,11 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Widget class extending functionality of jQueryMobile widget class
+//>>label: Widget extension
+//>>group: Tizen:Widgets
+
+define( [ '../jquery.mobile.tizen.core' ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
 /*
  *
  * This software is licensed under the MIT licence (as defined by the OSI at
        };
 
 }( jQuery ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
diff --git a/src/js/widgets/less/ctxpopup.less b/src/js/widgets/less/ctxpopup.less
new file mode 100644 (file)
index 0000000..def9e09
--- /dev/null
@@ -0,0 +1,21 @@
+.ui-ctxpopup {
+    display: table;
+
+    .ui-ctxpopup-row {
+        display: table-row;
+
+        .ui-ctxpopup-cell {
+            display: table-cell;
+        }
+    }
+}
+/* 
+ * The settings in this file are part of the theme. They are not part of the structure of ctxpopup.
+ * In the default theme, ui-body-* has a border width of 1px. So, to make the triangles cross this border, we set them in
+ * by 1px.
+ */
+.ui-ctxpopup-row {
+       .ui-triangle-top { top: 1px; }
+       .ui-triangle-left { left: 1px; }
+       .ui-triangle-right { right: 1px; }
+       .ui-triangle-bottom { bottom: 1px; }
diff --git a/src/widgets/common/js/jquery.mobile.tizen.pinch.js b/src/widgets/common/js/jquery.mobile.tizen.pinch.js
deleted file mode 100644 (file)
index a0f0eb7..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/* ***************************************************************************
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- * ***************************************************************************
- *
- *     Author: Minkyu Kang <mk7.kang@samsung.com>
- */
-
-/*
- * Pinch Event
- *
- * Events
- *     pinchstart: triggered when start the touched two points
- *     pinch: triggered when move the touch point after pinchstart event occured
- *     pinchend: triggered when touchend event after pinchstart event occured
- *
- * Parameters
- *     point: touched points
- *     ratio: origin point-to-current point ratio for moving distance
- *
- *     $("#pinch").bind("pinch", function (e, p) {
- *             console.log("point[0].x: " + p.point[0].x);
- *             console.log("point[0].y: " + p.point[0].y);
- *             console.log("point[1].x: " + p.point[1].x);
- *             console.log("point[1].y: " + p.point[1].y);
- *             console.log("ratio: " + p.ratio);
- *     });
- *
- * Options
- *     $.mobile.pinch.enabled: true or false
- *     $.mobile.pinch.min: minimum value of ratio
- *     $.mobile.pinch.max: maximum value of ratio
- *     $.mobile.pinch.factor: scale factor of ratio
- *     $.mobile.pinch.threshold: move threshold of ratio
- *     $.mobile.pinch.interval: interval for pinch event
- */
-
-( function( $, window, undefined ) {
-
-pinch_event = {
-       setup: function () {
-               var thisObject = this,
-                       $this = $( thisObject );
-
-               if ( !$.mobile.support.touch ) {
-                       return;
-               }
-
-               function getDistance( point ) {
-                       var x = point[0].x - point[1].x,
-                               y = point[0].y - point[0].y;
-
-                       return Math.sqrt( ( x * x ) + ( y * y ) );
-               }
-
-               function getParameter( point, ratio ) {
-                       return { point: point, ratio: ratio };
-               }
-
-               $this.bind( "touchstart", function ( event ) {
-                       var data = event.originalEvent.touches,
-                               origin,
-                               last_ratio = 1,
-                               processing = false;
-
-                       if ( !$.mobile.pinch.enabled ) {
-                               return;
-                       }
-
-                       if ( data.length != 2 ) {
-                               return;
-                       }
-
-                       origin = [
-                                       { x: data[0].pageX, y: data[0].pageY },
-                                       { x: data[1].pageX, y: data[1].pageY }
-                       ];
-
-                       $( event.target ).trigger( "pinchstart", getParameter( origin, undefined ) );
-
-                       function pinchHandler( event ) {
-                               var data = event.originalEvent.touches,
-                                       current,
-                                       ratio,
-                                       delta,
-                                       factor = $( window ).width() / $.mobile.pinch.factor;
-
-                               if ( processing ) {
-                                       return;
-                               }
-
-                               if ( !origin ) {
-                                       return;
-                               }
-
-                               current = [
-                                               { x: data[0].pageX, y: data[0].pageY },
-                                               { x: data[1].pageX, y: data[1].pageY }
-                               ];
-
-                               delta = getDistance( current ) - getDistance( origin );
-
-                               ratio = 1 + delta / factor;
-
-                               if ( ratio < $.mobile.pinch.min ) {
-                                       ratio = $.mobile.pinch.min;
-                               } else if ( ratio > $.mobile.pinch.max ) {
-                                       ratio = $.mobile.pinch.max;
-                               }
-
-                               if ( Math.abs( ratio - last_ratio ) < $.mobile.pinch.threshold ) {
-                                       return;
-                               }
-
-                               $( event.target ).trigger( "pinch", getParameter( current, ratio ) );
-
-                               last_ratio = ratio;
-
-                               if ( $.mobile.pinch.interval ) {
-                                       processing = true;
-
-                                       setTimeout( function () {
-                                               processing = false;
-                                       }, $.mobile.pinch.interval );
-                               }
-                       }
-
-                       $this.bind( "touchmove", pinchHandler )
-                               .one( "touchend", function ( event ) {
-                                       $this.unbind( "touchmove", pinchHandler );
-                                       $( event.target ).trigger( "pinchend",
-                                                               getParameter( undefined, last_ratio ) );
-
-                                       origin = undefined;
-                                       current = undefined;
-                                       last_ratio = 1;
-                                       processing = false;
-                               });
-               });
-       }
-};
-
-$.event.special["pinch"] = pinch_event;
-
-$.mobile.pinch = {
-       enabled: true,
-       min: 0.1,
-       max: 3,
-       factor: 4,
-       threshold: 0.01,
-       interval: 50
-};
-
-})( jQuery, this );
diff --git a/src/widgets/popupwindow_ctxpopup/css/jquery.mobile.tizen.ctxpopup.css b/src/widgets/popupwindow_ctxpopup/css/jquery.mobile.tizen.ctxpopup.css
deleted file mode 100644 (file)
index fdc4071..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* 
- * The settings in this file are part of the theme. They are not part of the structure of ctxpopup.
- * In the default theme, ui-body-* has a border width of 1px. So, to make the triangles cross this border, we set them in
- * by 1px.
- */
-
-.ui-ctxpopup-row .ui-triangle-top {
-    top: 1px;
-}
-
-.ui-ctxpopup-row .ui-triangle-left {
-    left: 1px;
-}
-
-.ui-ctxpopup-row .ui-triangle-right {
-    right: 1px;
-}
-
-.ui-ctxpopup-row .ui-triangle-bottom {
-    bottom: 1px;
-}
diff --git a/src/widgets/popupwindow_ctxpopup/less/jquery.mobile.tizen.ctxpopup.less b/src/widgets/popupwindow_ctxpopup/less/jquery.mobile.tizen.ctxpopup.less
deleted file mode 100644 (file)
index b79df71..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.ui-ctxpopup {
-    display: table;
-
-    .ui-ctxpopup-row {
-        display: table-row;
-
-        .ui-ctxpopup-cell {
-            display: table-cell;
-        }
-    }
-}
index 450a5c7..f25554a 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/bash
 
-WIDGET_BASE_DIR="$1"
+WIDGET_FNAME=$1
+WIDGET_BASE_DIR="`dirname ${WIDGET_FNAME}`"
 VERBOSE=$(test "x$2x" != "xx" && echo "1" || echo "0")
 
 rm_tmpfile() # No args
@@ -200,19 +201,20 @@ process_fname() # $1 = file name, n_pass
 }
 
 if test "x${WIDGET_BASE_DIR}x" = "xx"; then
-  echo "Usage: $(basename $0) <widget_base_dir>"
+  echo "Usage: $(basename $0) <widget_file_path>"
   exit 1
 fi
 
-for FNAME in ${WIDGET_BASE_DIR}/js/*.js; do
-  TMP_FNAME=`mktemp`
-  N_PASS=0
-  while ! process_fname $FNAME $N_PASS > $TMP_FNAME; do 
-    if test $VERBOSE -eq 1; then
-        echo "Going for another pass with ${TMP_FNAME}" > /dev/stderr
-    fi
-    N_PASS=`expr "$N_PASS" + 1`
-  done
-  cat $TMP_FNAME
-  rm_tmpfile
+FNAME=${WIDGET_FNAME}
+TMP_FNAME=`mktemp`
+N_PASS=0
+while ! process_fname $FNAME $N_PASS > $TMP_FNAME; do 
+       if test $VERBOSE -eq 1; then
+               echo "Going for another pass with ${TMP_FNAME}" > /dev/stderr
+       fi
+       N_PASS=`expr "$N_PASS" + 1`
 done
+cat $TMP_FNAME
+rm_tmpfile
+
+
diff --git a/tools/moduledep.js b/tools/moduledep.js
new file mode 100644 (file)
index 0000000..555279e
--- /dev/null
@@ -0,0 +1,329 @@
+#!/usr/bin/env node
+/*
+ * moduledep.js
+ *
+ * Read dependency info from a file, and get dependency tree/library load order 
+ * from the dependency info of all files
+ *
+ * ***************************************************************************
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * ***************************************************************************
+ *
+ * Authors: Youmin Ha <youmin.ha@samsung.com>
+*/
+
+var util = require("util"),
+       assert = require("assert"),
+       path = require("path"),
+       vm = require("vm"),
+       fs = require("fs"),
+       child_process = require('child_process'),
+       puts = util.puts,
+       error = util.error,
+       print = util.print;
+
+path.sep = path.sep ? path.sep : '/';
+
+function DepInfo( fPath, basedir ) {
+       var self = this,
+               code,
+               context,
+               origDir,
+               linebuf,
+               line;
+
+       function define( depModList, moduleBody ) {
+               var p, i;
+               if ( typeof depModList == 'object' ) {
+                       for( i in depModList ) {
+                               p = path.join( path.dirname( self.filePath() ), depModList[i] );
+                               self.depends.push( path.normalize( p, '.js' ) );
+                       }
+               }
+       }
+
+       origDir = path.resolve();       // Backup origDir
+
+       if ( ! basedir || ! basedir.length ) {
+               basedir = ".";
+       }
+       process.chdir( basedir );       // Move to basedir
+       self.basedir = path.resolve( );         //self.basedir: absolute path.
+       self.path = path.normalize( fPath );
+       self.name = path.join( path.dirname( self.path ), path.basename( self.path, '.js' ) );
+       self.depends = [ ];
+       self.label = '';
+       self.group = '';
+       self.description = '';
+
+       try {
+               code = fs.readFileSync( self.path, 'utf-8' );
+               linebuf = code.split( /\n\r?/ );
+               for( var idx in linebuf ) {
+                       line = linebuf[idx];
+                       if( line.match( /^\/\/>>label:/ ) ) {
+                               self.label = line.replace( /^\/\/>>label:(.*)$/, "$1" ).trim();
+                       }
+                       if( line.match( /^\/\/>>group:/ ) ) {
+                               self.group = line.replace( /^\/\/>>group:(.*)$/, "$1" ).trim();
+                       }
+                       if( line.match( /^\/\/>>description:/ ) ) {
+                               self.description = line.replace( /^\/\/>>description:(.*)$/, "$1" ).trim();
+                       }
+               }
+               context = vm.createContext( { define: define } );
+               vm.runInContext( code, context );       // Set depends
+       } catch ( e ) {
+               // file read failure
+               //error(e);
+               return null;
+       } finally {
+               process.chdir( origDir );       // Back to origDir
+       }
+}
+DepInfo.prototype = {
+       fullPath: function ( ) {
+               return path.normalize( path.join( this.basedir, this.path ) );
+       },
+       filePath: function ( ) {
+               return path.relative( this.basedir, this.fullPath() );
+       }
+}
+
+function DepTree( ) {
+       return this;
+}
+DepTree.prototype = {
+       _depData: { },
+
+       // Set basedir(s)
+       setBasedir: function ( ) {
+               this.basedir = arguments[0];
+       },
+
+       // Add dependency data from file at the path
+       // @param[in]   fPath   module file's path
+       // @return      true if collection is successful, false if not
+       add: function ( fPath ) {
+               var di;
+
+               di = new DepInfo( fPath, this.basedir );
+               if ( di ) {
+                       this._depData[ di.name ] = di;
+               } else {
+                       return false;
+               }
+               return true;
+       },
+       depData: function ( ) {
+               return this._depData;
+       },
+       order: function ( reqList ) {
+               var self = this,
+                       depData = {},
+                       order = [],
+                       pool = [],
+                       mName,  // current module name
+                       mDep,   // current module's dependency (array)
+                       depIdx,
+                       i, j;
+
+               if( ! reqList ) {
+                       reqList = Object.keys( self._depData );
+               }
+
+               // copy _depData into pool & depData
+               for( j=0; j<reqList.length; j++ ) {
+                       modName = reqList[j];
+                       pool.push( modName );
+                       depData[ modName ] = [];
+                       for( i in self._depData[ modName ].depends ) {
+                               // deep copy
+                               depData[ modName ][i] = self._depData[ modName ].depends[i];
+
+                               // Still not exist in the reqList, add it
+                               if( reqList.indexOf( depData[ modName ][i] ) == -1 ) {
+                                       //error("NOT found! " + depData[ modName ][i] );
+                                       reqList.push( depData[ modName ][i] );
+                               }
+                       }
+               };
+
+               // Mark and sweep
+               while( pool.length > 0 ) {
+                       // Sort pool with remained dependency
+                       pool.sort( function ( a, b ) {
+                               var la, lb;
+                               la =  depData[ a ] ? depData[ a ].length : 0;
+                               lb =  depData[ b ] ? depData[ b ].length : 0;
+                               return la - lb;
+                       } );
+
+                       // Sweep
+                       mName = pool.shift();   // Pop a module name
+                       order.push( mName );    // Add first module to the order (Don't consider whether depData[mName].length == 0.
+
+                       // and Mark
+                       for( i = 0; i < pool.length; i++ ) {    // For all remained modules,
+                               mDep = depData[ pool[i] ];      // Get a dependency list
+                               depIdx = mDep.indexOf( mName );
+                               if ( depIdx != -1 ) {   // Found a dependency!
+                                       mDep.splice( depIdx, 1 );       // Remove mName module
+                               }
+                       }
+               }
+               return order;
+       },
+       construct: function ( ) {
+               var dd = this._depData,
+                       di,
+                       i, j, m;
+               for( i in dd ) {
+                       di = dd[i];             // Get DependencyInfo
+                       for( j in di.depends ) {
+                               m = di.depends[ j ];    // Per dependent module,
+                               if ( ! dd[ m ] ) {              // if there is no module in depData,
+                                       this.add( m );          // add it.
+                               }
+                       }
+               }
+       },
+       import: function ( depData ) {
+               var i;
+               this._depData = depData;
+       },
+       printDepJSON: function ( ) {
+               puts( JSON.stringify( this._depData, null, '\t' ) );
+       }
+};
+
+// Export modules
+module.exports.DepInfo = DepInfo;
+module.exports.DepTree = DepTree;
+
+// main module
+function main( argv ) {
+       var option = argv[2],
+               val = argv[3];
+
+       switch( option ) {
+               case '-c':
+                       createDepInfo( val );
+                       break;
+               case '-d':
+                       calculateDepOrder( val, argv[4], argv[5] );
+                       break;
+               default:
+                       usage();
+       }
+
+       function usage() {
+               error("Usage: " + path.basename( argv[1] ) + " [option] [argument]" );
+               error("       " + path.basename( argv[1] ) + " -c [module directory path] : Create a dependency data" );
+               error("       " + path.basename( argv[1] ) + " -d [module directory path] [depData.json path] [require file path]: Calculate a dependency order, and make a library" );
+               process.exit();
+       }
+
+       function createDepInfo( basedir ) {
+               var dt,
+                       origdir = path.resolve();       // Remember original dir
+
+               if( ! basedir ) basedir = '.';
+
+               dt = new DepTree();
+               dt.setBasedir( basedir );
+
+               child_process.exec('find ' + basedir +  ' -name "*.js" -type f',
+                       function ( err, stdout, stderr ) {
+                               var fpathlist,
+                                       fpath,
+                                       i;
+
+                               if( err ) {
+                                       error( 'Failure finding js files in ' + basedir );
+                                       process.chdir( origdir );
+                                       process.exit(1);
+                               }
+                               fpathlist = stdout.split(/\r?\n/);
+                               for( i in fpathlist ) {
+                                       fpath = fpathlist[i];
+                                       fpath =  path.relative( basedir, fpath );
+                                       //puts(">> " + fpath + " ? " + fpath.match( /.*\.js$/ ) );
+                                       if( fpath.match( /.*\.js$/ ) ) {
+                                               dt.add( fpath );
+                                       }
+                               }
+                               dt.construct();
+                               dt.printDepJSON();
+                       } );
+       }
+
+       function calculateDepOrder( modPath, depDataPath, requirePath ) {
+               var dt = new DepTree(),
+                       depData,
+                       require = null,
+                       code,
+                       context,
+                       order,
+                       mod,
+                       i;
+
+               function _require( depList ) {
+                       var i;
+                       for( i in depList ) {
+                               //dt.add( depList[i] );
+                               require.push( depList[i] );
+                       }
+               }
+
+               dt.setBasedir( modPath );
+
+               if( path.basename( depDataPath ) == "depData.json" ) {
+                       code = fs.readFileSync( depDataPath, 'utf-8' );
+                       depData = JSON.parse( code );
+                       dt.import( depData );
+               }
+               if ( path.basename( requirePath ) == "require.js" ) {
+                       require = [];
+                       code = fs.readFileSync( requirePath, 'utf-8' );
+                       context = vm.createContext( { require: _require } );
+                       vm.runInContext( code, context );
+               }
+
+               dt.construct();
+               order = dt.order( require );
+               //error(order);
+
+
+               for( i in order ) {
+                       mod = order[i];
+                       try {
+                               code = fs.readFileSync( path.join( modPath, mod + '.js' ) );
+                               puts(code);
+                       } catch( ex ) {
+                               if( ex.code != "ENOENT" ) {     // Ignore No entry(no file) error
+                                       throw( ex );
+                               }
+                       }
+               }
+       }
+}
+if ( require.main === module ) main( process.argv );