Skip to content

Commit

Permalink
Fix google#185: Support and use autogen-modules.
Browse files Browse the repository at this point in the history
This makes it possible to generate tarballs without generated modules
(which would be regenerated anyway when the package is build).
See tensorflow/haskell#180 for an example of the issues that causes.
  • Loading branch information
judah committed May 20, 2018
1 parent 6116acd commit 69f5938
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 43 deletions.
22 changes: 2 additions & 20 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,8 @@ since they are intended only for use within this repository:
- Make sure you are on a commit that has been merged upstream to `google/proto-lens`.

## Steps
1. For each package *without* autogenerated proto modules, simply run (from the root of the repo):
First, run `stack build` at the top level. Then, for each package that you want to upload, run

stack upload {name-of-package}

Then verify that they've been uploaded successfully by visiting `hackage.org` in a web browser.

2. For packages *with* autogenerated proto-modules (currently:
`proto-lens-protobuf-types` and `proto-lens-combinators`): these are a little
harder to upload due to #185. We have a script for running `sdist`:

./release.sh

Then, for each package that should be uploaded:

cabal upload {package}/dist/{path}.tar.gz

3. Finally, tag each uploaded package with its version and push it back to upstream. For example:

git tag -a proto-lens-v0.3.0.0 -m "Release proto-lens v0.3.0.0"
...
git remote add upstream [email protected]:google/proto-lens.git
git push upstream --follow-tags # See: https://stackoverflow.com/a/26438076

Then verify that they've been uploaded successfully by visiting `hackage.org` in a web browser.
2 changes: 1 addition & 1 deletion proto-lens-combinators/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ tests:
- proto-lens-protoc
- test-framework
- test-framework-hunit
other-modules:
generated-other-modules:
Proto.Combinators
Proto.Combinators_Fields
3 changes: 2 additions & 1 deletion proto-lens-protobuf-types/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:

library:
source-dirs: src
exposed-modules:
generated-exposed-modules:
- Data.ProtoLens.Any
- Proto.Google.Protobuf.Any
- Proto.Google.Protobuf.Any_Fields
Expand All @@ -42,3 +42,4 @@ library:
- Proto.Google.Protobuf.Wrappers_Fields
- Proto.Google.Protobuf.Timestamp
- Proto.Google.Protobuf.Timestamp_Fields
other-modules: []
5 changes: 5 additions & 0 deletions proto-lens-protoc/src/Data/ProtoLens/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,16 @@ generatingSpecificProtos root getProtos hooks = hooks
{ buildHook = \p l h f -> generate l >> buildHook hooks p l h f
, haddockHook = \p l h f -> generate l >> haddockHook hooks p l h f
, replHook = \p l h f args -> generate l >> replHook hooks p l h f args
#if !MIN_VERSION_Cabal(2,0,0)
-- Older versions of Cabal don't support the autogen-modules field.
-- Work around it by manually generating the modules and putting them
-- in a place where `cabal sdist` will pick them up.
, sDistHook = \p maybe_l h f -> case maybe_l of
Nothing -> error "Can't run protoc; run 'cabal configure' first."
Just l -> do
generate l
sDistHook hooks (fudgePackageDesc l p) maybe_l h f
#endif
, postCopy = \a flags pkg lbi -> do
let verb = fromFlag $ copyVerbosity flags
let destDir = datadir (absoluteInstallDirs pkg lbi
Expand Down
21 changes: 0 additions & 21 deletions release.sh

This file was deleted.

0 comments on commit 69f5938

Please sign in to comment.