Commit Graph

54 Commits

Author SHA1 Message Date
jerome.fayot 402fe6b579 fix: replaced defaultValue with ?? 2025-03-11 22:58:00 +01:00
jjspace 09a719b8fb
run prettier v3 2024-09-20 11:24:24 -04:00
ggetz a56b205a77 Fix failing render specs for msaa 2024-08-28 12:55:39 -04:00
Sanjeet Suhag aaf6bd8a5c Adds engine and widgets workspaces 2022-11-01 15:39:57 -04:00
Peter Gagliardi 897427bd0e Control test canvas size from cli or query string 2022-08-16 16:43:37 -04:00
Peter Gagliardi c6678e0a4c update comment 2022-08-15 11:04:07 -04:00
Sanjeet Suhag cf266ae4af Fixes duplicate imports in specs 2022-07-21 17:32:08 -04:00
Gabby Getz 8143df4436 var -> const/let 2022-01-21 11:26:25 -05:00
Matthew Amato 2fd0e8f7e4 Format all code with prettier 2020-04-16 20:31:36 -04:00
Matthew Amato aabd27a760 Migrate Cesium to ES6 Modules
See https://github.com/AnalyticalGraphicsInc/cesium/pull/8224 for details.

eslint
There are a handful of new .eslintrc.json files, mostly to identify the files that are still AMD modules (Sandcastle/Workers). These are needed because you can't change the parser type with a comment directive (since the parser is the thing reading the file). We can finally detect unusued modules! So those have all been cleaned up as well.

requirejs -> rollup & clean-css
requirejs, almond, and karma-requirejs have all been removed. We now use rollup for building and minifying (via uglify) JS code and clean-css for css. These changes are fairly straight-forward and just involve calling rollup instead of requirejs in the build process.

Overall build time is significantly faster. CI is ~11 minutes compared to ~17 in master. Running makeZipFile on my machine takes 69 seconds compared to 112 seconds in master. There's probably plenty of room for additional optimization here too.

We wrote an published a small npm module, rollup-plugin-strip-pragma, for stripping the requirejs pragmas we use out of the release builds. This is maintained in the Tools/rollup-plugin-strip-pragma directory.

As for what we produce. The built version of Cesium is now a UMD module. So it should work anywhere that hasn't made the jump to ES6 yet. For users that were already using the "legacy" combined/minified approach, nothing changes.

One awesome thing about roll-up is that it compiles all of the workers at once and automatically detects shared codes and generates separate bundles under the hood. This means the size of our worker modules shrink dramatically and Cesium itself will load them much faster. The total minified/gzipped size of all workers in master is 2.6 MB compared to 225 KB in this branch! This should be most noticeable on demos like Geometry & Appearances which load lots of workers for the various geometry typs.

roll-up is also used to build Cesium Viewer, which is now an ES6 app.

We use clean-css via gulp and it is also a straightforward change from requirejs that requires no special mention.

Workers
While the spec allows for ES6 Web Workers, no browser actually supports them yet. That means we needed a way to get our workers into non-ES6 form. Thankfully, roll-up can generate AMD modules, which means we now have a build step to compile our Worker source code back into AMD and use the existing TaskProcessor to load and execute them. This build step is part of the standard build task and is called createWorkers. During development, these "built" workers are un-optimized so you can still debug them and read the code.

Since there is a build step, that means if you are changing code that affects a worker, you need to re-run build, or you can use the build-watch task to do it automatically.

The ES6 versions of Worker code has moved into Source/WorkersES6 and we build the workers into their "old home" of Source/Workers. cesiumWorkerBootstrapper and transferTypedArrayTest which were already non-AMD ES5 scripts remain living in the Workers directory.

Surprisingly little was changed about TaskProcessor or the worker system in general, especially considering that I thought this would be one of the major hurdles.

ThirdParty
A lot of our ThirdParty either already had a hand-written wrapper for AMD (which I updated to ES6) or had UMD which created problems when importing the same code in both Node and the browser. I basically had to update the wrapper of every third-party library to fix these problems. In some cases I updated the library version itself (Autolinker, topojson). Nothing to be too concerned about, but future clean-up would be using npm versions of these libraries and auto-generating the wrappers as needed so we don't hand-edit things.

Sandcastle
Sandcastle is eternal and manages to live another day in it's ancient requirejs/dojo 1.x form. Sandcastle now automatically uses the ES6 version of Cesium if it is available and fallsback to the ES5 unminified version if it is now. The built version of Sandcastle always uses CesiumUnminified, just like master. This means Sandcastle still works in IE11 if you run the combine step first (or use the relase zip)

Removed Cesium usage from Sandcastle proper, since it wasn't really needed
Generate a VERSION propertyin the gallery index since Cesium is no longer being included.
Remove requirejs from Sandcastle bucket
Update bucket to use the built version of Cesium if it is available by fallbackto the ES6 version during development.
Standalone.html was also updated
There's a bit of room for further clean-up here, but I think this gets us into master. I did not rename bucket-requirejs.html because I'm pretty sure it would break previously shared demos. We can put in some backwards compatible code later on if we want. (But I'd rather just see a full Sandcastle rewrite).

Specs
Specs are now all ES6, except for TestWorkers, which remain standard JS worker modules. This means you can no longer run the unbuilt unit tests in IE11. No changes for Chrome and Firefox.

Since the specs use ES6 modules and built Cesium is an ES5 UMD, I added a build-specs build step which generates a combined ES5 version of the specs which rely on Cesium as a global variable. We then inject these files into jasmine instead of the standard specs and everything works exactly as it did before. SpecRunner.html has been updated to inject the correct version of the script depending on the build/release query parameters.

The Specs must always use Cesium by importing Source/Cesium.js, this is so we can replace it with the built Cesium as describe above.

There's a bunch of room for clean-up here, such as unifying our two copies of jasmine into a single helper file, but I didn't want to start doing that clean-up as part of this already overly big PR. The important thing is that we can still test the built version and still test on IE/Edge as needed.

I also found and fixed two bugs that were causing failing unit tests, one in BingMapsImageryProviderSpec.js (which was overwriting createImage andnot setting it back) and ShadowVolumeAppearance.js (which had a module level caching bug). I think these may have been the cause of random CI failures in master as well, but only time will tell.

For coverage, we had to switch to karma-coverage-istanbul-instrumenter for native ES6 support, but that's it.

Finally, I updated appveryor to build Cesium and run the built tests under IE. We still don't fail the build for IE, but we should probably fix that if we want to keep it going.

NodeJS
When NODE_ENV is production, we now require in the minified CesiumJS directly, which works great because it's now a UMD module. Otherwise, we use the excellant esmpackage to load individual modules, it was a fairly straightforward swap from our old requirejs usage. We could probably drop esm too if we don't care about debugging or if we provie source maps at some point.
2019-10-03 11:51:23 -04:00
Dan Bagnell 132b9337b1 Fix some tests and a copy-paste error. 2018-09-05 17:10:28 -04:00
Ottavio Hartman 337ad9d7eb Remove global define and global defineSuite 2017-06-28 17:10:51 -04:00
Sean Lilley 3f35a4029c Misc changes and helpers from 3d-tiles 2017-04-27 15:52:08 -04:00
hpinkos 38988ff931 remove unused requires 2017-03-01 10:12:22 -05:00
Patrick Cozzi 5205fce667 Move WebGL stub to the Specs directory so it is not part of the Cesium build 2017-01-05 08:53:19 -05:00
Patrick Cozzi ed1d591ce7 Use WebGL stub with widget tests 2017-01-05 08:35:37 -05:00
Patrick Cozzi a211783459 Remove destroyCanvas 2017-01-05 08:28:53 -05:00
Patrick Cozzi 937fc23bb9 Fix timing issue when using WebGL stub from the command line 2017-01-05 07:48:41 -05:00
Patrick Cozzi fb2af9338b renderForSpecs no longer needs to readPixels 2016-12-16 06:34:59 -05:00
Patrick Cozzi ba5a5eb193 Merge master to webgl-mock-for-tests 2016-12-15 08:21:29 -05:00
Patrick Cozzi b31303b6d9 Remove old pickForSpecs 2016-12-15 08:16:09 -05:00
Patrick Cozzi 49b13adef8 Replace custom Scene expectation functions with custom Jasmine matchers 2016-12-13 06:34:59 -05:00
Sean Lilley 077e225ff1 Added tests 2016-12-12 22:26:29 -05:00
Patrick Cozzi 580f379c57 Improve stub expect functions 2016-12-12 09:49:45 -05:00
Patrick Cozzi 547d126a5f Pass through webglStub query parameter 2016-12-02 09:18:54 -05:00
Patrick Cozzi 1b16385c7d Start of WebGL stub 2016-12-01 16:15:01 -05:00
Patrick Cozzi 4912f4992d Start of webglstub parameter 2016-12-01 14:34:57 -05:00
Patrick Cozzi c0f87766a3 Start of expectRenderForSpecs and friends 2016-12-01 13:20:17 -05:00
Frederic Junod 8ba5ce1797 Remove unused require 2016-11-22 16:44:04 +01:00
Tom Payne 1ae9fda901 Add newlines to end of text files. 2016-10-19 16:53:31 -04:00
ggetz f19c2fd2c0 Merge remote-tracking branch 'cesium/master' into cesium-ci 2016-02-10 12:08:19 -05:00
Sanuj 04216d0204 Replace "use strict" by 'use strict' 2016-02-09 11:07:51 +05:30
ggetz 9bcaf8e546 Factored out webgl validation to global 2016-02-05 13:42:18 -05:00
Matthew Amato 2b34d0aac3 Default failIfMajorPerformanceCaveat to false
In order to avoid users first impression of Cesium being a failed to
load screen, this changes failIfMajorPerformanceCaveat back to the
official WebGL default of `false`. While I agree that many Cesium apps
will perform poorly under these conditions, there are several use cases
where it makes sense, such as RDP sessions.

I also removed an old Firefox workaround for Firefox 35.  Since 35 was not
an ESR release, there's no reason for the workaround to still be there.
2015-10-19 12:14:39 -04:00
Sean Lilley 6bfab45f79 Updated GroundPrimitiveSpec 2015-09-09 17:12:41 -04:00
unknown e2fe7c4598 set failIfMajorPerformanceCaveat to false in tests 2015-08-20 15:52:28 -04:00
Patrick Cozzi 4a2d99554b Removed destroyScene 2015-02-06 11:30:34 -05:00
Dan Bagnell b7a5e22d90 Updates from review. 2015-01-05 16:58:36 -05:00
Dan Bagnell 8bef129d67 Fix Sun test failures with WebGL validation. 2015-01-05 16:08:49 -05:00
Chris Cooper 522e4fb9cb enable scene.rethrowRenderErrors by default for specs 2014-11-27 10:47:07 +11:00
Scott Hunter 5399aee0be remove Specs/getQueryParameters which is no longer needed 2014-10-01 16:31:46 -04:00
Patrick Cozzi fac9c689b0 Use WebGL validation with tests using createScene. Use WebGL validation only when requested. 2014-06-20 16:58:03 -04:00
Patrick Cozzi 64895b4ace Added options parameter to Scene constructor 2014-06-02 13:03:25 -04:00
Patrick Cozzi c7bbf3b5e9 Replace createTextureAtlas with new TextureAtlas 2014-05-12 12:00:00 -04:00
hpinkos 3b65ca728f private context 2014-03-28 16:59:49 -04:00
Patrick Cozzi fdda9fa0ea Merge master to gltf and fixes 2014-02-18 09:09:23 -05:00
Patrick Cozzi 776d5bf739 More animation tests 2014-02-06 12:16:24 -05:00
Patrick Cozzi 4c28451d84 Add renderForSpecs 2014-02-05 09:23:57 -05:00
Patrick Cozzi dfc7593c48 Added allowTextureFilterAnisotropic 2013-11-28 08:35:53 -05:00
Frank Stoner 2a19aef805 Turn off antialiasing for test robustness. 2013-11-12 12:06:23 -05:00