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,
CompilerPhase compilerPhase)
Compile and return the semantic errors.
|
static CompileResult |
compile(String sourceRoot,
String packageName,
CompilerPhase compilerPhase)
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 String |
concatFileName(String fileName,
Path pathLocation)
concatenates a given filename to the provided path in directory.
|
static BStruct |
createAndGetStruct(ProgramFile programFile,
String packagePath,
String structName) |
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)
Compile and run a ballerina file.
|
public static CompileResult compileAndSetup(String sourceFilePath)
sourceFilePath
- Path to source package/filepublic static CompileResult compileAndSetup(Object obj, String sourceRoot, String packageName)
obj
- this is to find the original callers location.sourceRoot
- root path of the source packagespackageName
- name of the package to compilepublic static CompileResult compile(String sourceFilePath)
sourceFilePath
- Path to source package/filepublic static CompileResult compile(Object obj, String sourceRoot, String packageName)
obj
- this is to find the original callers location.sourceRoot
- root path of the source packagespackageName
- name of the package 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)
sourceFilePath
- Path to source package/filecompilerPhase
- Compiler phasepublic static CompileResult compile(String sourceRoot, String packageName, CompilerPhase compilerPhase)
sourceRoot
- root path of the source packagespackageName
- name of the package to compilecompilerPhase
- Compiler phasepublic static BLangPackage compileAndGetPackage(String sourceFilePath)
sourceFilePath
- Path to source package/filepublic static void run(String sourceFilePath)
sourceFilePath
- Path to the ballerina file.public static BStruct 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 package nameCopyright © 2018 WSO2. All rights reserved.