mirror of
https://github.com/enso-org/enso.git
synced 2024-11-26 17:06:48 +03:00
941512e0ba
This change adds serialization and deserialization of library bindings. In order to be functional, one needs to first generate IR and serialize bindings using `--compiled <path-to-library>` command. The bindings will be stored under the library with `.bindings` suffix. Bindings are being generated during `buildEngineDistribution` task, thus not requiring any extra steps. When resolving import/exports the compiler will first try to load module's bindings from cache. If successful, it will not schedule its imports/exports for immediate compilation, as we always did, but use the bindings info to infer the dependent modules. The current change does not make any optimizations when it comes to compiling the modules, yet. It only delays the actual compilation/loading IR from cache so that it can be done in bulk. Further optimizations will come from this opportunity such as parallel loading of caches or lazily inferring only the necessary modules. Part of https://github.com/enso-org/enso/issues/5568 work.
42 lines
1.2 KiB
Scala
42 lines
1.2 KiB
Scala
object Platform {
|
|
|
|
/** Returns true if the build system is running on Windows.
|
|
*/
|
|
def isWindows: Boolean =
|
|
sys.props("os.name").toLowerCase().contains("windows")
|
|
|
|
/** Returns true if the build system is running on Linux.
|
|
*/
|
|
def isLinux: Boolean =
|
|
sys.props("os.name").toLowerCase().contains("linux")
|
|
|
|
/** Returns true if the build system is running on macOS.
|
|
*/
|
|
def isMacOS: Boolean =
|
|
sys.props("os.name").toLowerCase().contains("mac")
|
|
|
|
/** Returns the dynamic library file name on the current platform.
|
|
*
|
|
* @param libraryName the library name
|
|
* @return the file name of provided library on the current platform
|
|
*/
|
|
def dynamicLibraryFileName(libraryName: String): String = {
|
|
if (isMacOS) s"lib$libraryName.dylib"
|
|
else if (isWindows) s"$libraryName.dll"
|
|
else if (isLinux) s"lib$libraryName.so"
|
|
else {
|
|
throw new RuntimeException(s"Unknown platform [${sys.props("os.name")}].")
|
|
}
|
|
}
|
|
|
|
/** Returns the executable file name on the current platform.
|
|
*
|
|
* @param name the executable name
|
|
* @return the file name of provided executable on the current platform
|
|
*/
|
|
def executableFileName(name: String): String = {
|
|
if (isWindows) s".\\$name.bat" else name
|
|
}
|
|
|
|
}
|