public class BCompileUtil extends Object
Constructor and Description |
---|
BCompileUtil() |
Modifier and Type | Method and Description |
---|---|
static CompileResult |
compile(Object obj,
String sourceRoot,
String packageName)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceFilePath)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceFilePath,
boolean isSiddhiRuntimeEnabled) |
static CompileResult |
compile(String sourceFilePath,
CompilerPhase compilerPhase)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceFilePath,
CompilerPhase compilerPhase,
boolean enableExpFeatures)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceRoot,
String packageName,
CompilerPhase compilerPhase)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceRoot,
String packageName,
CompilerPhase compilerPhase,
boolean enableExpFeatures)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceRoot,
String packageName,
CompilerPhase compilerPhase,
boolean isSiddhiRuntimeEnabled,
boolean enableExpFeatures)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceRoot,
String packageName,
CompilerPhase compilerPhase,
SourceDirectory sourceDirectory) |
static CompileResult |
compileAndGetBIR(String sourceFilePath)
Compile and return the semantic errors.
|
static BLangPackage |
compileAndGetPackage(String sourceFilePath)
Compile and return the compiled package node.
|
static CompileResult |
compileAndSetup(Object obj,
String sourceRoot,
String packageName)
Compile and return the semantic errors.
|
static CompileResult |
compileAndSetup(String sourceFilePath)
Compile and return the semantic errors.
|
static CompileResult |
compileWithoutExperimentalFeatures(String sourceFilePath) |
static CompileResult |
compileWithTests(CompilerContext context,
String packageName,
CompilerPhase compilerPhase)
Compile with tests and return the semantic errors.
|
static String |
concatFileName(String fileName,
Path pathLocation)
concatenates a given filename to the provided path in directory.
|
static BMap<String,BValue> |
createAndGetStruct(ProgramFile programFile,
String packagePath,
String structName) |
static CompilerContext |
createCompilerContext(String sourceRoot,
CompilerPhase compilerPhase)
Create a compiler context.
|
static CompilerContext |
createCompilerContext(String sourceRoot,
CompilerPhase compilerPhase,
boolean enableExpFeatures) |
static List<Diagnostic> |
getDiagnostics(ClassLoader classLoader,
String sourceRoot,
String fileName)
Used by IntelliJ IDEA plugin to provide semantic analyzing capability.
|
static String |
readFileAsString(String path) |
static void |
run(String sourceFilePath,
String functionName)
Compile and run a ballerina file.
|
public static CompileResult compileAndSetup(String sourceFilePath)
sourceFilePath
- Path to source module/filepublic static CompileResult compileAndSetup(Object obj, String sourceRoot, String packageName)
obj
- this is to find the original callers location.sourceRoot
- root path of the modulespackageName
- name of the module to compilepublic static CompileResult compileAndGetBIR(String sourceFilePath)
sourceFilePath
- Path to source module/filepublic static CompileResult compile(String sourceFilePath)
sourceFilePath
- Path to source module/filepublic static CompileResult compileWithoutExperimentalFeatures(String sourceFilePath)
public static CompileResult compile(String sourceFilePath, boolean isSiddhiRuntimeEnabled)
public static CompileResult compile(Object obj, String sourceRoot, String packageName)
obj
- this is to find the original callers location.sourceRoot
- root path of the modulespackageName
- name of the module to compilepublic static String concatFileName(String fileName, Path pathLocation)
concatenates a given filename to the provided path in directory.
Note : this function is relevant since in Unix the directory would be separated from backslash and in unix the folder will be separated from forward slash.
fileName
- name of the file.pathLocation
- location of the directory.public static CompileResult compile(String sourceFilePath, CompilerPhase compilerPhase, boolean enableExpFeatures)
sourceFilePath
- Path to source package/filecompilerPhase
- Compiler phaseenableExpFeatures
- Flag indicating to enable the experimental featurepublic static CompileResult compile(String sourceFilePath, CompilerPhase compilerPhase)
sourceFilePath
- Path to source package/filecompilerPhase
- Compiler phasepublic static CompileResult compile(String sourceRoot, String packageName, CompilerPhase compilerPhase, boolean enableExpFeatures)
sourceRoot
- root path of the modulespackageName
- name of the module to compilecompilerPhase
- Compiler phaseenableExpFeatures
- Flag indicating to enable the experimental featurespublic static CompileResult compile(String sourceRoot, String packageName, CompilerPhase compilerPhase, boolean isSiddhiRuntimeEnabled, boolean enableExpFeatures)
sourceRoot
- root path of the modulespackageName
- name of the module to compilecompilerPhase
- Compiler phaseisSiddhiRuntimeEnabled
- Flag indicating to enable siddhi runtime for stream processingenableExpFeatures
- Flag indicating to enable the experimental featurespublic static CompileResult compile(String sourceRoot, String packageName, CompilerPhase compilerPhase)
sourceRoot
- root path of the modulespackageName
- name of the module to compilecompilerPhase
- Compiler phasepublic static CompileResult compileWithTests(CompilerContext context, String packageName, CompilerPhase compilerPhase)
context
- Compiler ContextpackageName
- name of the module to compilecompilerPhase
- Compiler phasepublic static CompilerContext createCompilerContext(String sourceRoot, CompilerPhase compilerPhase)
sourceRoot
- source root or project directory pathcompilerPhase
- Compiler phasepublic static CompilerContext createCompilerContext(String sourceRoot, CompilerPhase compilerPhase, boolean enableExpFeatures)
public static CompileResult compile(String sourceRoot, String packageName, CompilerPhase compilerPhase, SourceDirectory sourceDirectory)
public static BLangPackage compileAndGetPackage(String sourceFilePath)
sourceFilePath
- Path to source module/filepublic static void run(String sourceFilePath, String functionName)
sourceFilePath
- Path to the ballerina file.functionName
- The name of the function to runpublic static String readFileAsString(String path) throws IOException
IOException
public static BMap<String,BValue> createAndGetStruct(ProgramFile programFile, String packagePath, String structName)
public static List<Diagnostic> getDiagnostics(ClassLoader classLoader, String sourceRoot, String fileName)
classLoader
- a ClassLoader
to be set as thread context class loader. This is used by ServiceLoader
. Otherwise semantic analyzing capability providing wont work since it
cant find core package.sourceRoot
- source root of a projectfileName
- either the file name (if in project root) or the module nameCopyright © 2018 WSO2. All rights reserved.