Skip to content

Commit

Permalink
Merge pull request #81 from p2m2/develop
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
ofilangi committed Mar 25, 2021
2 parents cdc52cf + 5e2e0fc commit f78a786
Show file tree
Hide file tree
Showing 13 changed files with 2,258 additions and 3,358 deletions.
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ workflows:
context:
- DOCKER_CONTEXT
- CREDENTIAL_CONTEXT
- GPG_CONTEXT
filters:
tags:
ignore: /.*/
Expand All @@ -61,6 +62,7 @@ workflows:
context:
- DOCKER_CONTEXT
- CREDENTIAL_CONTEXT
- GPG_CONTEXT
filters:
tags:
only: /.*/
Expand Down Expand Up @@ -233,6 +235,8 @@ jobs:
name: Snapshot publication
command: |
export DISCOVERY_VERSION="${CIRCLE_BRANCH}-SNAPSHOT"
echo "Importing key"
echo -e "$GPG_KEY" | gpg --import
sbt publish
publish_tag_to_sonatype_stagge_for_release:
Expand All @@ -249,6 +253,8 @@ jobs:
name: Snapshot publication
command: |
export DISCOVERY_VERSION="${CIRCLE_TAG}"
echo "Importing key"
echo -e "$GPG_KEY" | gpg --import
sbt publish
check_discovery_valid_fullopjs_cdn_jsdelivr:
Expand Down Expand Up @@ -298,5 +304,4 @@ jobs:
name: Js Opt Lib generation
command: |
npm config set registry http://registry.npmjs.org
npm version 0.0.4
npm publish --access public
141 changes: 103 additions & 38 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sbt.Keys.scalacOptions
import sbtcrossproject.CrossPlugin.autoImport.crossProject

/* scala libs */
lazy val utestVersion = "0.7.7"
lazy val upickleVersion = "1.2.2"
lazy val airframeLogVersion = "20.11.0"
Expand All @@ -10,11 +11,19 @@ lazy val scalaJsDOMVersion = "1.1.0"
lazy val scalaStubVersion = "1.0.0"
lazy val scalatagVersion = "0.9.2"
lazy val rdf4jVersion = "3.6.0-M2"
lazy val slf4j_version = "1.7.9"

/* p2m2 libs */
lazy val comunica_actor_init_sparql_rdfjs_version = "1.0.0"
lazy val data_model_rdfjs_version = "1.0.0"
lazy val n3js_facade_version = "1.0.1"
lazy val rdfxml_streaming_parser_version = "1.0.0"
lazy val comunica_version = "1.19.2"

/* npm libs */
lazy val npm_axios_version = "0.21.1"
lazy val npm_qs_version = "6.9.6"
lazy val npm_showdown_version = "1.9.1"
lazy val npm_comunica_version = "1.19.2"

releaseIgnoreUntrackedFiles := true

Expand All @@ -33,27 +42,27 @@ val buildSWDiscoveryVersionAtBuildTimeFile =
| val version : String = " build ${java.time.LocalDate.now.toString}"
|}""").stripMargin)


def getPackageSetting() = Seq(
name := "discovery",
version := version_build,
scalaVersion := "2.13.5",
organization := "com.github.p2m2",
organizationName := "p2m2",
organizationHomepage := Some(url("https://www6.inrae.fr/p2m2")),
licenses := Seq("MIT License" -> url("http://www.opensource.org/licenses/mit-license.php")),
homepage := Some(url("https://github.com/p2m2/Discovery")),
description := "Ease Sparql request on the network MetaboHUB/Semantics Databases.",
scmInfo := Some(
ThisBuild / name := "discovery"
ThisBuild / organizationName := "p2m2"
ThisBuild / name := "discovery"
ThisBuild / version := version_build
ThisBuild / scalaVersion := "2.13.5"
ThisBuild / organization := "com.github.p2m2"
ThisBuild / organizationName := "p2m2"
ThisBuild / organizationHomepage := Some(url("https://www6.inrae.fr/p2m2"))
ThisBuild / licenses := Seq("MIT License" -> url("http://www.opensource.org/licenses/mit-license.php"))
ThisBuild / homepage := Some(url("https://github.com/p2m2/Discovery"))
ThisBuild / description := "Ease Sparql request on the network MetaboHUB/Semantics Databases."
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/p2m2/Discovery"),
"scm:git@github.com:p2m2/Discovery.git"
)
),
developers := List(
)
ThisBuild / developers := List(
Developer("ofilangi", "Olivier Filangi", "olivier.filangi@inrae.fr",url("https://github.com/ofilangi"))
),
credentials += {
)
ThisBuild / credentials += {

val realm = scala.util.Properties.envOrElse("REALM_CREDENTIAL", "" )
val host = scala.util.Properties.envOrElse("HOST_CREDENTIAL", "" )
Expand All @@ -67,18 +76,20 @@ def getPackageSetting() = Seq(
} else {
Credentials(realm,host,login,pass)
}
},
publishTo := {
if (isSnapshot.value)
Some("Sonatype Snapshots Nexus" at "https://oss.sonatype.org/content/repositories/snapshots")
else
Some("Sonatype Snapshots Nexus" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
publishConfiguration := publishConfiguration.value.withOverwrite(true) ,
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true),
pomIncludeRepository := { _ => false },
publishMavenStyle := true,
)
}

ThisBuild / publishTo := {
if (isSnapshot.value)
Some("Sonatype Snapshots Nexus" at "https://oss.sonatype.org/content/repositories/snapshots")
else
Some("Sonatype Snapshots Nexus" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
}

ThisBuild / publishConfiguration := publishConfiguration.value.withOverwrite(true)
ThisBuild / publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true)
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishMavenStyle := true


lazy val root = (project in file("."))
.aggregate(discovery.js, discovery.jvm)
Expand All @@ -89,7 +100,6 @@ lazy val root = (project in file("."))
)

lazy val discovery=crossProject(JSPlatform, JVMPlatform).in(file("."))
.settings(getPackageSetting())
.settings(
resolvers += Resolver.bintrayRepo("hmil", "maven"),
libraryDependencies ++= Seq(
Expand All @@ -109,8 +119,6 @@ lazy val discovery=crossProject(JSPlatform, JVMPlatform).in(file("."))
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.jsSettings(
npmDependencies in Compile ++= Seq(
"@comunica/utils-datasource" -> comunica_version),
libraryDependencies ++= Seq(
"com.github.p2m2" %%% "comunica-actor-init-sparql-rdfjs" % comunica_actor_init_sparql_rdfjs_version ,
"com.github.p2m2" %%% "data-model-rdfjs" % data_model_rdfjs_version ,
Expand All @@ -119,10 +127,12 @@ lazy val discovery=crossProject(JSPlatform, JVMPlatform).in(file("."))
),
webpackBundlingMode := BundlingMode.LibraryAndApplication(),
npmDependencies in Compile ++= Seq(
"axios" -> "0.21.1",
"qs" -> "6.9.6",
"showdown" -> "1.9.1"
"axios" -> npm_axios_version,
"qs" -> npm_qs_version,
"showdown" -> npm_showdown_version,
"@comunica/utils-datasource" -> npm_comunica_version
),

scalaJSLinkerConfig in (Compile, fastOptJS ) ~= {
_.withOptimizer(false)
.withPrettyPrint(true)
Expand All @@ -139,11 +149,66 @@ lazy val discovery=crossProject(JSPlatform, JVMPlatform).in(file("."))
.jvmSettings(
libraryDependencies ++= Seq(
"org.scala-js" %% "scalajs-stubs" % scalaStubVersion % "provided",
"org.slf4j" % "slf4j-api" % "1.7.9",
"org.slf4j" % "slf4j-simple" % "1.7.9",
"org.slf4j" % "slf4j-api" % slf4j_version,
"org.slf4j" % "slf4j-simple" % slf4j_version,
"org.eclipse.rdf4j" % "rdf4j-storage" % rdf4jVersion,
"org.eclipse.rdf4j" % "rdf4j-tools-federation" % rdf4jVersion
))

/**
* Build package.json to publish on npm repository
*/
// first define a task key
lazy val npmPackageJson = taskKey[Unit]("Build the discovery package.json")

npmPackageJson := {

val scalaJsBundlerPackageJsonFile = IO.readLines(new File("js/target/scala-2.13/scalajs-bundler/main/package.json")).filter(_.length>0)
val indexStartDependencies = scalaJsBundlerPackageJsonFile.zipWithIndex.map {
case (v,i) if v.contains("dependencies") => i
case _ => -1
}.filter( _ > 0)(0)

val indexEndDependencies = scalaJsBundlerPackageJsonFile.zipWithIndex.map {
case (v,i) if (v.contains("}") && i > indexStartDependencies) => i
case _ => -1
}.filter( _ > 0)(0)

val dependencies = scalaJsBundlerPackageJsonFile.zipWithIndex.collect{
case (x,idx) if ( (idx > indexStartDependencies) && (idx < indexEndDependencies) ) => x
}


val file = reflect.io.File("./package.json").writeAll(
Predef.augmentString(
s"""{
"name": "@${(ThisBuild / organizationName).value}/${(ThisBuild / name).value}",
"description": "${(ThisBuild / description).value}",
"version": "${(ThisBuild / version).value}",
"main": "./js/target/scala-2.13/scalajs-bundler/main/discovery-opt.js",
"files": [
"js/target/scala-2.13/scalajs-bundler/main/discovery-opt.js"
],
"dependencies": {
${dependencies.mkString("\n")}
},
"repository": {
"type": "git",
"url": "git+https://github.com/p2m2/Discovery.git"
},
"keywords": [
"sparql",
"rdf",
"scalajs"
],
"author": "Olivier Filangi",
"license": "MIT",
"bugs": {
"url": "https://github.com/p2m2/Discovery/issues"
},
"homepage": "https://github.com/p2m2/Discovery#README.md"
}
""").stripMargin)
}

Global / onChangedBuildSource := ReloadOnSourceChanges
//publishTo in ThisBuild :=
2 changes: 1 addition & 1 deletion dist/checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d926a1e92398f12f978ab25bad89bb7d -
2ff59ae149c99f34c1272d97c1bff8c6 -

0 comments on commit f78a786

Please sign in to comment.