Commit 977e1e4b authored by Bas Lijnse's avatar Bas Lijnse

Merge branch 'remove-or-fix-erroneous-files' into 'master'

fix or remove erroneous files from the Libraries folder

See merge request !352
parents d85d3254 38fadd49
Pipeline #35765 passed with stage
in 6 minutes and 45 seconds
......@@ -13,12 +13,12 @@ manageStore
selectStore :: Task (String,String) //Namespace and store name
selectStore
= (enterChoiceWithShared (Title "Namespace") [] storeNamespaces
= (enterChoiceWithShared [] storeNamespaces <<@ Title "Namespace"
>&> \sNamespace -> whileUnchanged sNamespace
\mbNamespace -> case mbNamespace of
Nothing = enterChoice (Title "Stores") [ChooseFromGrid id] []
Just ns = enterChoiceWithShared (Title "Stores") [ChooseFromGrid id] (sdsFocus ns storeNames) @ (\s -> (ns,s))
) <<@ (ArrangeWithSideBar 0 TopSide 55 False)
Nothing = enterChoice [ChooseFromGrid id] [] <<@ Title "Store"
Just ns = enterChoiceWithShared [ChooseFromGrid id] (sdsFocus ns storeNames) <<@ Title "Stores" @ (\s -> (ns,s))
) <<@ ArrangeWithSideBar 0 TopSide False
//Low-level access
deleteStore :: (String,String) -> Task ()
......
definition module iTasks.Extensions.Development.CleanCode
/**
* This module provides tasks and types for dealing with Clean source code
*/
import iTasks
implementation module iTasks.Extensions.Development.CleanCode
import iTasks
viewCleanModule :: FilePath String -> Task ()
viewCleanModule baseDir moduleName
= viewInformation "TODO" [] (baseDir,moduleName) @! ()
import System.Directory, System.File
/**
* Given a list of absolute path names, offers a tree structure choice to select a file
* @param absolute paths of directories to search through
* @param only show files with given extensions, all files are shown if this list is empty
* @return selected file and the absolute path directory name it is found
*/
chooseFile :: [FilePath] [FileExtension] -> Task (FilePath,FilePath)
chooseFile paths extensions
= accWorld (getFilesInDir paths extensions)
>>- \tree -> enterChoice [Att (Title "Select File"), Att IconEdit] [ChooseWith (ChooseFromTree (\list _ -> toChoiceTree list))] (treeToList tree [])
@? adjust
where
toChoiceTree :: [(Int,(FilePath,[FilePath],FilePath))] -> [ChoiceTree FilePath]
toChoiceTree [] = []
toChoiceTree [(i,(path,[],fileName)):next]
= [{label = fileName, icon = Nothing, value = ChoiceNode i, type = LeafNode}:toChoiceTree next]
toChoiceTree [(i,(path,[dir:dirs],fileName)):next]
= [{label = dir, icon = Nothing, value = GroupNode dir, type = CollapsedNode (toChoiceTree inDir`)}:toChoiceTree outDir]
where
(inDir,outDir) = span (\(_,(_,dirs,_)) -> if (not (isEmpty dirs)) (hd dirs == dir) False) next
inDir` = [(i,(path,dirs,fileName)):[(j,(path,tl dirs,name)) \\ (j,(path,dirs,name)) <- inDir]]
adjust (Value (path,dirs,fileName) stab)
| fileName == "" = NoValue
= Value (foldl (</>) path dirs,fileName) stab
adjust NoValue = NoValue
treeToList :: [(FilePath,[TreeNode FilePath])] [FilePath] -> [(FilePath,[FilePath],FilePath)]
treeToList [] dirs = []
treeToList [(path,[Leaf file:files]):tree] dirs = [(path,dirs,file): treeToList [(path,files)] dirs] ++ treeToList tree []
treeToList [(path,[Node dir childs :files]):tree] dirs = treeToList [(path,childs)] (dirs++[dir]) ++ treeToList [(path,files)] dirs ++ treeToList tree []
treeToList [_:tree] dirs = treeToList tree []
getFilesInDir :: [FilePath] [FileExtension] !*World -> ([(FilePath,[TreeNode FilePath])],*World)
getFilesInDir [] extensions w = ([],w)
getFilesInDir [path:paths] extensions w
# (treeFiles,w) = getTree (takeDirectory path) [dropDirectory path] w
# (ntrees,w) = getFilesInDir paths extensions w
= ([(takeDirectory path,treeFiles):ntrees],w)
where
getTree absolutePath [] w = ([],w)
getTree absolutePath [fileName:fileNames] w
# absoluteFileName = absolutePath </> fileName
# (mbInfo,w) = getFileInfo absoluteFileName w
| isError mbInfo = getTree absolutePath fileNames w
| (fromOk mbInfo).directory // file is directory name
# (filesInDir,w) = getFilesInPath absoluteFileName w
# (dirNodes,w) = getTree absoluteFileName filesInDir w
# (filesNodes,w) = getTree absolutePath fileNames w
= case dirNodes of
[] -> (filesNodes,w)
_ -> ([Node fileName dirNodes:filesNodes],w)
| isEmpty extensions || isMember (snd (splitExtension fileName)) extensions
# (treeNodes,w) = getTree absolutePath fileNames w
= ([Leaf fileName:treeNodes],w)
= getTree absolutePath fileNames w
getFilesInPath :: !FilePath !*World -> ([FilePath],!*World)
getFilesInPath path w
# (mbFiles,w) = readDirectory path w
| isError mbFiles = ([],w)
= ([name \\ name <- fromOk mbFiles | name <> "." && name <> ".."],w)
readDir :: !FilePath !*World -> ([FilePath],!*World)
readDir path w
# (mbInfo,w) = getFileInfo path w
| isError mbInfo = ([],w)
| (fromOk mbInfo).directory = getFilesInPath path w
......@@ -6,4 +6,4 @@ definition module iTasks.Extensions.FileDialog
*/
import iTasks
editFilePath :: String Action (Maybe FilePath) -> Task (Maybe FilePath)
editFilePath :: String Action !(Maybe FilePath) -> Task (Maybe FilePath)
......@@ -10,7 +10,7 @@ from Data.Map import unions
derive class iTask FileInfo, Tm
editFilePath :: String Action (Maybe FilePath) -> Task (Maybe FilePath)
editFilePath :: String Action !(Maybe FilePath) -> Task (Maybe FilePath)
editFilePath title action initialPath
= (determineInitialDir initialPath
>>- \(initDir,initFile) ->
......@@ -35,33 +35,33 @@ where
accWorldError (getFileInfo fullPath) snd
@ \{FileInfo|directory} -> if directory (fullPath,Nothing) (takeDirectory fullPath,Just (dropDirectory fullPath))
navigateUp :: (Shared (FilePath,Maybe String)) -> Task (FilePath, Maybe String)
navigateUp :: (Shared sds (FilePath,Maybe String)) -> Task (FilePath, Maybe String) | RWShared sds
navigateUp sSelection
= editSharedChoiceWithShared () [ChooseFromDropdown fst] (ancestorDirectories sSelection) (selection sSelection)
= editSharedChoiceWithShared [ChooseFromDropdown fst] (ancestorDirectories sSelection) (selection sSelection)
chooseFromCurrentDirectory :: (Shared (FilePath,Maybe String))-> Task (FilePath, Maybe String)
chooseFromCurrentDirectory :: (Shared sds (FilePath,Maybe String))-> Task (FilePath, Maybe String) | RWShared sds
chooseFromCurrentDirectory sSelection
= editSharedChoiceWithShared () [ChooseFromList view] (filesInCurDir sSelection) (selection sSelection)
= editSharedChoiceWithShared [ChooseFromList view] (filesInCurDir sSelection) (selection sSelection)
where
view (path,Nothing) = "[DIR] " +++ dropDirectory path
view (path,Just filename) = "[FILE] " +++ filename
selection sds = mapReadWrite (Just, const) sds
selection sds = mapReadWrite (Just, const) Nothing sds
editFilename :: (Shared (FilePath, Maybe String)) -> Task (FilePath,Maybe String)
editFilename sSelection = updateSharedInformation () [UpdateAs snd (\(d,_) f -> (d,f))] sSelection
editFilename :: (Shared sds (FilePath, Maybe String)) -> Task (FilePath,Maybe String) | RWShared sds
editFilename sSelection = updateSharedInformation [UpdateSharedAs snd (\(d,_) f -> (d,f)) \_->id] sSelection
fileListLayout = setUIAttributes (unions [sizeAttr FlexSize (ExactSize 200),minWidthAttr (ExactBound 400)])
fileListLayout = setUIAttributes (unions [sizeAttr FlexSize (ExactSize 200)/*, minWidthAttr (ExactBound 400)*/])
navigateUpLayout = layoutSubUIs SelectChildren (setUIAttributes (widthAttr FlexSize))
ancestorDirectories :: (SDS () (FilePath,Maybe String) (FilePath,Maybe String))
-> SDS () [(FilePath,Maybe String)] (FilePath,Maybe String)
ancestorDirectories :: (Shared sds (FilePath,Maybe String))
-> SDSLens () [(FilePath,Maybe String)] (FilePath,Maybe String) | RWShared sds
ancestorDirectories sds = mapRead (ancestors o fst) sds
where
ancestors "" = [("/",Nothing)]
ancestors path = [(path,Nothing):ancestors (takeDirectory path)]
filesInCurDir :: (SDS () (FilePath,Maybe String) (FilePath,Maybe String)) -> SDS () [(FilePath,Maybe String)] ()
filesInCurDir :: (Shared sds (FilePath,Maybe String)) -> SDSSequence () [(FilePath,Maybe String)] () | RWShared sds
filesInCurDir selection
= sdsSequence "filesIn" id (\() (p,_) -> p) (\() _ = Right snd)
(SDSWriteConst (\_ _ -> Ok Nothing)) (SDSWriteConst (\_ _ -> Ok Nothing)) selection directoryListingWithDir
......@@ -69,7 +69,7 @@ filesInCurDir selection
//Files are listed as (<current dir>,Just <file name>)
//Directories are listed as (<child dir>, Nothing)
directoryListingWithDir :: SDS FilePath [(FilePath,Maybe String)] ()
directoryListingWithDir :: SDSLens FilePath [(FilePath,Maybe String)] ()
directoryListingWithDir = mapRead (map combine) directoryListingWithInfo
where
combine (parentDir,filename,{FileInfo|directory})
......@@ -78,7 +78,7 @@ where
//UTIL
//Entries are: (Dir, Filename, Fileinfo)
directoryListingWithInfo :: SDS FilePath [(FilePath,String,FileInfo)] ()
directoryListingWithInfo :: SDSSource FilePath [(FilePath,String,FileInfo)] ()
directoryListingWithInfo = createReadOnlySDSError read
where
read path iworld = case readDirectory path iworld of
......
definition module iTasks.Extensions.Picture.Interaction
import iTasks
import iTasks.Extensions.Picture.JPEG
showJPEGPicture :: JPEGPicture -> Task (Maybe JPEGPicture)
implementation module iTasks.Extensions.Picture.Interaction
import iTasks
import iTasks.API.Core.Client.Tasklet
import iTasks.Extensions.Picture.JPEG
showJPEGPicture :: JPEGPicture -> Task (Maybe JPEGPicture)
showJPEGPicture photo
= mkTask (showJPEGPictureTasklet photo)
showJPEGPictureTasklet :: JPEGPicture -> Tasklet (Maybe JPEGPicture) (Maybe JPEGPicture)
showJPEGPictureTasklet picture
=
{ genUI = showJPEGPictureGUI picture
, resultFunc = \_ -> Value (Just picture) True
, tweakUI = setTitle "Picture"
}
where
showJPEGPictureGUI picture _ _ iworld
# gui = { width = WrapSize
, height = WrapSize
, html = RawText htmlText
, eventHandlers = []
}
= (TaskletHTML gui, Nothing, iworld)
htmlText :: String
htmlText = "<img style='max-width: 300px;' src='data:image/jpg;base64," +++ picture +++ "' alt='no photo' />"
......@@ -21,5 +21,7 @@ derive JSONEncode JPEGPicture
derive JSONDecode JPEGPicture
derive gEq JPEGPicture
gEditor{|JPEGPicture|} = comapEditorValue (\(JPEGPicture val) -> ImgTag [SrcAttr val, AltAttr "no photo", StyleAttr ("max-width: 200px; max-height: 200px;")])
htmlView
gEditor{|JPEGPicture|}
= comapEditorValue (\(JPEGPicture val) -> ImgTag
[SrcAttr ("data:image/jpg;base64,"+++val), AltAttr "no photo", StyleAttr ("max-width: 200px; max-height: 200px;")])
htmlView
......@@ -4,10 +4,8 @@ from iTasks.Internal.IWorld import :: IWorld
from iTasks.UI.Editor import :: VSt
//TEST STUBS
toStubIWorld :: *World -> *IWorld
toStubIWorld :: !*World -> *IWorld
fromStubIWorld :: *IWorld -> *World
fromStubIWorld :: !*IWorld -> *World
toStubVSt :: *IWorld -> *VSt
fromStubVSt :: *VSt -> *IWorld
toStubVSt :: *VSt
implementation module iTasks.Internal.Test.Stubs
import iTasks.Engine
import iTasks.Internal.IWorld
import iTasks.Internal.Generic.Defaults
import iTasks.UI.Editor
import ABC.Interpreter
import System.Time
import Data.Maybe
import StdMisc
import qualified Data.Map as DM
import StdEnv
import iTasks
from Data.Map import newMap
//TEST STUBS
toStubIWorld :: *World -> *IWorld
toStubIWorld :: !*World -> *IWorld
toStubIWorld world
= {IWorld
|options = {EngineOptions|appName="STUB",appPath="./",appVersion="STUB",serverPort=80,serverUrl="/127.0.0.1:80/",keepaliveTime={tv_sec=0,tv_nsec=0},sessionTime={tv_sec=0,tv_nsec=0}
,persistTasks=False,autoLayout=False,webDirPath="./STUB/",storeDirPath="./STUB/",tempDirPath="./STUB/",saplDirPath="./STUB",timeout=Nothing}
,clock = {tv_sec=0,tv_nsec=0}
,current ={TaskEvalState|taskTime= 0,taskInstance= 0,sessionInstance = Nothing,attachmentChain = [] ,nextTaskNo = 0}
,sdsNotifyRequests = [], memoryShares = 'DM'.newMap, readCache = 'DM'.newMap, writeCache = 'DM'.newMap, exposedShares = 'DM'.newMap
,jsCompilerState = Nothing ,shutdown = Nothing ,ioTasks = {done = [], todo = []},ioStates = 'DM'.newMap
,world = world
,resources = [], random = [], onClient = False }
# (opts, world) = defaultEngineOptions world
=
{ IWorld
| options = opts
, clock = zero
, current =
{ taskTime = 0
, taskInstance = 0
, sessionInstance = Nothing
, attachmentChain = []
, nextTaskNo = 0
}
, random = []
, sdsNotifyRequests = newMap
, sdsNotifyReqsByTask = newMap
, memoryShares = newMap
, readCache = newMap
, writeCache = newMap
, abcInterpreterEnv = {pie_symbols={}, pie_code_start= -1}
, ioTasks = {done=[], todo=[]}
, ioStates = newMap
, signalHandlers = []
, world = world
, resources = []
, onClient = False
, shutdown = Nothing
}
fromStubIWorld :: *IWorld -> *World
fromStubIWorld :: !*IWorld -> *World
fromStubIWorld iworld=:{IWorld|world} = world
toStubVSt :: *IWorld -> *VSt
toStubVSt iworld = {VSt| selectedConsIndex = -1, taskId = "STUB", mode = Enter, optional = False, iworld = iworld}
fromStubVSt :: *VSt -> *IWorld
fromStubVSt vst=:{VSt|iworld} = iworld
toStubVSt :: *VSt
toStubVSt =
{ VSt
| taskId = "STUB"
, optional = False
, selectedConsIndex = -1
, pathInEditMode = []
, abcInterpreterEnv = {pie_symbols={}, pie_code_start= -1}
}
......@@ -21,6 +21,17 @@ fi
./CreateBasicAPIExamples.exe > BasicAPIExamples.icl
)
#Try to compile all modules
errors="$(
cd Examples
find ../Libraries/ -name "*.dcl" -exec head -n 1 {} \; \
| sed 's/definition module //g' \
| xargs cpm project BasicAPIExamples.prj compile \
|& grep -Po '(?<=Error \[).*(?=\.icl.*)' \
| uniq)"
echo "$errors" >&2
[ -z "$errors" ]
#Try to compile everything
find . -name "*.prj.default" | while read f; do
cp "$f" "$(dirname $f)/$(basename -s .prj.default $f)".prj
......@@ -34,4 +45,3 @@ find . -name "*.prj" -not -name "IncidoneCCC.prj" -not -name "examples.prj" -not
#Run the unit tests
find Tests/Unit -name "*.prj.default" | sed "s/.prj.default//" | xargs -n 1 -I@ cleantest -f human --junit @-junit.xml -r @
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment