mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
Dojo Builder
Added support for Dojo builder. * Includes built builder and patches required to build the builder. * _base/configRhino.js is required by the builder to run under rhino. * added utility scripts for running the builder * build.sh * clean.sh * compile.sh * make-builder.sh * prepare-dojo.sh https://fedorahosted.org/freeipa/ticket/112
This commit is contained in:
parent
8c59ddbcbe
commit
9d3364719d
3
.gitignore
vendored
3
.gitignore
vendored
@ -49,6 +49,9 @@ install/stamp-h1
|
||||
install/po/test.po
|
||||
install/po/test_locale/xh_ZA/LC_MESSAGES/ipa.mo
|
||||
install/ui/test/results
|
||||
install/ui/release
|
||||
install/ui/src/dojo
|
||||
install/ui/src/build
|
||||
ipa-client/COPYING
|
||||
ipa-client/ChangeLog
|
||||
ipa-client/INSTALL
|
||||
|
@ -34,6 +34,11 @@ UglifyJS - licensed under BSD license
|
||||
* util/uglifyjs/uglify-js.js
|
||||
* utli/uglifyjs/lib/*
|
||||
|
||||
Dojo, Dojo Builder - dual licensed under BSD license and AFL version 2.1
|
||||
* full license text in util/build/LICENSE
|
||||
* util/build/build.js
|
||||
* util/build/_base/*.js
|
||||
|
||||
Full license texts and copyright notices are listed below.
|
||||
|
||||
= jQuery copyright notice with MIT license =
|
||||
|
108
install/ui/src/build.profile.js
Normal file
108
install/ui/src/build.profile.js
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// BUILDER profile
|
||||
//
|
||||
|
||||
var profile = (function(){
|
||||
return {
|
||||
basePath: ".",
|
||||
releaseDir: "../release",
|
||||
releaseName: "build",
|
||||
action: "release",
|
||||
|
||||
layerOptimize: "comments",
|
||||
optimize: "comments",
|
||||
cssOptimize: "comments",
|
||||
mini: true,
|
||||
stripConsole: "warn",
|
||||
selectorEngine: "lite",
|
||||
|
||||
staticHasFeatures: {
|
||||
"host-rhino":1,
|
||||
"host-browser":0,
|
||||
"host-node":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":0,
|
||||
"dojo-dom-ready-api":0,
|
||||
"dojo-dom-ready-plugin":0,
|
||||
"dojo-ready-api":1,
|
||||
"dojo-error-api":1,
|
||||
"dojo-publish-privates":1,
|
||||
"dojo-gettext-api":1,
|
||||
"dojo-sniff":0,
|
||||
"dojo-loader":1,
|
||||
"dojo-test-xd":0,
|
||||
"dojo-test-sniff":0
|
||||
},
|
||||
|
||||
packages:[{
|
||||
name: "dojo",
|
||||
location: "dojo"
|
||||
},{
|
||||
name: "build",
|
||||
location: "build"
|
||||
}],
|
||||
|
||||
layers: {
|
||||
"build/build": {
|
||||
include: [
|
||||
'dojo/dojo',
|
||||
'build/buildControlBase',
|
||||
'build/argv',
|
||||
'build/build.profile',
|
||||
'build/discover',
|
||||
'build/messages',
|
||||
'build/removeComments',
|
||||
'build/fs',
|
||||
'build/main',
|
||||
'build/fileUtils',
|
||||
'build/process',
|
||||
'build/v1xProfiles',
|
||||
'build/replace',
|
||||
'build/fileHandleThrottle',
|
||||
'build/buildControl',
|
||||
'build/commandLineArgs',
|
||||
'build/stringify',
|
||||
'build/buildControlDefault',
|
||||
'build/version',
|
||||
'build/plugins/querySelector',
|
||||
'build/plugins/domReady',
|
||||
'build/plugins/has',
|
||||
'build/plugins/text',
|
||||
'build/plugins/loadInit',
|
||||
'build/plugins/require',
|
||||
'build/plugins/i18n',
|
||||
'build/transforms/depsDump',
|
||||
'build/transforms/copy',
|
||||
'build/transforms/trace',
|
||||
'build/transforms/read',
|
||||
'build/transforms/writeAmd',
|
||||
'build/transforms/dojoPragmas',
|
||||
'build/transforms/report',
|
||||
'build/transforms/hasFindAll',
|
||||
'build/transforms/hasFixup',
|
||||
'build/transforms/writeDojo',
|
||||
'build/transforms/depsScan',
|
||||
'build/transforms/write',
|
||||
'build/transforms/dojoReport',
|
||||
'build/transforms/writeOptimized',
|
||||
'build/transforms/insertSymbols',
|
||||
'build/transforms/hasReport',
|
||||
'build/transforms/writeCss',
|
||||
'build/transforms/depsDeclarative',
|
||||
'build/transforms/optimizeCss',
|
||||
'build/node/fs',
|
||||
'build/node/process',
|
||||
'build/rhino/fs',
|
||||
'build/rhino/process'
|
||||
],
|
||||
customBase: true,
|
||||
boot: true
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
35
install/ui/util/build.sh
Executable file
35
install/ui/util/build.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/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
|
||||
|
||||
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 $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
|
||||
|
26
install/ui/util/clean.sh
Executable file
26
install/ui/util/clean.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/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/>.
|
||||
|
||||
# Clean after build
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
rm -rf $DIR/../release
|
120
install/ui/util/compile.sh
Executable file
120
install/ui/util/compile.sh
Executable file
@ -0,0 +1,120 @@
|
||||
#!/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/>.
|
||||
|
||||
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
|
||||
|
||||
# clean all other files
|
||||
BUILD_DIR=$RDIR/$RELEASE/`echo $LAYER | cut -d/ -f 1`
|
||||
LAYER_FILE=`echo $LAYER | cut -d/ -f 2`.js
|
||||
rm -f $RDIR/$RELEASE/build-report.txt
|
||||
pushd $BUILD_DIR
|
||||
if [[ $? != 0 ]] ; then
|
||||
echo "Invalid build dir: $BUILD_DIR"
|
||||
exit 1
|
||||
fi
|
||||
ls -1 | grep -v -e "^$LAYER_FILE$" | xargs rm -rf
|
||||
popd
|
50
install/ui/util/make-builder.sh
Executable file
50
install/ui/util/make-builder.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/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 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
|
204
install/ui/util/prepare-dojo.sh
Executable file
204
install/ui/util/prepare-dojo.sh
Executable file
@ -0,0 +1,204 @@
|
||||
#!/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/>.
|
||||
|
||||
#
|
||||
# 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 pull
|
||||
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 pull
|
||||
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
|
Loading…
Reference in New Issue
Block a user