sbt Build Commands:
- clean: flushes all the stuff and can be useful when getting new code.
- runtime/clean: flushes just the engine libs bits (so quicker).
- buildProjectManagerDistribution: builds the project manager server executable.
- buildEngineDistribution: builds the engine server and libraries distribution executable.
- buildStdLib...: builds the standard library can be
Allor a specific one. Tends to leave the index in a mess so often lose the dropdowns or CB.
Running Enso IDE:
- Just run the executable it will launch a GUI and a Project Manager. Opening a project opens a Language Server.
IDE Dashboard <---> Project Manager --launches-> Language Server <---> IDE Graph Editor
- Execution happens in the language server.
- IDE and L/S have parsers reading and parsing the code.
- Can separate the IDE and Project Manager:
--engine falsewill stop IDE running the P/M. Either on the installed (%AppData%\Local\Programs\enso\enso.exe) or the built one in dist (.\dist\ide\win-unpacked\Enso.exe). (./run ide build ends up here). - Project Manager is in
.\built-distribution\enso-project-manager-0.0.0-dev-windows-amd64\enso\bin\project-manager.exeif built by sbt. - THe libraries used by the L/S are read from
%AppData%\Local\enso\distso if you sym link0.0.0-devto.\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\within the repo will use the output ofbuildEngineDistribution. - You also need a
0.0.0-dev.yamlfile in the%AppData%\Local\enso\editions. - The edition is set within the
package.yamlof all projects.edition: 0.0.0-devandprefer-local-libraries: true ENSO_JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"- sets up the connection to allow Java debugging of the Language Server (connect up IntelliJ to it).
Running Enso CLI:
- If you run
.\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\bin\ensoit will run Enso in CLI mode. - Command line args and environment variables to control it.
--run <Path>runs a project or an enso script (something with amainfunction).--in-project <Path>specifies the project the script runs in (really useful for our unit tests).--ir-cachesjust use it - basically speeds up Enso compilation by using intermediate representation which is saved in a cache.--inspectruns Enso CLI in debug mode and gives a URL to connect a Chrome debugger to.ENSO_TEST_JUNIT_DIRspecifies where to write the JUnit XML files to if running tests.JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"- sets up the connection to allow Java debugging (connect up IntelliJ to it).- Utility
enso.ps1script to run CLI.
Project Structure:
- app: IDE. Visualisation code is
app/gui/view/graph-editor/src/builtin/visualization/java_script/ - app/gui2: New TS Vue GUI.
- distribution/lib: The Enso code of the standard libs.
- engine: The built-in types and runtime. Java code for built-ins are here.
- std-bits: The Java code of the standard libs.
- test: The unit tests for the Enso standard libs.
- tools: The only thing that comes up in here is the legal review. Only matters if you update or change a third party library.
- Want to exclude
dist,built-distributionandtargetfrom the IDE.
Enso Project Structure:
package.yaml: has the edition and can have lots of meta data stuff.src: has the Enso code.src\Main.enso: entry point for the project.data: has the data files. (optional).enso: internal stuff but basically a localised git repo containing all changes.
Enso Script Structure:
- Imports at the top.
import Standard.Base.Data.List.Listimports theListtype from theListmodule in theData.Listfolder in theStandard.Baselibrary.import Standard.Base.Data.Listimports theListmodule in theData.Listfolder in theStandard.Baselibrary. Use bits of it asList.<...>- Can alias
asfor exampleimport Standard.Base.Data.List as List_Modulethen useList_Module.<...> from Standard.Base.Data.List import allimports all the types and functions in module to the names space (not prefixed).from Standard.Base.Data.List import List, List_Errorimports specifics.polyglot java import <JavaFullClassName>imports a Java class (supportsasas well).- "Best practice" is to sort the imports alphabetically within each library.
projectimports within the same project. Within a library should be used don't use the full name.Main.ensoin a library is where we choose what we to export (exportsimilar toimport).from Standard.Base import allbrings in whatever is exported fromMain.ensoinStandard.Base.
main =is the entry point for the script.- No
returnstatement, last value from a block is returned. Makes early exit harder. - Variables are immutable. I.e.
a=123; a=456is not allowed. <|folds the block into the line above.if <cond> then <true block> else <false block>have to have theif/then/elseon one line.case <cond> of\n True-> <true block>\n False-> <false block>.- Instance vs static functions. First argument is
selfthen an instance function. - Extension function:
Text.substring self start end =is an extension function onTexttype.