-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Frege Compiler Classpath with Environment Variable (#28)
* WIP: how to make the frege compiler configurable explore the effort of reading a gradle plugin property with the gradle tooling api. * feat: add shouldCorrectlyConfigureExtraClasspath test Expose two environment variables to configure the frege compiler: - FREGE_LSP_SOURCE_DIR - FREGE_LSP_EXTRA_CLASSPATH * refactor: split compilerHelper into compileOptions, compileGlobal and compileExecutor modules
- Loading branch information
Showing
23 changed files
with
1,759 additions
and
1,395 deletions.
There are no files selected for viewing
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
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 +1,2 @@ | ||
version = 3.1.0-alpha | ||
version = 3.2.0-alpha | ||
gradleVersion = 7.4.2 |
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
18 changes: 18 additions & 0 deletions
18
src/main/frege/ch/fhnw/thga/fregelanguageserver/compile/CompileGlobal.fr
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,18 @@ | ||
module ch.fhnw.thga.fregelanguageserver.compile.CompileGlobal where | ||
|
||
import ch.fhnw.thga.fregelanguageserver.compile.CompileOptions(standardCompileOptions) | ||
|
||
import Compiler.types.Global (Global, Options, SubSt) | ||
import Compiler.common.CompilerOptions (standardGlobal, theClassLoader) | ||
|
||
fromOptions :: Options -> IO Global | ||
fromOptions opts = do | ||
initialLoader <- theClassLoader opts | ||
initialGlobal <- standardGlobal | ||
pure initialGlobal. { | ||
options = opts, | ||
sub <- SubSt. { loader = initialLoader } | ||
} | ||
|
||
standardCompileGlobal :: IO Global | ||
standardCompileGlobal = fromOptions standardCompileOptions |
31 changes: 31 additions & 0 deletions
31
src/main/frege/ch/fhnw/thga/fregelanguageserver/compile/CompileOptions.fr
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,31 @@ | ||
module ch.fhnw.thga.fregelanguageserver.compile.CompileOptions where | ||
import Compiler.types.Global (Options) | ||
import frege.compiler.types.Targets public(thisTarget) | ||
import Compiler.enums.Flags | ||
|
||
getEnvDefault :: String -> String -> String | ||
getEnvDefault defaultValue envName = maybe defaultValue id $ System.getenv envName | ||
|
||
standardCompileOptions :: Options | ||
standardCompileOptions = Options | ||
{ | ||
source = "-", | ||
sourcePath = [ getEnvDefault "." "FREGE_LS_SOURCE_DIR" ], | ||
dir = ".", | ||
path = [ getEnvDefault "" "FREGE_LS_EXTRA_CLASSPATH" ], | ||
prefix = "", | ||
encoding = Just "UTF-8", | ||
tRanges = [], | ||
target = thisTarget, | ||
extending = Nothing, | ||
implementing = [], | ||
code = [], | ||
flags = Flags.fromList | ||
[ | ||
WARNINGS, | ||
HINTS, | ||
VERBOSE, | ||
IDEMODE, | ||
IDETOKENS | ||
] | ||
} |
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
3 changes: 0 additions & 3 deletions
3
src/main/frege/ch/fhnw/thga/fregelanguageserver/diagnostic/DiagnosticLSP.fr
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
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
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
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
Oops, something went wrong.