Skip to content

Commit

Permalink
Merge pull request #439 from eed3si9n/wip/sbt1
Browse files Browse the repository at this point in the history
1.5.2
  • Loading branch information
eed3si9n committed Aug 24, 2017
2 parents d552bd8 + b7f111a commit 05914df
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 14 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
scalaxb
=======

![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.scalaxb/scalaxb_2.12/badge.svg)

[![Join the chat at https://gitter.im/eed3si9n/scalaxb](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eed3si9n/scalaxb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

scalaxb is an XML data-binding tool for Scala that supports W3C XML Schema (xsd) and
Expand All @@ -10,13 +12,6 @@ From schema documents scalaxb will generate Scala source files containing
case classes to represent the data and typeclass instances to turn XML documents into an object,
and the object back to XML.

Status
------

The latest is 1.5.0. Some things may not work.
I'd really appreciate if you could run it against your favorite xsd
file and let me know the result.

Modules
-------

Expand All @@ -29,7 +24,7 @@ There are currently four ways of running scalaxb:

### sbt-scalaxb

To call scalaxb from sbt 0.13.x, put this in your `project/scalaxb.sbt`:
To call scalaxb from sbt 1.x and sbt 0.13.x, put this in your `project/scalaxb.sbt`:

resolvers += Resolver.sonatypeRepo("public")
addSbtPlugin("org.scalaxb" % "sbt-scalaxb" % "X.X")
Expand Down
6 changes: 1 addition & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Dependencies._
import Common._

lazy val commonSettings = Seq(
version in ThisBuild := "1.5.0",
version in ThisBuild := "1.5.2",
organization in ThisBuild := "org.scalaxb",
homepage in ThisBuild := Some(url("http://scalaxb.org")),
licenses in ThisBuild := Seq("MIT License" -> url("https://github.com/eed3si9n/scalaxb/blob/master/LICENSE")),
Expand Down Expand Up @@ -58,12 +58,8 @@ lazy val integration = (project in file("integration")).
lazy val scalaxbPlugin = (project in file("sbt-scalaxb")).
settings(commonSettings: _*).
settings(
crossScalaVersions := Seq(scala210),
scalaVersion := scala210,
sbtPlugin := true,
name := "sbt-scalaxb",
// sbtVersion in Global := "0.12.4",
// scalaVersion in Global := "2.9.2",
description := """sbt plugin to run scalaxb""",
ScriptedPlugin.scriptedSettings,
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Expand Down
19 changes: 19 additions & 0 deletions notes/1.5.1.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

### bug fixes

- Replaces trailing underscore with `"u93"`. [#415][415] by [@varnerac][@varnerac]
- Fixes BigDecimal formatting. [#417][417] by [@coutoPL][@coutoPL]

### enhancements

- Adds Gigahorse support. [#413][413] by [@alexdupre][@alexdupre]
- Adds Scala 2.12 cross building. [#413][413]/[#419][419] by [@alexdupre][@alexdupre] and [@dwijnand][@dwijnand]

[413]: https://github.com/eed3si9n/scalaxb/pull/413
[415]: https://github.com/eed3si9n/scalaxb/pull/415
[417]: https://github.com/eed3si9n/scalaxb/pull/417
[419]: https://github.com/eed3si9n/scalaxb/pull/419
[@alexdupre]: https://github.com/alexdupre
[@varnerac]: https://github.com/varnerac
[@coutoPL]: https://github.com/coutoPL
[@dwijnand]: https://github.com/dwijnand
8 changes: 8 additions & 0 deletions notes/1.5.2.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

### enhancements

- Adds support for Gigahorse 0.3 and different backends (OkHttp and AHC) #428 by @alexdupre

### bug fixes

- Splits `fromAnySchemaType` into smaller chunks to work around JVM code size limit. #429 by @fltt
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.15
sbt.version=0.13.16
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ object ScalaxbCompile {
val module = Module.moduleByFileName(src)
module.processFiles(sources.toVector, config.update(Outdir(outDir)))
} getOrElse {Nil}

def cachedCompile =
inputChanged(cacheDir / "scalaxb-inputs") { (inChanged, inputs: Seq[File] :+: FilesInfo[ModifiedFileInfo] :+: String :+: HNil) =>
outputChanged(cacheDir / "scalaxb-output") { (outChanged, outputs: FilesInfo[PlainFileInfo]) =>
Expand Down
38 changes: 38 additions & 0 deletions sbt-scalaxb/src/main/scala-sbt-1.0/sbtscalaxb/ScalaxbCompile.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package sbtscalaxb

import sbt._
import Keys._
import scalaxb.{compiler => sc}
import scalaxb.compiler.{Config => ScConfig}
import sc.ConfigEntry._
import scalaxb.BuildInfo

object ScalaxbCompile {
def apply(sources: Seq[File], packageName: String, outDir: File, cacheDir: File): Seq[File] =
apply(sources, sc.Config.default.update(PackageNames(Map(None -> Some(packageName)))), outDir, cacheDir, false)

def apply(sources: Seq[File], config: sc.Config, outDir: File, cacheDir: File, verbose: Boolean = false): Seq[File] = {
import Tracked.{inputChanged, outputChanged}
import FilesInfo.{lastModified, exists}
import sbt.util.CacheImplicits._

def compile: Seq[File] =
sources.headOption map { src =>
import sc._
sc.Log.configureLogger(verbose)
val module = Module.moduleByFileName(src)
module.processFiles(sources.toVector, config.update(Outdir(outDir)))
} getOrElse {Nil}

def cachedCompile =
inputChanged(cacheDir / "scalaxb-inputs") { (inChanged, inputs: (Seq[File], FilesInfo[ModifiedFileInfo], String)) =>
outputChanged(cacheDir / "scalaxb-output") { (outChanged, outputs: FilesInfo[PlainFileInfo]) =>
if (inChanged || outChanged) compile
else outputs.files.toSeq map {_.file}
}
}
def inputs: (Seq[File], FilesInfo[ModifiedFileInfo], String) =
(sources, lastModified(sources.toSet).asInstanceOf[FilesInfo[ModifiedFileInfo]], BuildInfo.version)
cachedCompile(inputs)(() => exists((outDir ** "*.scala").get.toSet).asInstanceOf[FilesInfo[PlainFileInfo]])
}
}

0 comments on commit 05914df

Please sign in to comment.