updates target definition and fixes error/warning handling
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/.launch/
|
||||
/.settings/
|
||||
/RV32GC.json
|
||||
|
@@ -39,7 +39,7 @@
|
||||
<unit id="org.json" version="1.0.0.v201011060100"/>
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<repository location="https://minres.github.io/CoreDSL/repository/2.0/2.0.14"/>
|
||||
<repository location="https://minres.github.io/CoreDSL/repository/2.0/2.0.17"/>
|
||||
<unit id="com.minres.coredsl.feature.source.feature.group" version="0.0.0"/>
|
||||
<unit id="com.minres.coredsl.feature.feature.group" version="0.0.0"/>
|
||||
</location>
|
||||
|
@@ -45,7 +45,7 @@ class CoreDslJsonGenerator extends AbstractGenerator {
|
||||
}
|
||||
def JSONArray compile(CoreDef coreDef) {
|
||||
val insts = coreDef.allInstr
|
||||
val enabled_insts = insts.filter[it.isHls]
|
||||
val enabled_insts = insts//.filter[it.isHls]
|
||||
val res = enabled_insts.map[ inst | inst.jsonDescr ].toList
|
||||
return res.length>0?new JSONArray(res) :new JSONArray()
|
||||
}
|
||||
@@ -60,7 +60,11 @@ class CoreDslJsonGenerator extends AbstractGenerator {
|
||||
}
|
||||
|
||||
def String getSource(Statement stmt){
|
||||
try {
|
||||
(stmt.eResource as XtextResource).serializer.serialize(stmt)
|
||||
} catch(RuntimeException e){
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
def Iterable<Instruction> allInstr(CoreDef core) {
|
||||
|
@@ -28,6 +28,7 @@ import org.eclipse.xtext.generator.IFileSystemAccess
|
||||
import java.lang.reflect.MalformedParametersException
|
||||
import org.apache.log4j.Level
|
||||
import org.eclipse.emf.ecore.resource.Resource
|
||||
import org.eclipse.xtext.diagnostics.Severity
|
||||
|
||||
class Main implements Callable<Integer> {
|
||||
|
||||
@@ -84,9 +85,16 @@ class GeneratorMain {
|
||||
// Validate the resource
|
||||
val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl)
|
||||
if (!issues.empty) {
|
||||
val errors = issues.filter[it.severity == Severity.ERROR]
|
||||
val warnings = issues.filter[it.severity == Severity.WARNING]
|
||||
if (!errors.empty) {
|
||||
logger.error("Error validating " + resource.URI)
|
||||
issues.forEach[logger.error(it)]
|
||||
throw new ParseException("error validating " + resource.URI)
|
||||
} else if (!warnings.empty) {
|
||||
logger.warn("There are warnings validating " + resource.URI)
|
||||
issues.forEach[logger.warn(it)]
|
||||
}
|
||||
}
|
||||
// Configure and start the generator
|
||||
resource.runGenerator(params.outputFile)
|
||||
|
Reference in New Issue
Block a user