-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Polyglot class>>installLanguage:version:
- Loading branch information
Showing
3 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
19 changes: 3 additions & 16 deletions
19
src/TruffleSqueak-Core.package/Polyglot.class/class/installLanguage.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
17 changes: 17 additions & 0 deletions
17
src/TruffleSqueak-Core.package/Polyglot.class/class/installLanguage.version..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters