-
Notifications
You must be signed in to change notification settings - Fork 5
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 #37 from delphi-hub/release/0.9.5
Release/0.9.5
- Loading branch information
Showing
18 changed files
with
502 additions
and
247 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
language: scala | ||
scala: | ||
- 2.12.4 | ||
- 2.13.1 | ||
script: | ||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then sbt ++$TRAVIS_SCALA_VERSION test; fi' | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt ++$TRAVIS_SCALA_VERSION coverage test coverageReport coverageAggregate codacyCoverage; fi' | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt ++$TRAVIS_SCALA_VERSION test; fi' | ||
# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt ++$TRAVIS_SCALA_VERSION coverage test coverageReport coverageAggregate codacyCoverage; fi' | ||
after_success: | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash <(curl -s https://codecov.io/bash); fi' | ||
# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash <(curl -s https://codecov.io/bash); fi' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,114 @@ | ||
scalaVersion := "2.12.4" | ||
import com.typesafe.sbt.packager.docker._ | ||
|
||
ThisBuild / organization := "de.upb.cs.swt.delphi" | ||
ThisBuild / organizationName := "Delphi Project" | ||
ThisBuild / organizationHomepage := Some(url("https://delphi.cs.uni-paderborn.de/")) | ||
|
||
ThisBuild / scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/delphi-hub/delphi-cli"), | ||
"scm:[email protected]:delphi-hub/delphi-cli.git" | ||
) | ||
) | ||
|
||
ThisBuild / developers := List( | ||
Developer( | ||
id = "bhermann", | ||
name = "Ben Hermann", | ||
email = "[email protected]", | ||
url = url("https://www.thewhitespace.de") | ||
) | ||
) | ||
|
||
ThisBuild / description := "The command line client for Delphi" | ||
ThisBuild / licenses := List("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt")) | ||
ThisBuild / homepage := Some(url("https://delphi.cs.uni-paderborn.de/")) | ||
|
||
lazy val scala212 = "2.12.10" | ||
lazy val scala213 = "2.13.1" | ||
lazy val supportedScalaVersions = List(scala213) | ||
|
||
ThisBuild / scalaVersion := scala213 | ||
|
||
name := "delphi" | ||
version := "1.0.0-SNAPSHOT" | ||
version := "0.9.5" | ||
maintainer := "Ben Hermann <[email protected]>" | ||
|
||
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.html")) | ||
|
||
packageSummary := "Windows Package for the Delphi CLI" | ||
packageDescription := """Windows Package for the Delphi CLI""" | ||
wixProductId := "ce07be71-510d-414a-92d4-dff47631848a" | ||
wixProductUpgradeId := "4552fb0e-e257-4dbd-9ecb-dba9dbacf424" | ||
|
||
scalastyleConfig := baseDirectory.value / "project" / "scalastyle_config.xml" | ||
|
||
val akkaVersion = "2.5.14" | ||
val akkaHttpVersion = "10.1.5" | ||
val http4sVersion = "0.21.0-M6" | ||
|
||
// Only necessary for SNAPSHOT releases | ||
resolvers += Resolver.sonatypeRepo("snapshots") | ||
|
||
libraryDependencies ++= Seq( | ||
"com.typesafe.akka" %% "akka-http-core" % akkaHttpVersion, | ||
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion, | ||
"com.typesafe.akka" %% "akka-stream" % akkaVersion | ||
"org.http4s" %% "http4s-dsl" % http4sVersion, | ||
"org.http4s" %% "http4s-blaze-client" % http4sVersion, | ||
"org.http4s" %% "http4s-circe" % http4sVersion | ||
) | ||
|
||
libraryDependencies += "com.github.scopt" %% "scopt" % "3.7.0" | ||
libraryDependencies += "io.spray" %% "spray-json" % "1.3.3" | ||
libraryDependencies += "com.github.scopt" %% "scopt" % "3.7.1" | ||
libraryDependencies += "io.spray" %% "spray-json" % "1.3.5" | ||
libraryDependencies += "de.vandermeer" % "asciitable" % "0.3.2" | ||
libraryDependencies += "com.lihaoyi" %% "fansi" % "0.2.5" | ||
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value | ||
libraryDependencies += "com.lihaoyi" %% "fansi" % "0.2.7" | ||
libraryDependencies += "au.com.bytecode" % "opencsv" % "2.4" | ||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" % "test" | ||
libraryDependencies += "joda-time" % "joda-time" % "2.10.5" | ||
|
||
libraryDependencies += "de.upb.cs.swt.delphi" %% "delphi-core" % "0.9.2" | ||
libraryDependencies += "de.upb.cs.swt.delphi" %% "delphi-client" % "0.9.2" | ||
|
||
libraryDependencies ++= Seq( | ||
"com.softwaremill.sttp" %% "core" % "1.7.2", | ||
"com.softwaremill.sttp" %% "spray-json" % "1.7.2" | ||
) | ||
|
||
|
||
debianPackageDependencies := Seq("java8-runtime-headless") | ||
mainClass in Compile := Some("de.upb.cs.swt.delphi.cli.DelphiCLI") | ||
discoveredMainClasses in Compile := Seq() | ||
|
||
lazy val cli = (project in file(".")). | ||
enablePlugins(JavaAppPackaging). | ||
enablePlugins(DockerPlugin). | ||
settings( | ||
dockerBaseImage := "openjdk:jre-alpine", | ||
dockerAlias := com.typesafe.sbt.packager.docker.DockerAlias(None, Some("delphihub"),"delphi-cli", Some(version.value)), | ||
dockerEntrypoint := Seq("/bin/bash"), | ||
dockerCommands ++= Seq( | ||
Cmd("USER", "root"), | ||
Cmd("RUN", "apk", "--no-cache", "add", "bash"), | ||
Cmd("RUN", "ln", "-s", "/opt/docker/bin/delphi", "/usr/bin/delphi" ), | ||
Cmd("USER", "daemon") | ||
) | ||
). | ||
enablePlugins(ScalastylePlugin). | ||
enablePlugins(BuildInfoPlugin). | ||
enablePlugins(DebianPlugin). | ||
enablePlugins(WindowsPlugin). | ||
|
||
enablePlugins(GraalVMNativeImagePlugin). | ||
settings( | ||
graalVMNativeImageOptions ++= Seq( | ||
"--enable-https", | ||
"--enable-http", | ||
"--enable-all-security-services", | ||
"--allow-incomplete-classpath", | ||
"--enable-url-protocols=http,https" | ||
) | ||
). | ||
enablePlugins(JDKPackagerPlugin). | ||
settings( | ||
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion), | ||
buildInfoPackage := "de.upb.cs.swt.delphi.cli" | ||
buildInfoPackage := "de.upb.cs.swt.delphi.cli", | ||
crossScalaVersions := supportedScalaVersions | ||
) | ||
scalastyleConfig := baseDirectory.value / "project" / "scalastyle-config.xml" | ||
|
||
trapExit := false | ||
fork := true | ||
connectInput := true |
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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version = 1.1.1 | ||
sbt.version = 1.2.8 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright (C) 2018 The Delphi Team. | ||
// See the LICENCE file distributed with this work for additional | ||
// information regarding copyright ownership. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package de.upb.cs.swt.delphi.cli | ||
|
||
import java.io.{BufferedWriter, FileWriter} | ||
|
||
import de.upb.cs.swt.delphi.cli.artifacts.Result | ||
import au.com.bytecode.opencsv.CSVWriter | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
/** | ||
* Export search and retrieve results to .csv file. | ||
* | ||
* @author Lisa Nguyen Quang Do | ||
* @author Ben Hermann | ||
* | ||
*/ | ||
|
||
class CsvOutput(config: Config) { | ||
|
||
def exportResult(value: Any): Unit = { | ||
printToCsv( | ||
value match { | ||
case results : | ||
Seq[Result] if results.headOption.getOrElse(Seq.empty[Array[String]]).isInstanceOf[Result] => resultsToCsv(results) | ||
case _ => Seq.empty[Array[String]] | ||
} | ||
) | ||
} | ||
|
||
def printToCsv(table : Seq[Array[String]]): Unit = { | ||
val outputFile = new BufferedWriter(new FileWriter(config.csv, /* append = */false)) | ||
val csvWriter = new CSVWriter(outputFile) | ||
csvWriter.writeAll(seqAsJavaList(table)) | ||
outputFile.close() | ||
} | ||
|
||
def resultsToCsv(results : Seq[Result]) : Seq[Array[String]] = { | ||
val headOption = results.headOption.getOrElse() | ||
if (!headOption.isInstanceOf[Result]) { | ||
Seq.empty[Array[String]] | ||
} else { | ||
val fieldNames = headOption.asInstanceOf[Result].fieldNames() | ||
val tableHeader : Array[String] = | ||
fieldNames.+:("discovered at").+:("version").+:("groupId").+:("artifactId").+:("source").+:("Id").toArray | ||
results.map { | ||
e => { | ||
Array(e.id, e.metadata.source, e.metadata.artifactId, e.metadata.groupId, e.metadata.version, | ||
e.metadata.discovered).++(fieldNames.map(f => e.metricResults(f).toString)) | ||
} | ||
}.+:(tableHeader) | ||
} | ||
} | ||
} |
Oops, something went wrong.