-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace tuple with proper record type for licenses
- Loading branch information
1 parent
689f347
commit 4c923e4
Showing
7 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
core/src/main/contraband-scala/sbt/librarymanagement/LicenseInfo.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
/** Basic license information for a project module */ | ||
final class LicenseInfo private ( | ||
val name: String, | ||
val url: java.net.URL, | ||
val distribution: Option[String], | ||
val comments: Option[String]) extends Serializable { | ||
|
||
private def this() = this("", new java.net.URL("http:"), None, None) | ||
|
||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match { | ||
case x: LicenseInfo => (this.name == x.name) && (this.url == x.url) && (this.distribution == x.distribution) && (this.comments == x.comments) | ||
case _ => false | ||
}) | ||
override def hashCode: Int = { | ||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.LicenseInfo".##) + name.##) + url.##) + distribution.##) + comments.##) | ||
} | ||
override def toString: String = { | ||
"LicenseInfo(" + name + ", " + url + ", " + distribution + ", " + comments + ")" | ||
} | ||
private[this] def copy(name: String = name, url: java.net.URL = url, distribution: Option[String] = distribution, comments: Option[String] = comments): LicenseInfo = { | ||
new LicenseInfo(name, url, distribution, comments) | ||
} | ||
def withName(name: String): LicenseInfo = { | ||
copy(name = name) | ||
} | ||
def withUrl(url: java.net.URL): LicenseInfo = { | ||
copy(url = url) | ||
} | ||
def withDistribution(distribution: Option[String]): LicenseInfo = { | ||
copy(distribution = distribution) | ||
} | ||
def withDistribution(distribution: String): LicenseInfo = { | ||
copy(distribution = Option(distribution)) | ||
} | ||
def withComments(comments: Option[String]): LicenseInfo = { | ||
copy(comments = comments) | ||
} | ||
def withComments(comments: String): LicenseInfo = { | ||
copy(comments = Option(comments)) | ||
} | ||
} | ||
object LicenseInfo { | ||
|
||
def apply(): LicenseInfo = new LicenseInfo() | ||
def apply(name: String, url: java.net.URL, distribution: Option[String], comments: Option[String]): LicenseInfo = new LicenseInfo(name, url, distribution, comments) | ||
def apply(name: String, url: java.net.URL, distribution: String, comments: String): LicenseInfo = new LicenseInfo(name, url, Option(distribution), Option(comments)) | ||
} |
33 changes: 33 additions & 0 deletions
33
core/src/main/contraband-scala/sbt/librarymanagement/LicenseInfoFormats.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } | ||
trait LicenseInfoFormats { self: sjsonnew.BasicJsonProtocol => | ||
implicit lazy val LicenseInfoFormat: JsonFormat[sbt.librarymanagement.LicenseInfo] = new JsonFormat[sbt.librarymanagement.LicenseInfo] { | ||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.LicenseInfo = { | ||
__jsOpt match { | ||
case Some(__js) => | ||
unbuilder.beginObject(__js) | ||
val name = unbuilder.readField[String]("name") | ||
val url = unbuilder.readField[java.net.URL]("url") | ||
val distribution = unbuilder.readField[Option[String]]("distribution") | ||
val comments = unbuilder.readField[Option[String]]("comments") | ||
unbuilder.endObject() | ||
sbt.librarymanagement.LicenseInfo(name, url, distribution, comments) | ||
case None => | ||
deserializationError("Expected JsObject but found None") | ||
} | ||
} | ||
override def write[J](obj: sbt.librarymanagement.LicenseInfo, builder: Builder[J]): Unit = { | ||
builder.beginObject() | ||
builder.addField("name", obj.name) | ||
builder.addField("url", obj.url) | ||
builder.addField("distribution", obj.distribution) | ||
builder.addField("comments", obj.comments) | ||
builder.endObject() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters