Imported Upstream version 4.6.2
This commit is contained in:
37
install/ui/util/build.sh
Executable file
37
install/ui/util/build.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Build script for FreeIPA Web UI
|
||||
set -o errexit
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
profile=$1
|
||||
|
||||
if [[ ! $profile ]] ; then
|
||||
echo 'No profile set'
|
||||
echo 'Usage: build.sh PROFILE_NAME'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RHINO="java -Xss${JAVA_STACK_SIZE:-512k} -classpath /usr/share/java/js.jar org.mozilla.javascript.tools.shell.Main"
|
||||
$RHINO $DIR/build/build.js baseUrl=$DIR/build load=build profile=$DIR/../src/$profile.profile.js
|
||||
exit $?
|
||||
195
install/ui/util/build/LICENSE
Normal file
195
install/ui/util/build/LICENSE
Normal file
@@ -0,0 +1,195 @@
|
||||
Dojo is available under *either* the terms of the modified BSD license *or* the
|
||||
Academic Free License version 2.1. As a recipient of Dojo, you may choose which
|
||||
license to receive this code under (except as noted in per-module LICENSE
|
||||
files). Some modules may not be the copyright of the Dojo Foundation. These
|
||||
modules contain explicit declarations of copyright in both the LICENSE files in
|
||||
the directories in which they reside and in the code itself. No external
|
||||
contributions are allowed under licenses which are fundamentally incompatible
|
||||
with the AFL or BSD licenses that Dojo is distributed under.
|
||||
|
||||
The text of the AFL and BSD licenses is reproduced below.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The "New" BSD License:
|
||||
**********************
|
||||
|
||||
Copyright (c) 2005-2012, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The Academic Free License, v. 2.1:
|
||||
**********************************
|
||||
|
||||
This Academic Free License (the "License") applies to any original work of
|
||||
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
||||
following notice immediately following the copyright notice for the Original
|
||||
Work:
|
||||
|
||||
Licensed under the Academic Free License version 2.1
|
||||
|
||||
1) Grant of Copyright License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license to do the
|
||||
following:
|
||||
|
||||
a) to reproduce the Original Work in copies;
|
||||
|
||||
b) to prepare derivative works ("Derivative Works") based upon the Original
|
||||
Work;
|
||||
|
||||
c) to distribute copies of the Original Work and Derivative Works to the
|
||||
public;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) Grant of Patent License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
|
||||
claims owned or controlled by the Licensor that are embodied in the Original
|
||||
Work as furnished by the Licensor, to make, use, sell and offer for sale the
|
||||
Original Work and Derivative Works.
|
||||
|
||||
3) Grant of Source Code License. The term "Source Code" means the preferred
|
||||
form of the Original Work for making modifications to it and all available
|
||||
documentation describing how to modify the Original Work. Licensor hereby
|
||||
agrees to provide a machine-readable copy of the Source Code of the Original
|
||||
Work along with each copy of the Original Work that Licensor distributes.
|
||||
Licensor reserves the right to satisfy this obligation by placing a
|
||||
machine-readable copy of the Source Code in an information repository
|
||||
reasonably calculated to permit inexpensive and convenient access by You for as
|
||||
long as Licensor continues to distribute the Original Work, and by publishing
|
||||
the address of that information repository in a notice immediately following
|
||||
the copyright notice that applies to the Original Work.
|
||||
|
||||
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
||||
of any contributors to the Original Work, nor any of their trademarks or
|
||||
service marks, may be used to endorse or promote products derived from this
|
||||
Original Work without express prior written permission of the Licensor. Nothing
|
||||
in this License shall be deemed to grant any rights to trademarks, copyrights,
|
||||
patents, trade secrets or any other intellectual property of Licensor except as
|
||||
expressly stated herein. No patent license is granted to make, use, sell or
|
||||
offer to sell embodiments of any patent claims other than the licensed claims
|
||||
defined in Section 2. No right is granted to the trademarks of Licensor even if
|
||||
such marks are included in the Original Work. Nothing in this License shall be
|
||||
interpreted to prohibit Licensor from licensing under different terms from this
|
||||
License any Original Work that Licensor otherwise would have a right to
|
||||
license.
|
||||
|
||||
5) This section intentionally omitted.
|
||||
|
||||
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
||||
Works that You create, all copyright, patent or trademark notices from the
|
||||
Source Code of the Original Work, as well as any notices of licensing and any
|
||||
descriptive text identified therein as an "Attribution Notice." You must cause
|
||||
the Source Code for any Derivative Works that You create to carry a prominent
|
||||
Attribution Notice reasonably calculated to inform recipients that You have
|
||||
modified the Original Work.
|
||||
|
||||
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
||||
the copyright in and to the Original Work and the patent rights granted herein
|
||||
by Licensor are owned by the Licensor or are sublicensed to You under the terms
|
||||
of this License with the permission of the contributor(s) of those copyrights
|
||||
and patent rights. Except as expressly stated in the immediately proceeding
|
||||
sentence, the Original Work is provided under this License on an "AS IS" BASIS
|
||||
and WITHOUT WARRANTY, either express or implied, including, without limitation,
|
||||
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
|
||||
This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
|
||||
license to Original Work is granted hereunder except under this disclaimer.
|
||||
|
||||
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise, shall the
|
||||
Licensor be liable to any person for any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License
|
||||
or the use of the Original Work including, without limitation, damages for loss
|
||||
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses. This limitation of liability shall not
|
||||
apply to liability for death or personal injury resulting from Licensor's
|
||||
negligence to the extent applicable law prohibits such limitation. Some
|
||||
jurisdictions do not allow the exclusion or limitation of incidental or
|
||||
consequential damages, so this exclusion and limitation may not apply to You.
|
||||
|
||||
9) Acceptance and Termination. If You distribute copies of the Original Work or
|
||||
a Derivative Work, You must make a reasonable effort under the circumstances to
|
||||
obtain the express assent of recipients to the terms of this License. Nothing
|
||||
else but this License (or another written agreement between Licensor and You)
|
||||
grants You permission to create Derivative Works based upon the Original Work
|
||||
or to exercise any of the rights granted in Section 1 herein, and any attempt
|
||||
to do so except under the terms of this License (or another written agreement
|
||||
between Licensor and You) is expressly prohibited by U.S. copyright law, the
|
||||
equivalent laws of other countries, and by international treaty. Therefore, by
|
||||
exercising any of the rights granted to You in Section 1 herein, You indicate
|
||||
Your acceptance of this License and all of its terms and conditions.
|
||||
|
||||
10) Termination for Patent Action. This License shall terminate automatically
|
||||
and You may no longer exercise any of the rights granted to You by this License
|
||||
as of the date You commence an action, including a cross-claim or counterclaim,
|
||||
against Licensor or any licensee alleging that the Original Work infringes a
|
||||
patent. This termination provision shall not apply for an action alleging
|
||||
patent infringement by combinations of the Original Work with other software or
|
||||
hardware.
|
||||
|
||||
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
||||
License may be brought only in the courts of a jurisdiction wherein the
|
||||
Licensor resides or in which Licensor conducts its primary business, and under
|
||||
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
||||
application of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any use of the Original Work outside the
|
||||
scope of this License or after its termination shall be subject to the
|
||||
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
|
||||
seq., the equivalent laws of other countries, and international treaty. This
|
||||
section shall survive the termination of this License.
|
||||
|
||||
12) Attorneys Fees. In any action to enforce the terms of this License or
|
||||
seeking damages relating thereto, the prevailing party shall be entitled to
|
||||
recover its costs and expenses, including, without limitation, reasonable
|
||||
attorneys' fees and costs incurred in connection with such action, including
|
||||
any appeal of such action. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
13) Miscellaneous. This License represents the complete agreement concerning
|
||||
the subject matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent necessary to
|
||||
make it enforceable.
|
||||
|
||||
14) Definition of "You" in This License. "You" throughout this License, whether
|
||||
in upper or lower case, means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License. For legal
|
||||
entities, "You" includes any entity that controls, is controlled by, or is
|
||||
under common control with you. For purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management of such
|
||||
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
|
||||
(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
|
||||
entity.
|
||||
|
||||
15) Right to Use. You may use the Original Work in all ways not otherwise
|
||||
restricted or conditioned by this License or by law, and Licensor promises not
|
||||
to interfere with or be responsible for such uses by You.
|
||||
|
||||
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
|
||||
Permission is hereby granted to copy and distribute this license without
|
||||
modification. This license may not be modified without the express written
|
||||
permission of its copyright owner.
|
||||
12
install/ui/util/build/README
Normal file
12
install/ui/util/build/README
Normal file
@@ -0,0 +1,12 @@
|
||||
build.js is builded dojo builder, with applied patches from 'patches' folder, by
|
||||
itself and compiled using uglify.js
|
||||
|
||||
_base/configRhino.js is unmodifed file from dojo/dojo. Required for a build to work.
|
||||
|
||||
= DOJO builder copyright notice =
|
||||
Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
|
||||
= License =
|
||||
Full Dojo license is in LICENSE file.
|
||||
121
install/ui/util/build/_base/configRhino.js
Normal file
121
install/ui/util/build/_base/configRhino.js
Normal file
@@ -0,0 +1,121 @@
|
||||
function rhinoDojoConfig(config, baseUrl, rhinoArgs){
|
||||
// summary:
|
||||
// This module provides bootstrap configuration for running dojo in rhino.
|
||||
|
||||
// TODO: v1.6 tries to set dojo.doc and dojo.body in rhino; why?
|
||||
|
||||
// get a minimal console up
|
||||
var log = function(hint, args){
|
||||
print((hint ? hint + ":" : "") + args[0]);
|
||||
for(var i = 1; i < args.length; i++){
|
||||
print(", " + args[i]);
|
||||
}
|
||||
};
|
||||
// intentionally define console in the global namespace
|
||||
console= {
|
||||
log: function(){ log(0, arguments); },
|
||||
error: function(){ log("ERROR", arguments); },
|
||||
warn: function(){ log("WARN", arguments); }
|
||||
};
|
||||
|
||||
// any command line arguments with the load flag are pushed into deps
|
||||
for(var deps = [], i = 0; i < rhinoArgs.length; i++){
|
||||
var arg = (rhinoArgs[i] + "").split("=");
|
||||
if(arg[0] == "load"){
|
||||
deps.push(arg[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// provides timed callbacks using Java threads
|
||||
if(typeof setTimeout == "undefined" || typeof clearTimeout == "undefined"){
|
||||
var timeouts = [];
|
||||
clearTimeout = function(idx){
|
||||
if(!timeouts[idx]){ return; }
|
||||
timeouts[idx].stop();
|
||||
};
|
||||
|
||||
setTimeout = function(func, delay){
|
||||
var def = {
|
||||
sleepTime:delay,
|
||||
hasSlept:false,
|
||||
|
||||
run:function(){
|
||||
if(!this.hasSlept){
|
||||
this.hasSlept = true;
|
||||
java.lang.Thread.currentThread().sleep(this.sleepTime);
|
||||
}
|
||||
try{
|
||||
func();
|
||||
}catch(e){
|
||||
console.debug("Error running setTimeout thread:" + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var runnable = new java.lang.Runnable(def);
|
||||
var thread = new java.lang.Thread(runnable);
|
||||
thread.start();
|
||||
return timeouts.push(thread) - 1;
|
||||
};
|
||||
}
|
||||
|
||||
var isLocal = function(url){
|
||||
return (new java.io.File(url)).exists();
|
||||
};
|
||||
|
||||
// reset the has cache with node-appropriate values;
|
||||
var hasCache = {
|
||||
"host-rhino":1,
|
||||
"host-browser":0,
|
||||
"dom":0,
|
||||
"dojo-has-api":1,
|
||||
"dojo-xhr-factory":0,
|
||||
"dojo-inject-api":1,
|
||||
"dojo-timeout-api":0,
|
||||
"dojo-trace-api":1,
|
||||
"dojo-loader-catches":1,
|
||||
"dojo-dom-ready-api":0,
|
||||
"dojo-publish-privates":1,
|
||||
"dojo-sniff":0,
|
||||
"dojo-loader":1,
|
||||
"dojo-test-xd":0,
|
||||
"dojo-test-sniff":0
|
||||
};
|
||||
for(var p in hasCache){
|
||||
config.hasCache[p] = hasCache[p];
|
||||
}
|
||||
|
||||
// reset some configuration switches with rhino-appropriate values
|
||||
var rhinoConfig = {
|
||||
baseUrl:baseUrl,
|
||||
commandLineArgs:rhinoArgs,
|
||||
deps:deps,
|
||||
timeout:0,
|
||||
locale:String(java.util.Locale.getDefault().toString().replace('_', '-').toLowerCase()),
|
||||
|
||||
loaderPatch:{
|
||||
injectUrl: function(url, callback){
|
||||
try{
|
||||
if(isLocal(url)){
|
||||
load(url);
|
||||
}else{
|
||||
require.eval(readUrl(url, "UTF-8"));
|
||||
}
|
||||
callback();
|
||||
}catch(e){
|
||||
console.log("failed to load resource (" + url + ")");
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
|
||||
getText: function(url, sync, onLoad){
|
||||
// TODO: test https://bugzilla.mozilla.org/show_bug.cgi?id=471005; see v1.6 hostenv_rhino
|
||||
// note: async mode not supported in rhino
|
||||
onLoad(isLocal(url) ? readFile(url, "UTF-8") : readUrl(url, "UTF-8"));
|
||||
}
|
||||
}
|
||||
};
|
||||
for(p in rhinoConfig){
|
||||
config[p] = rhinoConfig[p];
|
||||
}
|
||||
}
|
||||
1
install/ui/util/build/build.js
Normal file
1
install/ui/util/build/build.js
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,169 @@
|
||||
From c0962cfb520d25c367689243b71e43af1dcc0601 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Vobornik <pvoborni@redhat.com>
|
||||
Date: Thu, 8 Nov 2012 13:22:30 +0100
|
||||
Subject: [PATCH] Make dojo builder buildable by itself
|
||||
|
||||
Dojo builder is now buildable by itself. It just needed a packackage information,
|
||||
profile and separating of internal definition of commanLineArgs module to separate
|
||||
file.
|
||||
|
||||
It allows to use a builder as a single file in rhino with only one dependency
|
||||
(_base/configRhino) copied from dojo/dojo. We would need an additional patch to
|
||||
get rid of this dependency.
|
||||
---
|
||||
build/argv.js | 2 +-
|
||||
build/build.profile.js | 32 ++++++++++++++++++++++++++++++++
|
||||
build/commandLineArgs.js | 7 +++++++
|
||||
build/main.js | 26 ++++++++++----------------
|
||||
build/package.json | 23 +++++++++++++++++++++++
|
||||
5 files changed, 73 insertions(+), 17 deletions(-)
|
||||
create mode 100644 build/build.profile.js
|
||||
create mode 100644 build/commandLineArgs.js
|
||||
create mode 100644 build/package.json
|
||||
|
||||
diff --git a/build/argv.js b/build/argv.js
|
||||
index 18bda74b0eb80e37d9c83cb23a10f29f8ffe91d9..997576687eb74cbb6a6a293b3a855a6d15142368 100644
|
||||
--- a/build/argv.js
|
||||
+++ b/build/argv.js
|
||||
@@ -5,7 +5,7 @@ define([
|
||||
"./fs",
|
||||
"./fileUtils",
|
||||
"./process",
|
||||
- "commandLineArgs",
|
||||
+ "./commandLineArgs",
|
||||
"./stringify",
|
||||
"./version",
|
||||
"./messages",
|
||||
diff --git a/build/build.profile.js b/build/build.profile.js
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..507728c283c5703106fe029c0fd282cb864c994d
|
||||
--- /dev/null
|
||||
+++ b/build/build.profile.js
|
||||
@@ -0,0 +1,32 @@
|
||||
+//
|
||||
+// Dojo builder profile file
|
||||
+//
|
||||
+
|
||||
+
|
||||
+var profile = (function(){
|
||||
+
|
||||
+ var examples = /^build\/examples\//;
|
||||
+ var ignore = {
|
||||
+ 'build/transforms/dojoBoot':1,
|
||||
+ 'build/optimizeRunner':1
|
||||
+ };
|
||||
+
|
||||
+ return {
|
||||
+ resourceTags: {
|
||||
+
|
||||
+ // all JavaScript files are AMD modules
|
||||
+ amd: function(filename, mid) {
|
||||
+ var amd = (!examples.test(mid) &&
|
||||
+ !(mid in ignore) &&
|
||||
+ /\.js$/.test(filename));
|
||||
+ //if (amd)print("'"+mid+"',");
|
||||
+ return amd;
|
||||
+ },
|
||||
+ miniExclude: function(filename, mid) {
|
||||
+ return (examples.test(mid) ||
|
||||
+ !/\.js$/.test(filename) ||
|
||||
+ (mid in ignore));
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+})();
|
||||
\ No newline at end of file
|
||||
diff --git a/build/commandLineArgs.js b/build/commandLineArgs.js
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..41df62e31a05ef2c00e1eb609c0fabe8641e2d03
|
||||
--- /dev/null
|
||||
+++ b/build/commandLineArgs.js
|
||||
@@ -0,0 +1,7 @@
|
||||
+
|
||||
+define([], function(){
|
||||
+
|
||||
+ var args = [];
|
||||
+
|
||||
+ return args;
|
||||
+});
|
||||
\ No newline at end of file
|
||||
diff --git a/build/main.js b/build/main.js
|
||||
index eeb329c91c0eb4df94178cdfc445e5235409401a..89ad7a9d639257ec99ca86be59abdb74d54939a3 100644
|
||||
--- a/build/main.js
|
||||
+++ b/build/main.js
|
||||
@@ -33,16 +33,14 @@
|
||||
// github: https://github.com/altoviso/bdBuild
|
||||
// docs: http://bdframework.org/bdBuild/docs
|
||||
|
||||
-define(["require", "dojo/has"], function(require, has){
|
||||
+define(["require", "dojo/has", "./commandLineArgs"], function(require, has, commandLineArgs){
|
||||
|
||||
// host-dependent environment initialization
|
||||
if(has("host-node")){
|
||||
- define("commandLineArgs", function(){
|
||||
- //arg[0] is node; argv[1] is dojo.js; therefore, start with argv[2]
|
||||
- return process.argv.slice(2);
|
||||
- });
|
||||
+ //arg[0] is node; argv[1] is dojo.js; therefore, start with argv[2]
|
||||
+ commandLineArgs.push(process.argv.slice(2));
|
||||
|
||||
- // helps during dev or heavily async node...
|
||||
+ // helps during dev or heavily async node
|
||||
var util = require.nodeRequire("util");
|
||||
debug = function(it, depth, inspect){
|
||||
util.debug(inspect ? util.inspect(it, false, depth) : it);
|
||||
@@ -50,16 +48,12 @@ define(["require", "dojo/has"], function(require, has){
|
||||
|
||||
has.add("is-windows", process.platform == "win32");
|
||||
}else if(has("host-rhino")){
|
||||
- define("commandLineArgs", [], function(){
|
||||
- var result = [];
|
||||
- require.rawConfig.commandLineArgs.forEach(function(item){
|
||||
- var parts = item.split("=");
|
||||
- if(parts[0]!="baseUrl"){
|
||||
- result.push(item);
|
||||
- }
|
||||
- });
|
||||
- return result;
|
||||
- });
|
||||
+ require.rawConfig.commandLineArgs.forEach(function(item){
|
||||
+ var parts = item.split("=");
|
||||
+ if(parts[0]!="baseUrl"){
|
||||
+ commandLineArgs.push(item);
|
||||
+ }
|
||||
+ });
|
||||
// TODO: make this real
|
||||
has.add("is-windows", /indows/.test(environment["os.name"]));
|
||||
}else{
|
||||
diff --git a/build/package.json b/build/package.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..568101cb1a182d3415c73d02e151359e1ce3e27d
|
||||
--- /dev/null
|
||||
+++ b/build/package.json
|
||||
@@ -0,0 +1,23 @@
|
||||
+{
|
||||
+ "name": "build",
|
||||
+ "version":"1.8.1",
|
||||
+ "directories": {
|
||||
+ "lib": "."
|
||||
+ },
|
||||
+ "main": "main",
|
||||
+ "description": "Dojo build system.",
|
||||
+ "licenses": [
|
||||
+ {
|
||||
+ "type": "AFLv2.1",
|
||||
+ "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43"
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "BSD",
|
||||
+ "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13"
|
||||
+ }
|
||||
+ ],
|
||||
+ "bugs": "http://bugs.dojotoolkit.org/",
|
||||
+ "keywords": ["JavaScript", "Dojo", "Toolkit"],
|
||||
+ "homepage": "http://dojotoolkit.org/",
|
||||
+ "dojoBuild": "build.profile.js"
|
||||
+}
|
||||
--
|
||||
1.7.11.7
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
From 711bfa2bda294cbaf36df28391c8e25361a82d63 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Vobornik <pvoborni@redhat.com>
|
||||
Date: Tue, 22 Jan 2013 15:25:00 +0100
|
||||
Subject: [PATCH] Allow to specify modules for which builder doesn't raise
|
||||
dependency error
|
||||
|
||||
One can specify module ids provided by other means (already built layer file) to build profile file in package section providedMids array. Builder than ignores dependency errors for specified modules. This allows to build layers without source codes of their dependencies, with no expected errors raised.
|
||||
|
||||
Example:
|
||||
|
||||
packages:[
|
||||
{
|
||||
name: "packageName",
|
||||
location: "packageName",
|
||||
providedMids: [
|
||||
'dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/_base/array',
|
||||
'dojo/Stateful'
|
||||
//etc
|
||||
]
|
||||
}
|
||||
],
|
||||
---
|
||||
build/buildControl.js | 10 +++++++++-
|
||||
build/transforms/depsScan.js | 13 +++++++++++--
|
||||
2 files changed, 20 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/build/buildControl.js b/build/buildControl.js
|
||||
index 08fa793a8e21068b9847ab82a45e442e00759323..1198b59e4f754f87409912dfe409cc4205f9b4e5 100644
|
||||
--- a/build/buildControl.js
|
||||
+++ b/build/buildControl.js
|
||||
@@ -1,5 +1,6 @@
|
||||
define([
|
||||
"require",
|
||||
+ "dojo/_base/array",
|
||||
"dojo/_base/lang",
|
||||
"./argv",
|
||||
"./fs",
|
||||
@@ -10,7 +11,7 @@ define([
|
||||
"./process",
|
||||
"./messages",
|
||||
"dojo/text!./help.txt"
|
||||
-], function(require, lang, argv, fs, fileUtils, bc, v1xProfiles, stringify, process, messages, helpText){
|
||||
+], function(require, array, lang, argv, fs, fileUtils, bc, v1xProfiles, stringify, process, messages, helpText){
|
||||
//
|
||||
// Process the arguments given on the command line to build up a profile object that is used to instruct and control
|
||||
// the build process.
|
||||
@@ -291,6 +292,13 @@ define([
|
||||
main:pack.destMain || pack.main,
|
||||
location:computePath(pack.destLocation || ("./" + (pack.destName || packName)), bc.destBasePath)
|
||||
};
|
||||
+
|
||||
+ var providedMids = pack.providedMids || [];
|
||||
+ pack.providedMids = [];
|
||||
+ array.forEach(providedMids, function(mid) {
|
||||
+ pack.providedMids[mid] = true;
|
||||
+ });
|
||||
+
|
||||
delete pack.destName;
|
||||
delete pack.destMain;
|
||||
delete pack.destLocation;
|
||||
diff --git a/build/transforms/depsScan.js b/build/transforms/depsScan.js
|
||||
index cd9c098ea5da30a148a82b2ff6cc1eaa593871d2..75186abc3fdce4135c426a6c64863fcd40a6342a 100644
|
||||
--- a/build/transforms/depsScan.js
|
||||
+++ b/build/transforms/depsScan.js
|
||||
@@ -604,6 +604,11 @@ define([
|
||||
aggregateDeps = names.concat(aggregateDeps);
|
||||
// need to use extractResult[0] since it may delete the dojo.loadInit applications
|
||||
resource.getText = function(){ return "// wrapped by build app" + newline + "define(" + json.stringify(aggregateDeps) + ", function(" + names.join(",") + "){" + newline + extractResult[0] + newline + "});" + newline; };
|
||||
+ },
|
||||
+
|
||||
+ isProvidedDependency = function(mid, dep) {
|
||||
+ var packName = mid.split('/')[0];
|
||||
+ return bc.packages[packName].providedMids[dep] === true;
|
||||
};
|
||||
|
||||
// scan the resource for dependencies
|
||||
@@ -627,10 +632,14 @@ define([
|
||||
}else if(module){
|
||||
deps.push(module);
|
||||
}else{
|
||||
- bc.log("amdMissingDependency", ["module", resource.mid, "dependency", dep]);
|
||||
+ if (!isProvidedDependency(resource.mid, dep)) {
|
||||
+ bc.log("amdMissingDependency", ["module", resource.mid, "dependency", dep]);
|
||||
+ }
|
||||
}
|
||||
}catch(e){
|
||||
- bc.log("amdMissingDependency", ["module", resource.mid, "dependency", dep, "error", e]);
|
||||
+ if (!isProvidedDependency(resource.mid, dep)) {
|
||||
+ bc.log("amdMissingDependency", ["module", resource.mid, "dependency", dep, "error", e]);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
});
|
||||
--
|
||||
1.7.11.7
|
||||
|
||||
143
install/ui/util/change-profile.sh
Executable file
143
install/ui/util/change-profile.sh
Executable file
@@ -0,0 +1,143 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
RDIR=$DIR/../release
|
||||
|
||||
usage() {
|
||||
cat <<-__EOF__;
|
||||
NAME
|
||||
change-profile.sh - Changes development enviroment.
|
||||
|
||||
SYNOPSIS
|
||||
path/to/change-profile.sh [--help] [--profile] NAME
|
||||
|
||||
DESCRIPTION
|
||||
Changes symbolic links to switch between development profiles. Run
|
||||
with --git-ignore option to prevent git change notifications.
|
||||
|
||||
OPTIONS
|
||||
--help print the help message
|
||||
|
||||
-p PROFILE
|
||||
--profile PROFILE
|
||||
allsource: both dojo, freeipa uses source files
|
||||
compiled: both dojo, freeipa uses compiled versions
|
||||
source: dojo compiled, freeipa source files
|
||||
default: source
|
||||
--git-ignore
|
||||
set git --assume-unchanged on dojo and freeipa symlinks
|
||||
--git-undo
|
||||
undo --git-ignore
|
||||
|
||||
__EOF__
|
||||
}
|
||||
|
||||
args=`getopt -u -l help,profile:,git-ignore,git-undo p: $*`
|
||||
|
||||
if test $? != 0
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -- $args
|
||||
for i
|
||||
do
|
||||
case "$i" in
|
||||
--help)
|
||||
shift;
|
||||
HELP=1
|
||||
;;
|
||||
--profile | -p)
|
||||
shift;
|
||||
PROFILE=$1
|
||||
shift;
|
||||
;;
|
||||
--git-ignore)
|
||||
shift;
|
||||
GIT_IGNORE=1
|
||||
;;
|
||||
--git-undo)
|
||||
shift;
|
||||
GIT_UNDO=1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -- $args
|
||||
|
||||
if [[ $HELP ]] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# = 2 ]] ; then
|
||||
PROFILE=$2
|
||||
fi
|
||||
|
||||
if [[ $# = 1 ]] ; then
|
||||
PROFILE='source'
|
||||
fi
|
||||
|
||||
printprofile() {
|
||||
echo "Setting profile: $PROFILE"
|
||||
}
|
||||
|
||||
|
||||
pushd $DIR/../js
|
||||
rm -f ./dojo
|
||||
rm -f ./freeipa
|
||||
|
||||
case "$PROFILE" in
|
||||
'source')
|
||||
printprofile
|
||||
ln -s ../build/dojo ./dojo
|
||||
ln -s ../src/freeipa ./freeipa
|
||||
;;
|
||||
'allsource')
|
||||
printprofile
|
||||
ln -s ../src/dojo ./dojo
|
||||
ln -s ../src/freeipa ./freeipa
|
||||
;;
|
||||
'compiled')
|
||||
printprofile
|
||||
ln -s ../build/dojo ./dojo
|
||||
ln -s ../build/freeipa ./freeipa
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown profile: $PROFILE"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $GIT_IGNORE ]] ; then
|
||||
git update-index --assume-unchanged ./dojo
|
||||
git update-index --assume-unchanged ./freeipa
|
||||
fi
|
||||
|
||||
if [[ $GIT_UNDO ]] ; then
|
||||
git update-index --no-assume-unchanged ./dojo
|
||||
git update-index --no-assume-unchanged ./freeipa
|
||||
fi
|
||||
popd
|
||||
27
install/ui/util/clean.sh
Executable file
27
install/ui/util/clean.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
# Clean after build
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
rm -rf $DIR/../release
|
||||
109
install/ui/util/compile.sh
Executable file
109
install/ui/util/compile.sh
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
RDIR=$DIR/../release
|
||||
|
||||
usage() {
|
||||
cat <<-__EOF__;
|
||||
NAME
|
||||
compile.sh - Compiles layer file of Dojo build using uglify.js.
|
||||
Deletes all other files.
|
||||
|
||||
SYNOPSIS
|
||||
path/to/compile.sh [--help] --release RELEASE --layer NAME/NAME
|
||||
|
||||
DESCRIPTION
|
||||
Compiles layer file of Dojo build output using uglify.js.
|
||||
Deletes all other files.
|
||||
|
||||
OPTIONS
|
||||
--help print the help message
|
||||
|
||||
-r
|
||||
--release build release name
|
||||
|
||||
-l
|
||||
--layer layer name
|
||||
|
||||
-o
|
||||
--output output JavaScript file
|
||||
__EOF__
|
||||
}
|
||||
|
||||
if [ "$#" = "0" ] ; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
args=`getopt -u -l help,release:,layer:,output: l:r:o: $*`
|
||||
|
||||
if test $? != 0
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -- $args
|
||||
for i
|
||||
do
|
||||
case "$i" in
|
||||
--help)
|
||||
shift;
|
||||
HELP=1
|
||||
;;
|
||||
--release | -r)
|
||||
shift;
|
||||
RELEASE=$1
|
||||
shift;
|
||||
;;
|
||||
--layer | -l)
|
||||
shift;
|
||||
LAYER=$1
|
||||
shift;
|
||||
;;
|
||||
--output | -o)
|
||||
shift;
|
||||
OUTPUT_FILE=$1
|
||||
shift;
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $HELP ]] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ ! $RELEASE ]] || [[ ! $LAYER ]] ; then
|
||||
echo 'Wrong input \n use --help for instructions'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $OUTPUT_FILE ]] ; then
|
||||
OUTPUT_FILE=$RDIR/$RELEASE/$LAYER.js
|
||||
fi
|
||||
|
||||
# compile using uglify.js
|
||||
$DIR/uglifyjs/uglify $RDIR/$RELEASE/$LAYER.js $OUTPUT_FILE
|
||||
51
install/ui/util/make-builder.sh
Executable file
51
install/ui/util/make-builder.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
# Build DOJO builder, overwrites util/build/build.js. Cleans after itself.
|
||||
|
||||
# For first time usage, user have to have cloned Dojo reps. It's done by
|
||||
# prepare-dojo.sh with --clone --util --dojo --checkout --patches options
|
||||
# or just with --all option.
|
||||
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Create DOJO symbolic links to DOJO reps.
|
||||
# Build of builder requires both original dojo and patched util repositories.
|
||||
$DIR/prepare-dojo.sh --links --util --dojo
|
||||
|
||||
$DIR/clean.sh
|
||||
$DIR/build.sh build
|
||||
|
||||
# Stop at error. We don't want to overwrite good builder with failed build.
|
||||
if [[ $? != 0 ]] ; then
|
||||
echo "Build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Compile and overwrite the builder
|
||||
$DIR/compile.sh --release build --layer build/build --output $DIR/build/build.js
|
||||
$DIR/clean.sh
|
||||
|
||||
# Delete DOJO symbolic links
|
||||
rm -f $DIR/../src/dojo
|
||||
rm -f $DIR/../src/build
|
||||
26
install/ui/util/make-css.sh
Executable file
26
install/ui/util/make-css.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
lesscpy -x $DIR/../less/ipa.less > $DIR/../css/ipa.css
|
||||
exit $?
|
||||
39
install/ui/util/make-dojo.sh
Executable file
39
install/ui/util/make-dojo.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
# Build script for Dojo library
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
$DIR/prepare-dojo.sh --links --dojo
|
||||
|
||||
$DIR/clean.sh
|
||||
$DIR/build.sh dojo
|
||||
|
||||
# Stop at error. We don't want to overwrite good build with failed build.
|
||||
if [[ $? != 0 ]] ; then
|
||||
echo "Build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DIR/compile.sh --release dojo --layer dojo/dojo --output $DIR/../build/dojo/dojo.js
|
||||
$DIR/clean.sh
|
||||
30
install/ui/util/make-patternfly.sh
Executable file
30
install/ui/util/make-patternfly.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2014 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
|
||||
# This script is used for custom build of Bootstrap 3, PatternFly and
|
||||
# Font Awesome. Inspect ../less/patternfly.less for more information
|
||||
|
||||
lessc --clean-css $DIR/../less/patternfly.less > $DIR/../css/patternfly.css
|
||||
exit $?
|
||||
37
install/ui/util/make-ui.sh
Executable file
37
install/ui/util/make-ui.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
# Build script for FreeIPA Web UI
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
IPA_DIR=$DIR/../build/freeipa
|
||||
|
||||
if [ ! -d $IPA_DIR ] ; then
|
||||
mkdir $IPA_DIR
|
||||
fi
|
||||
|
||||
$DIR/clean.sh
|
||||
$DIR/build.sh webui
|
||||
# don't stop at error. Some dependency errors are expected.
|
||||
$DIR/compile.sh --release lib --layer freeipa/core --output $IPA_DIR/core.js
|
||||
$DIR/compile.sh --release lib --layer freeipa/app --output $IPA_DIR/app.js
|
||||
$DIR/clean.sh
|
||||
206
install/ui/util/prepare-dojo.sh
Executable file
206
install/ui/util/prepare-dojo.sh
Executable file
@@ -0,0 +1,206 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
#
|
||||
# This script prepares working enviroment to use dojo toolkit.
|
||||
#
|
||||
# It checkouts public git mirrors of dojo svns then applies custom patches and
|
||||
# makes symbolic links from install/ui/js/dojo and install/ui/js/util
|
||||
|
||||
# freeipa/install/ui absolute path - to use when this script is not run from
|
||||
# install/ui directory
|
||||
|
||||
usage() {
|
||||
cat <<-__EOF__;
|
||||
NAME
|
||||
prepare-dojo.sh - prepare FreeIPA Web UI developmnent enviroment to work
|
||||
with Dojo Library
|
||||
|
||||
SYNOPSIS
|
||||
path/to/prepare-dojo.sh [--help] [--all] [other options]
|
||||
|
||||
DESCRIPTION
|
||||
prepare-dojo.sh is a shell script which prepares FreeIPA Web UI enviroment
|
||||
for creating custom Dojo/Dojo or Dojo/Util/Build builds.
|
||||
|
||||
OPTIONS
|
||||
--help print the help message
|
||||
|
||||
--clone clone git repository
|
||||
|
||||
--checkout checkout git repository
|
||||
|
||||
--patches applies custom patches, must be used with --checkout
|
||||
|
||||
--links makes symbolic links from src directory to Dojo directory
|
||||
|
||||
--dojo work with Dojo
|
||||
|
||||
--util work with Util
|
||||
|
||||
--all Do --clone --checkout --patches --links --dojo --util
|
||||
|
||||
--branch <br> Specify a Dojo branch/tag/hash to checkout, default: 1.8.3
|
||||
|
||||
--dir <dir> Specify a clone dir, default: freeipa/../dojo/
|
||||
__EOF__
|
||||
}
|
||||
|
||||
if [ "$#" = "0" ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# relative path for target dir to checkout dojo
|
||||
DOJO_DIR=$DIR/../../../../dojo
|
||||
|
||||
# working version of Dojo toolkit
|
||||
BRANCH='1.8.3'
|
||||
YES='YES'
|
||||
|
||||
args=`getopt -q -u -l help,checkout,clone,patches,links,dojo,util,all,branch:,dir: a $*`
|
||||
|
||||
if test $? != 0
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -- $args
|
||||
for i
|
||||
do
|
||||
case "$i" in
|
||||
--help)
|
||||
shift;
|
||||
HELP=$YES
|
||||
;;
|
||||
--checkout)
|
||||
shift;
|
||||
CHECKOUT=$YES
|
||||
;;
|
||||
--clone)
|
||||
shift;
|
||||
CLONE=$YES
|
||||
;;
|
||||
--patches)
|
||||
shift;
|
||||
PATCHES=$YES
|
||||
;;
|
||||
--links)
|
||||
shift;
|
||||
LINKS=$YES
|
||||
;;
|
||||
--dojo)
|
||||
shift;
|
||||
DOJO=$YES
|
||||
;;
|
||||
--util)
|
||||
shift;
|
||||
UTIL=$YES
|
||||
;;
|
||||
--all | -a)
|
||||
shift;
|
||||
CHECKOUT=$YES
|
||||
CLONE=$YES
|
||||
PATCHES=$YES
|
||||
LINKS=$YES
|
||||
DOJO=$YES
|
||||
UTIL=$YES
|
||||
ALL=$YES
|
||||
;;
|
||||
--branch)
|
||||
shift;
|
||||
BRANCH=$1
|
||||
shift;
|
||||
;;
|
||||
--dir)
|
||||
shift;
|
||||
DOJO_DIR=$1
|
||||
shift;
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $HELP = $YES ]] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $DOJO_DIR ] ; then
|
||||
mkdir $DOJO_DIR
|
||||
fi
|
||||
|
||||
# clone dojo git repositories
|
||||
pushd $DOJO_DIR
|
||||
|
||||
if [[ $DOJO = $YES ]] ; then
|
||||
if [[ $CLONE = $YES ]] ; then
|
||||
git clone https://github.com/dojo/dojo.git
|
||||
fi
|
||||
pushd dojo
|
||||
if [[ $CHECKOUT = $YES ]] ; then
|
||||
git clean -dfx
|
||||
git checkout master
|
||||
git fetch --tags
|
||||
git fetch
|
||||
git branch -D $BRANCH
|
||||
git checkout $BRANCH
|
||||
fi
|
||||
popd
|
||||
|
||||
if [[ $LINKS = $YES ]] ; then
|
||||
rm -f $DIR/../src/dojo
|
||||
ln -s $DOJO_DIR/dojo $DIR/../src/dojo
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $UTIL = $YES ]] ; then
|
||||
if [[ $CLONE = $YES ]] ; then
|
||||
git clone https://github.com/dojo/util.git
|
||||
fi
|
||||
pushd util
|
||||
if [[ $CHECKOUT = $YES ]] ; then
|
||||
git clean -dfx
|
||||
git checkout master
|
||||
git fetch --tags
|
||||
git fetch
|
||||
git branch -D $BRANCH
|
||||
git checkout $BRANCH
|
||||
fi
|
||||
|
||||
if [[ $PATCHES = $YES ]] ; then
|
||||
# apply util custom patches
|
||||
git am $DIR/build/patches/*.patch
|
||||
fi
|
||||
popd
|
||||
|
||||
if [[ $LINKS = $YES ]] ; then
|
||||
rm -f $DIR/../src/build
|
||||
ln -s $DOJO_DIR/util/build $DIR/../src/build
|
||||
fi
|
||||
fi
|
||||
|
||||
popd # $DOJO_DIR
|
||||
361
install/ui/util/sync.sh
Executable file
361
install/ui/util/sync.sh
Executable file
@@ -0,0 +1,361 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
set -o errexit
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
RDIR=$DIR/../release
|
||||
|
||||
usage() {
|
||||
cat <<-__EOF__;
|
||||
NAME
|
||||
sync.sh - Sync development files with installed FreeIPA
|
||||
|
||||
SYNOPSIS
|
||||
path/to/sync.sh [--help] [--host login@host.name] [--freeipa]
|
||||
|
||||
DESCRIPTION
|
||||
Sync UI development files from 'install' dir to '/usr/share/ipa' dir.
|
||||
|
||||
OPTIONS
|
||||
--help print the help message
|
||||
|
||||
-h
|
||||
--host
|
||||
host login in format login@hostname
|
||||
-f
|
||||
--freeipa
|
||||
files from ui/src/freeipa to ui/js/freeipa
|
||||
--libs
|
||||
files from ui/src/libs to ui/js/libs
|
||||
-d
|
||||
--dojo
|
||||
files from ui/src/dojo to ui/js/dojo
|
||||
--misc
|
||||
files from ui/ non-recursive
|
||||
--images
|
||||
files from ui/images
|
||||
--css
|
||||
files from ui/css
|
||||
--data
|
||||
files from ui/test/data
|
||||
--migration
|
||||
files from migration/
|
||||
--config
|
||||
files from html/
|
||||
--strings
|
||||
ipaserver/plugins/internal.py
|
||||
-C
|
||||
--compiled
|
||||
changes source dir of --freeipa and --dojo to /src/build/freeipa
|
||||
and /src/built/dojo
|
||||
-c
|
||||
--clean
|
||||
removes all files from from target dir
|
||||
-e
|
||||
--existing
|
||||
updates only existing files. Don't transfer new files.
|
||||
-r
|
||||
--restart
|
||||
restart httpd
|
||||
--create-dir
|
||||
create target dir
|
||||
--no-sync
|
||||
don't copy files
|
||||
__EOF__
|
||||
}
|
||||
|
||||
args=`getopt -u -l help,ui,host:,freeipa,libs,dojo,misc,images,css,data,\
|
||||
migration,config,strings,compiled,clean,restart,create-dir,no-sync h:fdcCer $*`
|
||||
|
||||
if test $? != 0
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -- $args
|
||||
for i
|
||||
do
|
||||
case "$i" in
|
||||
--help)
|
||||
shift
|
||||
HELP=1
|
||||
;;
|
||||
--host | -h)
|
||||
shift
|
||||
HOST=$1
|
||||
shift
|
||||
;;
|
||||
--freeipa | -f)
|
||||
shift
|
||||
FREEIPA=1
|
||||
;;
|
||||
--libs)
|
||||
shift
|
||||
LIBS=1
|
||||
;;
|
||||
--dojo)
|
||||
shift
|
||||
DOJO=1
|
||||
;;
|
||||
--misc)
|
||||
shift
|
||||
MISC=1
|
||||
;;
|
||||
--images)
|
||||
shift
|
||||
IMAGES=1
|
||||
;;
|
||||
--css)
|
||||
shift
|
||||
CSS=1
|
||||
;;
|
||||
--data)
|
||||
shift
|
||||
DATA=1
|
||||
;;
|
||||
--migration)
|
||||
shift
|
||||
MIGRATION=1
|
||||
;;
|
||||
--config)
|
||||
shift
|
||||
CONFIG=1
|
||||
;;
|
||||
--strings)
|
||||
shift
|
||||
STRINGS=1
|
||||
;;
|
||||
--compiled | -C)
|
||||
shift
|
||||
COMPILED=1
|
||||
;;
|
||||
--clean | -c)
|
||||
shift
|
||||
CLEAN=1
|
||||
;;
|
||||
--restart | -r)
|
||||
shift
|
||||
RESTART=1
|
||||
;;
|
||||
--existing | -e)
|
||||
shift
|
||||
EXISTING=1
|
||||
;;
|
||||
--create-dir)
|
||||
shift
|
||||
CREATE_DIR=1
|
||||
;;
|
||||
--no-sync)
|
||||
shift
|
||||
NO_SYNC=1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -- $args
|
||||
|
||||
if [[ $HELP ]] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sync-files() {
|
||||
# global vars: (SOURCE, TARGET, HOST, RECURSIVE, EXISTING, CLEAN)
|
||||
# local vars: OPTIONS
|
||||
# TARGET: absolute path or relative to account home
|
||||
# SOURCE: file expression
|
||||
# HOST: in format username@host.name
|
||||
|
||||
|
||||
if [[ $HOST ]] ; then
|
||||
#remote sync
|
||||
|
||||
if [[ $CREATE_DIR ]] ; then
|
||||
echo "$HOST \"mkdir $TARGET\""
|
||||
ssh $HOST "mkdir -p $TARGET"
|
||||
fi
|
||||
|
||||
if [[ $CLEAN = 1 ]] ; then
|
||||
if [[ $RECURSIVE = 1 ]] ; then
|
||||
echo "ssh $HOST \"rm -rf $TARGET/*\""
|
||||
ssh $HOST "rm -rfv $TARGET/*"
|
||||
else
|
||||
echo "ssh $HOST \"rm -fv $TARGET/*\""
|
||||
ssh $HOST "rm -fv $TARGET/*"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! $NO_SYNC ]] ; then
|
||||
# options for rsync
|
||||
# archvive, verbose, compress, update
|
||||
# archive: rlptgoD - recursive, links, permissions, times, groups,
|
||||
# owner, specials
|
||||
|
||||
OPTIONS='-avzu'
|
||||
if [[ $EXISTING = 1 ]] ; then
|
||||
OPTIONS="$OPTIONS --existing"
|
||||
fi
|
||||
if [[ $RECURSIVE = 0 ]] ; then
|
||||
OPTIONS="$OPTIONS --no-r"
|
||||
fi
|
||||
|
||||
echo "rsync $OPTIONS $EXCEPTIONS $SOURCE $HOST:$TARGET/"
|
||||
rsync $OPTIONS $EXCEPTIONS $SOURCE $HOST:$TARGET/
|
||||
fi
|
||||
else
|
||||
#local sync
|
||||
|
||||
if [[ $CLEAN = 1 ]] ; then
|
||||
if [[ $RECURSIVE = 1 ]] ; then
|
||||
rm -rf $TARGET/*
|
||||
else
|
||||
rm -f $TARGET/*
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! $NO_SYNC ]] ; then
|
||||
#--existing is ignored
|
||||
OPTIONS=''
|
||||
if [[ $RECURSIVE = 1 ]] ; then
|
||||
OPTIONS="$OPTIONS -r"
|
||||
fi
|
||||
cp $OPTIONS $SOURCE $TARGET/
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
pushd $DIR/../../ #freeipa/install
|
||||
TARGET_BASE='/usr/share/ipa'
|
||||
LOGIN=$HOST
|
||||
|
||||
if [[ $FREEIPA ]] ; then
|
||||
SOURCE=ui/src/freeipa/*
|
||||
if [[ $COMPILED ]] ; then
|
||||
SOURCE=ui/build/freeipa/*
|
||||
fi
|
||||
TARGET=$TARGET_BASE/ui/js/freeipa
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $LIBS ]] ; then
|
||||
SOURCE=ui/src/libs/*
|
||||
TARGET=$TARGET_BASE/ui/js/libs
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude /Makefile* --exclude .in"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $DOJO ]] ; then
|
||||
SOURCE=ui/src/dojo/*
|
||||
if [[ $COMPILED ]] ; then
|
||||
SOURCE=ui/build/dojo/*
|
||||
fi
|
||||
TARGET=$TARGET_BASE/ui/js/dojo
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude tests --exclude .git"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $MISC ]] ; then
|
||||
SOURCE=ui/*
|
||||
TARGET=$TARGET_BASE/ui
|
||||
RECURSIVE=0
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $IMAGES ]] ; then
|
||||
SOURCE=ui/images/*
|
||||
TARGET=$TARGET_BASE/ui/images
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
|
||||
SOURCE=ui/img/*
|
||||
TARGET=$TARGET_BASE/ui/img
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $CSS ]] ; then
|
||||
SOURCE=ui/*.css
|
||||
TARGET=$TARGET_BASE/ui
|
||||
RECURSIVE=0
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
|
||||
SOURCE=ui/css/*.css
|
||||
TARGET=$TARGET_BASE/ui/css
|
||||
RECURSIVE=0
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $DATA ]] ; then
|
||||
SOURCE=ui/test/data/*
|
||||
TARGET=$TARGET_BASE/ui/test/data
|
||||
RECURSIVE=1
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $MIGRATION ]] ; then
|
||||
SOURCE=migration/*
|
||||
TARGET=$TARGET_BASE/migration
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
fi
|
||||
|
||||
if [[ $CONFIG ]] ; then
|
||||
SOURCE=html/*
|
||||
TARGET=/etc/ipa/html
|
||||
RECURSIVE=1
|
||||
EXCEPTIONS="--exclude /Makefile*"
|
||||
sync-files
|
||||
fi
|
||||
popd
|
||||
|
||||
if [[ $STRINGS ]] ; then
|
||||
SOURCE=ipaserver/plugins/internal.py
|
||||
TARGET=/usr/lib/python2.7/site-packages/ipaserver/plugins
|
||||
RECURSIVE=0
|
||||
CLEAN=0 # don't clean entire folder
|
||||
pushd $DIR/../../../
|
||||
sync-files
|
||||
popd
|
||||
fi
|
||||
|
||||
if [[ $RESTART ]] ; then
|
||||
if [[ ! $HOST ]] ; then
|
||||
echo "Restarting httpd"
|
||||
sudo systemctl restart httpd.service
|
||||
else
|
||||
echo "Restarting httpd: $HOST"
|
||||
ssh $HOST "systemctl restart httpd.service"
|
||||
fi
|
||||
fi
|
||||
1219
install/ui/util/uglifyjs/lib/consolidator.js
Normal file
1219
install/ui/util/uglifyjs/lib/consolidator.js
Normal file
File diff suppressed because it is too large
Load Diff
1369
install/ui/util/uglifyjs/lib/parse-js.js
Normal file
1369
install/ui/util/uglifyjs/lib/parse-js.js
Normal file
File diff suppressed because it is too large
Load Diff
2117
install/ui/util/uglifyjs/lib/process.js
Normal file
2117
install/ui/util/uglifyjs/lib/process.js
Normal file
File diff suppressed because it is too large
Load Diff
78
install/ui/util/uglifyjs/lib/squeeze-more.js
Normal file
78
install/ui/util/uglifyjs/lib/squeeze-more.js
Normal file
@@ -0,0 +1,78 @@
|
||||
var jsp = require("./parse-js"),
|
||||
pro = require("./process"),
|
||||
slice = jsp.slice,
|
||||
member = jsp.member,
|
||||
curry = jsp.curry,
|
||||
MAP = pro.MAP,
|
||||
PRECEDENCE = jsp.PRECEDENCE,
|
||||
OPERATORS = jsp.OPERATORS;
|
||||
|
||||
function ast_squeeze_more(ast) {
|
||||
var w = pro.ast_walker(), walk = w.walk, scope;
|
||||
function with_scope(s, cont) {
|
||||
var save = scope, ret;
|
||||
scope = s;
|
||||
ret = cont();
|
||||
scope = save;
|
||||
return ret;
|
||||
};
|
||||
function _lambda(name, args, body) {
|
||||
return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ];
|
||||
};
|
||||
return w.with_walkers({
|
||||
"toplevel": function(body) {
|
||||
return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ];
|
||||
},
|
||||
"function": _lambda,
|
||||
"defun": _lambda,
|
||||
"new": function(ctor, args) {
|
||||
if (ctor[0] == "name") {
|
||||
if (ctor[1] == "Array" && !scope.has("Array")) {
|
||||
if (args.length != 1) {
|
||||
return [ "array", args ];
|
||||
} else {
|
||||
return walk([ "call", [ "name", "Array" ], args ]);
|
||||
}
|
||||
} else if (ctor[1] == "Object" && !scope.has("Object")) {
|
||||
if (!args.length) {
|
||||
return [ "object", [] ];
|
||||
} else {
|
||||
return walk([ "call", [ "name", "Object" ], args ]);
|
||||
}
|
||||
} else if ((ctor[1] == "RegExp" || ctor[1] == "Function" || ctor[1] == "Error") && !scope.has(ctor[1])) {
|
||||
return walk([ "call", [ "name", ctor[1] ], args]);
|
||||
}
|
||||
}
|
||||
},
|
||||
"call": function(expr, args) {
|
||||
if (expr[0] == "dot" && expr[1][0] == "string" && args.length == 1
|
||||
&& (args[0][1] > 0 && expr[2] == "substring" || expr[2] == "substr")) {
|
||||
return [ "call", [ "dot", expr[1], "slice"], args];
|
||||
}
|
||||
if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) {
|
||||
// foo.toString() ==> foo+""
|
||||
if (expr[1][0] == "string") return expr[1];
|
||||
return [ "binary", "+", expr[1], [ "string", "" ]];
|
||||
}
|
||||
if (expr[0] == "name") {
|
||||
if (expr[1] == "Array" && args.length != 1 && !scope.has("Array")) {
|
||||
return [ "array", args ];
|
||||
}
|
||||
if (expr[1] == "Object" && !args.length && !scope.has("Object")) {
|
||||
return [ "object", [] ];
|
||||
}
|
||||
if (expr[1] == "String" && !scope.has("String")) {
|
||||
return [ "binary", "+", args[0], [ "string", "" ]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}, function() {
|
||||
return walk(pro.ast_add_scope(ast));
|
||||
});
|
||||
};
|
||||
|
||||
exports.ast_squeeze_more = ast_squeeze_more;
|
||||
|
||||
// Local variables:
|
||||
// js-indent-level: 4
|
||||
// End:
|
||||
1
install/ui/util/uglifyjs/ug.js
Normal file
1
install/ui/util/uglifyjs/ug.js
Normal file
@@ -0,0 +1 @@
|
||||
//just empty file to make rhino happy
|
||||
33
install/ui/util/uglifyjs/uglify
Executable file
33
install/ui/util/uglifyjs/uglify
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Wrapper for calling uglify.js under rhino
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# rhino-1.7R4 doesn't have -main option to enable CommonJS support. It was
|
||||
# replaced by -require option.
|
||||
RHINO="java -Xss${JAVA_STACK_SIZE:-512k} -classpath /usr/share/java/js.jar org.mozilla.javascript.tools.shell.Main"
|
||||
if [ `$RHINO --help | grep -e -require | wc -l` -gt 0 ] ; then
|
||||
$RHINO -require $DIR/uglify-js.js $@
|
||||
else
|
||||
$RHINO -main $DIR/uglify-js.js $DIR/ug.js $@
|
||||
fi
|
||||
86
install/ui/util/uglifyjs/uglify-js.js
Normal file
86
install/ui/util/uglifyjs/uglify-js.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// Modified version of the orignal uglify-js.js. Modified to be runnable
|
||||
// under rhino by Petr Vobornik, Red Hat
|
||||
// writeFile(), read() code written by John Resig.
|
||||
|
||||
function uglify(orig_code, options){
|
||||
options || (options = {});
|
||||
var jsp = uglify.parser;
|
||||
var pro = uglify.uglify;
|
||||
|
||||
var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST
|
||||
ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names
|
||||
ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations
|
||||
var final_code = pro.gen_code(ast, options.gen_options); // compressed code here
|
||||
return final_code;
|
||||
};
|
||||
|
||||
uglify.parser = require("./lib/parse-js");
|
||||
uglify.uglify = require("./lib/process");
|
||||
uglify.consolidator = require("./lib/consolidator");
|
||||
|
||||
module.exports = uglify
|
||||
|
||||
|
||||
importPackage(java.io);
|
||||
|
||||
function writeFile( file, stream ) {
|
||||
var buffer = new PrintWriter( new FileWriter( file ) );
|
||||
buffer.print( stream );
|
||||
buffer.close();
|
||||
}
|
||||
|
||||
function read( file ) {
|
||||
var f = new File(file);
|
||||
var reader = new BufferedReader(new FileReader(f));
|
||||
var line = null;
|
||||
var buffer = new java.lang.StringBuffer(f.length());
|
||||
while( (line = reader.readLine()) != null) {
|
||||
buffer.append(line);
|
||||
buffer.append("\n");
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
var options = {
|
||||
ast: false,
|
||||
consolidate: false,
|
||||
mangle: true,
|
||||
mangle_toplevel: false,
|
||||
no_mangle_functions: false,
|
||||
squeeze: true,
|
||||
make_seqs: true,
|
||||
dead_code: true,
|
||||
verbose: false,
|
||||
show_copyright: true,
|
||||
out_same_file: false,
|
||||
max_line_length: 32 * 1024,
|
||||
unsafe: false,
|
||||
reserved_names: null,
|
||||
defines: { },
|
||||
lift_vars: false,
|
||||
codegen_options: {
|
||||
ascii_only: false,
|
||||
beautify: false,
|
||||
indent_level: 4,
|
||||
indent_start: 0,
|
||||
quote_keys: false,
|
||||
space_colon: false,
|
||||
inline_script: false
|
||||
},
|
||||
make: false,
|
||||
output: true // stdout
|
||||
};
|
||||
|
||||
if (arguments.length < 2) {
|
||||
print('Invalid input\nUsage: uglify inputFile outputFile');
|
||||
quit();
|
||||
}
|
||||
|
||||
if (arguments.indexOf('-v')) {
|
||||
print('Uglifying '+arguments[0] +'\nOutput: '+arguments[1]);
|
||||
}
|
||||
|
||||
//read input file
|
||||
var input = read(arguments[0]) + '';
|
||||
var output = uglify(input, options);
|
||||
writeFile(arguments[1], output);
|
||||
Reference in New Issue
Block a user