From 71a6331c7a88404a500a3b6ba312f039486d69c4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 11 Oct 2019 12:42:49 -0400 Subject: [PATCH] Stub in a package for analysis. --- cabal.project | 4 ++ semantic-analysis/LICENSE | 21 +++++++++ semantic-analysis/README.md | 18 ++++++++ semantic-analysis/Setup.hs | 2 + semantic-analysis/semantic-analysis.cabal | 55 +++++++++++++++++++++++ semantic-analysis/test/Doctest.hs | 12 +++++ 6 files changed, 112 insertions(+) create mode 100644 semantic-analysis/LICENSE create mode 100644 semantic-analysis/README.md create mode 100644 semantic-analysis/Setup.hs create mode 100644 semantic-analysis/semantic-analysis.cabal create mode 100644 semantic-analysis/test/Doctest.hs diff --git a/cabal.project b/cabal.project index f94f1be91..6bac49236 100644 --- a/cabal.project +++ b/cabal.project @@ -1,4 +1,5 @@ packages: . + semantic-analysis semantic-core semantic-java semantic-json @@ -11,6 +12,9 @@ jobs: $ncpus package semantic ghc-options: -Werror +package semantic-analysis + ghc-options: -Werror + package semantic-core ghc-options: -Werror diff --git a/semantic-analysis/LICENSE b/semantic-analysis/LICENSE new file mode 100644 index 000000000..331b241b3 --- /dev/null +++ b/semantic-analysis/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-analysis/README.md b/semantic-analysis/README.md new file mode 100644 index 000000000..f31452a02 --- /dev/null +++ b/semantic-analysis/README.md @@ -0,0 +1,18 @@ +# semantic-analysis + +Program analysis by abstract definitional interpretation. + + +## Development + +This project consists of a Haskell package named `semantic-analysis`. The library’s sources are in [`src`][]. + +Development of `semantic-analysis` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-analysis/src diff --git a/semantic-analysis/Setup.hs b/semantic-analysis/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/semantic-analysis/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-analysis/semantic-analysis.cabal b/semantic-analysis/semantic-analysis.cabal new file mode 100644 index 000000000..8f5551ecf --- /dev/null +++ b/semantic-analysis/semantic-analysis.cabal @@ -0,0 +1,55 @@ +cabal-version: 2.4 + +name: semantic-analysis +version: 0.0.0.0 +synopsis: Program analysis by abstract definitional interpretation. +description: Program analysis abstractions and implementations by abstract definitional interpretation. +homepage: https://github.com/github/semantic/tree/master/semantic-analysis#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: + GHC == 8.6.5 + +common common + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + +library + import: common + hs-source-dirs: src + -- exposed-modules: + build-depends: + base >= 4.12 && < 5 + +test-suite doctest + import: common + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Doctest.hs + build-depends: + base >=4.9 && <4.13 + , doctest >=0.7 && <1.0 + , QuickCheck + , semantic-analysis diff --git a/semantic-analysis/test/Doctest.hs b/semantic-analysis/test/Doctest.hs new file mode 100644 index 000000000..9393da208 --- /dev/null +++ b/semantic-analysis/test/Doctest.hs @@ -0,0 +1,12 @@ +module Main +( main +) where + +import System.Environment +import Test.DocTest + +main :: IO () +main = do + args <- getArgs + autogen <- fmap (<> "/build/doctest/autogen") <$> lookupEnv "HASKELL_DIST_DIR" + doctest (maybe id ((:) . ("-i" <>)) autogen ("-isemantic-analysis/src" : "--fast" : if null args then ["semantic-analysis/src"] else args))