Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update sbt version 0.13.11, scalaz version 7.1.0 and other libraries. Fix issue #18 and #15 #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This project is derived from [https://github.com/typesafehub/sbteclipse](https:/
1. Add nbsbt to your plugin definition file. You can use either the global one at ~/.sbt/0.13/plugins/plugins.sbt or the project-specific one at PROJECT_DIR/project/plugins.sbt:

// for sbt 0.13.x
addSbtPlugin("org.netbeans.nbsbt" % "nbsbt-plugin" % "1.1.4")
addSbtPlugin("org.netbeans.nbsbt" % "nbsbt-plugin" % "1.1.5")
// for sbt 0.12.x
addSbtPlugin("org.netbeans.nbsbt" % "nbsbt-plugin" % "1.0.2")

Expand Down
210 changes: 107 additions & 103 deletions nbsbt-core/src/main/scala/org/netbeans/nbsbt/core/NetBeans.scala

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ private object NetBeansOpts {
val UseProjectId = "use-project-id"

val GenNetBeans = "gen-netbeans"

val WithBundledScalaContainers = "with-bundled-scala-containers"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,46 @@ import scala.xml.{Attribute, Elem, MetaData, Node, Null, Text}
import scala.xml.transform.RewriteRule
import scalariform.formatter.preferences.IFormattingPreferences

object NetBeansPlugin extends NetBeansPlugin

trait NetBeansPlugin {
object NetBeansPlugin {

/** These settings are injected into individual projects. */
def netbeansSettings: Seq[Setting[_]] = {
import NetBeansKeys._
Seq(
commandName := "netbeans",
commands <+= (commandName)(NetBeans.netbeansCommand)
commands <+= (commandName)(NetBeans.netbeansCommand),
executionEnvironment := None,
configurations := Set(Configurations.Compile, Configurations.Test),
projectFlavor := NetBeansProjectFlavor.Scala,
withBundledScalaContainers := projectFlavor.value.id == NetBeansProjectFlavor.Scala.id,
classpathTransformerFactories := defaultClasspathTransformerFactories(withBundledScalaContainers.value),
projectTransformerFactories := Seq(NetBeansRewriteRuleTransformerFactory.Identity),
createSrc := NetBeansCreateSrc.Default,
netbeansOutput := None,
preTasks := Seq(),
relativizeLibs := true,
skipParents := true,
withSource := false,
skipProject := false
)
}

def defaultClasspathTransformerFactories(withBundledScalaContainers: Boolean) = {
if (withBundledScalaContainers)
Seq(NetBeansRewriteRuleTransformerFactory.ClasspathDefault)
else
Seq(NetBeansRewriteRuleTransformerFactory.Identity)
}

/** These settings are injected into the "ThisBuild" scope of sbt, i.e. global acrosss projects. */
def buildNetBeansSettings: Seq[Setting[_]] = {
import NetBeansKeys._
Seq(
skipParents := true,
// Typically, this will be overridden for each project by the project level default of false. However, if a
// project disables the EclipsePlugin, the project level default won't be set, and so it will fall back to this
// build level setting, which means the project will be skipped.
skipProject := true
)
}

Expand All @@ -66,6 +97,11 @@ trait NetBeansPlugin {
"Download and link sources for library dependencies?"
)

val withBundledScalaContainers: SettingKey[Boolean] = SettingKey(
prefix(WithBundledScalaContainers),
"Let the generated project use the bundled Scala library of the ScalaIDE plugin"
)

val useProjectId: SettingKey[Boolean] = SettingKey(
prefix(UseProjectId),
"Use the sbt project id as the NetBeans project name?"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ package object core {
(Space ~> key ~ ("=" ~> ("true" | "false"))) map { case (k, v) => k -> v.toBoolean }
}

def setting[A](key: SettingKey[A], state: State): Validation[A] =
key get structure(state).data match {
case Some(a) => a.success
case None => "Undefined setting '%s'!".format(key.key).failNel
}

def evaluateTask[A](key: TaskKey[A], ref: ProjectRef, state: State): Validation[A] =
EvaluateTask(structure(state), key, state, ref, EvaluateTask defaultConfig state) match {
case Some((_, Value(a))) => a.success
Expand All @@ -77,5 +71,5 @@ package object core {

def structure(state: State): BuildStructure = extracted(state).structure

type Validation[A] = ScalazValidation[NonEmptyList[String], A]
type Validation[A] = scalaz.Validation[NonEmptyList[String], A]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@

package org.netbeans.nbsbt.plugin

import org.netbeans.nbsbt.core.{NetBeansPlugin => CoreNetBeansPlugin}
import sbt.{Plugin, Setting}
import org.netbeans.nbsbt.core.{NetBeansPlugin => NetBeansCorePlugin}
import sbt.{AutoPlugin, Setting}

object NetBeansPlugin extends Plugin with CoreNetBeansPlugin {
override def settings: Seq[Setting[_]] = CoreNetBeansPlugin.netbeansSettings
object NetBeansPlugin extends AutoPlugin {
override def requires = sbt.plugins.JvmPlugin
override def trigger = allRequirements
// Auto import semantics users expect today.
val autoImport: NetBeansCorePlugin.type = NetBeansCorePlugin
override def projectSettings: Seq[Setting[_]] = NetBeansCorePlugin.netbeansSettings
override def buildSettings: Seq[Setting[_]] = NetBeansCorePlugin.buildNetBeansSettings
}
4 changes: 2 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ object Build extends Build {
file("nbsbt-core"),
settings = commonSettings ++ Seq(
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.0.2",
"org.scalaz" %% "scalaz-effect" % "7.0.2"),
"org.scalaz" %% "scalaz-core" % "7.1.0",
"org.scalaz" %% "scalaz-effect" % "7.1.0"),
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")))

lazy val nbsbtPlugin = Project(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.9
sbt.version=0.13.11
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

libraryDependencies <+= (sbtVersion)("org.scala-sbt" % "scripted-plugin" % _)

addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5")

// https://github.com/sbt/sbt-scalariform
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
Expand Down