From 86a61bce12c275a60596af710c433325ac754ec2 Mon Sep 17 00:00:00 2001
From: Pawel Kaczmarek
Date: Fri, 12 Dec 2014 13:59:08 +0100
Subject: [PATCH] [All API][Calendar] Merging JavaScript files
[Message]
This patch enable using more than one JavaScript file in each module.
Scrip mergejs.py merge all require files
listed in "*_api.js" file from "js" directory
Looking for //= require('file_name.js')
If there is no required files than uses source from "*_api.js" file
Change-Id: I57910d282de187a925a946eea065b18ad1e215f5
Signed-off-by: Pawel Kaczmarek
---
src/calendar/calendar_api.js | 58 ++++-----------------------
src/calendar/js/tizen.calendar.plugin | 28 -------------
tools/generate_api.py | 4 +-
3 files changed, 10 insertions(+), 80 deletions(-)
delete mode 100644 src/calendar/js/tizen.calendar.plugin
diff --git a/src/calendar/calendar_api.js b/src/calendar/calendar_api.js
index f0a9f356..9173210b 100644
--- a/src/calendar/calendar_api.js
+++ b/src/calendar/calendar_api.js
@@ -2,54 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-exports.getCalendars = function() {
- throw 'getCalendars not implemented';
-};
-
-exports.getUnifiedCalendar = function() {
- throw 'getUnifiedCalendar not implemented';
-};
-
-exports.getDefaultCalendar = function() {
- throw 'getDefaultCalendar not implemented';
-};
-
-exports.getCalendar = function() {
- throw 'getCalendar not implemented';
-};
-
-exports.addCalendar = function() {
- throw 'addCalendar not implemented';
-};
-
-exports.removeCalendar = function() {
- throw 'removeCalendar not implemented';
-};
-
-tizen.Calendar = function(accountId, name, type) {
- throw 'Calendar not implemented';
-};
-
-tizen.CalendarEventId = function(uid, rid) {
- throw 'CalendarEventId not implemented';
-};
-
-tizen.CalendarEvent = function(eventInitDict, format) {
- throw 'CalendarEvent not implemented';
-};
-
-tizen.CalendarTask = function(taskInitDict, format) {
- throw 'CalendarTask not implemented';
-};
-
-tizen.CalendarAlarm = function(time, method, description) {
- throw 'CalendarAlarm not implemented';
-};
-
-tizen.CalendarAttendee = function(uri, attendeeInitDict) {
- throw 'CalendarAttendee not implemented';
-};
-
-tizen.CalendarRecurrenceRule = function(frequency, ruleInitDict) {
- throw 'CalendarRecurrenceRule not implemented';
-};
+//= require('tizen.calendar.Common.js');
+//= require('tizen.calendar.CalendarItem.js');
+//= require('tizen.calendar.Calendar.js');
+//= require('tizen.calendar.CalendarManager.js');
+//= require('tizen.calendar.CalendarAttendee.js');
+//= require('tizen.calendar.CalendarAlarm.js');
+//= require('tizen.calendar.CalendarRecurrenceRule.js');
diff --git a/src/calendar/js/tizen.calendar.plugin b/src/calendar/js/tizen.calendar.plugin
deleted file mode 100644
index 8d2a13ec..00000000
--- a/src/calendar/js/tizen.calendar.plugin
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function () {
- 'use strict';
-
- var CalendarCommon = require('./tizen.calendar.Common');
- var CalendarItem = require('./tizen.calendar.CalendarItem');
- var Calendar = require('./tizen.calendar.Calendar');
- var CalendarManager = require('./tizen.calendar.CalendarManager');
- var CalendarAttendee = require('./tizen.calendar.CalendarAttendee');
- var CalendarAlarm = require('./tizen.calendar.CalendarAlarm');
- var CalendarRecurrenceRule = require('./tizen.calendar.CalendarRecurrenceRule');
-
-})();
diff --git a/tools/generate_api.py b/tools/generate_api.py
index cef97b7a..56c911e9 100755
--- a/tools/generate_api.py
+++ b/tools/generate_api.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import sys
+import subprocess
TEMPLATE = """\
extern const char %s[];
@@ -10,7 +11,8 @@ const char %s[] = { %s, 0 };
"""
js_code = sys.argv[1]
-lines = file(js_code).read()
+cmd = "python ../../tools/mergejs.py -f" + js_code
+lines = subprocess.check_output(cmd, shell=True)
c_code = ', '.join(str(ord(c)) for c in lines)
symbol_name = sys.argv[2]
--
2.34.1