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

[OPEN] Update grunt build scripts for linux #288

Closed
wants to merge 4 commits into from

Conversation

jasonsanjose
Copy link
Member

Replaces scripts/setup_linux_build.sh

@timburgess @DaBungalow would you like to test out these updates? Someone else with committer rights will need to handle merging though.

These changes bring the Linux setup and build Grunt tasks up to par with mac and windows. This doesn't replace the one-line wget (see https://gist.github.com/jasonsanjose/5514813) required for downloading the git repositories and installing Node.js and Grunt.

Here are the highlights:

  • I've hosted CEF binaries in using GitHub's release feature https://github.com/jasonsanjose/brackets-shell/releases/tag/cef-builds. These binaries are modified from the original zip files. To reduce the download size, I've removed the Debug folder. For folks like @timburgess that are doing work with the native shell, it won't be too hard for them to get the full binaries manually.
  • There's some extra commits from another outstanding pull fetch origin for new branches. fix jshint errors. #286. The prior pull should be merged first.
  • CEF and Node.js downloads are supported for 32 and 64 bit. I haven't tested the build process on 64-bit yet.
  • Speaking of build, you should be able to just pull this branch and run grunt to setup and build. grunt installer will produce the debian package
  • There's a new postinstall hook after npm install to install the compile-time dependencies
  • Incremental linux builds can be done via grunt build or simply make as before

@jasonsanjose
Copy link
Member Author

I've also uploaded a debian package for testing. There's a little churn going on with Sprint 28 due to some new crashes with the latest CEF. This build https://github.com/jasonsanjose/brackets-shell/releases/download/cef-builds/Brackets.Sprint.28.deb includes CEF 3.1547.1337 which will likely be ahead of what Sprint 28 releases with officially.

use correct fs.symlink on mac and linux

add arch support for linux 64-bit

update grunt tasks for linux

add linux installer to grunt tasks

fix linux clean installer task

update grunt for node on linux. move linux tools to an npm postinstall script.

rename debian package to Brackets Sprint NN.deb

fix 64 bit build

update debian package version and 64-bit dep
@ghost ghost assigned JeffryBooher Jul 30, 2013
@timburgess
Copy link
Contributor

Jason, this is what I'm seeing on 64bit Ubuntu 12.04 with node 0.10.15 npm 1.3.5.

I have installed node per the official wiki page for Linux
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Running 'npm install' in brackets-shell directory as per the 'Install Dependencies' section on the Wiki build page, I see:

Brackets-Shell@0.28.0-0 postinstall /home/tim/work/brackets-shell
grunt

Loading "curl.js" tasks...ERROR

Error: Cannot find module 'grunt-retro'

Running "cef" task

Running "cef-download" task
Downloading https://github.com/jasonsanjose/brackets-shell/releases/download/cef-builds/cef_binary_3.1453.1279_linux64_release.zip. This may take a while...
Warning: Task "curl-dir:cef-linux64" not found. Use --force to continue.

Aborted due to warnings.
npm ERR! weird error 3
npm ERR! not ok code 0

Some sort of curl dependency I'm guessing. I'm not overly familiar with Grunt atm.

@jasonsanjose
Copy link
Member Author

Looks like I need to update this wiki page https://github.com/adobe/brackets-shell/wiki/Building-brackets-shell.

The Linux prerequisites are basically covered in the gist https://gist.github.com/jasonsanjose/5514813 that I posted in https://github.com/adobe/brackets/wiki/Linux-Development-for-Contributors. That gist follows the same node and npm setup and also runs npm install as you've done.

I wonder if something went wrong during npm install. Try this

# in brackets-shell
npm cache clean
rm -rf node_modules
sudo npm install

@timburgess
Copy link
Contributor

Thanks. After the npm cleanup and re-install, I can confirm that 'grunt build' now builds out/Release/Brackets for me. And it runs as expected.

Presumably, there will be some coordination on the Adobe side for Mac/Win/Linux CEF builds when the Gruntfile.js CEF version line changes? Not that that worries me since I will be doing a CEF3 build myself. But I will be looking at the Gruntfile.js version reference to see what CEF version is currently being tracked.

Great to have similar build management on all 3 platforms. +1 to merge.

@jasonsanjose
Copy link
Member Author

Thanks! Yep, now that we're hosting the CEF builds we will coordinate updating Gruntfile.js.

Also, I haven't forgotten about your node pull request. I've been using my free time to get the build in shape. I hope to free up next week though.

@JeffryBooher you can go ahead with the code review since @timburgess took care of testing, no hurry though.

@timburgess
Copy link
Contributor

No worries. I didn't anticipate the node PR going into Sprint 28. Would be nice for 29 though.

@thefirstofthe300
Copy link

I just tried using the script to build the shell on a Linux Mint 64-bit machine and ran into a tiny problem with the gist script. The sudo before npm install threw the error:

npm WARN cannot run in wd Brackets-Shell@0.28.0-0 scripts/preinstall.sh (wd=/home/daniel/Projects/Git-     Repos/Brackets-Dev/brackets-shell)

After the script finished, I ran npm install and npm ran the preinstall script. Everything completed without errors.

I noticed that after running npm install, I still had to manually copy the src and samples directories from the core to the release directory. Is that just an oversight?

@thefirstofthe300
Copy link

OK. I just spent some time chasing this whole problem down. The line at the very end of the gist script threw me off.

According to the way the grunt scripts are working, the final brackets binary with the src and samples directories copied to it is built in the installer/linux/debian/usr/bin directory NOT out/Release/Brackets. I think this might be a good thing to clear up in the script somewhere.

I also reran the script after completely purging node from apt-get and still ran into the problem with the last command in the script with the same error (below).

npm WARN cannot run in wd Brackets-Shell@0.28.0-0 scripts/preinstall.sh (wd=/home/daniel/Projects/Git-     Repos/Brackets-Dev/brackets-shell)

I do believe that the last line should be npm install instead of sudo npm install.

To sum it all up, the grunt scripts seem to all be working beautifully, but there seems to be a problem with the setup script in you gist @jasonsanjose.

@jasonsanjose
Copy link
Member Author

Thanks @DaBungalow for trying it out.

I made a change to the new gist so that it only compiles the binaries at the end (previously it did build the installer). To build the installer, you have to run grunt installer separately.

I'm a bit confused though on your comment about sudo npm install. The script already has that https://gist.github.com/jasonsanjose/5514813. Did something else go wrong perhaps?

@thefirstofthe300
Copy link

I guess what I was trying to say was that sudo npm install actually
failed since the permissions weren't correct. I had to run npm install with downgraded permissions (instead of root, I was user).
After downgrading permissions everything worked beautifully.

On 8/6/13, Jason San Jose notifications@github.com wrote:

Thanks @DaBungalow for trying it out.

I made a change to the new gist so that it only compiles the binaries at the
end (previously it did build the installer). To build the installer, you
have to run grunt installer separately.

I'm a bit confused though on your comment about sudo npm install. The
script already has that https://gist.github.com/jasonsanjose/5514813. Did
something else go wrong perhaps?


Reply to this email directly or view it on GitHub:
#288 (comment)

Danny Seymour
dannyseeless@gmail.com

@thefirstofthe300
Copy link

@jasonsanjose
I just tried running grunt installer and I keep getting this error:

Running "build-branch" task
Unhandled rejected promise: TypeError: Cannot read property '1' of null
at /home/daniel/Documents/brackets-shell/tasks/build.js:134:73
at _fulfilled (/home/daniel/Documents/brackets-shell/node_modules/q/q.js:837:54)
at resolvedValue.promiseDispatch.done (/home/daniel/Documents/brackets-shell/node_modules/q/q.js:867:30)
at makePromise.promise.promiseDispatch (/home/daniel/Documents/brackets-shell/node_modules/q/q.js:519:13)
at /home/daniel/Documents/brackets-shell/node_modules/q/q.js:422:39
at process._tickCallback (node.js:415:13)

Any idea what is wrong? I am not very familiar with grunt either.

@thefirstofthe300
Copy link

I am noticing that a number of the grunt commands aren't working (grunt package for instance). Do you want me to go through the whole list in the wiki and report back?

@jasonsanjose
Copy link
Member Author

I wonder if something got stuck in node. Can you try what I recommended to @timburgess:

# in brackets-shell
npm cache clean
rm -rf node_modules
sudo npm install

@thefirstofthe300
Copy link

I tried the above and here are the results:

  1. I had to upgrade permissions on rm -rf node_modules to get the modules deleted.
  2. sudo npm install still threw the error about being unable to run the preinstall script and post install script in the working directory
  3. As the preinstall and postinstall scripts did not run, I had to run npm install with permissions downgraded to a user account. The scripts then worked.
  4. Grunt still failed the package task, the write-config test, and any tasks that depend on them. I still even had the grunt installer task problem.

I am working on trying to compile form scratch.

@thefirstofthe300
Copy link

I compiled from scratch and I DID need to use sudo npm install to get the modules to install.

However, npm still threw the error:

npm WARN cannot run in wd Brackets-Shell@0.28.0-0 scripts/preinstall.sh (wd=/home/daniel/Projects/Git-     Repos/Brackets-Dev/brackets-shell)

before installing the modules and it threw the error

npm WARN cannot run in wd Brackets-Shell@0.28.0-0 grunt (wd=/home/daniel/Projects/Git-     Repos/Brackets-Dev/brackets-shell)

after module installation. All of this I KNOW has to do with permissions because npm install will run the scripts.

Despite uninstalling and reinstalling node, I still end up with the error

Running "write-config" task
Warning: Required task "build-num" must be run first. Use --force to continue.

on grunt package. grunt installer still throws the error:

Running "build-branch" task
Unhandled rejected promise: TypeError: Cannot read property '1' of null
at /home/daniel/Documents/brackets-shell/tasks/build.js:134:73
at _fulfilled (/home/daniel/Documents/brackets-shell/node_modules/q/q.js:837:54)
at resolvedValue.promiseDispatch.done (/home/daniel/Documents/brackets-shell/node_modules/q/q.js:867:30)
at makePromise.promise.promiseDispatch (/home/daniel/Documents/brackets-shell/node_modules/q/q.js:519:13)
at /home/daniel/Documents/brackets-shell/node_modules/q/q.js:422:39
at process._tickCallback (node.js:415:13)

@thefirstofthe300
Copy link

I just figured out what the grunt build-branch problem is. When Igit status`, I get the output

# Not currently on any branch.
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   tasks/build.js
#
no changes added to commit (use "git add" and/or "git commit -a")

Which will obviously cause the the regex to have a fit and not return anything, thus the null error.

I then tried:

git checkout -b linux upstream/jasonsanjose/linux-sprint-28

git status returns:

# On branch linux
nothing to commit, working directory clean

I am now thinking that grunt build-branch should work.

Update: I ran it and the output is exactly that same as the first error.

@jasonsanjose
Copy link
Member Author

@DaBungalow @timburgess sorry for the slow turnaround. We weren't able to complete a good chunk of our stories this sprint and didn't have much free time left. We'll have to bump this out to sprint 30.

We did though officially release this branch jasonsanjose/linux-sprint-28 as our preview build, see http://blog.brackets.io/2013/08/09/preview-brackets-on-linux/.

@thefirstofthe300
Copy link

Thank you so much @jasonsanjose!

I just update my local build and can confirm that grunt is working
beautifully now. grunt package works grunt full-build and all of its
dependencies work. Thanks again!

On Fri, Aug 9, 2013 at 11:13 AM, Jason San Jose notifications@github.comwrote:

@DaBungalow https://github.com/DaBungalow @timburgesshttps://github.com/timburgesssorry for the slow turnaround. We weren't able to complete a good chunk of
our stories this sprint and didn't have much free time left. We'll have to
bump this out to sprint 30.

We did though officially release this branch jasonsanjose/linux-sprint-28as our preview build, see
http://blog.brackets.io/2013/08/09/preview-brackets-on-linux/.


Reply to this email directly or view it on GitHubhttps://github.com//pull/288#issuecomment-22413301
.

Danny Seymour
dannyseeless@gmail.com

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

Successfully merging this pull request may close these issues.

4 participants