Comments (6)
Because SPM doesn't support arbitrary build actions, right now I have a simple makefile that I use for my project:
# This Makefile is a thin layer on top of Swift package manager that handles the
# building of the citron parser generator binary and the generation of
# Sources/Parser.swift from Sources/Parser.citron.
GRAMMAR = ./Sources/Parser
CC = cc
SWIFTC = swiftc
BIN = ./bin
CITRON_SRC = ./citron/src
CITRON = ${BIN}/citron
SWIFT_FLAGS =
LCOV_FILE = ./.build/coverage.lcov
SHELL=/bin/bash
build: ${GRAMMAR}.swift
swift build --enable-test-discovery ${SWIFT_FLAGS}
test: ${GRAMMAR}.swift
swift test --enable-test-discovery ${SWIFT_FLAGS}
test-lcov: ${GRAMMAR}.swift
swift build --build-tests --enable-code-coverage
$$(swift test --enable-test-discovery --enable-code-coverage --verbose \
${SWIFT_FLAGS} 2>&1 \
| tee /dev/tty | grep 'llvm-cov export' \
| sed -e 's/ export / export -format=lcov /') > "${LCOV_FILE}"
${CITRON}: ${CITRON_SRC}/citron.c
mkdir -p ${BIN} && ${CC} $^ -o $@
clean:
rm -rf ${GRAMMAR}.swift ./.build
${GRAMMAR}.swift: ${CITRON} ${GRAMMAR}.citron
rm -f $@
${CITRON} ${GRAMMAR}.citron -o $@
chmod -w $@
from citron.
Another reason: I tried to define my own Error
type and it broke CitronParser.swift
which (reasonably) uses Swift.Error
without qualification. If it were in its own module I wouldn't have had that problem.
from citron.
I think CitronLexer and CitronParser can be spawned off into separate SPM modules, but I'm not quite sure what do with citron.c. I think it should be in an executable module, but I'm not sure how it can get used by the consuming project.
How do you envisage running the citron
executable when using Citron through SPM? (Maybe you'll have a Makefile or Xcode run phase?) Does making citron.c part of an executable module help?
from citron.
@dabrahams Can you please check if PR #13 (merged to master) suffices for your needs?
from citron.
Good start; I got this warning when using it as a package though:
'citron' /Users/dabrahams/src/barcon/.build/checkouts/citron: warning: found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
/Users/dabrahams/src/barcon/.build/checkouts/citron/Sources/CitronParserModule/LICENSE.txt
from citron.
Sorry about that. Hopefully, commit 05da734 in master should fix that.
from citron.
Related Issues (17)
- Running expr example HOT 3
- LICENSE file and "public domain code?" HOT 5
- Generated parser should import CitronParserModule? HOT 1
- Package plugin HOT 3
- Grammar with no tokens produces invalid Swift
- %token requires a terminating .
- | not accepted in %token_set
- sourceLocation() line messes up error reporting for empty braces
- Nondeterministic behavior HOT 2
- More sourceLocation()s
- Option to ignore conflicts and accept the default resolution HOT 2
- Parser seems to spend most of its time doing type metadata lookup
- Is expr_ec_spm defunct now?
- `CitronTokenCode` should be public
- #sourceLocation? HOT 5
- More #sourceLocation HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from citron.