Skip to content

Commit e4adf6e

Browse files
authored
Merge pull request #8 from NathanReb/upgrade-ppxlib-0-18
Make ppx_getenv compatible with ppxlib.0.18.0
2 parents 4b75f60 + 3afef28 commit e4adf6e

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

.travis.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
language: c
2-
install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-docker.sh
3-
script: bash -ex .travis-docker.sh
4-
services:
5-
- docker
2+
install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-opam.sh
3+
script: bash -ex .travis-opam.sh
64
env:
75
global:
86
- PACKAGE="ppx_getenv"
97
matrix:
10-
- DISTRO=debian-stable OCAML_VERSION=4.04
11-
- DISTRO=debian-stable OCAML_VERSION=4.05
12-
- DISTRO=debian-stable OCAML_VERSION=4.06
13-
- DISTRO=debian-stable OCAML_VERSION=4.07
14-
- DISTRO=debian-stable OCAML_VERSION=4.08
15-
- DISTRO=debian-stable OCAML_VERSION=4.09
16-
- DISTRO=debian-stable OCAML_VERSION=4.10
17-
- DISTRO=debian-stable OCAML_VERSION=4.11.0+trunk OCAML_BETA=enable
8+
- OCAML_VERSION=4.04
9+
- OCAML_VERSION=4.05
10+
- OCAML_VERSION=4.06
11+
- OCAML_VERSION=4.07
12+
- OCAML_VERSION=4.08
13+
- OCAML_VERSION=4.09
14+
- OCAML_VERSION=4.10
15+
- OCAML_VERSION=4.11

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
(tags ("syntax"))
1616
(depends
1717
(ocaml (>= 4.04.0))
18-
(ppxlib (>= 0.9.0))
18+
(ppxlib (>= 0.18.0))
1919
(ounit2 :with-test)
2020
(odoc :with-doc)))

ppx_getenv.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bug-reports: "https://github.com/ocaml-ppx/ppx_getenv/issues"
1111
depends: [
1212
"dune" {>= "2.0"}
1313
"ocaml" {>= "4.04.0"}
14-
"ppxlib" {>= "0.9.0"}
14+
"ppxlib" {>= "0.18.0"}
1515
"ounit2" {with-test}
1616
"odoc" {with-doc}
1717
]

src/ppx_getenv.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
open Ppxlib
2-
open Ppxlib.Ast_helper
32

43
let getenv s = try Sys.getenv s with Not_found -> ""
54

65
let expander ~loc ~path:_ = function
76
| (* Should have a single structure item, which is evaluation of a constant string. *)
87
PStr [{ pstr_desc =
98
Pstr_eval ({ pexp_loc = loc;
10-
pexp_desc = Pexp_constant (Pconst_string (sym, None)); _ }, _); _ }] ->
9+
pexp_desc = Pexp_constant (Pconst_string (sym, _, None)); _ }, _); _ }] ->
1110
(* Replace with a constant string with the value from the environment. *)
12-
Exp.constant ~loc (Pconst_string (getenv sym, None))
11+
Ast_builder.Default.estring ~loc (getenv sym)
1312
| _ ->
1413
Location.raise_errorf ~loc "[%%getenv] accepts a string, e.g. [%%getenv \"USER\"]"
1514

0 commit comments

Comments
 (0)