Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #569: Merge Bramble with upstream Adobe Brackets (1.9 dev) #588

Merged
merged 16 commits into from
Feb 16, 2017

Conversation

humphd
Copy link

@humphd humphd commented Feb 13, 2017

mozilla/brackets: 3754f1a (Wed Feb 8, 2017)
adobe/brackets: e9399ba (Sun Jan 29, 2017)

This is almost done. I've fixed all the merge conflicts, and am starting on fixing regressions. Once I'm done we'll need to test it for a while, since I have no idea how badly this will break things.

mozilla/brackets: 3754f1a (Wed Feb 8, 2017)
adobe/brackets: e9399ba (Sun Jan 29, 2017)

Common ancestor is c14890d (Tue May 26, 2015)
@humphd humphd force-pushed the merge-master-brackets1.9 branch from 2469504 to 851a257 Compare February 13, 2017 16:32
@humphd
Copy link
Author

humphd commented Feb 13, 2017

Out of interest, some stats:

  • We split-off from Adobe in May 2015 at c14890d (21 months ago)
  • Since then, Adobe's repo has had 1063 commits
  • Since then, Mozilla's repo has had 485 commits
  • 1,548 commits total between us

It took me about 8 hours to deal with the conflicts between the two branches, which total +45,846 −27,697 = 18,149 LOC.

@humphd
Copy link
Author

humphd commented Feb 13, 2017

This seems to run now, and I've fixed all the new eslint issues. I've also merged in the latest stuff on master that landed after I started my big merge. The only conflict I had there was the new allowJavaScript pref stuff, which I think I fixed OK.

This needs a ton of testing before we land.

@humphd
Copy link
Author

humphd commented Feb 13, 2017

cc @Pomax, @flukeout

@humphd
Copy link
Author

humphd commented Feb 13, 2017

One thing I see on console is about a conflict in the keybindings:

Cannot assign Alt-W to cmd.switchPaneFocus. It is already assigned to file.close
_addBinding @ KeyBindingManager.js:747
addBinding @ KeyBindingManager.js:883
_initialize @ MainViewManager.js:1643
(anonymous) @ MainViewManager.js:1692
_callHandler @ AppInit.js:89
_dispatchReady @ AppInit.js:109
(anonymous) @ brackets.js:325
j @ jquery-2.1.3.min.js:2
fireWith @ jquery-2.1.3.min.js:2
e.(anonymous function) @ jquery-2.1.3.min.js:2
(anonymous) @ PreferencesBase.js:322
(anonymous) @ jquery-2.1.3.min.js:2
j @ jquery-2.1.3.min.js:2
fireWith @ jquery-2.1.3.min.js:2
e.(anonymous function) @ jquery-2.1.3.min.js:2
(anonymous) @ PreferencesBase.js:192
(anonymous) @ File.js:110
(anonymous) @ FilerFileSystem.js:235
(anonymous) @ BracketsFiler.js:118
remoteFSCallbackHandler @ RemoteFiler.js:27

@humphd
Copy link
Author

humphd commented Feb 13, 2017

@gideonthomas actually, I need some advice on fixing something. They have a new string that is messing up the localization scripts:

https://github.com/adobe/brackets/blob/master/src/nls/root/strings.js#L788

Is it because of the \n?

Tracing dependencies for: main

Error: Parse error using esprima for file: /home/travis/build/mozilla/brackets/src/nls/root/strings.js

Error: Line 670: Unexpected token ILLEGAL

In module tree:

    brackets

      language/LanguageManager

        file/FileUtils

          strings

            i18n

{ Error: Error: Parse error using esprima for file: /home/travis/build/mozilla/brackets/src/nls/root/strings.js

Error: Line 670: Unexpected token ILLEGAL

In module tree:

    brackets

      language/LanguageManager

        file/FileUtils

          strings

            i18n

    at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:29530:47

    at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:30099:19

    at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3081:39

    at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3021:25

    at Function.prim.nextTick (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:29929:9)

    at Object.errback (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3020:26)

    at Object.callback (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3006:23)

    at Object.then (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3060:23)

    at build (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:30056:12)

    at runBuild (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:32006:17)

    at Object.execCb (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:1941:33)

  originalError: 

   { Error: Parse error using esprima for file: /home/travis/build/mozilla/brackets/src/nls/root/strings.js

   Error: Line 670: Unexpected token ILLEGAL

       at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:29530:47

       at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3063:37

       at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3011:25

       at Function.prim.nextTick (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:29929:9)

       at Object.callback (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3010:26)

       at Object.then (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3060:23)

       at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:29506:69

       at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3063:37

       at /home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:3011:25

       at Function.prim.nextTick (/home/travis/build/mozilla/brackets/node_modules/requirejs/bin/r.js:29929:9)

     fileName: '/home/travis/build/mozilla/brackets/src/nls/root/strings.js',

     moduleTree: 

      [ 'i18n',

        'strings',

        'file/FileUtils',

        'language/LanguageManager',

        'brackets' ] } }

The command "grunt build-browser-compressed" exited with 1.

@humphd
Copy link
Author

humphd commented Feb 13, 2017

@gideonthomas nvm, I figured it out and fixed locally.

@humphd
Copy link
Author

humphd commented Feb 13, 2017

This is getting closer and closer. Some notes:

  • I've fixed https://github.com/mozilla/thimble.mozilla.org/issues/1670 which was causing eslint failures in the new build setup
  • I've dealt with a few Gruntfile issues, and the build works now
  • We seem to copy a lot of node_modules/* over, which doesn't seem necessary. However, avoiding all node_module/* copying into dist/ will be bad, since they use some code this way vs. submodules as before. We should untangle this and make it a bit cleaner
  • I think we can probably update to latest grunt-contrib-compress, but I'm not sure if that s3 bug is gone

I'd love to finish this and land things this week, so if you can help me @gideonthomas, it would be great!

@gideonthomas
Copy link

gideonthomas commented Feb 14, 2017

I see three errors in the console:
screen shot 2017-02-14 at 10 35 05 am

EDIT: I feel like the first error is the real problem and it's causing the other two.

@humphd
Copy link
Author

humphd commented Feb 14, 2017

@gideonthomas I'll dig into those errors. Did you look at the copy stuff and node_modules?

@humphd
Copy link
Author

humphd commented Feb 14, 2017

To be honest, I'm not even clear why they install all these node_modules into dist/ at all. There seems to be very few places that actually uses any of it:

https://github.com/adobe/brackets/search?utf8=%E2%9C%93&q=node_modules

I wonder if we can just skip it?

@humphd
Copy link
Author

humphd commented Feb 14, 2017

@gideonthomas that error is due to the change here: https://github.com/mozilla/brackets/pull/584/files#diff-cedef1a0021f9b0a7a54ca7d3c53caa9 which references a string and command that weren't added, which causes this to fail: https://github.com/mozilla/brackets/pull/584/files#diff-cedef1a0021f9b0a7a54ca7d3c53caa9R104. cc @peiying16.

I've pushed a patch that fixes it. When we aren't adding commands that need UI, we should prefer registerInternal() to register(), which differ only by the need for a UI string.

I've also fixed the same error in the bramble-move-file extension.

@gideonthomas
Copy link

Ah, nice catch @humphd! Yeah I'm looking through the copy stuff right now (it's hard to find where some of these are being used).

@gideonthomas
Copy link

I'm not sure I understand why Move File isn't working though...it has the string defined here: https://github.com/mozilla/brackets/blob/master/locales/en-US/editor.properties#L184

@humphd
Copy link
Author

humphd commented Feb 14, 2017

These commits might point at things:

@humphd
Copy link
Author

humphd commented Feb 14, 2017

Probably it's a src/ vs. dist/ thing, where you have to run your localization scripts to merge strings, and it's not there in the base Brackets' strings? Just a guess, but my fix is the better way to solve this. We could also remove that string from the editor.properties file?

Gideon Thomas and others added 2 commits February 14, 2017 17:27
@gideonthomas
Copy link

@humphd fyi, doesn't look like we can use registerInternal for move file. The string does not show up in the UI (right-click on a file) when I check dist/hosted.html

Gruntfile.js Outdated
@@ -660,7 +660,7 @@ module.exports = function (grunt) {
/*'cssmin',*/
/*'uglify',*/
'copy:dist',
'npm-install',
// 'npm-install',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's git so you can always get this line back. If this isn't a work-in-progress PR, might as well just remove the line (and the commented lines above maybe?)

@gideonthomas
Copy link

This patch also fixes:

@humphd we have Cut/Copy/Paste enabled in the context menu. Cut and Copy work perfectly for me but paste doesn't. Interestingly, paste in general (even if we don't use the context menu) doesn't work - which is pretty bad.

Other than this, I tested this and couldn't find other issues.

@humphd
Copy link
Author

humphd commented Feb 16, 2017

Thanks for testing this so well! I'll do more on this tomorrow, but I had to research the paste issue. I'm so glad you caught that, I totally missed it.

So it seems they switched over to use document.execCommand(), which I've never used before, but allows you to send cut, copy, and sometimes paste to the browser, see docs. However, it doesn't seem to work perfectly in all browsers, or for paste in most.

I think for the purposes of getting this merge to happen, we should revert to ignoring those 3 key events, and let the browser handle them. Then we should consider filing a new bug to implement this with something like https://clipboardjs.com/. @Pomax, have you got a handle on where things are these days on cross-browser clipboard handling?

I'll try to finish this up tomorrow and land it.

@humphd
Copy link
Author

humphd commented Feb 16, 2017

Related question: since cut and copy actually work, should we leave those in, and just revert the paste bit? Should it be all-or-none?

relies on document.execCommand() which doesn't work well (esp. for paste)
in browsers.  See adobe#12674.

This reverts commit d93ccc5.
@Pomax
Copy link

Pomax commented Feb 16, 2017

I had not heard of execCommand before, I'm basically in favour of doing as much "letting brackets do what it does" so I'd be okay with the new behaviour if supported... http://caniuse.com/#search=execCommand suggests there is broad support for it now, and If I check chrome, copy/cut/paste are all supported, but firefox reports false on all three. So maybe we hold off on execCommands for now.

(I'm sure it works brilliant in an electron wrapped because of V8, but not so much on the web)

@humphd
Copy link
Author

humphd commented Feb 16, 2017

@Pomax not for paste, which will only run in privileged scripts (e.g., in an extension).

Also, I tracked down the final console error that this merge is causing:

KeyBindingManager.js:747 Cannot assign Alt-W to cmd.switchPaneFocus. It is already assigned to file.close

In #474 we stole Alt-W for file.Close, but Brackets now wants it for "pane switching"

src/view/MainViewManager.js:        // Listen to key Alt-W to toggle between panes
src/view/MainViewManager.js:        KeyBindingManager.addBinding(Commands.CMD_SWITCH_PANE_FOCUS, {key: 'Alt-W'});

Which one should I take?

@humphd
Copy link
Author

humphd commented Feb 16, 2017

I've filed #590 to do this process again down the road.

@humphd
Copy link
Author

humphd commented Feb 16, 2017

@gideonthomas I've just removed our totally-unguessable Alt-W keybinding to get rid of this error.

I think I'm done here. If you're OK, I'd like to merge. Let me know.

@humphd
Copy link
Author

humphd commented Feb 16, 2017

@flukeout, @Pomax, etc. a note about this. If you see students having troubles, or other community people, here is how you update to get this patch locally (assuming Mozilla's Brackets repo is named upstream):

git checkout master
git pull upstream master
git submodule update --init
rm -fr src/extensions/default/JavaScriptCodeHints/thirdparty/acorn
rm -fr src/extensions/default/JavaScriptCodeHints/thirdparty/tern
npm install

@humphd
Copy link
Author

humphd commented Feb 16, 2017

For future reference, this introduces a non-fatal build error installing the iltorb module for grunt-contrib-compress:

make: Entering directory `/home/travis/build/mozilla/brackets/node_modules/iltorb/build'
  CC(target) Release/obj.target/decode/brotli/common/dictionary.o
  CC(target) Release/obj.target/decode/brotli/dec/bit_reader.o
  CC(target) Release/obj.target/decode/brotli/dec/decode.o
  CC(target) Release/obj.target/decode/brotli/dec/huffman.o
  CC(target) Release/obj.target/decode/brotli/dec/state.o
  CXX(target) Release/obj.target/decode/src/common/allocator.o
In file included from ../src/common/allocator.cc:2:0:
../../nan/nan.h:43:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from /home/travis/.node-gyp/6.9.5/include/node/node.h:42:0,
...
make: *** [Release/obj.target/decode/src/common/allocator.o] Error 1
make: Leaving directory `/home/travis/build/mozilla/brackets/node_modules/iltorb/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/travis/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.8.12-040812-generic
gyp ERR! command "/home/travis/.nvm/versions/node/v6.9.5/bin/node" "/home/travis/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/travis/build/mozilla/brackets/node_modules/iltorb
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 

The error can safely be ignored, since this module is optional. We should also fix our travis setup to get around this: https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements

@humphd
Copy link
Author

humphd commented Feb 16, 2017

Filed #592 on the build error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants