Closed Bug 1015868 Opened 10 years ago Closed 10 years ago

Generating Makefile in javascript for building apps

Categories

(Firefox OS Graveyard :: Gaia::Build, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: yurenju, Assigned: yurenju)

Details

since we separated app-makefiles to multiple rules on bug 1008114, we can speed up gaia build process by make -jN. now we may generate Makefile for building apps to decide which apps need to be remade in javascript.
here is WIP[1] for this purpose, noted I will file follow bug for deciding which apps should be remade, for this bug I only generate Makefile to avoid regression risk.

Alex, chould you give some feedback for this idea? do you think that is a right way to detect remade apps?

https://github.com/yurenju/gaia/commit/0baa1af895a9db3de7fe90e4f9e42ad23e1c4d3c
Flags: needinfo?(poirot.alex)
Assignee: nobody → yurenju.mozilla
I don't feel confident going this way. It ends up looking very hacky to craft makefile scripts from JS.
If we go that road, we are going to entangle even more JS into bash/makefile.
Also it moves us away from being able to build gaia from an addon.

I tend to think we should try doing it in full JS.

Today, we call more and more JS scripts from Makefile, but for me, that's only an intermediate state.
I have in mind to end up calling one single script, that will manage building a given app completely.
For example here:
https://github.com/mozilla-b2g/gaia/blob/master/Makefile#L488-L494
Instead of these few lines, we would call only that:
  $(call run-js-command,app);
It will be up to this "app" script to copy all files and load'n call build.js if there is one.
And given this current bug, it can be up to this app script to decide if we have to rebuild the app or not.

It shouldn't be too hard, nor much slower to compute a hashmap of all files modification date in JS.
  let hash = new Map();
  ls(appPath, true).forEach(function (file) {
    hash.set(file.path, file.lastModifiedTime);
  });

Then you can save/load this hashmap from a file in build_stage. JSON, raw data, or even some Web storage (localStorage, indexedDB, ...). (you will need some hack to make a web storage to work in xpcshell, but I can help you about that).
Flags: needinfo?(poirot.alex)
since we are working on rewrite Makefile in javascript, set status to WONFIX.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.