Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/aml-org/amf-ci-tools-base-image:1.3.4
FROM ghcr.io/aml-org/amf-ci-tools-base-image:1.4.0
6 changes: 4 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pipeline {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
BRANCH_NAME = "${env.BRANCH_NAME}"
NPM_TOKEN = credentials('npm-mulesoft')
CURRENT_VERSION = sh(script:"cat dependencies.properties | grep \"version\" | cut -d '=' -f 2", returnStdout: true)
CURRENT_VERSION = sh(script: "cat dependencies.properties | grep \"version\" | cut -d '=' -f 2", returnStdout: true)
}
stages {
stage('Test') {
Expand Down Expand Up @@ -57,7 +57,9 @@ pipeline {
}
stage('Publish') {
when {
branch 'master'
anyOf {
branch 'master'
}
}
steps {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
Expand Down
7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import sbtsonar.SonarPlugin.autoImport.sonarProperties

ThisBuild / version := getVersion(2, 0)
ThisBuild / version := getVersion(2, 1)
ThisBuild / scalacOptions ++= Seq("-feature")
ThisBuild / scalaVersion := "2.12.15"
ThisBuild / scalaVersion := "2.12.20"

lazy val common = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
Expand All @@ -20,7 +20,8 @@ lazy val common = crossProject(JSPlatform, JVMPlatform)
)
.jvmSettings(libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided")
.jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
libraryDependencies += "org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
.settings(AutomaticModuleName.settings("org.mulesoft.common"))

Expand Down
6 changes: 4 additions & 2 deletions js/src/main/scala/org/mulesoft/common/io/JsBaseFile.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package org.mulesoft.common.io

import java.io.IOException

import org.mulesoft.common.js.SysError

import scala.concurrent.Promise
import scala.concurrent.{ExecutionContext, Promise}
/**
* Base File for JS implementation
*/
private[io] abstract class JsBaseFile(val fileSystem: JsServerFileSystem, val path: String) extends File {

override val global: ExecutionContext = scala.scalajs.concurrent.JSExecutionContext.queue

private val prefixLength = fileSystem.prefixLength(path)

override def parent: String = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package org.mulesoft.common.io

import scala.concurrent.ExecutionContext

/**
* IO Tests
*/
class JsAsyncIoTest extends IoAsyncTest {

override implicit val executionContext: ExecutionContext = scala.scalajs.concurrent.JSExecutionContext.queue

def fs: FileSystem = Fs
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scala.concurrent.{ExecutionContext, Future}
* Implementation of a AsyncFile for the JVM
* * @todo better handling of errors, Real async mode
*/
protected class JvmAsyncFile(private val syncFile: JvmSyncFile) extends AsyncFile {
protected class JvmAsyncFile(private val syncFile: JvmSyncFile) extends AsyncFile with JvmBaseFile {

val path: String = syncFile.path
val fileSystem: FileSystem = syncFile.fileSystem
Expand Down
9 changes: 9 additions & 0 deletions jvm/src/main/scala/org/mulesoft/common/io/JvmBaseFile.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.mulesoft.common.io

import scala.concurrent.ExecutionContext

trait JvmBaseFile extends File {

override val global: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.concurrent.ExecutionContext
/**
* Implementation of a SyncFile for the JVM
*/
protected class JvmSyncFile(val fileSystem: FileSystem, val path: String) extends SyncFile {
protected class JvmSyncFile(val fileSystem: FileSystem, val path: String) extends SyncFile with JvmBaseFile {

private val file = new JFile(path)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.mulesoft.common.io

import scala.concurrent.ExecutionContext

/**
* IO Tests
*/
class JvmAsyncIoTest extends IoAsyncTest {

override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

def fs: FileSystem = Fs

}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.7.3
sbt.version=1.10.4
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.4")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2")
addSbtPlugin("com.sonar-scala" % "sbt-sonar" % "2.3.0")
2 changes: 1 addition & 1 deletion shared/src/main/scala/org/mulesoft/common/io/File.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.language.higherKinds
*/
trait File {

protected val global: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global
protected val global: ExecutionContext

/** Returns an async view of the file */
def async: AsyncFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import scala.concurrent.ExecutionContext
* IO Tests
*/
trait IoAsyncTest extends AsyncFunSuite with BaseIoTest {
override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

test("read") {
val dataDir = fs.asyncFile(dirName)
Expand Down