Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Partial compilation #2839

Open
CeylonMigrationBot opened this issue Aug 27, 2014 · 3 comments
Open

Partial compilation #2839

CeylonMigrationBot opened this issue Aug 27, 2014 · 3 comments

Comments

@CeylonMigrationBot
Copy link

[@chochos] In relation to eclipse-archived/ceylon-ide-eclipse#856 the JS compiler should support partial compilation. This changes the way the generated JS is handled; right now it's directly written to the final CommonJS file, but this change would mean something like this:

  1. Every source file will be compiled to a corresponding intermediate JS file
  2. All these JS files are assembled into the final CommonJS module.

This will allow the user to recompile just 1 file and reassemble the entire module.

Some considerations:

  • Are these intermediate JS files considered only temporary, or are they official artifacts of the module?
  • In any case, where to store them?
  • Will they always be assembled together in the same order?
  • The compiler needs to determine what JS files to assemble together. If a source file has been removed, its resulting JS file must not be included in the JS module. This is probably easy to accomplish in the IDE, but it needs to work in CLI as well.

[Migrated from ceylon/ceylon-js#408]

@CeylonMigrationBot
Copy link
Author

[@quintesse]

Are these intermediate JS files considered only temporary, or are they official artifacts of the module?

Personally I'd say to make them only temporary because I'm not sure it's worth to have all the added complexity just so your first compilation is faster.

In any case, where to store them?

Probably easiest alongside the .JS file in the repository, but that would mean that it probably won't work if you compile directly to a remote repository. We could also just have a local "build" folder or something. Not sure.

Will they always be assembled together in the same order?

I'd say "yes, definitely"
(order of declarations in the original .ceylon file perhaps?)

If a source file has been removed, its resulting JS file must not be included in the JS module.

I'm not sure this is necessary, or even possible, we don't do this in the JVM compiler either, the idea being that if you want a clean build you clean the repository first. You could be doing several compilations that get their sources from different folders, so there would be no way to detect if a file was deleted.

@CeylonMigrationBot
Copy link
Author

[@davidfestal] We do some cleaning of this sort in the IDE because we can detect that a project file was removed between 2 incremental builds.
So if we have access to the JS intermediary files, we could be able to remove the temp file corresponding to a removed ceylon and regenerate the global commonJS file the same way as we currently clean CAR archives.
Why not.

But even in the IDE, the best way to ensure your generated archives are fully clean is still to do a clean build.

@CeylonMigrationBot
Copy link
Author

[@quintesse]

Why not.

Sure, the CLI compiler can do things the IDE will never allow, which is perfectly okay. It's even desirable that the IDE does a bit more work in this case.

is still to do a clean build.

exactly

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

No branches or pull requests

2 participants