FWIW, switching to commonjs style imports seems to work. Now I'm wondering how do I get from bytes to objects? Passing the bytes into the generated constructor doesn't seem to work - I'm still seeing binary values where I expect to see textual values
On Wed, Feb 15, 2017 at 10:20 AM, <[email protected]> wrote: > I don't expect that the code got pulled into the protobuf library because > I'm pulling the generated javascript files out of a jar created by maven > and using them on a box that has been set up solely for doing the > javascript side of things. The protobuf install there is via npm, although > I had to add message.js and map.js files to the closure compiler to get it > working there. It is possible I've gone about acquiring protobuf for my > javascript build entirely wrong, though. > > On Wednesday, February 15, 2017 at 10:16:42 AM UTC-9, [email protected] > wrote: >> >> Sure thing! >> >> Gruntfile.js: >> >> module.exports = function(grunt){ >> >> require('google-closure-compiler').grunt(grunt); >> >> grunt.initConfig({ >> pkg: grunt.file.readJSON('package.json'), >> 'closure-compiler': { >> my_target: { >> files: { >> 'target/full.js': ['js/**.js'] >> }, >> options: { >> js: [ >> 'node_modules/google-closure-library/**.js', >> '!node_modules/google-closure-library/**_test.js', >> '!node_modules/google-closure-library/**_perf.js', >> '!node_modules/google-closure-library/**tester.js', >> '!node_modules/google-closure-library/**promise/testsuiteada >> pter.js', >> '!node_modules/google-closure-library/**osapi/osapi.js', >> '!node_modules/google-closure-library/**svgpan/svgpan.js', >> '!node_modules/google-closure-library/**alltests.js', >> '!node_modules/google-closure-library/**node_modules**.js', >> '!node_modules/google-closure-library/**protractor_spec.js', >> '!node_modules/google-closure-library/**protractor.conf.js', >> '!node_modules/google-closure-library/**browser_capabilities >> .js', >> '!node_modules/google-closure-library/doc/**.js', >> 'node_modules/google-protobuf/**.js', >> 'js/missing-google-crap/message.js', >> 'js/missing-google-crap/map.js', >> 'js/person.js' >> ], >> compilation_level: 'SIMPLE', >> language_in: 'ECMASCRIPT5', >> create_source_map: 'target/full.js.map' >> >> } >> } >> } >> }); >> >> >> grunt.registerTask('default', ['closure-compiler']); >> } >> >> >> The javascript is generated via Maven, so here is the command we are >> using: >> >> <plugin> >> <groupId>com.github.os72</groupId> >> <artifactId>protoc-jar-maven-plugin</artifactId> >> <version>3.0.0</version> >> <executions> >> <execution> >> <phase>generate-sources</phase> >> <goals> >> <goal>run</goal> >> </goals> >> <configuration> >> <protocVersion>3.0.0</protocVersion> >> <inputDirectories> >> <include>src/main/resources/proto</include> >> </inputDirectories> >> <outputTargets> >> <outputTarget> >> <type>java</type> >> <addSources>none</addSources> >> >> <outputDirectory>src/main/gen</outputDirectory> >> </outputTarget> >> <outputTarget> >> >> <type>descriptor</type> >> <addSources>none</addSources> >> >> <outputDirectory>src/main/resources/protoDesc/</outputDirectory> >> </outputTarget> >> <outputTarget> >> <type>js</type> >> <addSources>none</addSources> >> >> <outputDirectory>src/main/resources/js/</outputDirectory> >> </outputTarget> >> </outputTargets> >> </configuration> >> </execution> >> </executions> >> </plugin> >> >> >> >> >> On Wednesday, February 15, 2017 at 9:40:03 AM UTC-9, Adam Cozzette wrote: >>> >>> If you could share your gruntfile that would be great. I would be >>> interested to know in particular the protoc command used to generate the >>> Javascript. Also it would be good to verify that the generated code for >>> that proto did not somehow get pulled into the protobuf build and end up >>> being part of the actual protobuf library. >>> >>> On Wed, Feb 15, 2017 at 9:10 AM, <[email protected]> wrote: >>> >>>> I've got some javascript generated from protoc and I'm trying to >>>> compile all those files together with closure-compiler so I can use them in >>>> a client app. >>>> >>>> I'm using Grunt and closure compiler and can provide my gruntfile and >>>> generated javascript if it would help. >>>> >>>> My problem is that the closure compiler gives me a namespace error for >>>> each type defined in the protobuf. >>>> >>>> ERROR - namespace "proto.gov.noaa.alaskafisherie >>>> s.demoperson.protos.Person" cannot be provided twice >>>> goog.provide('proto.gov.noaa.alaskafisheries.demoperson.protos.Person' >>>> ); >>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>> ^^^^^^^^^^^^^ >>>> >>>> And so on for each type defined in the .proto. >>>> >>>> So far as I can tell these are only provided once in the generated >>>> file, and I've pared down my compilation attempt to that single file + the >>>> closure library and protobuf library files. >>>> >>>> I've googled the heck out of it and I'm stumped. I've gotten >>>> everything working with https://github.com/dcodeIO/ProtoBuf.js/ but >>>> I'd like to be able to use google's generated code rather than bring in >>>> another library just for the javascript client. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Protocol Buffers" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to th >>> >>> -- Gunnar Gissel Programmer National Marine Fisheries 907-586-7602 -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
