Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #624 from adobe/master
Browse files Browse the repository at this point in the history
Merge master into release for Brackets 1.11
  • Loading branch information
swmitra authored Sep 19, 2017
2 parents 21e602f + 7173fd2 commit db006c9
Show file tree
Hide file tree
Showing 39 changed files with 918 additions and 249 deletions.
80 changes: 75 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
module.exports = function (grunt) {
var common = require("./tasks/common")(grunt),
platform = common.platform(),
staging;
staging,
cef_version = "3.2623.1397";

if (platform === "mac") {
staging = "installer/mac/staging/<%= build.name %>.app/Contents";
Expand All @@ -36,6 +37,10 @@ module.exports = function (grunt) {
staging = "installer/linux/debian/package-root/opt/brackets";
}

if (platform === "linux") {
cef_version = "3.2704.1414";
}

grunt.initConfig({
"pkg": grunt.file.readJSON("package.json"),
"config-json": staging + "/www/config.json",
Expand All @@ -58,6 +63,14 @@ module.exports = function (grunt) {
"dest" : "<%= downloads %>",
"src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-linux-x64.tar.gz"
},
"icu-linux32": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_linux32_release.zip"
},
"icu-linux64": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_linux64_release.zip"
},
/* mac */
"cef-mac": {
"dest" : "<%= downloads %>",
Expand Down Expand Up @@ -91,6 +104,10 @@ module.exports = function (grunt) {
"icu-win": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_windows32.zip"
},
"vs-crt-win": {
"dest" : "<%= downloads %>",
"src" : "<%= vsCrt.url %>/vs<%= vsCrt.version %>-crt-ia32.zip"
}
},
"clean": {
Expand Down Expand Up @@ -123,6 +140,50 @@ module.exports = function (grunt) {
"icuuc58.dll",
"icuin58.dll",
"icudt58.dll",
"api-ms-win-core-console-l1-1-0.dll",
"api-ms-win-core-handle-l1-1-0.dll",
"api-ms-win-core-processenvironment-l1-1-0.dll",
"api-ms-win-core-synch-l1-2-0.dll",
"api-ms-win-crt-filesystem-l1-1-0.dll",
"api-ms-win-crt-runtime-l1-1-0.dll",
"vccorlib140.dll",
"api-ms-win-core-datetime-l1-1-0.dll",
"api-ms-win-core-heap-l1-1-0.dll",
"api-ms-win-core-processthreads-l1-1-0.dll",
"api-ms-win-core-sysinfo-l1-1-0.dll",
"api-ms-win-crt-heap-l1-1-0.dll",
"api-ms-win-crt-stdio-l1-1-0.dll",
"vcruntime140.dll",
"api-ms-win-core-debug-l1-1-0.dll",
"api-ms-win-core-interlocked-l1-1-0.dll",
"api-ms-win-core-processthreads-l1-1-1.dll",
"api-ms-win-core-timezone-l1-1-0.dll",
"api-ms-win-crt-locale-l1-1-0.dll",
"api-ms-win-crt-string-l1-1-0.dll",
"api-ms-win-core-errorhandling-l1-1-0.dll",
"api-ms-win-core-libraryloader-l1-1-0.dll",
"api-ms-win-core-profile-l1-1-0.dll",
"api-ms-win-core-util-l1-1-0.dll",
"api-ms-win-crt-math-l1-1-0.dll",
"api-ms-win-crt-time-l1-1-0.dll",
"api-ms-win-core-file-l1-1-0.dll",
"api-ms-win-core-localization-l1-2-0.dll",
"api-ms-win-core-rtlsupport-l1-1-0.dll",
"api-ms-win-crt-conio-l1-1-0.dll",
"api-ms-win-crt-multibyte-l1-1-0.dll",
"api-ms-win-crt-utility-l1-1-0.dll",
"api-ms-win-core-file-l1-2-0.dll",
"api-ms-win-core-memory-l1-1-0.dll",
"api-ms-win-core-string-l1-1-0.dll",
"api-ms-win-crt-convert-l1-1-0.dll",
"api-ms-win-crt-private-l1-1-0.dll",
"msvcp140.dll",
"api-ms-win-core-file-l2-1-0.dll",
"api-ms-win-core-namedpipe-l1-1-0.dll",
"api-ms-win-core-synch-l1-1-0.dll",
"api-ms-win-crt-environment-l1-1-0.dll",
"api-ms-win-crt-process-l1-1-0.dll",
"ucrtbase.dll",
"natives_blob.bin",
"snapshot_blob.bin",
"command/**"
Expand Down Expand Up @@ -171,7 +232,12 @@ module.exports = function (grunt) {
"cef_100_percent.pak",
"cef_200_percent.pak",
"devtools_resources.pak",
"cef_extensions.pak",
"icudtl.dat",
"libcef.so",
"natives_blob.bin",
"snapshot_blob.bin",
"chrome-sandbox",
],
"dest" : "<%= build.staging %>"
},
Expand Down Expand Up @@ -245,15 +311,19 @@ module.exports = function (grunt) {
},
"cef": {
"url" : "http://s3.amazonaws.com/files.brackets.io/cef",
"version" : "3.2623.1397"
"version" : cef_version
},
"node": {
"version" : "6.3.1"
"version" : "6.11.0"
},
"icu": {
"url" : "http://s3.amazonaws.com/files.brackets.io/icu",
"version" : "58"
}
},
"vsCrt": {
"url" : "http://s3.amazonaws.com/files.brackets.io/vs-crt",
"version" : "2015"
},
});

grunt.loadTasks("tasks");
Expand All @@ -263,4 +333,4 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-curl");

grunt.registerTask("default", ["setup", "build"]);
};
};
60 changes: 58 additions & 2 deletions appshell.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,57 @@
# Copy ICU dlls
'destination': '<(PRODUCT_DIR)',
'files': ['deps/icu/bin/icuuc58.dll', 'deps/icu/bin/icuin58.dll', 'deps/icu/bin/icudt58.dll'],
}
},
{
# Copy VS2015 CRT dlls
'destination': '<(PRODUCT_DIR)',
'files': [
'deps/vs-crt/api-ms-win-core-console-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-handle-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-processenvironment-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-synch-l1-2-0.dll',
'deps/vs-crt/api-ms-win-crt-filesystem-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-runtime-l1-1-0.dll',
'deps/vs-crt/vccorlib140.dll',
'deps/vs-crt/api-ms-win-core-datetime-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-heap-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-processthreads-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-sysinfo-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-heap-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-stdio-l1-1-0.dll',
'deps/vs-crt/vcruntime140.dll',
'deps/vs-crt/api-ms-win-core-debug-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-interlocked-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-processthreads-l1-1-1.dll',
'deps/vs-crt/api-ms-win-core-timezone-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-locale-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-string-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-errorhandling-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-libraryloader-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-profile-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-util-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-math-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-time-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-file-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-localization-l1-2-0.dll',
'deps/vs-crt/api-ms-win-core-rtlsupport-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-conio-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-multibyte-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-utility-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-file-l1-2-0.dll',
'deps/vs-crt/api-ms-win-core-memory-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-string-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-convert-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-private-l1-1-0.dll',
'deps/vs-crt/msvcp140.dll',
'deps/vs-crt/api-ms-win-core-file-l2-1-0.dll',
'deps/vs-crt/api-ms-win-core-namedpipe-l1-1-0.dll',
'deps/vs-crt/api-ms-win-core-synch-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-environment-l1-1-0.dll',
'deps/vs-crt/api-ms-win-crt-process-l1-1-0.dll',
'deps/vs-crt/ucrtbase.dll',
],
},
],
}],
[ 'OS=="win" and multi_threaded_dll', {
Expand Down Expand Up @@ -366,13 +416,19 @@
],
'link_settings': {
'ldflags': [
'-pthread',
'-Wl,-rpath,\$$ORIGIN/',
'<(march)'
],
'libraries': [
"$(BUILDTYPE)/libcef.so",
"-lX11",
'appshell_extensions_js.o',
'deps/icu/lib/libicuuc.a',
'deps/icu/lib/libicuio.a',
'deps/icu/lib/libicui18n.a',
'deps/icu/lib/libicudata.a',
'-ldl',
],
},
'sources': [
Expand Down Expand Up @@ -572,4 +628,4 @@
},
}],
],
}
}
77 changes: 70 additions & 7 deletions appshell/appshell_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#include "appshell_node_process.h"
#include "config.h"

#ifdef OS_LINUX
#include "appshell/browser/main_context.h"
#include "appshell/browser/root_window_manager.h"
#endif

#include <algorithm>

extern std::vector<CefString> gDroppedFiles;
Expand Down Expand Up @@ -394,10 +399,15 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
CefWindowInfo wi;
CefBrowserSettings settings;

#if defined(OS_WIN)
wi.SetAsPopup(NULL, "DevTools");
#endif
browser->GetHost()->ShowDevTools(wi, browser->GetHost()->GetClient(), settings, CefPoint());
#if defined(OS_WIN)
wi.SetAsPopup(NULL, "DevTools");
#elif defined(OS_LINUX)
handler->ShowDevTools(browser, CefPoint());
#endif

#ifndef OS_LINUX
browser->GetHost()->ShowDevTools(wi, browser->GetHost()->GetClient(), settings, CefPoint());
#endif

} else if (message_name == "GetNodeState") {
// Parameters:
Expand All @@ -423,7 +433,15 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {

// The DispatchCloseToNextBrowser() call initiates a quit sequence. The app will
// quit if all browser windows are closed.
handler->DispatchCloseToNextBrowser();
#ifdef OS_LINUX
if(client::MainContext::Get() &&
client::MainContext::Get()->GetRootWindowManager()){
client::MainContext::Get()->GetRootWindowManager()->DispatchCloseToNextWindow();
}
#else
handler->DispatchCloseToNextBrowser();
#endif


} else if (message_name == "AbortQuit") {
// Parameters - none
Expand Down Expand Up @@ -765,8 +783,53 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
// 0: int32 - callback id

responseArgs->SetString(2, GetSystemUniqueID());
}
else {
}
else if (message_name == "ReadDirWithStats") {
// Parameters:
// 0: int32 - callback id

CefRefPtr<CefListValue> uberDict = CefListValue::Create();
CefRefPtr<CefListValue> dirContents = CefListValue::Create();
CefRefPtr<CefListValue> allStats = CefListValue::Create();

ExtensionString path = argList->GetString(1);
ReadDir(path, dirContents);

// Now we iterator through the contents of directoryContents.
size_t theSize = dirContents->GetSize();
for ( size_t iFileEntry = 0; iFileEntry < theSize ; ++iFileEntry) {
CefRefPtr<CefListValue> fileStats = CefListValue::Create();

#ifdef OS_WIN
ExtensionString theFile = path + L"/";
#else
ExtensionString theFile = path + "/";
#endif

ExtensionString fileName = dirContents->GetString(iFileEntry);
theFile = theFile + fileName;

ExtensionString realPath;
uint32 modtime;
double size;
bool isDir;
GetFileInfo(theFile, modtime, isDir, size, realPath);

fileStats->SetInt(0, modtime);
fileStats->SetBool(1, isDir);
fileStats->SetInt(2, size);
fileStats->SetString(3, realPath);

allStats->SetList(iFileEntry, fileStats);

}

uberDict->SetList(0, dirContents);
uberDict->SetList(1, allStats);
responseArgs->SetList(2, uberDict);
}

else {
fprintf(stderr, "Native function not implemented yet: %s\n", message_name.c_str());
return false;
}
Expand Down
46 changes: 44 additions & 2 deletions appshell/appshell_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,50 @@ if (!appshell.app) {
}, path);
};



/**
* Reads the contents of a directory and reports contents along with stats.
*
* @param {string} path The path of the directory to read.
* @param {function(err, files)} callback Asynchronous callback function. The callback gets three arguments
* (err, files, stats) where files is an array of the names of the files
* in the directory excluding '.' and '..' and stats is an array of all stats of the files.
* Possible error values:
* NO_ERROR
* ERR_UNKNOWN
* ERR_INVALID_PARAMS
* ERR_NOT_FOUND
* ERR_CANT_READ
*
* @return None. This is an asynchronous call that sends all return information to the callback.
*/
// Test dictionary
native function ReadDirWithStats();
appshell.fs.readDirWithStats = function (path, callback){

ReadDirWithStats(function (err, allPaths){
if (callback) {
var finalArray = [];
var allContents = allPaths[0];
var allStats = allPaths[1];

allStats.forEach(function (val, idx) {
finalArray[idx] = {
isFile: function () {
return !val[1];
},
isDirectory: function () {
return val[1];
},
mtime: new Date(val[0] * 1000), // modtime is seconds since 1970, convert to ms
size: new Number(val[2]),
realPath: val[3] ? val[3] : null
}
});
callback(err, allContents, finalArray);
}
}, path);
};

/**
* Quits native shell application
*/
Expand Down
Loading

0 comments on commit db006c9

Please sign in to comment.