freeipa/install/ui/util/build/patches/01-Make-dojo-builder-buildable-by-itself.patch
Petr Vobornik df95ba5983 WebUI build: use NodeJS instead of Rhino
Rhino is no longer mainstream, nor is Nashorn. In addition it is quite
slow (about 10x) in comparison to NodeJS. Over the years NodeJS became
common part of OSes, thus one of the original reasons why use Rhino
went away.

The change in 01-Make-dojo-builder-buildable-by-itself.patch fixes
an incorrect change of the patch (it was not processing input options
well).

Removing configRhino.js and adding configNode.js are prerequisites
for Dojo Builder. These files are copied from Dojo project. Without
them it doesn̈́'t run. In long run, it would be good to replace Dojo
builder with something else but that is outside of this commit/PR.

Last changes are preparation for update to latest stable version of
Dojo 1. The updated Dojo and Dojo builder are in subsequent commit.

Reviewed-By: Armando Neto <abiagion@redhat.com>
2018-07-12 15:38:01 +02:00

170 lines
4.9 KiB
Diff

From be32e8039fca859a8fc9202c50dcd8663023dd53 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvoborni@redhat.com>
Date: Thu, 8 Nov 2012 13:22:30 +0100
Subject: [PATCH 1/2] 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 c6589afb..98d95bf8 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 00000000..507728c2
--- /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 00000000..41df62e3
--- /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 131ed644..c0eb36e9 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.apply(commandLineArgs, 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 00000000..576030f2
--- /dev/null
+++ b/build/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "build",
+ "version":"1.13.0",
+ "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"
+}
--
2.14.3