Equivalent of "make build" & type defs (comments, olx)

46 views
Skip to first unread message

Alexandre Dubé

unread,
Jan 15, 2018, 9:42:20 AM1/15/18
to OpenLayers Dev
Hello devs,

  I'm looking at the current master version of openlayers and looking for the alternative of "make build" (which doesn't work anymore).  My goal here is to understand how I can change some code and see if it "builds without errors".

  I have other questions related to the build / minimization.  OL seems to use webpack + (babel minify)? as its dev / minimization tools.
  • Is the externs/olx.js file still being used in this new environment?
  • What about the definitions of the methods in comments?
  I used to find these definitions quite useful to detect errors while compiling. Will these comments / the olx file still be used / detected while minimizing?  Any hint would be welcome.

Thanks a lot,

Alexandre Dubé

Andreas Hocevar

unread,
Jan 15, 2018, 11:10:02 AM1/15/18
to OpenLayers Dev on behalf of Alexandre Dubé
Hi Alexandre,

there will be no externs/olx.js file any more. Types for constructor
options will be defined next to the constructor, other types will have
typedefs. These type definitions can also be used by applications.

We will continue to use JSDoc annotations, but the types in the
annotations will be changed to Closure path types (see
https://github.com/google/closure-compiler/wiki/JS-Modules#type-references).

We will still provide a full build (ol.js, ol-debug.js). The npm task
that creates that build will also serve as type checker, and will use
Closure Compiler because of the type checking. For users, we recommend
to use the ES modules that OpenLayers 5.x provides natively. It is up
to the user which set of tools to use, but we have made good
experience with Webpack and Babel Minifier.

I hope this clarifies things. Don't hesitate to ask if anything is unclear.

Andreas.

On Mon, Jan 15, 2018 at 3:42 PM, Alexandre Dubé via OpenLayers Dev
<openlayers-dev+APn2wQczcP2xIhKH_...@googlegroups.com>
wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "OpenLayers Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to openlayers-de...@googlegroups.com.
> To post to this group, send email to openlay...@googlegroups.com.
> Visit this group at https://groups.google.com/group/openlayers-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/openlayers-dev/5a14c6ce-d90d-4dad-b4de-9a7b68dd8cea%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Alexandre Dubé

unread,
Jan 15, 2018, 12:08:20 PM1/15/18
to OpenLayers Dev
Hello Andreas,

  Yes, this clarifies a lot.  The fact that you'll still use Closure Compiler and a mean of typing is reassuring.  For me, well for my existing projects, I'll simply need to be patient and see how things turn out in OL and migrate accordingly.  For new projects, I'll look more into the new possibilities.  For example, I never used TypeScript, but it seems like a good thing to try to deal with typing the code.  I'll give this a try.

  I'll definitively continue watching the progression towards OL 5.

Thank you very much for the answer,
Alexandre Dubé

On Monday, 15 January 2018 11:10:02 UTC-5, Andreas Hocevar wrote:
Hi Alexandre,

there will be no externs/olx.js file any more. Types for constructor
options will be defined next to the constructor, other types will have
typedefs. These type definitions can also be used by applications.

We will continue to use JSDoc annotations, but the types in the
annotations will be changed to Closure path types (see
https://github.com/google/closure-compiler/wiki/JS-Modules#type-references).

We will still provide a full build (ol.js, ol-debug.js). The npm task
that creates that build will also serve as type checker, and will use
Closure Compiler because of the type checking. For users, we recommend
to use the ES modules that OpenLayers 5.x provides natively. It is up
to the user which set of tools to use, but we have made good
experience with Webpack and Babel Minifier.

I hope this clarifies things. Don't hesitate to ask if anything is unclear.

Andreas.

On Mon, Jan 15, 2018 at 3:42 PM, Alexandre Dubé via OpenLayers Dev

Alexandre Dubé

unread,
Jun 27, 2018, 1:51:55 PM6/27/18
to OpenLayers Dev
Hello again,

  I've been looking at the new environment today and I'm still trying to figure out where and how Closure Compiler is used for typing.

  I tried some silly scenarios to see if errors/warning could be detected, such as:

  • use `zoom: "aaa"` in an example to see if Webpack returns an error about the fact that zoom should be a number - it didn't
  • changed a base constructor call to add invalid arguments and see if `npm run build` detects it - it didn't
  I understand that type definition can be used at the application level, but normally if I do a `new View({zoom: "aaa"})` I'd expect errors to be thrown.

  Any more information about this would be welcome.

Thank you very much,
Alexandre D.

Andreas Hocevar

unread,
Jun 27, 2018, 1:57:56 PM6/27/18
to OpenLayers Dev on behalf of Viggo Lunde
There is no type checking at the moment, because the last two releases
of Closure Compiler did not work with our setup at all. See
https://github.com/openlayers/openlayers/pull/8217 for a work in
progress to try to make type checks work again.

That said, I personally think type checking with Closure Compiler is a
dead-end road, and I will be investigating typing with TypeScript
JSDoc comments over the course of the next few weeks.

Andreas.
On Wed, Jun 27, 2018 at 7:51 PM Alexandre Dubé via OpenLayers Dev
<openlayers-dev+APn2wQczcP2xIhKH_...@googlegroups.com>
wrote:
>>> <openlayers-dev+APn2wQczcP2xIhKH_...@googlegroups.com>
> To view this discussion on the web visit https://groups.google.com/d/msgid/openlayers-dev/ecc13ea6-0438-477c-aa9c-09fa5b2a7b41%40googlegroups.com.

Alexandre Dubé

unread,
Jun 27, 2018, 2:13:16 PM6/27/18
to OpenLayers Dev
Hi Andreas,

  Thank you very much for pointing this out so quickly.  I'll keep an eye out.

Alexandre D.


On Wednesday, 27 June 2018 13:57:56 UTC-4, Andreas Hocevar wrote:
There is no type checking at the moment, because the last two releases
of Closure Compiler did not work with our setup at all. See
https://github.com/openlayers/openlayers/pull/8217 for a work in
progress to try to make type checks work again.

That said, I personally think type checking with Closure Compiler is a
dead-end road, and I will be investigating typing with TypeScript
JSDoc comments over the course of the next few weeks.

Andreas.
On Wed, Jun 27, 2018 at 7:51 PM Alexandre Dubé via OpenLayers Dev
Reply all
Reply to author
Forward
0 new messages