Skip to content

Commit 6e2bd1e

Browse files
authored
Reduce number of cabal projects, improving build time (#580)
Use src/ as library; and exe/Main.hs as executable. Just as it used to be before. Not using neuron on GHCJS anymore.
1 parent ca824f9 commit 6e2bd1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+63
-108
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion

bin/format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22
set -xe
3-
nix-shell --pure --run "find neuron/src -name \*.hs | xargs ormolu -m inplace"
3+
nix-shell --pure --run "find {lib,exe,test} -name \*.hs | xargs ormolu -m inplace"

cabal.project

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.
Lines changed: 57 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: neuron
3-
version: 1.9.24.0
3+
version: 1.9.24.1
44
license: AGPL-3.0-only
55
copyright: 2020 Sridhar Ratnakumar
66
maintainer: [email protected]
@@ -11,9 +11,9 @@ bug-reports: https://github.com/srid/neuron/issues
1111
synopsis:
1212
Future-proof system for plain-text notes.
1313
description:
14-
neuron is a future-proof system for managing your plain-text Zettelkasten notes.
14+
neuron is a future-proof system for managing and publishing your plain-text Zettelkasten notes.
1515
data-files:
16-
src-bash/neuron-search
16+
neuron-search
1717

1818
source-repository head
1919
type: git
@@ -34,46 +34,68 @@ common library-common
3434
default-language: Haskell2010
3535
build-depends:
3636
base >=4.12 && < 4.15,
37-
aeson,
37+
aeson-gadt-th >= 0.2.5.0,
3838
aeson-pretty,
39-
mtl,
40-
text,
41-
time,
42-
relude,
43-
filepath,
39+
aeson,
4440
algebraic-graphs >= 0.5,
45-
parser-combinators,
46-
feed,
47-
containers,
48-
filepattern,
49-
megaparsec,
41+
ansi-terminal,
42+
async,
43+
clay,
44+
co-log,
5045
commonmark ^>= 0.1.0.2,
5146
commonmark-extensions ^>= 0.2.0.4,
5247
commonmark-pandoc >= 0.1.0.0 && < 0.3,
48+
constraints-extras,
49+
containers,
50+
data-default,
51+
dependent-map,
52+
dependent-sum-aeson-orphans >= 0.2.1.0,
53+
dependent-sum-template,
54+
dependent-sum,
55+
dhall >= 1.30,
56+
directory-contents,
57+
directory,
58+
either,
59+
exceptions,
60+
feed,
61+
file-embed,
62+
filepath,
63+
filepattern,
64+
foldl,
65+
fsnotify,
66+
HsYAML,
67+
iso8601-time,
68+
lsp,
69+
megaparsec,
70+
modern-uri,
71+
mtl,
72+
optparse-applicative,
5373
pandoc-link-context >= 1.0.2,
5474
pandoc-types >= 1.21,
5575
parsec,
56-
modern-uri,
57-
HsYAML,
58-
aeson-gadt-th >= 0.2.5.0,
59-
dependent-sum,
60-
dependent-sum-template,
61-
dependent-sum-aeson-orphans >= 0.2.1.0,
62-
dependent-map,
63-
constraints-extras,
64-
data-default,
65-
reflex,
76+
parser-combinators,
6677
reflex-dom-core,
6778
reflex-dom-pandoc >= 0.7.9.0,
68-
clay,
69-
tagged,
79+
reflex-fsnotify,
80+
reflex,
81+
relude,
7082
shower,
83+
tagged,
84+
text,
85+
time,
86+
timeit,
87+
unix,
7188
uri-encode,
72-
directory-contents
89+
uuid,
90+
wai-app-static,
91+
wai-extra,
92+
warp,
93+
which,
94+
with-utf8,
7395

7496
library
7597
import: library-common
76-
hs-source-dirs: src/lib
98+
hs-source-dirs: src
7799
exposed-modules:
78100
Neuron.Config.Type
79101
Neuron.Markdown
@@ -122,65 +144,6 @@ library
122144
Data.Time.DateMayTime
123145
Data.YAML.ToJSON
124146
Data.Structured.Breadcrumb
125-
126-
-- Everything below this marker should be deleted when using neuron.cabal in
127-
-- GHCJS as a library.
128-
-- ---------
129-
-- LIBMARKER
130-
131-
common app-common
132-
import: library-common
133-
default-language: Haskell2010
134-
build-depends:
135-
base >=4.12 && < 4.15,
136-
aeson,
137-
clay -any,
138-
mtl,
139-
containers,
140-
directory,
141-
exceptions,
142-
file-embed,
143-
optparse-applicative,
144-
pandoc-types,
145-
relude,
146-
iso8601-time,
147-
time,
148-
text,
149-
modern-uri,
150-
foldl,
151-
filepath,
152-
dhall >= 1.30,
153-
which,
154-
unix,
155-
megaparsec,
156-
dependent-sum,
157-
dependent-sum-template,
158-
data-default,
159-
uuid,
160-
with-utf8,
161-
either,
162-
timeit,
163-
reflex,
164-
reflex-fsnotify,
165-
fsnotify,
166-
wai-app-static,
167-
wai-extra,
168-
warp,
169-
async,
170-
co-log,
171-
ansi-terminal,
172-
lsp
173-
174-
-- Everything below will have to be stripped away, if whoever uses this repo
175-
-- will want to avoid non-core dependencies. Cabal doesn't seem to provide a way
176-
-- to selectively dependent on a library without pulling in every stanza defined
177-
-- here.
178-
-- cf. https://www.srid.ca/2012605.html
179-
180-
library neuron-app-lib
181-
import: app-common
182-
hs-source-dirs: src/app
183-
exposed-modules:
184147
Data.Structured.OpenGraph
185148
Data.Structured.OpenGraph.Render
186149
System.Directory.Contents.Extra
@@ -208,15 +171,9 @@ library neuron-app-lib
208171
Paths_neuron
209172
other-modules:
210173
Paths_neuron
211-
-- A trick to make ghcid reload if library dependencies change
212-
-- https://www.srid.ca/2012605.html
213-
if flag(ghcid)
214-
hs-source-dirs: src/lib
215-
else
216-
build-depends: neuron
217174

218175
test-suite neuron-test
219-
import: app-common
176+
import: library-common
220177
type: exitcode-stdio-1.0
221178
hs-source-dirs: test
222179
main-is: Spec.hs
@@ -227,9 +184,9 @@ test-suite neuron-test
227184
time
228185
default-language: Haskell2010
229186
if (flag(ghcid))
230-
hs-source-dirs: src/lib src/app
187+
hs-source-dirs: src
231188
else
232-
build-depends: neuron, neuron-app-lib
189+
build-depends: neuron
233190
other-modules:
234191
Data.PathTreeSpec
235192
Data.TagTreeSpec
@@ -241,12 +198,12 @@ test-suite neuron-test
241198

242199
-- To profile: ghc-options: -fexternal-interpreter -prof -fprof-auto -rtsopts
243200
executable neuron
244-
import: app-common
245-
hs-source-dirs: src/exe
201+
import: library-common
202+
hs-source-dirs: exe
246203
main-is: Main.hs
247204
-- FIXME: Threaded runtime causes high cpu usage when using reflex headless
248205
-- ghc-options: -threaded -rtsopts -with-rtsopts=-N
249206
if (flag(ghcid))
250-
hs-source-dirs: src/lib src/app
207+
hs-source-dirs: src
251208
else
252-
build-depends: neuron, neuron-app-lib
209+
build-depends: neuron

project.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let
3434
});
3535

3636
sources = {
37-
neuron = gitignoreSource ./neuron;
37+
neuron = gitignoreSource ./.;
3838
reflex-dom-pandoc = thunkSource ./dep/reflex-dom-pandoc;
3939
pandoc-link-context = thunkSource ./dep/pandoc-link-context;
4040
directory-contents = thunkSource ./dep/directory-contents;
@@ -43,7 +43,7 @@ let
4343

4444
searchBuilder = ''
4545
mkdir -p $out/bin
46-
cp $src/src-bash/neuron-search $out/bin/neuron-search
46+
cp $src/neuron-search $out/bin/neuron-search
4747
chmod +x $out/bin/neuron-search
4848
wrapProgram $out/bin/neuron-search --prefix 'PATH' ':' ${
4949
with (if pkgsForBins != null then pkgsForBins else pkgs);
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)