diff --git a/.gitignore b/.gitignore index 1528c21..e026b96 100644 --- a/.gitignore +++ b/.gitignore @@ -176,4 +176,9 @@ hs_err_pid* .history .ionide -# End of https://www.toptal.com/developers/gitignore/api/java,intellij+iml,visualstudiocode,emacs \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/java,intellij+iml,visualstudiocode,emacs + +lib/ +target/ +node_modules/ +.vscode/ \ No newline at end of file diff --git a/.npmignore b/.npmignore index d8fd991..752a43d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,3 @@ -lib/ target/ .settings/ .classpath @@ -6,4 +5,6 @@ target/ src/ .vscode/ .idea/ -.java-version \ No newline at end of file +.java-version +example/ +test/ \ No newline at end of file diff --git a/launcher.ol b/launcher.ol index 2df766d..04b997f 100755 --- a/launcher.ol +++ b/launcher.ol @@ -21,7 +21,6 @@ from runtime import Runtime from file import File - service Launcher { outputPort wrapper { RequestResponse: run @@ -35,7 +34,7 @@ service Launcher { getRealServiceDirectory@file()( home ) getFileSeparator@file()( sep ) - loadLibrary@runtime( home + sep + "lib" + sep + "jolieslicer-0.1.0.jar" )() + loadLibrary@runtime( home + sep + "lib" + sep + "jolieslicer.jar" )() loadEmbeddedService@runtime( { filepath = home + sep + "main.ol" service = "Main" diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ef1c7fa --- /dev/null +++ b/package-lock.json @@ -0,0 +1,382 @@ +{ + "name": "@jolie/slicer", + "version": "0.1.2", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@jolie/slicer", + "version": "0.1.2", + "license": "LGPL 2.1", + "dependencies": { + "shx": "^0.3.4" + }, + "bin": { + "jolieslicer": "launcher.ol" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + }, + "dependencies": { + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "requires": { + "has": "^1.0.3" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "requires": { + "resolve": "^1.1.6" + } + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "requires": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } +} diff --git a/package.json b/package.json index 7f549fc..a638b10 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,38 @@ { - "version": "0.1.2", + "version": "0.1.5", "repo": "https://github.com/jolie/slicer", - "name": "@jolie/slicer", - "description": "A slicer for Jolie modules", - "author": [ + "name": "@jolie/slicer", + "description": "A slicer for Jolie modules", + "author": { + "name": "Valentino Picotti" + }, + "contributors": [ { - "name": "Valentino Picotti" - }, - { - "name": "Fabrizio Montesi", - "email": "famontesi@gmail.com", - "url": "https://www.fabriziomontesi.com" - } - ], - "bin": { - "jolieslicer": "./launcher.ol" - }, - "license": "LGPL 2.1", - "keywords": ["jolie","microservices"] + "name": "Fabrizio Montesi", + "email": "famontesi@gmail.com", + "url": "https://www.fabriziomontesi.com" + } + ], + "bin": { + "jolieslicer": "./launcher.ol" + }, + "scripts": { + "prepack": "npx --package=@jolie/jpm -- jpm hooks:prepack", + "postpublish": "shx rm -rf lib" + }, + "license": "LGPL 2.1", + "keywords": [ + "jolie", + "microservices" + ], + "jolie": { + "dependencies": {}, + "maven": { + "dependencies": {}, + "indirectDependencies": {} + } + }, + "dependencies": { + "shx": "^0.3.4" + } } diff --git a/pom.xml b/pom.xml index 2e04bfe..75db251 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 joliex jolieslicer @@ -11,7 +12,8 @@ UTF-8 11 11 - 1.10.6-git + 1.11.0-git + lib jar @@ -61,28 +63,31 @@ - org.apache.maven.plugins - maven-dependency-plugin - 3.1.1 + maven-assembly-plugin - copy-installed - install + package - copy + single - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - jar - ${project.artifactId}-${project.version}.jar - - - dist - + + + + ${project.artifactId} + ${outDir} + + jar-with-dependencies + + false + + + + maven-jar-plugin + 3.0.2 + + + default-jar + none @@ -93,21 +98,25 @@ org.jolie-lang jolie ${jolie.version} + provided org.jolie-lang libjolie ${jolie.version} + provided org.jolie-lang jolie-js ${jolie.version} + provided org.jolie-lang jolie-cli ${jolie.version} + provided diff --git a/src/main/java/joliex/slicer/DependenciesResolver.java b/src/main/java/joliex/slicer/DependenciesResolver.java index ada7a6e..78d7b33 100644 --- a/src/main/java/joliex/slicer/DependenciesResolver.java +++ b/src/main/java/joliex/slicer/DependenciesResolver.java @@ -587,4 +587,14 @@ public Set< OLSyntaxNode > visit( EmbedServiceNode n, Unit ctx ) { return dependencies; } } + + @Override + public Set visit(SolicitResponseExpressionNode n, Unit ctx) { + return new HashSet<>(); + } + + @Override + public Set visit(IfExpressionNode n, Unit ctx) { + return new HashSet<>(); + } } diff --git a/src/main/java/joliex/slicer/JoliePrettyPrinter.java b/src/main/java/joliex/slicer/JoliePrettyPrinter.java index c6675d6..acfd8c9 100644 --- a/src/main/java/joliex/slicer/JoliePrettyPrinter.java +++ b/src/main/java/joliex/slicer/JoliePrettyPrinter.java @@ -109,12 +109,14 @@ import jolie.lang.parse.ast.expression.ConstantLongExpression; import jolie.lang.parse.ast.expression.ConstantStringExpression; import jolie.lang.parse.ast.expression.FreshValueExpressionNode; +import jolie.lang.parse.ast.expression.IfExpressionNode; import jolie.lang.parse.ast.expression.InlineTreeExpressionNode; import jolie.lang.parse.ast.expression.InstanceOfExpressionNode; import jolie.lang.parse.ast.expression.IsTypeExpressionNode; import jolie.lang.parse.ast.expression.NotExpressionNode; import jolie.lang.parse.ast.expression.OrConditionNode; import jolie.lang.parse.ast.expression.ProductExpressionNode; +import jolie.lang.parse.ast.expression.SolicitResponseExpressionNode; import jolie.lang.parse.ast.expression.SumExpressionNode; import jolie.lang.parse.ast.expression.VariableExpressionNode; import jolie.lang.parse.ast.expression.VoidExpressionNode; @@ -758,7 +760,7 @@ public void visit( InstallFixedVariableExpressionNode n ) { @Override public void visit( VariablePathNode n ) { - pp.onlyIf( n.isGlobal(), _0 -> _0.append( Constants.GLOBAL ).dot() ) + pp.onlyIf( n.isGlobal(), _0 -> _0.append( "global" ).dot() ) .intercalate( n.path(), (element, pp) -> { OLSyntaxNode node = element.key(); @@ -789,7 +791,7 @@ public void visit( TypeInlineDefinition n ) { boolean previousValue = isTopLevelTypeDeclaration; isTopLevelTypeDeclaration = false; List< Map.Entry< String, TypeDefinition > > subTypes = new ArrayList<>( n.subTypes() ); - subTypes.sort( Comparator.comparing( entry -> entry.getValue().context().line() ) ); + subTypes.sort( Comparator.,Integer>comparing( entry -> entry.getValue().context().startLine()) ); pp.intercalate( subTypes, ( entry, _1 ) -> entry.getValue().accept( this ), PrettyPrinter::newline ); @@ -1263,4 +1265,26 @@ public PrettyPrinter rbrace() { return this; } } + + @Override + public void visit(SolicitResponseExpressionNode n) { + pp.append( n.id() ) + .append( "@" ) + .append( n.outputPortId() ) + .spacedParens( _0 -> _0 + .ifPresent( Optional.ofNullable( n.outputExpression() ), + ( outExpre, _1 ) -> outExpre.accept( this ) ) ); + } + + @Override + public void visit(IfExpressionNode n) { + pp.append("if") + .spacedParens( _1 -> n.guard().accept(this)); + n.thenExpression().accept(this); + pp.ifPresent( + Optional.ofNullable( n.elseExpression() ), + ( proc, _0 ) -> _0 + .surround( PrettyPrinter::space, asPPConsumer( PrettyPrinter::append, "else" ) ) + .newCodeBlock( _1 -> proc.accept( this ) ) ); + } } diff --git a/src/main/java/joliex/slicer/JolieSlicer.java b/src/main/java/joliex/slicer/JolieSlicer.java index 2310bf4..1fd641f 100644 --- a/src/main/java/joliex/slicer/JolieSlicer.java +++ b/src/main/java/joliex/slicer/JolieSlicer.java @@ -23,13 +23,9 @@ import jolie.Interpreter; import jolie.cli.CommandLineException; import jolie.cli.CommandLineParser; -import jolie.lang.CodeCheckingException; -import jolie.lang.parse.OLParser; -import jolie.lang.parse.ParserException; -import jolie.lang.parse.Scanner; +import jolie.lang.CodeCheckException; import jolie.lang.parse.SemanticVerifier; import jolie.lang.parse.ast.Program; -import jolie.lang.parse.module.ModuleException; import jolie.lang.parse.util.ParsingUtils; import jolie.runtime.FaultException; import jolie.runtime.JavaService; @@ -37,12 +33,8 @@ import jolie.runtime.embedding.RequestResponse; import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; -import java.util.stream.Stream; public class JolieSlicer extends JavaService { @@ -114,7 +106,7 @@ public void slice( Value request ) throws FaultException { slicer.generateServiceDirectories(); - } catch ( ParserException | InvalidConfigurationFileException | CodeCheckingException | ModuleException | CommandLineException | IOException e ) { + } catch ( CommandLineException | InvalidConfigurationFileException | CodeCheckException | IOException e ) { throw new FaultException( e.getClass().getSimpleName(), e ); } } diff --git a/src/main/java/joliex/slicer/Main.java b/src/main/java/joliex/slicer/Main.java index 7784769..2e05c7b 100644 --- a/src/main/java/joliex/slicer/Main.java +++ b/src/main/java/joliex/slicer/Main.java @@ -26,11 +26,9 @@ import jolie.Interpreter; import jolie.JolieURLStreamHandlerFactory; import jolie.cli.CommandLineException; -import jolie.lang.CodeCheckingException; -import jolie.lang.parse.ParserException; +import jolie.lang.CodeCheckException; import jolie.lang.parse.SemanticVerifier; import jolie.lang.parse.ast.Program; -import jolie.lang.parse.module.ModuleException; import jolie.lang.parse.util.ParsingUtils; /** @@ -88,7 +86,7 @@ public static void main( String[] args ) { } catch( CommandLineException | InvalidConfigurationFileException e ) { System.out.println( e.getMessage() ); - } catch( IOException | ParserException | CodeCheckingException | ModuleException e ) { + } catch( IOException | CodeCheckException e ) { e.printStackTrace(); } } diff --git a/src/main/java/joliex/slicer/Slicer.java b/src/main/java/joliex/slicer/Slicer.java index 30b687f..6ac9837 100644 --- a/src/main/java/joliex/slicer/Slicer.java +++ b/src/main/java/joliex/slicer/Slicer.java @@ -137,7 +137,7 @@ private void sliceProgram() { List< OLSyntaxNode > newProgram = dependenciesResolver.getServiceDependencies( s ) .stream() - .sorted( Comparator.comparing( dep -> dep.context().line() ) ) + .sorted( Comparator.comparing( dep -> dep.context().startLine() ) ) .collect( Collectors.toList() ); newProgram.add( s ); slices.put( s.name(), new Program( program.context(), newProgram ) );