-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2192 from lf-lang/tracing-refactoring2
Plugin API for tracing
- Loading branch information
Showing
14 changed files
with
131 additions
and
21 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
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
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
56 changes: 56 additions & 0 deletions
56
core/src/main/java/org/lflang/target/property/TracePluginProperty.java
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,56 @@ | ||
package org.lflang.target.property; | ||
|
||
import org.lflang.MessageReporter; | ||
import org.lflang.lf.Element; | ||
import org.lflang.target.TargetConfig; | ||
import org.lflang.target.property.TracePluginProperty.TracePluginOptions; | ||
import org.lflang.target.property.type.PrimitiveType; | ||
|
||
/** Property that provides an alternative tracing implementation. */ | ||
public class TracePluginProperty extends TargetProperty<TracePluginOptions, PrimitiveType> { | ||
|
||
/** Singleton target property instance. */ | ||
public static final TracePluginProperty INSTANCE = new TracePluginProperty(); | ||
|
||
private TracePluginProperty() { | ||
super(PrimitiveType.STRING); | ||
} | ||
|
||
@Override | ||
public TracePluginOptions initialValue() { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected TracePluginOptions fromAst(Element node, MessageReporter reporter) { | ||
reporter.at(node).error(TargetConfig.NOT_IN_LF_SYNTAX_MESSAGE); | ||
return null; | ||
} | ||
|
||
@Override | ||
protected TracePluginOptions fromString(String s, MessageReporter reporter) { | ||
return new TracePluginOptions(s); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "trace-plugin"; | ||
} | ||
|
||
@Override | ||
public Element toAstElement(TracePluginOptions value) { | ||
throw new UnsupportedOperationException(TargetConfig.NOT_IN_LF_SYNTAX_MESSAGE); | ||
} | ||
|
||
public static class TracePluginOptions { | ||
private final String implementationArchiveFile; | ||
|
||
public TracePluginOptions(String implementationArchiveFile) { | ||
this.implementationArchiveFile = implementationArchiveFile; | ||
} | ||
|
||
public String getImplementationArchiveFile() { | ||
return implementationArchiveFile; | ||
} | ||
} | ||
} |
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