You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bi...@apache.org on 2016/03/13 09:45:23 UTC
[08/16] git commit: [flex-utilities] [refs/heads/develop] - All
dependencies are getting downloaded now, at least on Windows.
All dependencies are getting downloaded now, at least on Windows.
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/5dcd4c8c
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/5dcd4c8c
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/5dcd4c8c
Branch: refs/heads/develop
Commit: 5dcd4c8c6e0a314b6127cd04515c8946e2f80ad2
Parents: 9a6f4ac
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Sun Dec 27 01:34:31 2015 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Sun Mar 13 00:44:13 2016 -0800
----------------------------------------------------------------------
npm-flexjs/dependencies/ApacheFalcon.js | 167 ++++++++++++++-----
.../dependencies/DownloadUncompressAndCopy.js | 36 ++--
npm-flexjs/package.json | 2 +
3 files changed, 136 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/5dcd4c8c/npm-flexjs/dependencies/ApacheFalcon.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/ApacheFalcon.js b/npm-flexjs/dependencies/ApacheFalcon.js
index 60091ba..5a7f873 100644
--- a/npm-flexjs/dependencies/ApacheFalcon.js
+++ b/npm-flexjs/dependencies/ApacheFalcon.js
@@ -34,6 +34,8 @@ var ApacheFalcon = module.exports = Object.create(events.EventEmitter.prototype)
var pathToFalconBinary = 'flex/falcon/0.5.0/binaries/';
var fileNameFalconBinary = 'apache-flex-falconjx-0.5.0-bin.zip';
var falconCompilerLibFolder = 'falcon/compiler/lib/';
+var jsLibFolder = constants.FLEXJS_FOLDER + 'js/lib/';
+var googleClosureCompilerFolder = constants.FLEXJS_FOLDER + 'js/lib/google/closure-compiler/';
//Antlr
var antlrURL = 'http://search.maven.org/remotecontent?filepath=org/antlr/antlr-complete/3.5.2/antlr-complete-3.5.2.jar';
@@ -107,6 +109,52 @@ var falconDependencies = [
destinationPath:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder,
destinationFileName:'flex-tool-api.jar',
unzip:false
+ },
+ {
+ url:'http://search.maven.org/remotecontent?filepath=/args4j/args4j/2.0.28/',
+ remoteFileName:'args4j-2.0.28.jar',
+ destinationPath:jsLibFolder,
+ destinationFileName:'args4j.jar',
+ unzip:false
+ },
+ {
+ url:'http://dl.google.com/closure-compiler/',
+ remoteFileName:'compiler-20150609.zip',
+ destinationPath:constants.DOWNLOADS_FOLDER,
+ destinationFileName:'compiler-20150609.zip',
+ pathOfFileToBeCopiedFrom:'compiler.jar',
+ pathOfFileToBeCopiedTo:googleClosureCompilerFolder + 'compiler.jar',
+ unzip:true
+ },
+ {
+ url:'http://archive.apache.org/dist/commons/io/binaries/',
+ remoteFileName:'commons-io-2.4-bin.zip',
+ destinationPath:constants.DOWNLOADS_FOLDER,
+ destinationFileName:'commons-io-2.4-bin.zip',
+ pathOfFileToBeCopiedFrom:'commons-io-2.4/commons-io-2.4.jar',
+ pathOfFileToBeCopiedTo:jsLibFolder + 'commons-io.jar',
+ unzip:true
+ },
+ {
+ url:'http://search.maven.org/remotecontent?filepath=/com/google/guava/guava/17.0/',
+ remoteFileName:'guava-17.0.jar',
+ destinationPath:jsLibFolder,
+ destinationFileName:'guava.jar',
+ unzip:false
+ },
+ {
+ url:'http://search.maven.org/remotecontent?filepath=/org/codeartisans/org.json/20131017/',
+ remoteFileName:'org.json-20131017.jar',
+ destinationPath:jsLibFolder,
+ destinationFileName:'org.json.jar',
+ unzip:false
+ },
+ {
+ url:'http://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool-api/1.0.0/',
+ remoteFileName:'flex-tool-api-1.0.0.jar',
+ destinationPath:jsLibFolder,
+ destinationFileName:'flex-tool-api.jar',
+ unzip:false
}
];
@@ -151,6 +199,61 @@ ApacheFalcon.prepareForFalconDependencies = function()
{
if ( e.code != 'EEXIST' ) throw e;
}
+ try
+ {
+ fs.mkdirSync(googleClosureCompilerFolder);
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+
+ try
+ {
+ mkdirp(constants.FLEXJS_FOLDER + 'js/bin');
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+
+ try
+ {
+ mkdirp(constants.FLEXJS_FOLDER + 'js/lib');
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+
+ try
+ {
+ mkdirp(constants.FLEXJS_FOLDER + 'js/libs');
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+
+ try
+ {
+ mkdirp(constants.FLEXJS_FOLDER + 'externs');
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+
+ //Create downloads directory if it does not exist already
+ try
+ {
+ mkdirp(constants.FLEXJS_FOLDER + 'bin');
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+
ApacheFalcon.downloadDependencies();
};
@@ -171,7 +274,7 @@ ApacheFalcon.downloadNextDependency = function()
}
else
{
- duc.on("installComplete", handleDependencyInstallComplete);
+ duc.once("installComplete", handleDependencyInstallComplete);
duc.install(falconDependencies[currentStep]);
}
};
@@ -183,61 +286,37 @@ function handleDependencyInstallComplete(event)
ApacheFalcon.dependenciesComplete = function()
{
- duc.removeListener("installComplete", handleDependencyInstallComplete);
- copyFiles();
+ ApacheFalcon.copyFiles();
ApacheFalcon.falconInstallComplete();
};
-function copyFiles()
+ApacheFalcon.copyFiles = function()
{
- //Ant TODO:FIXME
+ var mergedirs = require('merge-dirs');
//Bin
- //Create downloads directory if it does not exist already
- try
- {
- mkdirp(constants.FLEXJS_FOLDER + 'bin');
- }
- catch(e)
- {
- if ( e.code != 'EEXIST' ) throw e;
- }
- wrench.copyDirSyncRecursive(constants.DOWNLOADS_FOLDER + 'falcon/compiler/generated/dist/sdk/bin',
- constants.FLEXJS_FOLDER + 'bin', {
- forceDelete: true
- });
-
- //Bin-legacy TODO:FIXME
+ mergedirs.default(constants.DOWNLOADS_FOLDER + 'falcon/compiler/generated/dist/sdk/bin',
+ constants.FLEXJS_FOLDER + 'bin',
+ 'overwrite');
//copyfiles.jx copy FalconJX files into SDK
- try
- {
- mkdirp(constants.FLEXJS_FOLDER + 'js/bin');
- mkdirp(constants.FLEXJS_FOLDER + 'js/lib');
- mkdirp(constants.FLEXJS_FOLDER + 'js/libs');
- mkdirp(constants.FLEXJS_FOLDER + 'externs');
- }
- catch(e)
- {
- if ( e.code != 'EEXIST' ) throw e;
- }
+ mergedirs.default(constants.DOWNLOADS_FOLDER + 'falcon/js/lib',
+ constants.FLEXJS_FOLDER + 'js/lib',
+ 'overwrite');
+ mergedirs.default(constants.DOWNLOADS_FOLDER + 'falcon/js/libs',
+ constants.FLEXJS_FOLDER + 'js/libs',
+ 'overwrite');
- wrench.copyDirSyncRecursive(constants.DOWNLOADS_FOLDER + 'falcon/js/lib',
- constants.FLEXJS_FOLDER + 'js/lib', {
- forceDelete: true
- });
+ mergedirs.default(constants.DOWNLOADS_FOLDER + 'falcon/externs',
+ constants.FLEXJS_FOLDER + 'externs',
+ 'overwrite');
- wrench.copyDirSyncRecursive(constants.DOWNLOADS_FOLDER + 'falcon/js/libs',
- constants.FLEXJS_FOLDER + 'js/libs', {
- forceDelete: true
- });
+// Bin-legacy TODO:FIXME
- wrench.copyDirSyncRecursive(constants.DOWNLOADS_FOLDER + 'falcon/externs',
- constants.FLEXJS_FOLDER + 'externs', {
- forceDelete: true
- });
+// Ant TODO:FIXME
+
+};
-}
ApacheFalcon.falconInstallComplete = function()
{
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/5dcd4c8c/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/DownloadUncompressAndCopy.js b/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
index d15e18f..2546359 100644
--- a/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
+++ b/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
@@ -19,9 +19,8 @@
var request = require('request');
-var fs = require('fs');
+var fs = require('fs-extra');
var events = require('events');
-var prompt = require('prompt');
var unzip = require('unzip');
var constants = require('../dependencies/Constants');
@@ -33,28 +32,12 @@ DownloadUncompressAndCopy.downloadFile = function(item)
request
.get(item.url + item.remoteFileName)
.pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
- .on('finish', function(){
+ .on('close', function(){
console.log('Finished downloading: ' + item.url + item.remoteFileName);
if(item.unzip)
{//Unzip
console.log('Uncompressing: ' + constants.DOWNLOADS_FOLDER + item.remoteFileName);
fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
- /*.pipe(unzip.Extract({ path: item.destinationPath + item.destinationFileName})
- .on('finish', function(){
- console.log('Finished uncompressing: ' + constants.DOWNLOADS_FOLDER + item.remoteFileName + ' to: ' + item.destinationPath + item.destinationFileName);
- if(item.pathOfFileToBeCopiedTo != undefined)
- {
- fs.createReadStream(item.pathOfFileToBeCopiedFrom)
- .pipe(fs.createWriteStream(item.pathOfFileToBeCopiedTo)
- .on('finish',function(){
- DownloadUncompressAndCopy.emit('installComplete');
- }));
- }
- else
- {
- DownloadUncompressAndCopy.emit('installComplete');
- }
- })*/
.pipe(unzip.Parse())
.on('entry', function (entry) {
var fileName = entry.path;
@@ -74,16 +57,19 @@ DownloadUncompressAndCopy.downloadFile = function(item)
}
else
{//Just copy
- if((constants.DOWNLOADS_FOLDER + item.remoteFileName == item.destinationPath + item.destinationFileName))
+ if((constants.DOWNLOADS_FOLDER + item.remoteFileName === item.destinationPath + item.destinationFileName))
{
DownloadUncompressAndCopy.emit('installComplete');
}
- else {
+ else
+ {
fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
- .pipe(fs.createWriteStream(item.destinationPath + item.destinationFileName)
- .on('finish',function() {
- DownloadUncompressAndCopy.emit('installComplete');
- }));
+ .pipe(fs.createWriteStream(item.destinationPath + item.destinationFileName))
+ .on('close', function(){
+ console.log("Copied " + constants.DOWNLOADS_FOLDER + item.remoteFileName + " to " +
+ item.destinationPath + item.destinationFileName);
+ DownloadUncompressAndCopy.emit('installComplete');
+ });
}
}
})
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/5dcd4c8c/npm-flexjs/package.json
----------------------------------------------------------------------
diff --git a/npm-flexjs/package.json b/npm-flexjs/package.json
index fa3a420..149eb7e 100644
--- a/npm-flexjs/package.json
+++ b/npm-flexjs/package.json
@@ -20,6 +20,8 @@
"author": "OmPrakash Muppirala <bi...@apache.org>",
"license": "Apache-2.0",
"dependencies": {
+ "fs-extra": "^0.26.3",
+ "merge-dirs": "^0.2.1",
"mkdirp": "^0.5.1",
"prompt": "^0.2.14",
"request": "^2.67.0",