Skip to content

Commit

Permalink
Merge pull request #543 from lf-lang/issue537-multiline-warnings
Browse files Browse the repository at this point in the history
Fix #537 - support warnings that span multiple lines in standalone compiler
  • Loading branch information
lhstrh authored Oct 19, 2021
2 parents a82240f + 69367b8 commit 437e0f9
Show file tree
Hide file tree
Showing 26 changed files with 512 additions and 75 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ jobs:
verbose: true # optional (default = false)
if: runner.os == 'Linux'

standalone-lfc-tests:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
# Setup Build dependencies
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
# The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
java-version: 11
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Run standalone LFC tests
run: |
./gradlew :org.lflang.lfc:test --stacktrace
c-tests:
strategy:
matrix:
Expand Down
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@ subprojects {
delete "${projectDir}/src-gen/"
}
}

gradle.projectsEvaluated {
// Our CI uses --tests filters, which fails if some
// subprojects have no matching test.
//
// https://stackoverflow.com/questions/26147480/how-to-make-gradle-not-to-mark-build-failed-if-no-tests-are-found
subprojects {
test {
filter {
setFailOnNoMatchingTests(false)
}
}
}
}

21 changes: 21 additions & 0 deletions org.lflang.lfc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@

sourceSets {
test {
java.srcDirs = []
kotlin.srcDirs = ['test/kotlin']
resources.srcDir('test/resources')
resources.include '**/*'
}
}

compileTestKotlin {
destinationDir = compileTestJava.destinationDir
kotlinOptions {
jvmTarget = "1.8"
}
}



dependencies {
implementation project(':org.lflang')
implementation "org.eclipse.xtext:org.eclipse.xtext.ide:${xtextVersion}"
implementation "org.eclipse.xtext:org.eclipse.xtext.xbase.ide:${xtextVersion}"

testImplementation "junit:junit:4.12"
}

apply plugin: 'application'
Expand Down
17 changes: 13 additions & 4 deletions org.lflang.lfc/src/org/lflang/lfc/LFStandaloneModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
* generated by Xtext 2.23.0
*/

package org.lflang;
package org.lflang.lfc;

import java.util.Objects;

import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.impl.EValidatorRegistryImpl;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;

import org.lflang.lfc.ReportingBackend;
import org.lflang.lfc.StandaloneErrorReporter;
import org.lflang.lfc.StandaloneIssueAcceptor;
import org.lflang.ErrorReporter;
import org.lflang.LFRuntimeModule;

import com.google.inject.Binder;
import com.google.inject.Module;
Expand All @@ -60,5 +61,13 @@ public void configure(Binder binder) {
binder.bind(ErrorReporter.class).to(StandaloneErrorReporter.class);
binder.bind(ReportingBackend.class).toInstance(helper);
binder.bind(ValidationMessageAcceptor.class).to(StandaloneIssueAcceptor.class);
// This is required to force the ResourceValidator to
// use a new registry instance (which is reused by the injector as a singleton).
// Otherwise, it uses the static EValidator.Registry.INSTANCE which is bad
// as the first validator to be created would persist in that static instance.
// New injectors would reuse the existing instance, but
// its fields would have been injected by an older injector
// and be out of sync with the rest of the application.
binder.bind(EValidator.Registry.class).to(EValidatorRegistryImpl.class).asEagerSingleton();
}
}
Loading

0 comments on commit 437e0f9

Please # to comment.