mirror of
https://github.com/github/semantic.git
synced 2024-12-23 23:11:50 +03:00
Try a different approach for embedding the git commit sha
This commit is contained in:
parent
f0956624a0
commit
1ab38e297a
@ -1,5 +1,6 @@
|
||||
Dockerfile
|
||||
/.licenses
|
||||
/.git
|
||||
.ghc.environment.x86_64-darwin-8.6.5
|
||||
|
||||
/bin
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ dist-repl
|
||||
tmp/
|
||||
/bin/
|
||||
|
||||
/src/Semantic/Version.hs.bak
|
||||
/semanticd/test/current
|
||||
/semanticd/test/rover-example-config/semantic.log
|
||||
/test/fixtures/*/examples
|
||||
|
21
Dockerfile
21
Dockerfile
@ -22,26 +22,11 @@ ENTRYPOINT ["/protobuf/bin/protoc", "-I/protobuf", "--plugin=protoc-gen-haskell=
|
||||
FROM haskell:8.6 as build
|
||||
WORKDIR /build
|
||||
|
||||
# Build just the dependencies so that this layer can be cached
|
||||
COPY semantic.cabal .
|
||||
COPY semantic-analysis semantic-analysis/
|
||||
COPY semantic-core semantic-core/
|
||||
COPY semantic-java semantic-java/
|
||||
COPY semantic-json semantic-json/
|
||||
COPY semantic-python semantic-python/
|
||||
COPY semantic-source semantic-source/
|
||||
COPY semantic-tags semantic-tags/
|
||||
COPY semantic-ast semantic-ast/
|
||||
COPY cabal.project .
|
||||
RUN cabal v2-update && \
|
||||
cabal v2-configure --flags="release" --ghc-options="-D$GIT_COMMIT"
|
||||
COPY cabal.project.local .
|
||||
RUN cabal v2-build --only-dependencies
|
||||
|
||||
|
||||
# Build all of semantic
|
||||
COPY . .
|
||||
RUN cabal v2-build semantic:exe:semantic
|
||||
RUN cabal v2-update && \
|
||||
cabal v2-configure --flags="release" && \
|
||||
cabal v2-build semantic:exe:semantic
|
||||
|
||||
# A fake `install` target until we can get `cabal v2-install` to work
|
||||
RUN cp $(find dist-newstyle/build/x86_64-linux -name semantic -type f -perm -u=x) /usr/local/bin/semantic
|
||||
|
@ -11,7 +11,8 @@ BUILD_SHA=$(git rev-parse HEAD 2>/dev/null)
|
||||
DOCKER_IMAGE=docker.pkg.github.com/github/semantic/semantic
|
||||
|
||||
# Build
|
||||
docker build -t $DOCKER_IMAGE --build-arg BUILD_SHA=$BUILD_SHA.
|
||||
sed -i .bak "s/buildSHA =.*/buildSHA = \"$BUILD_SHA\"/" src/Semantic/Version.hs
|
||||
docker build -t $DOCKER_IMAGE .
|
||||
|
||||
# Make sure semantic is in the image.
|
||||
docker run --rm $DOCKER_IMAGE --version
|
||||
|
@ -1,30 +1,16 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
#ifdef COMPUTE_GIT_SHA
|
||||
{-# OPTIONS_GHC -fforce-recomp #-} -- So that gitHash is correct.
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
#endif
|
||||
module Semantic.Version
|
||||
( buildSHA
|
||||
, buildVersion
|
||||
) where
|
||||
|
||||
import Data.Version (showVersion)
|
||||
#ifdef COMPUTE_GIT_SHA
|
||||
import Development.GitRev
|
||||
#endif
|
||||
import Paths_semantic (version)
|
||||
|
||||
-- The SHA1 hash of this build of semantic.
|
||||
-- If compiled as a development build, this will be @<development>@.
|
||||
buildSHA :: String
|
||||
#if defined(GIT_COMMIT)
|
||||
buildSHA = "GIT_COMMIT"
|
||||
#elif defined(COMPUTE_GIT_SHA)
|
||||
buildSHA = $(gitHash)
|
||||
#else
|
||||
buildSHA = "unspecified"
|
||||
#endif
|
||||
|
||||
-- The version string of this build of semantic.
|
||||
buildVersion :: String
|
||||
buildVersion = showVersion version
|
||||
|
||||
-- The SHA1 hash of this build of semantic.
|
||||
-- If compiled as a development build, this will be @<development>@.
|
||||
buildSHA :: String
|
||||
buildSHA = "<development>"
|
||||
|
Loading…
Reference in New Issue
Block a user