当前位置: 首页>>代码示例>>Scala>>正文


Scala ScalaJSPlugin类代码示例

本文整理汇总了Scala中org.scalajs.sbtplugin.ScalaJSPlugin的典型用法代码示例。如果您正苦于以下问题:Scala ScalaJSPlugin类的具体用法?Scala ScalaJSPlugin怎么用?Scala ScalaJSPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ScalaJSPlugin类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: CanThrowBuild

//设置package包名称以及导入依赖的类
import sbt._
import Keys._
import org.scalajs.sbtplugin.{OptimizerOptions, ScalaJSPlugin}
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._

object CanThrowBuild extends Build {

  val deps = libraryDependencies ++= Seq(
    "org.scalatest" %% "scalatest" % "3.0.0-M15" % "test"
  )

  val otherSettings: Seq[sbt.Def.Setting[_]] = Seq(
    name := "canthrow",
    version := "0.0.1",
    scalaVersion := "2.11.7",
    persistLauncher in Compile := true,
    persistLauncher in Test := false,
    relativeSourceMaps := true
  )

  val sets: Seq[Def.Setting[_]] = (Defaults.projectCore ++ otherSettings) :+ deps

  lazy val root = Project(id = "root", base = file("."))
    .settings(scalaVersion := "2.11.7")
    .settings(sets)

  lazy val core = Project(id = "shared", base = file("shared"))
    .settings(sets)

} 
开发者ID:edmundnoble,项目名称:canthrow,代码行数:31,代码来源:Build.scala

示例2: Dependencies

//设置package包名称以及导入依赖的类
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import org.scalajs.sbtplugin.cross.CrossProject
import org.scalajs.sbtplugin.{AbstractJSDep, ScalaJSPlugin}
import sbt.Keys._
import sbt._
import sbt.complete.Parser
//import scoverage.ScoverageKeys.coverageExcludedPackages

object Dependencies {

  val cats = libraryDependencies ++= Seq(
    "org.typelevel" %%% "cats-core" % "0.9.0",
    "org.typelevel" %%% "cats-kernel" % "0.9.0",
    "org.typelevel" %%% "cats-macros" % "0.9.0",
    "org.typelevel" %%% "cats-free" % "0.9.0"
  )

  val scalatest = libraryDependencies ++= Seq(
    "org.scalatest" %%% "scalatest" % "3.0.1" % "test"
  )

  val kindProjector = 
    addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.3" cross CrossVersion.binary)

} 
开发者ID:edmundnoble,项目名称:atlast,代码行数:26,代码来源:Dependencies.scala

示例3: TypeLevelScalaIssue135Workaround

//设置package包名称以及导入依赖的类
import org.scalajs.sbtplugin.ScalaJSPlugin
import sbt.Keys.libraryDependencies
import sbt.{AutoPlugin, CrossVersion, Def, PluginTrigger, Plugins}


object TypeLevelScalaIssue135Workaround extends AutoPlugin {

  override def requires: Plugins = ScalaJSPlugin // This plugin should run after ScalaJSPlugin, in order to replace dependencies introduced by ScalaJSPlugin

  override def trigger: PluginTrigger = allRequirements

  private object CrossFull {
    def unapply(full: CrossVersion.Full): Some[String => String] = {
      Some(full.remapVersion)
    }
  }

  override def projectSettings: Seq[Def.Setting[_]] = Seq(
    libraryDependencies := {
      val oldDependencies = libraryDependencies.value
      val CrossFull(id) = CrossVersion.full
      for (libraryDependency <- oldDependencies) yield {
        libraryDependency.crossVersion match {
          case CrossFull(remapVersion) if remapVersion.getClass == id.getClass =>
            libraryDependency.copy(crossVersion = CrossVersion.patch)
          case _ =>
            libraryDependency
        }
      }
    }
  )
} 
开发者ID:ThoughtWorksInc,项目名称:feature.scala,代码行数:33,代码来源:TypeLevelScalaIssue135Workaround.scala

示例4: NGPlugin

//设置package包名称以及导入依赖的类
package com.august.scalajsng.sbtplugin

import be.doeraene.sjsreflect.sbtplugin.ScalaJSReflectionPlugin
import be.doeraene.sjsreflect.sbtplugin.ScalaJSReflectionPlugin.autoImport._
import org.scalajs.sbtplugin.ScalaJSPlugin
import sbt.{CrossVersion, _}

object NGPlugin extends AutoPlugin {

  override def requires: Plugins = ScalaJSPlugin && ScalaJSReflectionPlugin

  override def projectSettings = Seq(
    addCompilerPlugin(
      "org.scalameta" % "paradise" % "3.0.0-SNAPSHOT" cross CrossVersion.full),
    scalaJSReflectSelectors ++= Seq(
      selectDescendentClasses("ng.macros.NGAnnotation") -> reflectEnumerateClass()
    )
  )
} 
开发者ID:AugustNagro,项目名称:scalajs-ng,代码行数:20,代码来源:NGPlugin.scala

示例5: AtlastBuild

//设置package包名称以及导入依赖的类
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import org.scalajs.sbtplugin.cross.CrossProject
import org.scalajs.sbtplugin.{AbstractJSDep, ScalaJSPlugin}
import sbt.Keys._
import sbt._
import sbt.complete.Parser
//import scoverage.ScoverageKeys.coverageExcludedPackages

object AtlastBuild {

val baseSettings = Seq(
    version := "0.0.1",
    scalaVersion := "2.12.1",
    scalaOrganization := "org.typelevel",
    updateOptions ~= (_.withCachedResolution(true)),
    scalacOptions ++= Seq(
      "-Xexperimental"
    ),
    Dependencies.kindProjector
  )

  lazy val core: CrossProject =  crossProject.in(file("core"))
    .settings(baseSettings: _*)
    .jsSettings(ScalaJSPlugin.projectSettings: _*)
    .settings(Dependencies.cats: _*)
    .settings(Dependencies.scalatest: _*)

  lazy val coreJVM = core.jvm
  lazy val coreJS = core.js

  lazy val atlast: Project = project.in(file("."))
    .aggregate(coreJVM, coreJS)
    .settings(Defaults.projectCore)
    .settings(baseSettings: _*)

} 
开发者ID:edmundnoble,项目名称:typelevel-mini,代码行数:37,代码来源:AtlastBuild.scala

示例6: definition

//设置package包名称以及导入依赖的类
package definitions

import org.sbtidea.SbtIdeaPlugin.ideaExcludeFolders
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt._

import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.autoImport._

trait ScalaJsModule extends BasicModule {

  override def definition: Project = {
    super.definition
      .enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
      .settings(
        scalaJSModuleKind := ModuleKind.CommonJSModule,
        //Opt-in @ScalaJSDefined by default
        scalacOptions += "-P:scalajs:sjsDefinedByDefault",
        requiresDOM in Test := true,
        enableReloadWorkflow := true,
        emitSourceMaps := false,
        ideaExcludeFolders ++= List(
          s"$id/build",
          s"$id/node_modules",
          s"$id/target"
        ),
        cleanKeepFiles ++= Seq(
          target.value / "scala-2.12" / "scalajs-bundler" / "main" / "node_modules",
          target.value / "scala-2.12" / "scalajs-bundler" / "test" / "node_modules",
          target.value / "scalajs-bundler-jsdom" / "node_modules"
        )
      )
  }
} 
开发者ID:viktor-podzigun,项目名称:scommons,代码行数:37,代码来源:ScalaJsModule.scala

示例7: Version

//设置package包名称以及导入依赖的类
import sbt._
import Keys._
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._

object Version {
  final val Scala210 = "2.10.6"
  final val Scala211 = "2.11.11"
  final val Scala212 = "2.12.3"

  final val SjsReact = "1.1.0"
  final val Scalameta = "1.8.0"
  final val Scalajs = "0.6.19"
  final val ScalajsBundler = "0.7.0"
  final val ScalaTest = "3.0.2"
  final val Sangria = "1.2.0"
}

object Library {
  final val `scalajs-react` = libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % Version.SjsReact
  final val scalameta = "org.scalameta" %% "scalameta" % Version.Scalameta
  final val sangria = "org.sangria-graphql" %% "sangria" % Version.Sangria
  final val scalatest = "org.scalatest" %% "scalatest" % Version.ScalaTest % Test
} 
开发者ID:dispalt,项目名称:relay-modern-helper,代码行数:25,代码来源:Dependencies.scala

示例8: Build

//设置package包名称以及导入依赖的类
import sbt._
import Keys._

import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._

object Build extends Build {

  val uPickleVersion  = "0.3.8"

  val root = Project(
    id = "sjs-react-server-prerender",
    base = file("."),
    settings = Seq(
      name := "sjs-react-server-prerender",
      version := "0.0.1-SNAPSHOT",
      scalaVersion := "2.11.7",

      scalaJSOutputWrapper := ("var __ScalaJSEnv = { exportsNamespace: exports, global: global };", ""),

      persistLauncher := true,
      persistLauncher in Test := false,

      unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),

      libraryDependencies ++= Seq(
        "com.github.japgolly.scalajs-react"              %%% "core"              % "0.10.4" withSources(),
        "com.lihaoyi"                                     %% "upickle"           % uPickleVersion,
        "com.lihaoyi"                                    %%% "upickle"           % uPickleVersion,
        "com.lihaoyi"                                    %%% "autowire"          % "0.2.5"
      )
    )
  ).enablePlugins(ScalaJSPlugin)
} 
开发者ID:zv3,项目名称:sjs-react-server-prerender,代码行数:35,代码来源:build.scala


注:本文中的org.scalajs.sbtplugin.ScalaJSPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。