call-alloy 0.3.0.3 → 0.4
raw patch · 19 files changed
+353/−507 lines, 19 filesdep +asyncdep −file-embeddep −hashablebinary-addedPVP ok
version bump matches the API change (PVP)
Dependencies added: async
Dependencies removed: file-embed, hashable
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- README.md +3/−6
- bin/alloy/RunAlloy.class binary
- bin/commons-cli/LICENSE.txt +0/−202
- bin/commons-cli/NOTICE.txt +0/−5
- bin/commons-cli/commons-cli-1.5.0.jar binary
- bin/org.alloytools.alloy.dist.jar too large to diff
- bin/slf4j/LICENSE +0/−21
- bin/slf4j/slf4j-simple-1.7.36.jar binary
- call-alloy.cabal +17/−17
- data/alloy/RunAlloy.class binary
- data/commons-cli/LICENSE.txt +202/−0
- data/commons-cli/NOTICE.txt +5/−0
- data/commons-cli/commons-cli-1.5.0.jar binary
- data/org.alloytools.alloy.dist.jar too large to diff
- data/slf4j/LICENSE +21/−0
- data/slf4j/slf4j-simple-1.7.36.jar binary
- src/Language/Alloy/Internal/Call.hs +87/−242
- src/Language/Alloy/Ressources.hs +12/−14
ChangeLog.md view
@@ -4,6 +4,12 @@ ## Released changes +### 0.4++- provide required Java libraries in package data directory+- use async for process interaction+- terminate calls to Java properly (even on interrupts)+ ### 0.3.0.3 - fix runtime error on WARN
README.md view
@@ -1,8 +1,8 @@ # `call-alloy` [](https://github.com/marcellussiegburg/call-alloy/actions?query=workflow%3A%22Haskell+CI%22+branch%3Amaster) This is a simple library to call [Alloy](http://alloytools.org) given a specification.-This package includes a simple Java Library to make an API call to the Alloy Library.-Alloy is included (as JAR file) within this library as well.+This package installs a simple Java Library to make an API call to the Alloy Library.+Alloy is installed (as JAR file) alongside this library as well. ## Requirements @@ -15,10 +15,7 @@ The Java interface to get Alloy instances as well as the [Alloy Jar](https://github.com/AlloyTools/org.alloytools.alloy/releases/download/v5.1.0/org.alloytools.alloy.dist.jar)-file are baked into this library.--On every call the application checks the [`XdgDirectory`](https://hackage.haskell.org/package/directory/docs/System-Directory.html#t:XdgDirectory) if the libraries exist in a current version.-If not they are placed there together with a version identifier.+file are installed together with this library using usual cabal means (data directory). ## The library in action
− bin/alloy/RunAlloy.class
binary file changed (3575 → absent bytes)
− bin/commons-cli/LICENSE.txt
@@ -1,202 +0,0 @@- Apache License- Version 2.0, January 2004- http://www.apache.org/licenses/-- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION-- 1. Definitions.-- "License" shall mean the terms and conditions for use, reproduction,- and distribution as defined by Sections 1 through 9 of this document.-- "Licensor" shall mean the copyright owner or entity authorized by- the copyright owner that is granting the License.-- "Legal Entity" shall mean the union of the acting entity and all- other entities that control, are controlled by, or are under common- control with that entity. For the purposes of this definition,- "control" means (i) the power, direct or indirect, to cause the- direction or management of such entity, whether by contract or- otherwise, or (ii) ownership of fifty percent (50%) or more of the- outstanding shares, or (iii) beneficial ownership of such entity.-- "You" (or "Your") shall mean an individual or Legal Entity- exercising permissions granted by this License.-- "Source" form shall mean the preferred form for making modifications,- including but not limited to software source code, documentation- source, and configuration files.-- "Object" form shall mean any form resulting from mechanical- transformation or translation of a Source form, including but- not limited to compiled object code, generated documentation,- and conversions to other media types.-- "Work" shall mean the work of authorship, whether in Source or- Object form, made available under the License, as indicated by a- copyright notice that is included in or attached to the work- (an example is provided in the Appendix below).-- "Derivative Works" shall mean any work, whether in Source or Object- form, that is based on (or derived from) the Work and for which the- editorial revisions, annotations, elaborations, or other modifications- represent, as a whole, an original work of authorship. For the purposes- of this License, Derivative Works shall not include works that remain- separable from, or merely link (or bind by name) to the interfaces of,- the Work and Derivative Works thereof.-- "Contribution" shall mean any work of authorship, including- the original version of the Work and any modifications or additions- to that Work or Derivative Works thereof, that is intentionally- submitted to Licensor for inclusion in the Work by the copyright owner- or by an individual or Legal Entity authorized to submit on behalf of- the copyright owner. For the purposes of this definition, "submitted"- means any form of electronic, verbal, or written communication sent- to the Licensor or its representatives, including but not limited to- communication on electronic mailing lists, source code control systems,- and issue tracking systems that are managed by, or on behalf of, the- Licensor for the purpose of discussing and improving the Work, but- excluding communication that is conspicuously marked or otherwise- designated in writing by the copyright owner as "Not a Contribution."-- "Contributor" shall mean Licensor and any individual or Legal Entity- on behalf of whom a Contribution has been received by Licensor and- subsequently incorporated within the Work.-- 2. Grant of Copyright License. Subject to the terms and conditions of- this License, each Contributor hereby grants to You a perpetual,- worldwide, non-exclusive, no-charge, royalty-free, irrevocable- copyright license to reproduce, prepare Derivative Works of,- publicly display, publicly perform, sublicense, and distribute the- Work and such Derivative Works in Source or Object form.-- 3. Grant of Patent License. Subject to the terms and conditions of- this License, each Contributor hereby grants to You a perpetual,- worldwide, non-exclusive, no-charge, royalty-free, irrevocable- (except as stated in this section) patent license to make, have made,- use, offer to sell, sell, import, and otherwise transfer the Work,- where such license applies only to those patent claims licensable- by such Contributor that are necessarily infringed by their- Contribution(s) alone or by combination of their Contribution(s)- with the Work to which such Contribution(s) was submitted. If You- institute patent litigation against any entity (including a- cross-claim or counterclaim in a lawsuit) alleging that the Work- or a Contribution incorporated within the Work constitutes direct- or contributory patent infringement, then any patent licenses- granted to You under this License for that Work shall terminate- as of the date such litigation is filed.-- 4. Redistribution. You may reproduce and distribute copies of the- Work or Derivative Works thereof in any medium, with or without- modifications, and in Source or Object form, provided that You- meet the following conditions:-- (a) You must give any other recipients of the Work or- Derivative Works a copy of this License; and-- (b) You must cause any modified files to carry prominent notices- stating that You changed the files; and-- (c) You must retain, in the Source form of any Derivative Works- that You distribute, all copyright, patent, trademark, and- attribution notices from the Source form of the Work,- excluding those notices that do not pertain to any part of- the Derivative Works; and-- (d) If the Work includes a "NOTICE" text file as part of its- distribution, then any Derivative Works that You distribute must- include a readable copy of the attribution notices contained- within such NOTICE file, excluding those notices that do not- pertain to any part of the Derivative Works, in at least one- of the following places: within a NOTICE text file distributed- as part of the Derivative Works; within the Source form or- documentation, if provided along with the Derivative Works; or,- within a display generated by the Derivative Works, if and- wherever such third-party notices normally appear. The contents- of the NOTICE file are for informational purposes only and- do not modify the License. You may add Your own attribution- notices within Derivative Works that You distribute, alongside- or as an addendum to the NOTICE text from the Work, provided- that such additional attribution notices cannot be construed- as modifying the License.-- You may add Your own copyright statement to Your modifications and- may provide additional or different license terms and conditions- for use, reproduction, or distribution of Your modifications, or- for any such Derivative Works as a whole, provided Your use,- reproduction, and distribution of the Work otherwise complies with- the conditions stated in this License.-- 5. Submission of Contributions. Unless You explicitly state otherwise,- any Contribution intentionally submitted for inclusion in the Work- by You to the Licensor shall be under the terms and conditions of- this License, without any additional terms or conditions.- Notwithstanding the above, nothing herein shall supersede or modify- the terms of any separate license agreement you may have executed- with Licensor regarding such Contributions.-- 6. Trademarks. This License does not grant permission to use the trade- names, trademarks, service marks, or product names of the Licensor,- except as required for reasonable and customary use in describing the- origin of the Work and reproducing the content of the NOTICE file.-- 7. Disclaimer of Warranty. Unless required by applicable law or- agreed to in writing, Licensor provides the Work (and each- Contributor provides its Contributions) on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or- implied, including, without limitation, any warranties or conditions- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A- PARTICULAR PURPOSE. You are solely responsible for determining the- appropriateness of using or redistributing the Work and assume any- risks associated with Your exercise of permissions under this License.-- 8. Limitation of Liability. In no event and under no legal theory,- whether in tort (including negligence), contract, or otherwise,- unless required by applicable law (such as deliberate and grossly- negligent acts) or agreed to in writing, shall any Contributor be- liable to You for damages, including any direct, indirect, special,- incidental, or consequential damages of any character arising as a- result of this License or out of the use or inability to use the- Work (including but not limited to damages for loss of goodwill,- work stoppage, computer failure or malfunction, or any and all- other commercial damages or losses), even if such Contributor- has been advised of the possibility of such damages.-- 9. Accepting Warranty or Additional Liability. While redistributing- the Work or Derivative Works thereof, You may choose to offer,- and charge a fee for, acceptance of support, warranty, indemnity,- or other liability obligations and/or rights consistent with this- License. However, in accepting such obligations, You may act only- on Your own behalf and on Your sole responsibility, not on behalf- of any other Contributor, and only if You agree to indemnify,- defend, and hold each Contributor harmless for any liability- incurred by, or claims asserted against, such Contributor by reason- of your accepting any such warranty or additional liability.-- END OF TERMS AND CONDITIONS-- APPENDIX: How to apply the Apache License to your work.-- To apply the Apache License to your work, attach the following- boilerplate notice, with the fields enclosed by brackets "[]"- replaced with your own identifying information. (Don't include- the brackets!) The text should be enclosed in the appropriate- comment syntax for the file format. We also recommend that a- file or class name and description of purpose be included on the- same "printed page" as the copyright notice for easier- identification within third-party archives.-- Copyright [yyyy] [name of copyright owner]-- Licensed under the Apache License, Version 2.0 (the "License");- you may not use this file except in compliance with the License.- You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.-
− bin/commons-cli/NOTICE.txt
@@ -1,5 +0,0 @@-Apache Commons CLI-Copyright 2001-2017 The Apache Software Foundation--This product includes software developed at-The Apache Software Foundation (http://www.apache.org/).
− bin/commons-cli/commons-cli-1.5.0.jar
binary file changed (58284 → absent bytes)
− bin/org.alloytools.alloy.dist.jar
file too large to diff
− bin/slf4j/LICENSE
@@ -1,21 +0,0 @@- Copyright (c) 2004-2017 QOS.ch- All rights reserved.-- 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.
− bin/slf4j/slf4j-simple-1.7.36.jar
binary file changed (15333 → absent bytes)
call-alloy.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack name: call-alloy-version: 0.3.0.3+version: 0.4 synopsis: A simple library to call Alloy given a specification description: Please see the README on GitHub at <https://github.com/marcellussiegburg/call-alloy#readme> category: Language@@ -21,13 +21,15 @@ README.md LICENSE ChangeLog.md- bin/alloy/RunAlloy.class- bin/org.alloytools.alloy.dist.jar- bin/commons-cli/commons-cli-1.5.0.jar- bin/commons-cli/NOTICE.txt- bin/commons-cli/LICENSE.txt- bin/slf4j/slf4j-simple-1.7.36.jar- bin/slf4j/LICENSE+data-files:+ alloy/RunAlloy.class+ org.alloytools.alloy.dist.jar+ commons-cli/commons-cli-1.5.0.jar+ commons-cli/NOTICE.txt+ commons-cli/LICENSE.txt+ slf4j/slf4j-simple-1.7.36.jar+ slf4j/LICENSE+data-dir: data source-repository head type: git@@ -49,18 +51,18 @@ src ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Widentities -Wredundant-constraints build-depends:- base >=4.12 && <5+ async >=2.2.1 && <2.3+ , base >=4.12 && <5 , bytestring >=0.10.4 && <0.12 , containers ==0.6.* , directory ==1.3.* , extra ==1.7.*- , file-embed >=0.0.11 && <0.1 , filepath ==1.4.*- , hashable >=1.2 && <1.5 , mtl >=2.2 && <2.4 , process ==1.6.* , split ==0.2.* , trifecta >=2 && <2.2+ default-language: Haskell2010 if os(windows) cpp-options: -DWINDOWS build-depends:@@ -68,7 +70,6 @@ else build-depends: unix ==2.7.*- default-language: Haskell2010 test-suite call-alloy-test type: exitcode-stdio-1.0@@ -89,20 +90,20 @@ test ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Widentities -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N build-depends:- base >=4.12 && <5+ async >=2.2.1 && <2.3+ , base >=4.12 && <5 , bytestring >=0.10.4 && <0.12 , call-alloy , containers ==0.6.* , directory ==1.3.* , extra ==1.7.*- , file-embed >=0.0.11 && <0.1 , filepath ==1.4.*- , hashable >=1.2 && <1.5 , hspec , mtl >=2.2 && <2.4 , process ==1.6.* , split ==0.2.* , trifecta >=2 && <2.2+ default-language: Haskell2010 if os(windows) cpp-options: -DWINDOWS build-depends:@@ -110,4 +111,3 @@ else build-depends: unix ==2.7.*- default-language: Haskell2010
+ data/alloy/RunAlloy.class view
binary file changed (absent → 3575 bytes)
+ data/commons-cli/LICENSE.txt view
@@ -0,0 +1,202 @@+ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+
+ data/commons-cli/NOTICE.txt view
@@ -0,0 +1,5 @@+Apache Commons CLI+Copyright 2001-2017 The Apache Software Foundation++This product includes software developed at+The Apache Software Foundation (http://www.apache.org/).
+ data/commons-cli/commons-cli-1.5.0.jar view
binary file changed (absent → 58284 bytes)
+ data/org.alloytools.alloy.dist.jar view
file too large to diff
+ data/slf4j/LICENSE view
@@ -0,0 +1,21 @@+ Copyright (c) 2004-2017 QOS.ch+ All rights reserved.++ 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.
+ data/slf4j/slf4j-simple-1.7.36.jar view
binary file changed (absent → 15333 bytes)
src/Language/Alloy/Internal/Call.hs view
@@ -21,53 +21,45 @@ hGetLine, intercalate, stripPrefix,- writeFile, ) import qualified Data.ByteString.Char8 as BS (unlines) import Control.Concurrent (- ThreadId,- forkIO, killThread, newEmptyMVar, putMVar, takeMVar, threadDelay,+ threadDelay, )-import Control.Exception (IOException)-import Control.Monad (unless, void, when)+import Control.Concurrent.Async (+ concurrently,+ mapConcurrently_,+ wait,+ withAsync+ )+import Control.Exception (IOException, bracket, catch)+import Control.Monad (unless, when) import Data.ByteString (ByteString) import Data.ByteString.Char8 (unpack)-import Data.Hashable (hash)-import Data.IORef (IORef, newIORef, readIORef)+import Data.List (intercalate) import Data.List.Split (splitOn) import Data.Maybe (fromMaybe)-import System.Directory- (XdgDirectory (..), createDirectory, doesFileExist, doesDirectoryExist,- getTemporaryDirectory, getXdgDirectory)-import System.Directory.Internal (setFileMode)-import System.Directory.Internal.Prelude- (catch, isDoesNotExistError) import System.Exit (ExitCode (..)) import System.FilePath- ((</>), (<.>), searchPathSeparator, takeDirectory)+ (searchPathSeparator) import System.IO (BufferMode (..), Handle, hClose, hFlush, hIsEOF, hPutStr, hSetBuffering)-import System.IO.Unsafe (unsafePerformIO) import System.Process ( CreateProcess (..), StdStream (..), ProcessHandle,+ cleanupProcess, createProcess, proc, terminateProcess, waitForProcess, )-#if defined(mingw32_HOST_OS)-import System.Win32.Info (getUserName)-#else-import System.Posix.User (getLoginName)-#endif import Language.Alloy.RessourceNames (- alloyJarName, className, classPackage, commonsCliJarName, slf4jJarName,+ className, classPackage, ) import Language.Alloy.Ressources ( alloyJar,- classFile, commonsCliJar, slf4jJar, )+import Paths_call_alloy (getDataDir) {-| Configuration for calling alloy. These are:@@ -79,12 +71,12 @@ -} data CallAlloyConfig = CallAlloyConfig { -- | maximal number of instances to retrieve ('Nothing' for all)- maxInstances :: Maybe Integer,+ maxInstances :: !(Maybe Integer), -- | whether to not overflow when calculating numbers within Alloy- noOverflow :: Bool,+ noOverflow :: !Bool, -- | the time in microseconds after which to forcibly kill Alloy -- ('Nothing' for never)- timeout :: Maybe Int+ timeout :: !(Maybe Int) } {-|@@ -100,14 +92,7 @@ timeout = Nothing } -{-# NOINLINE mclassPath #-} {-|-'IORef' for storing the class path.--}-mclassPath :: IORef (Maybe FilePath)-mclassPath = unsafePerformIO (newIORef Nothing)--{-| This function may be used to get all raw model instances for a given Alloy specification. It calls Alloy via a Java interface and splits the raw instance answers before returning the resulting list of raw instances.@@ -123,6 +108,24 @@ } {-|+Creates an Alloy process using the given config.+-}+callAlloyWith+ :: CallAlloyConfig+ -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)+callAlloyWith config = do+ classPath <- getClassPath+ let callAlloy = proc "java"+ $ ["-cp", classPath, classPackage ++ '.' : className,+ "-i", show $ fromMaybe (-1) $ maxInstances config]+ ++ ["-o" | not $ noOverflow config]+ createProcess callAlloy {+ std_out = CreatePipe,+ std_in = CreatePipe,+ std_err = CreatePipe+ }++{-| This function may be used to get all raw model instances for a given Alloy specification. It calls Alloy via a Java interface and splits the raw instance answers before returning the resulting list of raw instances.@@ -134,78 +137,43 @@ -> String -- ^ The Alloy specification which should be loaded. -> IO [ByteString]-getRawInstancesWith config content = do- classPath <- getClassPath- let callAlloy = proc "java"- $ ["-cp", classPath, classPackage ++ '.' : className,- "-i", show $ fromMaybe (-1) $ maxInstances config]- ++ ["-o" | not $ noOverflow config]- (Just hin, Just hout, Just herr, ph) <-- createProcess callAlloy {- std_out = CreatePipe,- std_in = CreatePipe,- std_err = CreatePipe- }- pout <- listenForOutput hout- perr <- listenForOutput herr+getRawInstancesWith config content+ = bracket (callAlloyWith config) cleanupProcess $ \p -> do+ (Just hin, Just hout, Just herr, ph) <- return p #ifndef mingw32_HOST_OS hSetBuffering hin NoBuffering #endif- hPutStr hin content- hFlush hin- hClose hin- maybe (return ()) (void . startTimeout hin hout herr ph) $ timeout config- out <- getOutput pout- err <- getOutput perr- printContentOnError ph- let err' = removeInfoLines err- unless (null err') $ fail $ unpack $ BS.unlines err'- return $ fmap (BS.intercalate "\n")- $ filterLast ((/= partialInstance) . last)- $ drop 1 $ splitOn [begin] out+ let evaluateAlloy = do+ hPutStr hin content+ hFlush hin+ hClose hin+ printContentOnError ph+ withTimeout hin hout herr ph (timeout config) $ do+ (out, err) <- fst <$> concurrently+ (concurrently (getOutput hout) (getOutput herr))+ evaluateAlloy+ let err' = removeInfoLines err+ unless (null err') $ fail $ unpack $ BS.unlines err'+ return $ fmap (BS.intercalate "\n")+ $ filterLast ((/= partialInstance) . last)+ $ drop 1 $ splitOn [begin] out where begin :: ByteString begin = "---INSTANCE---" filterLast _ [] = [] filterLast p x@[_] = filter p x filterLast p (x:xs) = x:filterLast p xs-{-- prependLine xs = BS.append xs . BS.append "\n"- getWholeOutput h inst = do- eof <- hIsEOF h- if eof- then do- let inst' = inst ""- return $ if BS.null inst'- then id- else (inst' :)- else catch- (do- l <- BS.hGetLine h- if l == begin- then (. ((inst . prependLine l $ "") :)) <$> getWholeOutput h id- else getWholeOutput h $ inst . prependLine l)- (\(_ :: IOException) -> return id)--}- getWholeOutput h = do+ getOutput h = do eof <- hIsEOF h if eof then return [] else catch- ((:) <$> BS.hGetLine h <*> getWholeOutput h)+ ((:) <$> BS.hGetLine h <*> getOutput h) (\(_ :: IOException) -> return [partialInstance]) printContentOnError ph = do code <- waitForProcess ph when (code == ExitFailure 1) $ putStrLn $ "Failed parsing the Alloy code:\n" <> content- listenForOutput h = do- mvar <- newEmptyMVar- pid <- forkIO $ getWholeOutput h >>= putMVar mvar- return (pid, mvar)- getOutput (pid, mvar) = do- output <- takeMVar mvar- killThread pid- return output partialInstance :: ByteString partialInstance = "---PARTIAL_INSTANCE---"@@ -246,173 +214,50 @@ removeInfoLines xs = xs {-|-Start a new process that aborts execution by closing all handles and-killing the processes after the given amount of time.+Start a new sub process that communicates with the worker process+if a timeout is provided.+Execution is aborted by closing all handles and+killing the underlying worker processes after the given amount of time+(if it has not finished by then).+The process will wait for the sub process to make the result available.++If the provided timeout is 'Nothing', evaluation happens without+scheduled interruption in the main thread. -}-startTimeout+withTimeout :: Handle- -- ^ the input handle to close+ -- ^ the input handle (of the worker) to close -> Handle- -- ^ the output handle to close+ -- ^ the output handle (of the worker) to close -> Handle- -- ^ the error handle to close+ -- ^ the error handle (of the worker) to close -> ProcessHandle- -- ^ the main process handle- -> Int -> IO ThreadId-startTimeout i o e ph t = forkIO $ do+ -- ^ the worker process handle+ -> Maybe Int+ -- ^ the timeout (Nothing if no timeout)+ -> IO a+ -- ^ some action interacting with the worker and its handles+ -> IO a+withTimeout _ _ _ _ Nothing p = p+withTimeout i o e ph (Just t) p = withAsync p $ \a -> do threadDelay t- void $ forkIO $ hClose e- void $ forkIO $ hClose o- terminateProcess ph+ mapConcurrently_ id [+ hClose e,+ hClose o,+ terminateProcess ph+ ] hClose i+ wait a {-|-Check if the class path was determined already, if so use it, otherwise call-'readClassPath'.+Get the class path of all files in the data directory. Returns the class path. -} getClassPath :: IO FilePath-getClassPath = do- mclassPath' <- readIORef mclassPath- maybe readClassPath return mclassPath'--{--{--data CallAlloyConfig = Config {- alloyJarFile :: FilePath,- alloyClassFile :: FilePath,- keepFiles :: Bool- }--}--jarFileEnv :: String-jarFileEnv = "ALLOY_JAR_FILE"--callAlloyEnv :: String-callAlloyEnv = "CALL_ALLOY_CLASS_FILE"--keepFilesEnv :: String-keepFilesEnv = "KEEP_ALLOY_FILES"--{-|-Lookup environment variables which are to prefer if present.--}-getEnvironmentInformation :: IO CallAlloyConfig-getEnvironmentInformation = do- alloy <- lookupEnv jarFileEnv- callAlloy <- lookupEnv callAlloyEnv- keep <- lookupEnv keepFilesEnv- let mconfig = Config <$> alloy <*> callAlloy <*> pure (isJust keep)- case mconfig of- Nothing -> do- dataDir <- getXdgDirectory XdgData $ appName </> "dataDir"- Just c -> return c--}-{--getVersionFile :: IO FilePath-getVersionFile = do- configDir <- getXdgDirectory XdgConfig appName- let versionFile = configDir </> "version"- exists <- doesFileExist versionFile- if exists- then do- version <- read <$> readFile versionFile- unless (version == versionHash) $ createVersionFile configDir versionFile- else createVersionFile configDir versionFile--}--fallbackToTempDir :: IO FilePath -> IO FilePath-fallbackToTempDir m = catch m $ \e ->- if isDoesNotExistError e- then do- tmp <- getTemporaryDirectory-#if defined(mingw32_HOST_OS)- login <- getUserName-#else- login <- getLoginName-#endif- let tmpDir = tmp </> show (hash login) </> appName- createUserDirectoriesIfMissing tmpDir- return tmpDir- else error $ show e--{-|-Read the class path version specified in the user directory, if it is not-current or if it does not exist, call 'createVersionFile'.--Returns the class path.--}-readClassPath :: IO FilePath-readClassPath = do- configDir <- fallbackToTempDir $ getXdgDirectory XdgConfig appName- let versionFile = configDir </> "version"- exists <- doesFileExist versionFile- if exists- then do- version <- read <$> readFile versionFile- unless (version == versionHash) $ createVersionFile configDir versionFile- else createVersionFile configDir versionFile- dataDir <- getXdgDirectory XdgData $ appName </> "dataDir"- return $ dataDir ++ searchPathSeparator : dataDir </> alloyJarName- ++ searchPathSeparator : dataDir </> commonsCliJarName- ++ searchPathSeparator : dataDir </> slf4jJarName--{-|-Create all library files within the users 'XdgDirectory' by calling-'createDataDir' then place the current version number into a configuration File.--}-createVersionFile :: FilePath -> FilePath -> IO ()-createVersionFile configDir versionFile = do- createDataDir- createUserDirectoriesIfMissing configDir- writeFile versionFile $ show versionHash--{-|-Create all library files within the users 'XdgDirectory' based on the source-files enclosed into this library (see also 'Language.Alloy.RessourceNames' and-'Language.Alloy.Ressources').--}-createDataDir :: IO ()-createDataDir = do- dataDir <- fallbackToTempDir $ getXdgDirectory XdgData $ appName </> "dataDir"- createUserDirectoriesIfMissing $ dataDir </> classPackage- BS.writeFile (dataDir </> classPackage </> className <.> "class") classFile- BS.writeFile (dataDir </> alloyJarName) alloyJar- BS.writeFile (dataDir </> commonsCliJarName) commonsCliJar- BS.writeFile (dataDir </> slf4jJarName) slf4jJar--{-|-Creates user directories using the file permissions 700.-This function creates the specified directory and all its parent directories as-well (if they are also missing).--}-createUserDirectoriesIfMissing :: FilePath -> IO ()-createUserDirectoriesIfMissing fp = do- isDir <- doesDirectoryExist fp- let parent = takeDirectory fp- unless (isDir || parent == fp) $ do- createUserDirectoriesIfMissing parent- createDirectory fp-#ifndef mingw32_HOST_OS- setFileMode fp (7*8*8)-#endif--{-|-The application name (used to store data in a specific directory.--}-appName :: String-appName = "call-alloy"--{-# INLINE versionHash #-}-{-|-Used to determine possible source code and Alloy version changes across multiple-versions of this library.--}-versionHash :: Int-versionHash = hash $ alloyHash + commonsCliHash + slf4jHash + classFileHash+getClassPath =+ concatPaths <$> getDataDir <*> alloyJar <*> commonsCliJar <*> slf4jJar where- alloyHash = hash alloyJar- commonsCliHash = hash commonsCliJar- classFileHash = hash classFile- slf4jHash = hash slf4jJar+ concatPaths w x y z = intercalate+ [searchPathSeparator]+ [w, x, y, z]
src/Language/Alloy/Ressources.hs view
@@ -1,27 +1,25 @@-{-# LANGUAGE TemplateHaskell #-} module Language.Alloy.Ressources ( alloyJar,- classFile, commonsCliJar, slf4jJar, ) where -import Data.ByteString (ByteString)-import Data.FileEmbed (embedFile)-import System.FilePath ((</>), (<.>))+import Data.Functor ((<&>))+import System.FilePath ((</>)) import Language.Alloy.RessourceNames (- alloyJarName, className, classPackage, commonsCliJarName, slf4jJarName,+ alloyJarName, commonsCliJarName, slf4jJarName, )+import Paths_call_alloy (getDataDir) -alloyJar :: ByteString-alloyJar = $(embedFile $ "bin" </> alloyJarName)+prependDataDir :: FilePath -> IO FilePath+prependDataDir xs = getDataDir <&> (</> xs) -commonsCliJar :: ByteString-commonsCliJar = $(embedFile $ "bin" </> "commons-cli" </> commonsCliJarName)+alloyJar :: IO FilePath+alloyJar = prependDataDir alloyJarName -slf4jJar :: ByteString-slf4jJar = $(embedFile $ "bin" </> "slf4j" </> slf4jJarName)+commonsCliJar :: IO FilePath+commonsCliJar = prependDataDir ("commons-cli" </> commonsCliJarName) -classFile :: ByteString-classFile = $(embedFile $ "bin" </> classPackage </> className <.> "class")+slf4jJar :: IO FilePath+slf4jJar = prependDataDir ("slf4j" </> slf4jJarName)