Skip to content

Commit

Permalink
Merge branch 'master' into 3501-Add-Generated-by-Drasil-Version-Try-2
Browse files Browse the repository at this point in the history
  • Loading branch information
harmanpreet-sagar committed Jul 25, 2023
2 parents 66db830 + 8d5e8f8 commit 7b99af1
Show file tree
Hide file tree
Showing 283 changed files with 895 additions and 842 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Examples

code/drasil-example/dblpendulum/ @JacquesCarette @cd155
code/drasil-example/dblpend/ @JacquesCarette @cd155
code/drasil-example/glassbr/ @JacquesCarette @samm82
code/drasil-example/projectile/ @JacquesCarette @samm82 @bmaclach
code/drasil-example/template/ @JacquesCarette @samm82
Expand All @@ -16,7 +16,7 @@ code/drasil-example/template/ @JacquesCarette @samm82
# Note that @JacquesCarette and @smiths have to be added to each rule because of how CODEOWNERS files work

code/stable/ @JacquesCarette @smiths
code/stable/dblpendulum/ @JacquesCarette @smiths @cd155
code/stable/dblpend/ @JacquesCarette @smiths @cd155
code/stable/glassbr/ @JacquesCarette @smiths @samm82
code/stable/gooltest/ @JacquesCarette @smiths @bmaclach
code/stable/projectile/ @JacquesCarette @smiths @samm82 @bmaclach
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ jobs:
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.swift/usr/bin" >> $GITHUB_PATH
- name: "HLint"
run: make hot_hlint
- name: "Install dependencies"
run: make stackArgs="--no-terminal" deps
- name: "Build"
Expand Down Expand Up @@ -96,7 +94,7 @@ jobs:
bash scripts/deploy_wrapper.bash
- name: "Deploy 🚀"
if: ${{ fromJSON(env.is_deployment) }}
uses: JamesIves/github-pages-deploy-action@v4.4.2
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
git-config-name: ${{ secrets.BOT_NAME }}
git-config-email: ${{ secrets.BOT_EMAIL }}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/Lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
pull_request:
branches: master
paths: 'code/drasil-**'
name: Linter
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
working-directory: code
jobs:
linter:
name: "HLint"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: "HLint"
run: make hot_hlint
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ swhs_diff | Solar Water Heating System with Phase Change Material
glassbr_diff | Glass-BR
hghc_diff | HGHC Toy Example
ssp_diff | Slope Stability Analysis
nopcm_diff | Minimal SWHS Example, with PCM Removed
swhsnopcm_diff | Minimal SWHS Example, with PCM Removed
projectile_diff | Projectile Motion Analysis
pdcontroller_diff | Proportional Derivative Controller
dblpendulum_diff | Double Pendulum
sglpendulum_diff | Single Pendulum
dblpend_diff | Double Pendulum
sglpend_diff | Single Pendulum

For more commands related to Drasil, use `make help` or check out the [Makefile documentation](https://github.com/JacquesCarette/Drasil/wiki/Makefile).

Expand All @@ -92,11 +92,11 @@ swhs | Solar Water Heating System with PCM (SWHS)
glassbr | Glass-BR
hghc | HGHC toy example
ssp | Slope Stability Analysis (SSP)
nopcm | SWHS without PCM (NoPCM)
swhsnopcm | SWHS without PCM (SWHSNoPCM)
projectile | Projectile motion analysis
pdcontroller | Proportional Derivative Controller
dblpendulum | Double Pendulum
sglpendulum | Single Pendulum
dblpend | Double Pendulum
sglpend | Single Pendulum

This runs the examples manually from the .stack-work folder after building, and the generated docs will
appear in this folder (i.e. in the SRS folders). Due to this placement, these generated
Expand Down
36 changes: 18 additions & 18 deletions code/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,44 @@ PACKAGE_GEN_TARGET = BUILD DOC GRAPH
#--------------------------------------------#

# Current list of examples
SRC_EXAMPLES = glassbr nopcm projectile pdcontroller dblpendulum
EXAMPLES = $(SRC_EXAMPLES) hghc swhs ssp gamephysics template sglpendulum
SRC_EXAMPLES = glassbr swhsnopcm projectile pdcontroller dblpend
EXAMPLES = $(SRC_EXAMPLES) hghc swhs ssp gamephysics template sglpend
GOOLTEST = codegenTest

# where they live
HGHC_DIR = hghc
GLASSBR_DIR = glassbr
NOPCM_DIR = nopcm
SWHSNOPCM_DIR = swhsnopcm
SWHS_DIR = swhs
SSP_DIR = ssp
GAMEPHYSICS_DIR = gamephysics
PROJECTILE_DIR = projectile
TEMPLATE_DIR = template
GOOLTEST_DIR = gooltest
DBLPENDULUM_DIR = dblpendulum
SGLPENDULUM_DIR = sglpendulum
DBLPEND_DIR = dblpend
SGLPEND_DIR = sglpend
PDCONTROLLER_DIR = pdcontroller

# Directories for examples with multiple src versions
MULTI_SRC_DIRS = $(PROJECTILE_DIR)

# All example directories
EXAMPLE_DIRS = $(MULTI_SRC_DIRS) $(HGHC_DIR) $(GLASSBR_DIR) $(NOPCM_DIR) \
$(SWHS_DIR) $(SSP_DIR) $(GAMEPHYSICS_DIR) $(DBLPENDULUM_DIR) $(SGLPENDULUM_DIR)\
EXAMPLE_DIRS = $(MULTI_SRC_DIRS) $(HGHC_DIR) $(GLASSBR_DIR) $(SWHSNOPCM_DIR) \
$(SWHS_DIR) $(SSP_DIR) $(GAMEPHYSICS_DIR) $(DBLPEND_DIR) $(SGLPEND_DIR)\
$(PDCONTROLLER_DIR)

# and the name of their executables
HGHC_EXE = hghc
GLASSBR_EXE = glassbr
NOPCM_EXE = nopcm
SWHSNOPCM_EXE = swhsnopcm
SWHS_EXE = swhs
SSP_EXE = ssp
GAMEPHYSICS_EXE = gamephysics
PROJECTILE_EXE = projectile
TEMPLATE_EXE = template
GOOLTEST_EXE = codegenTest
DBLPENDULUM_EXE = dblpendulum
SGLPENDULUM_EXE = sglpendulum
DBLPEND_EXE = dblpend
SGLPEND_EXE = sglpend
PDCONTROLLER_EXE = pdcontroller

# and the associated per-example information generated
Expand Down Expand Up @@ -146,8 +146,8 @@ WEBSITE_FOLDER = $(WEBSITE_FOLDER_NAME)/HTML/
FULL ?= 0

# GHC debug options
PROFALL = --executable-profiling --library-profiling
PROFEXEC = +RTS -xc -P
PROFALL = --profile
PROFEXEC = --profile --rts-options '-xc -P'

# GHC build options
GHCTHREADS ?= 2
Expand Down Expand Up @@ -243,7 +243,7 @@ packagedeps: graphmod check_dot
@echo ----------------------------
@echo Generating package dependency graph
@echo ----------------------------
@stack dot --prune dblpendulum,gamephysics,glassbr,hghc,nopcm,pdcontroller,projectile,sglpendulum,ssp,swhs,template,drasil-website | tred | dot -Tpng > "$(GRAPH_FOLDER)drasil-all-pkgs-deps".png
@stack dot --prune dblpend,gamephysics,glassbr,hghc,swhsnopcm,pdcontroller,projectile,sglpend,ssp,swhs,template,drasil-website | tred | dot -Tpng > "$(GRAPH_FOLDER)drasil-all-pkgs-deps".png

#--------------------------------------------------------------#
#--- Targets that are used for individual packages/examples ---#
Expand All @@ -267,13 +267,13 @@ $(filter %$(BUILD_P_SUFFIX), $(BUILD_PACKAGES)): %$(BUILD_P_SUFFIX): check_stack
$(filter %$(GEN_E_SUFFIX), $(GEN_EXAMPLES)): %$(GEN_E_SUFFIX):
stack build $(stackArgs) "$(EEXE)"
@mkdir -p "$(BUILD_FOLDER)$(EDIR)"
cd "$(BUILD_FOLDER)$(EDIR)" && stack exec -- "$(EEXE)" $(EXECARGS)
cd "$(BUILD_FOLDER)$(EDIR)" && stack exec $(EXECARGS) -- "$(EEXE)"

# Compiles GOOL examples to concrete code (Java, C++, etc.)
$(GOOLTEST)$(GEN_E_SUFFIX):
stack build $(stackArgs) "drasil-code:exe:$(GOOLTEST_EXE)"
@mkdir -p "$(BUILD_FOLDER)$(GOOLTEST_DIR)"
cd "$(BUILD_FOLDER)$(GOOLTEST_DIR)" && stack exec -- "$(GOOLTEST_EXE)" $(EXECARGS)
cd "$(BUILD_FOLDER)$(GOOLTEST_DIR)" && stack exec $(EXECARGS) -- "$(GOOLTEST_EXE)"

# Install individual Drasil examples
$(filter %$(INSTALL_E_SUFFIX), $(INSTALL_EXAMPLES)): %$(INSTALL_E_SUFFIX):
Expand All @@ -285,7 +285,7 @@ $(filter %$(INSTALL_E_SUFFIX), $(INSTALL_EXAMPLES)): %$(INSTALL_E_SUFFIX):
$(filter %$(TRACE_GRAPH_SUFFIX), $(TRACE_GRAPH_EXAMPLES)): %$(TRACE_GRAPH_SUFFIX): graphmod
stack build $(stackArgs) "$(EEXE)"
@mkdir -p "$(BUILD_FOLDER)$(EDIR)"
cd "$(BUILD_FOLDER)$(EDIR)" && stack exec -- "$(EEXE)" $(EXECARGS)
cd "$(BUILD_FOLDER)$(EDIR)" && stack exec $(EXECARGS) -- "$(EEXE)"
@mkdir -p "$(TRACEY_GRAPHS_FOLDER)$(EDIR)"
@echo Making traceability graphs for "$(EEXE)"
@if [ -d "$(BUILD_FOLDER)$(EDIR)/$(TRACEY_GRAPH_FOLDER)" ]; then \
Expand Down Expand Up @@ -342,8 +342,8 @@ $(filter %$(GRAPH_P_SUFFIX), $(GRAPH_PACKAGES)): %$(GRAPH_P_SUFFIX): graphmod ch
analysis: graphmod ##@Analysis Generate a table and some graphs to analyze Drasil's class, datatype, and instance structures.
- rm -rf "$(ANALYSIS_FOLDER)"
@mkdir -p "$(ANALYSIS_FOLDER)"
cd $(SCRIPT_FOLDER) && stack exec -- runghc ClassInstDepGen.hs
cd $(SCRIPT_FOLDER) && stack exec -- runghc TypeDepGen.hs
cd $(SCRIPT_FOLDER) && stack ClassInstDepGen.hs
cd $(SCRIPT_FOLDER) && stack TypeDepGen.hs
@echo "Analysis complete. Please see '$(ANALYSIS_FOLDER)' folder."

convertAnalyzed: ##@Analysis Convert analyzed dot graphs into SVGs.
Expand Down
6 changes: 3 additions & 3 deletions code/datafiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Last updated: July 29, 2021
--------------------------------------------------

This folder contains helper files including (but not limited to) system figures or images, graphs, sample inputs, and generated code dependencies for these Drasil examples:
- **dblpendulum**
- **dblpend**
- **gamephysics**
- **glassbr**
- **nopcm**
- **swhsnopcm**
- **pdcontroller**
- **projectile**
- **sglpendulum**
- **sglpend**
- **ssp**
- **swhs**

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Binary file removed code/datafiles/nopcm/SystemContextFigure.png
Binary file not shown.
File renamed without changes
Binary file added code/datafiles/swhsnopcm/SystemContextFigure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions code/drasil-code/lib/Language/Drasil/Choices.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ data Choices = Choices {
class RenderChoices a where
showChs :: a -> Sentence
showChsList :: [a] -> Sentence
showChsList [] = S "None"
showChsList lst = foldlSent_ (map showChs lst)

-- | Architecture of a program
Expand Down
8 changes: 2 additions & 6 deletions code/drasil-docLang/lib/Drasil/DocumentLanguage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import qualified Drasil.Sections.SpecificSystemDescription as SSD (assumpF,
import qualified Drasil.Sections.Stakeholders as Stk (stakeholderIntro,
tClientF, tCustomerF)
import qualified Drasil.DocumentLanguage.TraceabilityMatrix as TM (
generateTraceTableView, traceMHeader, TraceViewCat)
generateTraceTableView, traceMHeader, layoutUIDs)
import qualified Drasil.DocumentLanguage.TraceabilityGraph as TG (traceMGF)
import Drasil.DocumentLanguage.TraceabilityGraph (traceyGraphGetRefs)
import Drasil.Sections.TraceabilityMandGs (traceMatStandard)
Expand Down Expand Up @@ -429,13 +429,9 @@ mkTraceabilitySec (TraceabilityProg progs) si@SI{_sys = sys} = TG.traceMGF trace
trace = map (\(TraceConfig u _ desc cols rows) -> TM.generateTraceTableView
u desc cols rows si) fProgs
fProgs = filter (\(TraceConfig _ _ _ cols rows) -> not $ null
(header (showUIDs rows sidb) si) || null (header (showUIDs cols sidb) si)) progs
(header (TM.layoutUIDs rows sidb) si) || null (header (TM.layoutUIDs cols sidb) si)) progs
sidb = _sysinfodb si

-- | Helper to get UIDs
showUIDs :: [TM.TraceViewCat] -> ChunkDB -> [UID] -> [UID]
showUIDs a s e = concatMap (filter (`elem` (Map.keys $ s ^. traceTable)) . (\ x -> x e s)) a

-- | Helper to get headers of rows and columns
header :: ([UID] -> [UID]) -> SystemInformation -> [Sentence]
header f = TM.traceMHeader (f . nub . Map.keys . (^. refbyTable))
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-docLang/lib/Drasil/Sections/Introduction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ overviewParagraph programDefinition = foldlSP [S "The following", phrase section
-- | Constructor for Purpose of Document section that each example controls.
purpDocPara1 :: CI -> Sentence
purpDocPara1 proName = foldlSent [S "The primary purpose of this", phrase document, S "is to",
S "record the", plural requirement, S "of the" +:+. titleize proName,
S "record the", plural requirement, S "of" +:+. getAcc proName,
atStart' goal `sC` plural assumption `sC` plural thModel `sC`
plural definition `sC` S "and other", phrase model, S "derivation",
phrase information, S "are specified" `sC` S "allowing the reader to fully",
Expand Down
6 changes: 3 additions & 3 deletions code/drasil-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Last updated: July 22, 2021

This folder contains our working examples (implementations in Drasil of the previously manually created case studies).

**dblpendulum**
**dblpend**
- Contains the current state of the Double Pendulum case study implemented in Drasil

**gamephysics**
Expand All @@ -17,7 +17,7 @@ This folder contains our working examples (implementations in Drasil of the prev
**hghc**
- Contains the current state of the HGHC (fuel pin) example implemented in Drasil

**nopcm**
**swhsnopcm**
- Contains the current state of the solar water heating system case study implemented in Drasil

**pdcontroller**
Expand All @@ -26,7 +26,7 @@ This folder contains our working examples (implementations in Drasil of the prev
**projectile**
- Contains the current work on implementing the projectile example in Drasil

**sglpendulum**
**sglpend**
- Contains the current state of the Single Pendulum case study implemented in Drasil

**ssp**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import GHC.IO.Encoding

import Language.Drasil.Generate (gen, typeCheckSI, genCode, genDot, genLog,
DocSpec(DocSpec), DocType(SRS), Format(..), docChoices, dumpEverything)
import Drasil.DblPendulum.Body (srs, printSetting, fullSI)
import Drasil.DblPendulum.Choices (choices, code)
import Drasil.DblPend.Body (srs, printSetting, fullSI)
import Drasil.DblPend.Choices (choices, code)

main :: IO()
main = do
setLocaleEncoding utf8
dumpEverything fullSI ".drasil/"
typeCheckSI fullSI
gen (DocSpec (docChoices SRS [HTML, TeX, JSON]) "DblPendulum_SRS") srs printSetting
gen (DocSpec (docChoices SRS [HTML, TeX, JSON]) "DblPend_SRS") srs printSetting
genCode choices code
genDot fullSI
genLog fullSI printSetting
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE PostfixOperators #-}
module Drasil.DblPendulum.Assumptions (twoDMotion, cartSys, cartSysR,
module Drasil.DblPend.Assumptions (twoDMotion, cartSys, cartSysR,
yAxisDir, startOriginSingle, startOriginDouble, firstPend, secondPend, assumpSingle, assumpDouble) where

import Language.Drasil
Expand All @@ -9,7 +9,7 @@ import qualified Language.Drasil.Sentence.Combinators as S
import Data.Drasil.Concepts.Documentation (assumpDom)
import Data.Drasil.Concepts.Math (cartesian, xAxis, yAxis, direction, origin, positive)
import Data.Drasil.Concepts.Physics (gravity, twoD, pendulum)
import Drasil.DblPendulum.Concepts (pendMotion, firstRod, secondRod, firstObject, secondObject)
import Drasil.DblPend.Concepts (pendMotion, firstRod, secondRod, firstObject, secondObject)

assumpBasic :: [ConceptInstance]
assumpBasic = [twoDMotion, cartSys, cartSysR, yAxisDir]
Expand Down
Loading

0 comments on commit 7b99af1

Please sign in to comment.