Skip to content

Commit

Permalink
Merge branch 'master' into fix-index-deadline3
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Dec 19, 2022
2 parents a9c7a7e + 3ccc43b commit 7228484
Show file tree
Hide file tree
Showing 103 changed files with 2,036 additions and 1,795 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ If a repository has a text file that stores a ref (e.g., a SHA1 hash of a commit
After workflow execution, the value of the output `ref` will be equal to the first line in the given `file`.
## Nightly Build
See [nightly-build.yml](https://github.com/lf-lang/lingua-franca/blob/master/.github/workflows/nightly-build.yml).

## Debugging tests

To debug test failures that are difficult to reproduce locally, it can be useful
to add a step such as [this one](https://github.com/marketplace/actions/debugging-with-ssh) to SSH into the GitHub Actions runner. Such a debugging step
should not be included in the `master` version of the workflow file.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
uses: lf-lang/lingua-franca/.github/workflows/build.yml@master
needs: cancel

# Check that automatic code formatting works.
format:
uses: lf-lang/lingua-franca/.github/workflows/format.yml@master
needs: cancel

# Run the unit tests.
unit-tests:
uses: lf-lang/lingua-franca/.github/workflows/unit-tests.yml@master
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cpp-ros2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
ref: ${{ inputs.runtime-ref }}
if: ${{ inputs.runtime-ref }}
- name: Setup ROS2
uses: ros-tooling/setup-ros@0.2.2
uses: ros-tooling/setup-ros@v0.4
with:
required-ros-distributions: galactic
required-ros-distributions: rolling
- name: Run C++ tests;
run: |
source /opt/ros/galactic/setup.bash
source /opt/ros/*/setup.bash
./gradlew test --tests org.lflang.tests.runtime.CppRos2Test.*
- name: Report to CodeCov
uses: codecov/codecov-action@v2.1.0
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/cpp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
- name: Install Dependencies OS X
run: brew install coreutils
if: runner.os == 'macOS'
- name: Install clang-tidy on Ubuntu
- name: Install clang-tidy and lcov on Ubuntu
run: |
sudo apt-get update
sudo apt-get install -y clang-tidy
sudo apt-get install -y lcov
if: matrix.platform == 'ubuntu-latest'
- name: Check out specific ref of reactor-cpp
uses: actions/checkout@v2
Expand All @@ -43,10 +44,29 @@ jobs:
- name: Run C++ tests;
run: |
./gradlew test --tests org.lflang.tests.runtime.CppTest.*
- name: Report to CodeCov
- name: Report Java coverage to CodeCov
uses: codecov/codecov-action@v2.1.0
with:
file: org.lflang.tests/build/reports/xml/jacoco
fail_ci_if_error: false
verbose: true
if: ${{ !inputs.runtime-ref }} # i.e., if this is part of the main repo's CI
- name: Collect reactor-cpp coverage data
run: |
lcov --capture --directory test/Cpp --output-file coverage.info
lcov --extract coverage.info ${GITHUB_WORKSPACE}/test/Cpp/src-gen/reactor-cpp-default/\* --output-file reactor-cpp.info
genhtml reactor-cpp.info --output-directory reactor-cpp.coverage
if: matrix.platform == 'ubuntu-latest'
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: reactor-cpp.coverage
path: reactor-cpp.coverage
if: matrix.platform == 'ubuntu-latest'
- name: Report C++ coverage to CodeCov
uses: codecov/codecov-action@v2.1.0
with:
file: reactor-cpp.info
fail_ci_if_error: false
verbose: true
if: matrix.platform == 'ubuntu-latest'
19 changes: 19 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test the automatic code formatting task

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Check out lingua-franca repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Prepare build environment
uses: ./.github/actions/prepare-build-env
- name: Run spotlessCheck
run: ./gradlew spotlessCheck
shell: bash
8 changes: 8 additions & 0 deletions .github/workflows/lsp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
brew install protobuf
brew install protobuf-c
if: ${{ runner.os == 'macOS' }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run language server Python tests without PyLint
run: ./gradlew test --tests org.lflang.tests.lsp.LspTests.pythonValidationTestSyntaxOnly
- name: Report to CodeCov
Expand All @@ -69,6 +73,10 @@ jobs:
verbose: true
- name: Install pylint
run: python3 -m pip install pylint
if: ${{ runner.os != 'macOS' }}
- name: Install pylint macOS
run: brew install pylint
if: ${{ runner.os == 'macOS' }}
- name: Run language server tests
run: ./gradlew clean test --tests org.lflang.tests.lsp.LspTests.*ValidationTest
- name: Report to CodeCov
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/py-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
- name: Prepare build environment
uses: ./.github/actions/prepare-build-env
- name: Setup Python
uses: actions/setup-python@v2
if: ${{ runner.os == 'Windows' }}
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies OS X
run: |
brew install coreutils
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/serialization-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: Prepare build environment
uses: ./.github/actions/prepare-build-env
- name: Setup ROS2
uses: ros-tooling/setup-ros@0.2.2
uses: ros-tooling/setup-ros@v0.4
with:
required-ros-distributions: rolling
- name: Install Protobuf Ubuntu
run: |
sudo apt-get update
sudo apt-get install -y libprotobuf-c-dev protobuf-c-compiler protobuf-compiler libprotobuf-dev
sudo apt-get install -y libprotobuf-c-dev protobuf-c-compiler protobuf-compiler libprotobuf-dev python3-protobuf
- name: Install LinguaFrancaBase
run: pip3 install LinguaFrancaBase
- name: Run serialization tests;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ts-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
run:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out lingua-franca repository
Expand Down
4 changes: 1 addition & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions buildSrc/src/main/java/lfformat/LfFormatStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,19 @@ private Process runFormatter(File file) throws IOException {
new URLClassLoader(new URL[] {resourcePath.toUri().toURL()}));
final Path lffPath =
Path.of(
"org.lflang.cli",
"org.lflang",
"build",
"libs",
String.format("org.lflang.cli-%s-lff.jar", properties.getString("VERSION")));
String.format("org.lflang-%s.jar", properties.getString("VERSION")));
// It looks silly to invoke Java from Java, but it is necessary in
// order to break the circularity of needing the program to be built
// in order for it to be built.
return new ProcessBuilder(
List.of(
"java",
"-jar",
"-cp",
lffPath.toString(),
"org.lflang.cli.Lff",
"--dry-run",
file.getAbsoluteFile().toString()))
.start();
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ shadowJarVersion=7.1.2
spotlessVersion=6.11.0
xtextGradleVersion=3.0.0
xtextVersion=2.28.0
klighdVersion=2.2.1-SNAPSHOT

[manifestPropertyNames]
org.eclipse.xtext=xtextVersion
Expand Down
1 change: 1 addition & 0 deletions org.lflang.diagram/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Bundle-ActivationPolicy: lazy
Require-Bundle: de.cau.cs.kieler.klighd;bundle-version="2.2.0",
de.cau.cs.kieler.klighd.krendering.extensions;bundle-version="2.2.0",
de.cau.cs.kieler.klighd.lsp;bundle-version="2.2.0",
de.cau.cs.kieler.kgraph.text;bundle-version="2.2.0",
com.google.guava,
org.eclipse.xtext,
org.eclipse.xtext.xbase.lib,
Expand Down
108 changes: 108 additions & 0 deletions org.lflang.diagram/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

repositories {
mavenCentral()
// TODO Remove this in-official maven repository as soon as Klighd is released to maven central in the future.
maven {
url "https://rtsys.informatik.uni-kiel.de/~kieler/files/repo/"
}
}
dependencies {
implementation project(':org.lflang')
implementation project(':org.lflang.ide')
implementation "org.eclipse.xtext:org.eclipse.xtext.ide:${xtextVersion}"
implementation ("de.cau.cs.kieler.klighd:de.cau.cs.kieler.klighd.lsp:${klighdVersion}") {
exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt.*'
exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt'
}
implementation ("de.cau.cs.kieler.klighd:de.cau.cs.kieler.klighd.standalone:${klighdVersion}") {
exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt.*'
exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt'
}
}

apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'

task generateLanguageDiagramServer {
description 'Creates a jar that implements a language server with diagram support for LF.'

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'

mainClassName = "org.lflang.diagram.lsp.LanguageDiagramServer"

compileJava {
options.compilerArgs << '-Xlint:unchecked'
}

shadowJar {
classifier = 'lds'

// Handling of service loader registrations via META-INF/services/*
mergeServiceFiles()

// Merge properties
transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer){
resource = 'plugin.properties'
}

// Exclude files that are known to be dispensable for a language server
exclude(
'*._trace',
'*.ecore',
'*.ecorediag',
'*.g',
'*.genmodel',
'*.html',
'*.mwe2',
'*.profile',
'*.xtext',
'*readme.txt',
'.api_description',
'.options',
'about.*',
'about_*',
'about_files/*',
'ant_tasks/*',
'cheatsheets/*',
'com/*/*.java',
'de/*/*.java',
'docs/*',
'log4j.properties',
'META-INF/*.DSA',
'META-INF/*.RSA',
'META-INF/*.SF',
'META-INF/changelog.txt',
'META-INF/DEPENDENCIES',
'META-INF/eclipse.inf',
'META-INF/INDEX.LIST',
'META-INF/maven/*',
'META-INF/NOTICE',
'META-INF/NOTICE.txt',
'META-INF/p2.inf',
'META-INF/versions/*/module-info.class',
'modeling32.png',
'module-info.class',
'org/*/*.java',
'OSGI-INF/l10n/bundle.properties',
'plugin.xml',
'profile.list',
'schema/*',
'systembundle.properties',
'xtend-gen/*',
'xtext32.png',
)

// Minimizing should be enabled with caution because some classes are only
// loaded via services (e.g. diagram syntheses and some xtext aspects)
// and would be removed when minimized
// minimize() {
// exclude(dependency('log4j:log4j:.*'))
// exclude(dependency('org.eclipse.xtext:.*ide:.*'))
// }
}
}

generateLanguageDiagramServer.finalizedBy shadowJar
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

import java.util.List;

import org.eclipse.xtext.ide.server.LanguageServerImpl;
import org.eclipse.xtext.Constants;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.ide.server.ILanguageServerExtension;
import org.eclipse.xtext.ide.server.LanguageServerImpl;
import org.eclipse.xtext.service.AbstractGenericModule;
import org.eclipse.xtext.util.Modules2;
import org.lflang.generator.LanguageServerErrorReporter;
import org.lflang.ide.LFIdeSetup;

import com.google.inject.Module;
import com.google.inject.name.Names;
import com.google.inject.util.Modules;

import de.cau.cs.kieler.kgraph.text.services.KGraphGrammarAccess;
import de.cau.cs.kieler.klighd.lsp.KGraphLanguageClient;
import de.cau.cs.kieler.klighd.lsp.interactive.layered.LayeredInteractiveLanguageServerExtension;
import de.cau.cs.kieler.klighd.lsp.interactive.rectpacking.RectpackingInteractiveLanguageServerExtension;
Expand All @@ -16,9 +25,6 @@
import de.cau.cs.kieler.klighd.lsp.launch.ILanguageRegistration;
import de.cau.cs.kieler.klighd.lsp.launch.Language;

import org.lflang.ide.LFIdeSetup;
import org.lflang.generator.LanguageServerErrorReporter;

/**
* Language server with extended diagram communication.
*
Expand All @@ -30,10 +36,14 @@ private static class LFLsCreator extends AbstractLsCreator {

@Override
public Module createLSModules(boolean socket) {
return Modules.override(super.createLSModules(socket)).with(new AbstractGenericModule() {
return Modules2.mixin(Modules.override(super.createLSModules(socket)).with(new AbstractGenericModule() {
public Class<? extends LanguageServerImpl> bindLanguageServerImpl() {
return LFLanguageServer.class;
}
}), it -> {
// Temporary fix for an issue of Klighd with Xtext 2.28 (https://github.com/kieler/KLighD/issues/144)
it.bind(IGrammarAccess.class).to(KGraphGrammarAccess.class);
it.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("de.cau.cs.kieler.kgraph.text.KGraph");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@

import javax.inject.Inject;

import org.eclipse.elk.alg.layered.options.EdgeStraighteningStrategy;
import org.eclipse.elk.alg.layered.options.FixedAlignment;
import org.eclipse.elk.alg.layered.options.GreedySwitchType;
import org.eclipse.elk.alg.layered.options.LayerConstraint;
import org.eclipse.elk.alg.layered.options.LayeredOptions;
import org.eclipse.elk.alg.layered.options.NodePlacementStrategy;
Expand Down Expand Up @@ -1390,7 +1387,7 @@ private KNode addErrorComment(KNode node, String message) {

private Iterable<KNode> createUserComments(EObject element, KNode targetNode) {
if (getBooleanValue(SHOW_USER_LABELS)) {
String commentText = AttributeUtils.label(element);
String commentText = AttributeUtils.getLabel(element);

if (!StringExtensions.isNullOrEmpty(commentText)) {
KNode comment = _kNodeExtensions.createNode();
Expand Down
Loading

0 comments on commit 7228484

Please sign in to comment.