Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building with protocol buffers #1544

Merged
merged 6 commits into from
Jan 7, 2024
Merged

Conversation

cgay
Copy link
Member

@cgay cgay commented Dec 28, 2023

The doc explaining what this implements is here.

Briefly, a new protobuf-tool library that invokes an OD plugin for spec files with Origin: protobuf.

Plus a few minor cleanups.

// In addition to this code, the compiler executables have to "use protobuf-tool".

// TODO(cgay): why isn't the tool protocol just an open generic function to
// which we add a method?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it wasn't provided, this approach could have allowed introspection so you could do something show tools.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'll remove that TODO before merging.

end
end function modify-current-project;

/* Spec file format:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should go in the documentation rather than be left as a comment in a particular tool.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put the documentation in the protocol-buffers repo since we don't have a centralized place for tools in Open Dylan: cgay/protocol-buffers@0b078ed

* Remove tabs, trailing whitespace, and do minor reformatting.
* Improve command-line arg processing: recognize various cries for help.
* Combine module.dylan into library.dylan and remove unnecessary used modules.
* Do something useful if the default #"dylan" tool is found.
* Use protobuf-tool instead of motley, since the former is what is currently
  under development.
* Add some comments.
The user can either include the generated files into their own library or
generate a separate library. The former case is a bit of a hack:

* it requires that they use separate files for their library definition and
  module definition, so that

* the generated module definition files (and main code) can be inserted into
  the project between the first file (assumed to be the user's library
  definition) and the second file (usually the user's module definition). This
  way the user modules can use the generated protobuf modules and code.

Because of limitations in the build system, tools like protobuf-tool, motley,
scepter, et al are only invoked on "user projects". When a project is opened
via the registry it becomes a "system project". Therefore, compiling
sources/lib/protobuf-tool/tests/pbtool-test-one.lid must be done by passing the
.lid file to dylan-compiler directly, and that's why this commit does not
include a registry file for pbtool-test-one.

When generating a complete library, the user is responsible for creating a
registry for the generated library. In this commit, pbtool-test-two-pb is one
such registry file.

Fixing the build system (or just understanding it better) is future work.
@cgay cgay merged commit 573be03 into dylan-lang:master Jan 7, 2024
4 checks passed
@cgay cgay deleted the protobuf-tool-2 branch March 22, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants