Giter VIP home page Giter VIP logo

Comments (12)

sjrd avatar sjrd commented on August 16, 2024

No resolver is supposed to be needed. Well, to be precise, the required resolver is added by scalaJSSettings. Perhaps you forgot to use %%% instead of %%?

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

I had never see that syntax before.
Acutally I tried it with 3 "%" but this operator is not recognized (tested with 0.13.1, 0.13.2 and 0.13.5). I get the error:

value %%% is not a member of String
[error]         "org.scala-lang.modules.scalajs" %%% "scalajs-dom" % "0.6",
[error]                                          ^
[error] one error found

from scala-js-dom.

sjrd avatar sjrd commented on August 16, 2024

I had never see that syntax before.

You wouldn't have. It is Scala.js-specific, and was introduced with Scala.js 0.5.0, so it's brand new. You need the Scala.js sbt plugin for it to be available. Can you confirm that you have the following line in your project/build.sbt (or project/plugins.sbt or however you choose to call it):

addSbtPlugin("org.scala-lang.modules.scalajs" % "scalajs-sbt-plugin" % "0.5.0")

?

More generally, you might want to follow the steps in the tutorial to get you started with Scala.js 0.5. (Any 0.13.x version of sbt should work.)

If you still have an issue, can you elaborate a bit on your config? In particular the contents of your build.sbt and project/build.sbt would greatly help to identify the issue.

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

It is actually clearer ! It was not so straighforward in a multiproject application. Anyway, now it works fine. Thanks for helping. If you are interested in, have a look to my scaladget library which intends to use scala.js to provide higher level lib for building html pages in pure scala (https://github.com/mathieuleclaire/scaladget).

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

I have a comment about the new 0.5 version:
The library I just started (scaladget) relies on scala.js. When I use it in an other project (in the examples project of scaladget for instance), I need to use "%%%" to add my lib as dependency

libraryDependencies += "fr.iscpif" %%% "scaladget" % "0.1.0-SNAPSHOT"

It implies that I need to keep a dependency on the scala.js library in my example project. It would be nicer and clearer to have only a dependency on my lib for the final user of the scaladget lib. Is there a trick to bypass the scala.js dependency (as it was the case in the 0.4 version) ?

from scala-js-dom.

sjrd avatar sjrd commented on August 16, 2024

I don't understand. If your project is a Scala.js project, then by necessity any project depending on it is also a Scala.js project. What trick are you talking about in 0.4?

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

My lib is a Scala.js project, but a project depending on my lib should only depends on my lib and not on scala.js. Here is the build of an example project using my lib:

import sbt._
import Keys._
import fr.iscpif.jsmanager.JSManagerPlugin._

import scala.scalajs.sbtplugin.ScalaJSPlugin._

object ExampleBuild extends Build {
  val Organization = "fr.iscpif"
  val Name = "Scaladget Example"
  val Version = "0.1.0-SNAPSHOT"
  val ScalaVersion = "2.10.4"

  lazy val scaladgetExample = Project("examples",
    file("examples"),
    settings = Defaults.defaultSettings ++ jsManagerSettings ++ Seq(
      resolvers += Resolver.sonatypeRepo("snapshots"),
      libraryDependencies += "fr.iscpif" %%% "scaladget" % "0.1.0-SNAPSHOT",
      jsCall := "Form().run();"
      //outputPath := "/tmp"
    )
  )
}

The only solution I see is to exhibit a %%% function in my plugin, which calls the %%% scala.js function.
I realize that this thread is more a scala-js issue than a scala-js-dom one ! Sorry for that.

from scala-js-dom.

sjrd avatar sjrd commented on August 16, 2024

Ah, your project is a compiler plugin itself! That wasn't clear at all from your formulation of "my library". Then, yes, assuming jsManagerSettings contain scalaJSSettings, it's a valid setup. And then, yes, the solution for you is to provide %%% from your plugin. This is easily done by mixing in impl.DependencyBuilders:

object MyPlugin extends Plugin with scala.scalajs.sbtplugin.impl.DependencyBuilders {
  ...
}

although that makes your source dependent on the particular implementation of impl, which is not recommended.

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

Actually there are both a plugin (called jsManager) and a project (called scaladget). The examples project depends on both.

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

Well, mixing with DependencyBuilders does not fix it. The %%% is viewed as a String and the implicit converter toScalaJSGroupID is not invoked

from scala-js-dom.

mathieuleclaire avatar mathieuleclaire commented on August 16, 2024

I was actually mixing impl.DependencyBuilders instead of scala.scalajs.sbtplugin.impl.DependencyBuilders. It's now works fine. Thanks !

from scala-js-dom.

lihaoyi avatar lihaoyi commented on August 16, 2024

Closing this isnce you seem to have figured it out =)

from scala-js-dom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.