Skip to content

Commit

Permalink
Add Polyglot class>>installLanguage:version:
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Feb 17, 2024
1 parent 25f7b4c commit cd69aee
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
helpers
installLanguage
| downloader modulesPath selectedLanguage version |
[ downloader := Java type: 'org.graalvm.maven.downloader.Main' ]
on: Error
do: [ self error: 'Unable to find Maven Downloader. Additional languages can only be installed in a JVM standalone of TruffleSqueak.'].
modulesPath := (FSLocator vmDirectory resolve: '../modules').
modulesPath isDirectory ifFalse: [ self error: 'Unable to find modules/ directory.' ].
selectedLanguage := UIManager default
| languageId version |
languageId := UIManager default
chooseFrom: #('JavaScript' 'Ruby' 'Python' 'Java' 'LLVM' 'Wasm')
values: #('js' 'ruby' 'python' 'java' 'llvm' 'wasm')
title: 'Which language would you like to install?'.
version := UIManager default
request: 'Select a version:'
initialAnswer: ((Java type: 'java.lang.System') getProperty: 'org.graalvm.version' and: 'unknown').
'Installing language and its dependencies...' displayProgressFrom: 0 to: 1 during: [ :bar |
bar value: 0.
downloader main: {
'-o'. modulesPath fullName.
'-v'. version.
'-a'. selectedLanguage
}.
].
self inform: 'Success! Please restart TruffleSqueak for the language to become available. You can also install more languages now.'
self installLanguage: languageId version: version
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
helpers
installLanguage: languageId version: version
| downloader modulesPath |
[ downloader := Java type: 'org.graalvm.maven.downloader.Main' ]
on: Error
do: [ self error: 'Unable to find Maven Downloader. Additional languages can only be installed in a JVM standalone of TruffleSqueak.'].
modulesPath := (FSLocator vmDirectory resolve: '../modules').
modulesPath isDirectory ifFalse: [ self error: 'Unable to find modules/ directory.' ].
'Installing language and its dependencies...' displayProgressFrom: 0 to: 1 during: [ :bar |
bar value: 0.
downloader main: {
'-o'. modulesPath fullName.
'-v'. version.
'-a'. languageId
}.
].
self inform: 'Success! Please restart TruffleSqueak for the language to become available. You can also install more languages now.'
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"iconWASM" : "fn 6/26/2021 15:10",
"import:" : "fn 11/11/2018 21:34",
"initialize" : "fn 1/24/2020 14:41",
"installLanguage" : "fn 2/17/2024 13:10",
"installLanguage" : "fn 2/17/2024 13:19",
"installLanguage:version:" : "fn 2/17/2024 13:19",
"isPermitted:" : "fn 1/26/2021 17:27",
"isPolyglotEvalAllowed" : "fn 5/13/2020 17:37",
"languageIdHost" : "fn 6/25/2021 13:43",
Expand Down

0 comments on commit cd69aee

Please sign in to comment.