Jump to content

Building process : files dependency management.


SideraX
 Share

Recommended Posts

Hi all :)

At the moment, we have three tools to build and minifying babylon.js :

 

  • JSKompactor.exe which if I understand the readme, will use a list of files in the right order generated by BuildOurOwnBabylonJS.bat based on ourOwnBabylonJS.xml and babylonJS.xml, obviously work only on windows.

By the way gwenael, how does this currently work ? I know that you want to use an attribue "dependsOn" in the xml (you already have the code and the definition in the xsd) but I don't see any in babylonJs.xml ?

  • Not really a tool but we have this wiki page : Creating-the-minified-version which is maintained by deltakosh, I suppose this list is here for developers who want to run babylon directly in their pages without a minified version.
     
  • And a gulp based process (with the main advantage to be cross-platform, have a fast adoption rate by the js libraries and frontend dev) which I maintain and it require the list of files in the right order too, which is directly in gulpfile.js (generally I just copy/paste the list of the wiki page).

So we have actually three different file to update every time a new js file is added to the repository : babylonJS.xml, the wiki page and gulpfile.js. It's a bit inefficient in my opinion ^^ And personally, I miss a lot of update.

 

With the 1.12 and typescript, I will update gulp to manage the ts files and this give two different way to do the building process :

- I can first compile all ts files to their js counterpart and then concat the js files based on our list.

- I can compile all ts files into one big js file (option --out on typescript compiler) but in this case typescript need a _references.ts files which contains our list in the right order ^^ ( _references.ts is required too in visual studio if you want to use the in-program equivalent of the --out option).

 

So to make our life simpler, I think we need to either :

- Have just one tool to build babylon and just one list to maintain.

- Have typescript to compile one big js file and just maintain _references.ts (drawback : all js files are completely ignored).

- Have the tools use the same list maintened by hand.

- Have gulp implement something similar to what does BuildOurOwnBabylonJS.bat with babylonJS.xml and the "dependsOn" attribute.

 

Anyway an easy, efficient and bugfree building process is really important to make contribution easier  :)

 

What do you think ?

 

ps : please pardon me all grammar error, even if they are hideous ^^

Link to comment
Share on other sites

I agree with that :

 

- Have just one tool to build babylon and just one list to maintain.

- Have the tools use the same list maintened by hand.

- Have gulp implement something similar to what does BuildOurOwnBabylonJS.bat with babylonJS.xml and the "dependsOn" attribute.

Link to comment
Share on other sites

By the way gwenael, how does this currently work ? I know that you want to use an attribue "dependsOn" in the xml (you already have the code and the definition in the xsd) but I don't see any in babylonJs.xml ?

 

I'm waiting for some deltakosh's time to help me to add all the "dependsOn" since if one is wrong then the js is not generated. Let's say the tool works like a linker. Now that Typescript is used, it should be easier to add them (automatically?).

Link to comment
Share on other sites

- Have just one tool to build babylon and just one list to maintain.

- Have typescript to compile one big js file and just maintain _references.ts (drawback : all js files are completely ignored).

- Have the tools use the same list maintened by hand.

- Have gulp implement something similar to what does BuildOurOwnBabylonJS.bat with babylonJS.xml and the "dependsOn" attribute.

 

For the second one, like you said, it wouldn't include js files whereas deltakosh wanted developpers to still be able to write js files. He will do the port to TS for them but it means they wouldn't be able to test their code in the minified file as long as their code wouldn't have been ported.

 

Second, third and fourth option may be compiled in one option: _references.ts is used by a tool to write babylonJS.xml with "dependsOn" attributes and people add their JS file in ourBabylonJS.xml which includes babylonJS.xml. Thus ourOwnBabylonJS.xml can still be used by BuildOurOwnBabylonJS.bat and something else written for gulp could use it too. Once JS files are ported to TS, people can remove the lines they added to their ourOwnBabylonJS.xml that should never be committed.

Link to comment
Share on other sites

So currently how BuildOurOwnBabylonJS.bat know the right order ? babylonJs.xml doesn't seems to have the file sorted by dependency.

 

​Unfortunately typescript doesn't have a tool to resolve dependency, It just lauch a error on compile if something is not defined somewhere.

And _references.ts is just the files with the right order (it look like that : https://github.com/SideraX/sefjs/blob/master/src/_references.ts ) , you can't use it to know which file need which file precisely, you just know that maybe a file need all the files declared before.

 

But I can easily parse it, get the path attribute and replace .ts by .js then inject it into gulp.src ^^ 

 

Edit : typo and link

Link to comment
Share on other sites

Absolutely. But do not worries too much about dependencies because the way .js files are generated implies that dependencies are most of the times resolved when constructors are called (meaning when all the files are already loaded). So at the end of the day, order does not matter that much

Link to comment
Share on other sites

Most of time yes.

But in some case like prototype inheritance (when you copy the prototype of the parent class) really need it.

Currently if I use **/*.js (alphabetic order) in gulp instead of the files list, it crash on the first extends.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...