Introduce build scripts, solving many challenges with modern web dev

architecture
contributing
development

#1

Lots of web projects require you to run a build script after checking out the code, be it "Makefile", "grunt", "gulp", "build.xml", whichever. These often do the following:

  • downloading dependencies (ex: running composer, npm install)
  • running unit tests
  • compiling JS templates
  • minifying/concatenating JS or CSS files

However this adds an additional hurdles:
- to check in or not to check in minified code ?
- the design philosophy of ownCloud so far was that the code that comes out of git needs to be able to run directly
- raises the barrier of entry for new contributors

I don't think these are big issues. The barrier of entry can be reduced with proper documentation and helper scripts.
Also, even though ownCloud core from git might run, it is still missing most of the bundled apps.

I also noticed that many ownCloud apps themselves are using build scripts, like the mail app https://github.com/owncloud/mail (see Makefile and Gruntfile).

The reason that this is a blocker for JS dev in core for me is that it is not possible to properly use Handlebars template. So far, we need to compile the Handlebars template in real-time on the client side at load time because there is no build script to do it. However, for unit tests, we cannot compile these before running the tests without introducing another layer of async initialisation. I'd rather do it the proper way with a build script. See https://github.com/owncloud/core/issues/12848 for details.


#2

I'm all in to introducing a Makefile and move all required scripts into the sub folder build.

Let's start with the following tasks:
- get and run composer (requires 3rdparty to be dropped and composer.json to be moved to core)
- get and run bower (and npm ?????)
- add version eye to the composer and bower file - https://blog.versioneye.com/2016/08/16/pull-request-support-for-github/


#3

As a side note, currently to get a full dev environment for both PHP and Javascript, one needs to do this:

1) Check out the core code from Github
2) Check out apps (if needed)
3) Install PHP, composer, phpunit
4) Install node JS

One question is whether it makes sense to have the Makefile bootstrap some of these, like auto-download composer. There might be security implications.

Do we still want to check in dependencies like we do now ? (local 3rdparty folder, bower stuff)
The easiest is probably to continue doing it until further notice.


#4

The makefile was merged and I am happy: https://github.com/owncloud/core/pull/25513

Closing this topic.


#5