Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set external runtime path #1633

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ts-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ jobs:
run: |
brew install coreutils
if: ${{ runner.os == 'macOS' }}
- name: Clone reactor-ts
uses: actions/checkout@v3
with:
repository: lf-lang/reactor-ts
path: ./reactor-ts
ref: master
- name: Perform TypeScript tests
run: |
./gradlew test --tests org.lflang.tests.runtime.TypeScriptTest.*
./gradlew test --tests org.lflang.tests.runtime.TypeScriptTest.* -Druntime="./reactor-ts"
petervdonovan marked this conversation as resolved.
Show resolved Hide resolved
- name: Report to CodeCov
uses: codecov/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions org.lflang/src/org/lflang/TargetProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public enum TargetProperty {
* compiled binary.
*/
EXTERNAL_RUNTIME_PATH("external-runtime-path", PrimitiveType.STRING,
List.of(Target.CPP),
List.of(Target.CPP, Target.TS),
(config) -> ASTUtils.toElement(config.externalRuntimePath),
(config, value, err) -> {
config.externalRuntimePath = ASTUtils.elementToSingleString(value);
Expand Down Expand Up @@ -411,7 +411,7 @@ public enum TargetProperty {

/**
* Directive to specify the platform for cross code generation. This is either a string of the platform
* or a dictionary of options that includes the string name.
* or a dictionary of options that includes the string name.
*/
PLATFORM("platform", UnionType.PLATFORM_STRING_OR_DICTIONARY, Target.ALL,
(config) -> {
Expand Down
27 changes: 13 additions & 14 deletions org.lflang/src/org/lflang/cli/Lfc.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Lfc() {
@Option(
names = {"-q", "--quiet"},
arity = "0",
description =
description =
"Suppress output of the target compiler and other commands")
private boolean quiet;

Expand Down Expand Up @@ -195,7 +195,7 @@ private void invokeGenerator(

final Resource resource = getResource(path);
if (resource == null) {
reporter.printFatalErrorAndExit(path
reporter.printFatalErrorAndExit(path
+ " is not an LF file. Use the .lf file extension to"
+ " denote LF files.");
} else if (federated) {
Expand Down Expand Up @@ -261,27 +261,26 @@ protected Properties filterPassOnProps() {
BuildParm.SCHEDULER,
BuildParm.THREADING,
BuildParm.WORKERS)
.map(param -> param.getKey())
.map(BuildParm::getKey)
.collect(Collectors.toUnmodifiableSet());

Properties props = new Properties();

for (OptionSpec option : spec.options()) {
String optionName = option.longestName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String optionName = option.longestName();
String optionName = option.descriptionKey();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I commented this earlier, but I couldn't see my comment anymore. This issue was fixed on master #1631 in a different way.

if (optionName.startsWith("--")) optionName = optionName.substring(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (optionName.startsWith("--")) optionName = optionName.substring(2);

// Check whether this option needs to be passed on to the code
// generator as a property.
if (passOnParams.contains(optionName)) {
Object valueObject = option.getValue();
if (passOnParams.contains(optionName) && valueObject != null) {
String value = "";
// Boolean or Integer option.
if (option.getValue() instanceof Boolean ||
option.getValue() instanceof Integer) {
value = String.valueOf(option.getValue());
// String option.
} else if (option.getValue() instanceof String) {
value = option.getValue();
// Path option.
} else if (option.getValue() instanceof Path) {
value = option.getValue().toString();
if (valueObject instanceof Boolean ||
valueObject instanceof Integer) {
value = String.valueOf(valueObject);
} else if (valueObject instanceof String s) {
value = s;
} else if (valueObject instanceof Path) {
value = valueObject.toString();
}
props.setProperty(optionName, value);
}
Expand Down
5 changes: 1 addition & 4 deletions org.lflang/src/org/lflang/generator/LFGeneratorContext.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package org.lflang.generator;

import java.io.IOException;
import java.nio.file.Path;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;

import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.generator.IFileSystemAccess2;
import org.eclipse.xtext.generator.IGeneratorContext;
import org.eclipse.xtext.util.RuntimeIOException;

import org.lflang.ErrorReporter;
import org.lflang.FileConfig;
Expand Down Expand Up @@ -79,7 +76,7 @@ enum Mode {
}

/**
* Return the mode of operation, which indicates how the compiler has been invoked
* Return the mode of operation, which indicates how the compiler has been invoked
* (e.g., from within Epoch, from the command line, or via a Language Server).
*/
Mode getMode();
Expand Down