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.

Unfortunately, this required us stopping using `hpack` in our packages
that generate proto files.  `hpack`, when you use the `autogen-modules`
field,
`cabal-version: >= 2.0` when the file

I mitigated the situation a little by changing the Cabal test script to
only try to `sdist` packages that we're planning to release.
  • Loading branch information
judah committed May 21, 2018
1 parent 6116acd commit a551143
Show file tree
Hide file tree
Showing 13 changed files with 298 additions and 247 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ before_install:
cabal)
export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$HOME/.cabal/bin:$PATH;;
esac
- curl -L https://github.com/commercialhaskell/stack/releases/download/v1.6.1/stack-1.6.1-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C $HOME/.local/bin '*/stack'
- curl -L https://github.com/commercialhaskell/stack/releases/download/v1.7.1/stack-1.7.1-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C $HOME/.local/bin '*/stack'
- curl -L https://github.com/google/protobuf/releases/download/v3.0.0-beta-2/protoc-3.0.0-beta-2-linux-x86_64.zip > protoc-release.zip
- unzip -p protoc-release.zip protoc > $HOME/.local/bin/protoc
- chmod a+x $HOME/.local/bin/protoc
Expand Down
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.
50 changes: 0 additions & 50 deletions proto-lens-combinators/package.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions proto-lens-combinators/proto-lens-combinators.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: proto-lens-combinators
version: 0.1.0.10
synopsis: Utilities functions to proto-lens.
description: Useful things for working with protos.
category: Data
homepage: https://github.com/google/proto-lens#readme
bug-reports: https://github.com/google/proto-lens/issues
author: Zie Weaver
maintainer: [email protected]
copyright: Google Inc.
license: BSD3
license-file: LICENSE
build-type: Custom
cabal-version: >= 1.24
extra-source-files:
Changelog.md
tests/combinators.proto

source-repository head
type: git
location: https://github.com/google/proto-lens
subdir: proto-lens-combinators

custom-setup
setup-depends:
Cabal
, base >=4.8 && <4.12
, proto-lens-protoc ==0.3.*

library
exposed-modules:
Data.ProtoLens.Combinators
other-modules:
Paths_proto_lens_combinators
hs-source-dirs:
src
build-depends:
base >=4.8 && <4.12
, data-default-class >=0.0 && <0.2
, lens-family ==1.2.*
, proto-lens-protoc ==0.3.*
, transformers >=0.4 && <0.6
default-language: Haskell2010

test-suite combinators_test
type: exitcode-stdio-1.0
main-is: combinators_test.hs
other-modules:
Paths_proto_lens_combinators
Proto.Combinators Proto.Combinators_Fields
autogen-modules:
Proto.Combinators Proto.Combinators_Fields
hs-source-dirs:
tests
build-depends:
HUnit
, base
, lens-family
, lens-family-core
, proto-lens
, proto-lens-combinators
, proto-lens-protoc
, test-framework
, test-framework-hunit
default-language: Haskell2010
56 changes: 0 additions & 56 deletions proto-lens-discrimination/package.yaml

This file was deleted.

81 changes: 81 additions & 0 deletions proto-lens-discrimination/proto-lens-discrimination.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: proto-lens-discrimination
version: 0.1.1.0
synopsis: Support for using proto-lens types with http://hackage.haskell.org/package/discrimination.
description: Reflection-based implementations of Sort for proto-lens' generated types.
category: Data
homepage: https://github.com/google/proto-lens#readme
bug-reports: https://github.com/google/proto-lens/issues
author: Andrew Pritchard
maintainer: [email protected]
copyright: Google Inc.
license: BSD3
license-file: LICENSE
build-type: Custom
cabal-version: >= 1.24
extra-source-files:
tests/enum.proto

source-repository head
type: git
location: https://github.com/google/proto-lens
subdir: proto-lens-discrimination

custom-setup
setup-depends:
Cabal
, base >=4.8 && <4.12
, proto-lens-protoc ==0.3.*

library
exposed-modules:
Data.ProtoLens.Sort
Data.ProtoLens.Group
Data.ProtoLens.Discrimination
other-modules:
Paths_proto_lens_discrimination
hs-source-dirs:
src
build-depends:
base >=4.8 && <4.12
, bytestring ==0.10.*
, containers >=0.5 && <0.6
, contravariant >=1.3 && <1.5
, data-default >=0.5 && <0.8
, discrimination >=0.3 && <0.4
, discrimination-ieee754 ==0.1.*
, lens-family ==1.2.*
, proto-lens >=0.3 && <0.4
, proto-lens-protoc >=0.3 && <0.4
, text ==1.2.*
default-language: Haskell2010

test-suite discrimination_test
type: exitcode-stdio-1.0
main-is: disc_test.hs
other-modules:
Proto.Enum
Proto.Enum_Fields
autogen-modules:
Proto.Enum
Proto.Enum_Fields
hs-source-dirs:
tests
build-depends:
HUnit >=1.3 && <1.7
, base >=4.8 && <4.12
, bytestring ==0.10.*
, containers >=0.5 && <0.6
, contravariant >=1.3 && <1.5
, data-default >=0.5 && <0.8
, discrimination >=0.3 && <0.4
, discrimination-ieee754 ==0.1.*
, lens-family ==1.2.*
, proto-lens >=0.3 && <0.4
, proto-lens-arbitrary >=0.1 && <0.2
, proto-lens-discrimination
, proto-lens-protoc >=0.3 && <0.4
, test-framework ==0.8.*
, test-framework-hunit ==0.3.*
, test-framework-quickcheck2 ==0.3.*
, text ==1.2.*
default-language: Haskell2010
44 changes: 0 additions & 44 deletions proto-lens-protobuf-types/package.yaml

This file was deleted.

Loading

0 comments on commit a551143

Please sign in to comment.