File tree Expand file tree Collapse file tree 3 files changed +35
-8
lines changed Expand file tree Collapse file tree 3 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,4 @@ install:
21
21
22
22
script :
23
23
- make sdist
24
- - cd dist
25
- - tar xvzf alex-*.tar.gz
26
- - cd alex-*/
27
- - " echo 'packages: .' > cabal.project"
28
- - cabal new-test --enable-tests
24
+ - make sdist-test-only
Original file line number Diff line number Diff line change
1
+ CABAL = cabal
2
+
1
3
HAPPY = happy
2
4
HAPPY_OPTS = -agc
3
5
4
6
ALEX = alex
5
7
ALEX_OPTS = -g
8
+ ALEX_VER = ` awk ' /^version:/ { print $$2 }' alex.cabal `
6
9
7
10
sdist ::
11
+ @case " ` $( CABAL) --numeric-version` " in \
12
+ 2.[2-9].* | [3-9].* ) ;; \
13
+ * ) echo " Error: needs cabal 2.2.0.0 or later (but got : ` $( CABAL) --numeric-version` )" ; exit 1 ;; \
14
+ esac
8
15
@if [ " ` git status -s` " != ' ' ]; then \
9
- echo Tree is not clean; \
16
+ echo " Error: Tree is not clean" ; \
10
17
exit 1; \
11
18
fi
19
+ rm -rf dist/
12
20
$(HAPPY ) $(HAPPY_OPTS ) src/Parser.y -o src/Parser.hs
13
21
$(ALEX ) $(ALEX_OPTS ) src/Scan.x -o src/Scan.hs
14
22
mv src/Parser.y src/Parser.y.boot
15
23
mv src/Scan.x src/Scan.x.boot
16
- cabal new-run gen-alex-sdist
17
- cabal sdist
24
+ $(CABAL ) new-run gen-alex-sdist
25
+ $(CABAL ) sdist
26
+ @if [ ! -f " dist/alex-$( ALEX_VER) .tar.gz" ]; then \
27
+ echo " Error: source tarball not found: dist/alex-$( ALEX_VER) .tar.gz" ; \
28
+ exit 1; \
29
+ fi
18
30
git checkout .
19
31
git clean -f
32
+
33
+ sdist-test :: sdist sdist-test-only
34
+ @rm -rf " dist/alex-$( ALEX_VER) /"
35
+
36
+ sdist-test-only ::
37
+ @if [ ! -f " dist/alex-$( ALEX_VER) .tar.gz" ]; then \
38
+ echo " Error: source tarball not found: dist/alex-$( ALEX_VER) .tar.gz" ; \
39
+ exit 1; \
40
+ fi
41
+ rm -rf " dist/alex-$( ALEX_VER) /"
42
+ tar -xf " dist/alex-$( ALEX_VER) .tar.gz" -C dist/
43
+ echo " packages: ." > " dist/alex-$( ALEX_VER) /cabal.project"
44
+ cd " dist/alex-$( ALEX_VER) /" && cabal new-test --enable-tests all
45
+ @echo " "
46
+ @echo " Success! dist/alex-$( ALEX_VER) .tar.gz is ready for distribution!"
47
+ @echo " "
Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ new-run gen-alex-sdist` pre-preprocessing step):
78
78
$ make sdist
79
79
$ cabal install dist/alex-*.tar.gz
80
80
81
+ For convenience, there's also a ` make sdist-test ` target which builds the
82
+ source source tarball and runs the test-suite from within the source dist.
83
+
81
84
## Contributing & Reporting Issues
82
85
83
86
Please report any bugs or comments at https://github.com/simonmar/alex/issues
You can’t perform that action at this time.
0 commit comments