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

Generalization of VSI towards job pipelining + streaming AST construction messages + adaptation to latest changes in Silver #22

Merged
merged 86 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
1f890ad
Hooked Viper IDE to ViperServer
Sep 18, 2020
d6ca33d
implementing language server
Oct 3, 2020
df0e569
compilable version
Oct 9, 2020
a3704c6
verification running, diagnostics showing
Oct 11, 2020
bd49a93
verification cycle error-free
Oct 12, 2020
c4f4e9e
added flushing and proper server termination
Oct 13, 2020
6b81b69
moved language server files to their intended directory
Oct 13, 2020
b129773
Added VSI
Oct 13, 2020
887f2aa
preparing merge from master
Oct 13, 2020
7900e85
Merge branch 'master' into LanguageServer
Oct 13, 2020
64f67fc
implemented Language Server with updates from master
Oct 13, 2020
2541010
change test start
Oct 13, 2020
eb21f62
decremented positions to conform to LSP
Oct 13, 2020
b102be3
implemented Carbon/Silicon swap
Oct 13, 2020
90cb817
implemented backend swap
Oct 14, 2020
820d2dc
Split Server runner into two, one for each frontend
Oct 19, 2020
c314498
removed legacy code
Oct 21, 2020
204ef73
adjusted runner objects
Oct 22, 2020
8f466aa
Merge branch 'LanguageServer' of https://github.com/WissenIstNacht/vi…
aterga Nov 24, 2020
aa83feb
Resolved compilation errors after merge.
aterga Nov 24, 2020
e221128
Factored out some classes from VerificationServer
aterga Nov 24, 2020
78173e1
Use ViperConfig in LanguageServerRunner
aterga Nov 24, 2020
72bd15e
Generalized JobPool
aterga Nov 24, 2020
2327e17
Renamed VerificationTask to MessageStreamingTask
aterga Nov 24, 2020
4f8c5da
Added AstWorker, MessageReportingTask, refactored Packer and Unpacker…
aterga Nov 24, 2020
8f9d54c
Get rid of language definitions reporting in VerificationWorker. Add …
aterga Nov 24, 2020
1204cc7
Use helpers from ViperBackendConfig more often.
aterga Nov 24, 2020
ba597e3
Use custom TaskThread type for managing job artifacts in JobActor.
aterga Nov 24, 2020
91ed5ba
Store a Future[AST] in each AstHandle instance.
aterga Nov 24, 2020
aa6951a
Added method initializeAstConstruction to VSI
aterga Nov 25, 2020
7d6b4db
(1) Properly handle exceptions in AstWorker. (2) ViperHttpServer.onVe…
aterga Nov 25, 2020
69e6ec4
Support SMT counterexamples in ViperHttpServer
aterga Nov 25, 2020
ec38a62
Tiny changes in VSI
aterga Nov 28, 2020
403658e
Improvements in ViperServer's caching mechanism:
aterga Nov 28, 2020
6dec4e7
Continued refactoring VSI:
aterga Nov 29, 2020
96f40c1
Solve compilation problems after updating SBT to 1.4.4 and Scala to 2…
aterga Dec 11, 2020
0ac4be7
Ensure backwards compatibility.
aterga Dec 11, 2020
b063c65
Fixed a bug causing AstConstructor to crash while trying to verify no…
aterga Dec 19, 2020
596bc5f
Merge remote-tracking branch 'origin/master'
aterga Dec 19, 2020
a729b64
- adapted streamMessages after refactoring the job pipelines
aterga Dec 23, 2020
6cfb5bb
Cosmetic changes in VerificationWorker
aterga Dec 27, 2020
8796cb3
Renamed ViperServerSpec as viper.server.core.ViperServerHttpSpec
aterga Dec 27, 2020
60de197
Renamed ParsingTests as viper.server.core.AstGenerationTests
aterga Dec 27, 2020
bc90fe2
Added AsyncCoreServerSpec; started porting fragile tests from CoreSer…
aterga Dec 27, 2020
b72d78c
Some more cosmetic stuff
aterga Dec 27, 2020
a6660ee
Merge
aterga Dec 28, 2020
a678c44
Address Linard's points
aterga Dec 28, 2020
bb12abe
Merge https://github.com/viperproject/viperserver
aterga Dec 28, 2020
81c8c69
Update README.md
aterga Dec 28, 2020
a6a23da
Fixed the license headers
aterga Dec 28, 2020
1246a8e
Add a comment about a future refactoring possibility for LSP
aterga Dec 28, 2020
d94ddde
Add @tailrec to getHashForNode
aterga Dec 29, 2020
465413c
Fixed some tests in ViperServerHttpSpec
aterga Dec 29, 2020
1bc7ff5
Merge branch 'master' of http://github.com/aterga/viperserver
aterga Dec 29, 2020
1130886
ViperCache: do not add entries unless errors are correctly mapped to …
aterga Jan 5, 2021
b3917c2
Update scala.yml
aterga Jan 5, 2021
03a21f3
Adapted JSON writers in ViperIDEProtocol after recent changes in trai…
aterga Jan 5, 2021
7e8f9eb
Merge branch 'master' of http://github.com/aterga/viperserver
aterga Jan 5, 2021
3cd96c2
Update scala.yml
aterga Jan 5, 2021
8599eda
Update scala.yml
aterga Jan 5, 2021
173187c
Update scala.yml
aterga Jan 5, 2021
ec2cbfc
Update scala.yml
aterga Jan 5, 2021
fef997d
Update scala.yml
aterga Jan 5, 2021
239d34e
Update scala.yml
aterga Jan 5, 2021
bcd9924
Update scala.yml
aterga Jan 5, 2021
92f361e
Update scala.yml
aterga Jan 5, 2021
bbe9939
Update scala.yml
aterga Jan 5, 2021
cc8f346
Update scala.yml
aterga Jan 5, 2021
b4e0483
Update scala.yml
aterga Jan 5, 2021
26a3968
Try to add nightly artifact publishing
aterga Jan 5, 2021
fd382c4
Update scala.yml
aterga Jan 5, 2021
7125dcd
Temporary config
aterga Jan 5, 2021
46f715d
Update scala.yml
aterga Jan 5, 2021
58570c5
Update scala.yml
aterga Jan 5, 2021
16f734e
Update release.yml
aterga Jan 5, 2021
2cf1395
Update release.yml
aterga Jan 5, 2021
0e48c41
Update release.yml
aterga Jan 5, 2021
9f3e18e
Update release.yml
aterga Jan 5, 2021
27d87aa
Update release.yml
aterga Jan 5, 2021
ca5da36
Update scala.yml
aterga Jan 5, 2021
2335873
Update scala.yml
aterga Jan 5, 2021
7c8113d
Update scala.yml
aterga Jan 5, 2021
172683f
Delete release.yml
aterga Jan 6, 2021
a684420
Update build.sbt
aterga Jan 6, 2021
891449e
Update plugins.sbt
aterga Jan 6, 2021
b376991
Refactored port selection for web sockets.
aterga Jan 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 24 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
name: Release Nightly (Under Construction)
aterga marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
types: [created]
name: Handle Push
workflow_dispatch:

jobs:
generate:
name: Create nigtly artifacts
runs-on: ubuntu-latest
nightly:
runs-on: ubuntu-16.04
steps:
- name: Checkout the repository
uses: actions/checkout@master
- name: Generate the artifacts
uses: skx/github-action-build@master
- name: Upload the artifacts
uses: skx/github-action-publish-binaries@master
- name: Get Current Date
id: date
run: echo "::set-output name=DATE::$(date +'%Y-%m-%d')"

- name: Generate atrifact
run: mkdir -p target/scala-2.13; echo "Hello Viper" > target/scala-2.13/viper.jar

- name: Publish Nightly Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'example-*'
FILE: target/scala-2.13/viper.jar
NIGHTLY_RELEASE_ID: 36021300
ARTIFACT_NAME: viper-nightly-${{ steps.date.outputs.DATE }}.jar
run: |
echo Publishing $FILE as $ARTIFACT_NAME ...;
curl -H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: $(file -b --mime-type $FILE)" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data-binary @$FILE \
"https://uploads.github.com/repos/aterga/viperserver/releases/$NIGHTLY_RELEASE_ID/assets?name=$ARTIFACT_NAME"
130 changes: 82 additions & 48 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Scala CI
name: Check, Build, Test, Publish Nightly

on:
push:
pull_request:

jobs:
check-headers:
runs-on: ubuntu-latest
runs-on: ubuntu-16.04
steps:
- name: Checkout ViperServer repo
uses: actions/checkout@v2
Expand All @@ -17,54 +17,88 @@ jobs:
config: ./.github/license-check/config.json
strict: true

build:
runs-on: ubuntu-latest
test:
runs-on: ubuntu-16.04
steps:
- name: Checkout ViperServer
uses: actions/checkout@v2
with:
path: viperServer
- name: Checkout Silver
uses: actions/checkout@v2
with:
repository: viperproject/silver
path: silver
- name: Checkout Silicon
uses: actions/checkout@v2
with:
repository: viperproject/silicon
path: silicon
- name: Checkout Carbon
uses: actions/checkout@v2
with:
repository: viperproject/carbon
path: carbon

- name: Symbolically link Silver to Carbon
run: cd carbon; ln --symbolic ../silver
- name: Symbolically link Silver to Silicon
run: cd silicon; ln --symbolic ../silver
- name: Symbolically link Silver to ViperServer
run: cd viperServer; ln --symbolic ../silver
- name: Symbolically link Carbon to ViperServer
run: cd viperServer; ln --symbolic ../carbon
- name: Symbolically link Silicon to ViperServer
run: cd viperServer; ln --symbolic ../silicon

- name: Install Z3
run: sudo apt-get update -y; sudo apt-get install -y z3
- name: Get Current Date
id: date
run: echo "::set-output name=DATE::$(date +'%Y-%m-%d')"

- name: Checkout ViperServer
uses: actions/checkout@v2
with:
path: viperServer
- name: Checkout Silver
uses: actions/checkout@v2
with:
repository: viperproject/silver
path: silver
- name: Checkout Silicon
uses: actions/checkout@v2
with:
repository: viperproject/silicon
path: silicon
- name: Checkout Carbon
uses: actions/checkout@v2
with:
repository: viperproject/carbon
path: carbon

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Symbolically link Silver to Carbon
run: cd carbon; ln --symbolic ../silver
- name: Symbolically link Silver to Silicon
run: cd silicon; ln --symbolic ../silver
- name: Symbolically link Silver to ViperServer
run: cd viperServer; ln --symbolic ../silver
- name: Symbolically link Carbon to ViperServer
run: cd viperServer; ln --symbolic ../carbon
- name: Symbolically link Silicon to ViperServer
run: cd viperServer; ln --symbolic ../silicon

- name: Install Z3
env:
Z3_VERSION: 4.8.9
Z3_PLATFORM: x64
Z3_OS: ubuntu-16.04
run: |
export Z3=z3-$Z3_VERSION-$Z3_PLATFORM-$Z3_OS;
curl -J -L https://github.com/Z3Prover/z3/releases/download/z3-$Z3_VERSION/$Z3.zip > z3.zip;
unzip z3.zip;
sudo ln -s $(pwd)/$Z3/bin/z3 /usr/bin/z3

- name: Install SBT
run: echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list; curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add; sudo apt-get update; sudo apt-get install sbt
- name: Set up JDK 15
uses: actions/setup-java@v1
with:
java-version: '15.0.1'
architecture: x64

- name: Install SBT
run: |
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list;
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add;
sudo apt-get update; sudo apt-get install sbt

- name: test project
run: |
cd viperServer;
export Z3_EXE="/usr/bin/z3";
env > print_dir.txt;
sbt test

- name: Assemble project
run: cd viperServer; sbt assembly

- name: test project
run: cd viperServer; export Z3_EXE="/usr/bin/z3"; env > print_dir.txt; sbt test
- name: Assemble the fat JAR file
run: |
cd viperServer;
sbt assembly

- name: Publish Nightly Artifact
aterga marked this conversation as resolved.
Show resolved Hide resolved
env:
FILE: viperServer/target/scala-2.13/viper.jar
NIGHTLY_RELEASE_ID: 36021300
ARTIFACT_NAME: viper-nightly-${{ steps.date.outputs.DATE }}.jar
run: |
echo Publishing $FILE as $ARTIFACT_NAME ...;
curl -H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: $(file -b --mime-type $FILE)" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data-binary @$FILE \
"https://uploads.github.com/repos/${{ github.repository }}/releases/$NIGHTLY_RELEASE_ID/assets?name=$ARTIFACT_NAME"
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This is ViperServer, an HTTP server that manages verification requests to different tools from the Viper tool stack.

The main two tools currently are:
The main two Viper tools (a.k.a verification backends) currently are:

- [Carbon](https://bitbucket.org/viperproject/carbon), a verification condition generation (VCG) backend for the Viper language.
- [Silicon](https://bitbucket.org/viperproject/silicon), a symbolic execution verification backend.
Expand All @@ -14,13 +14,16 @@ The main two tools currently are:

1. Viper IDE: integration of Viper into Visual Studio Code (VS Code). Viper IDE provides the best user experience for Viper.
More details here: http://viper.ethz.ch/downloads/
2. Avoid 1-3 second delays caused by JVM startup time. ViperServer offers a robust alternative to, e.g.,
1. Facilitate the development of verification IDEs for Viper frontends, such as:
- [Gobra](https://github.com/viperproject/gobra), the Viper-based verifier for the Go language
- [Prusti](https://github.com/viperproject/prusti-dev/), the Viper-based verifier for the Rust language
1. Avoid 1-3 second delays caused by JVM startup time. ViperServer offers a robust alternative to, e.g.,
[Nailgun](https://github.com/facebook/nailgun).
3. Develop Viper encodings more efficiently with caching.
4. Interact with Viper tools programmatically using the HTTP API. A reference client implementation (in Python) is
1. Develop Viper encodings more efficiently with caching.
1. Interact with Viper tools programmatically using the HTTP API. A reference client implementation (in Python) is
aterga marked this conversation as resolved.
Show resolved Hide resolved
available via [viper_client](https://bitbucket.org/viperproject/viper_client).

For more details, please visit: http://viper.ethz.ch/downloads/
For more details about using Viper, please visit: http://viper.ethz.ch/downloads/


### Installation Instructions ###
Expand Down
17 changes: 11 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ lazy val silver = project in file("silver")
lazy val silicon = project in file("silicon")
lazy val carbon = project in file("carbon")

lazy val common = (project in file("common"))

// Viper Server specific project settings
lazy val server = (project in file("."))
.dependsOn(silver % "compile->compile;test->test")
.dependsOn(silicon % "compile->compile;test->test")
.dependsOn(carbon % "compile->compile;test->test")
.dependsOn(common)
.aggregate(common)
.enablePlugins(JavaAppPackaging)
.settings(
// General settings
Expand All @@ -26,16 +30,17 @@ lazy val server = (project in file("."))
Test / fork := true,

// Compilation settings
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.6.10",
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.2.1",
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.6.10",
libraryDependencies += "com.typesafe.akka" %% "akka-stream-testkit" % "2.6.10" % Test,
libraryDependencies += "com.typesafe.akka" %% "akka-http-testkit" % "10.2.1" % Test,
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.5.23",
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.8",
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.5.23",
libraryDependencies += "com.typesafe.akka" %% "akka-stream-testkit" % "2.5.23" % Test,
libraryDependencies += "com.typesafe.akka" %% "akka-http-testkit" % "10.1.8" % Test,
libraryDependencies += "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.8.1", // Java implementation of language server protocol
aterga marked this conversation as resolved.
Show resolved Hide resolved

// Run settings
run / javaOptions += "-Xss128m",

// Test settings.
// Test settings
Test / parallelExecution := false,

// Assembly settings
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// http://creativecommons.org/publicdomain/zero/1.0/

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.12")
aterga marked this conversation as resolved.
Show resolved Hide resolved
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")
49 changes: 49 additions & 0 deletions src/main/scala/viper/server/LanguageServerRunner.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2011-2020 ETH Zurich.

import java.io.IOException
import java.net.Socket

import org.eclipse.lsp4j.jsonrpc.Launcher
import viper.server.ViperConfig
import viper.server.frontends.lsp.{Coordinator, CustomReceiver, IdeLanguageClient}


object LanguageServerRunner {

private var _config: ViperConfig = _

def main(args: Array[String]): Unit = {
_config = new ViperConfig(args)
_config.verify()
val port = _config.port()
runServer(port)
}

def runServer(port: Int): Unit = {
aterga marked this conversation as resolved.
Show resolved Hide resolved
// start listening on port
try {
val socket = new Socket("localhost", port)
val localAddress = socket.getLocalAddress.getHostAddress
println(s"going to listen on $localAddress:$port")

Coordinator.port = port
Coordinator.url = localAddress

val server: CustomReceiver = new CustomReceiver()
val launcher = Launcher.createLauncher(server, classOf[IdeLanguageClient], socket.getInputStream, socket.getOutputStream)
server.connect(launcher.getRemoteProxy)

// start listening on input stream in a new thread:
val fut = launcher.startListening()
// wait until stream is closed again
fut.get()
} catch {
case e: IOException => println(s"IOException occurred: ${e.toString}")
}
}
}

23 changes: 8 additions & 15 deletions src/main/scala/viper/server/ViperConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package viper.server
import java.io.File

import org.rogach.scallop.{ScallopConf, ScallopOption, singleArgConverter}
import viper.server.utility.Helpers.{canonizedFile, validatePath}
import viper.server.utility.ibm
import viper.server.utility.ibm.Socket

Expand All @@ -31,24 +32,12 @@ class ViperConfig(args: Seq[String]) extends ScallopConf(args) {
val temp: File = java.io.File.createTempFile("viperserver_journal_" + System.currentTimeMillis(), ".log")
Some(temp.getAbsolutePath)
},
validate = (path: String) => {
val f = canonizedLogFile(path)
(f.isFile || f.isDirectory) && f.canWrite || f.getParentFile.canWrite
},
validate = validatePath,
noshort = true,
hidden = false)

private def canonizedLogFile(some_file_path: String): File = {
val f = new File(some_file_path)
if (f.isAbsolute) {
f
} else {
java.nio.file.Paths.get(System.getProperty("user.dir"), some_file_path).toFile
}
}

def getLogFileWithGuarantee: String = {
val cf: File = canonizedLogFile(logFile())
val cf: File = canonizedFile(logFile())
if ( cf.isDirectory ) {
val log: File = java.io.File.createTempFile("viperserver_journal_" + System.currentTimeMillis(), ".log", cf)
log.toString
Expand All @@ -68,7 +57,11 @@ class ViperConfig(args: Seq[String]) extends ScallopConf(args) {
descr = ("Specifies the port on which ViperServer will be started."
+ s"The port must be an integer in range [${Socket.MIN_PORT_NUMBER}-${ibm.Socket.MAX_PORT_NUMBER}]"
+ "If the option is omitted, an available port will be selected automatically."),
default = Some(ibm.Socket.findFreePort),
default = {
val p = ibm.Socket.findFreePort
aterga marked this conversation as resolved.
Show resolved Hide resolved
println(s"Automatically selecting port $p ...")
Some(p)
},
validate = p => try {
ibm.Socket.available(p)
} catch {
Expand Down