summaryrefslogtreecommitdiff
path: root/scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala
diff options
context:
space:
mode:
authordos65 <qtankle@gmail.com>2017-11-28 01:56:42 +0300
committerNikolay Tatarinov <5min4eq.unity@gmail.com>2017-12-20 01:17:16 +0300
commit6a7f6cf910362cadf6b39f8c0795c46745e08742 (patch)
tree5473fc949137771ab3f82cc259a83fb0966555f5 /scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala
parent2ecfb282365f7fd8168bfb845cdbb403c00e9615 (diff)
downloadmill-6a7f6cf910362cadf6b39f8c0795c46745e08742.tar.gz
mill-6a7f6cf910362cadf6b39f8c0795c46745e08742.tar.bz2
mill-6a7f6cf910362cadf6b39f8c0795c46745e08742.zip
publishLocal - looks like it works
Diffstat (limited to 'scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala')
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala90
1 files changed, 90 insertions, 0 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala b/scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala
new file mode 100644
index 00000000..ece7fbd1
--- /dev/null
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/publish/settings.scala
@@ -0,0 +1,90 @@
+package mill.scalaplugin.publish
+
+import mill.scalaplugin.Dep
+import mill.util.JsonFormatters
+
+trait Artifact extends Serializable with Product {
+ def group: String
+ def name: String
+ def id: String
+ def version: String
+}
+
+object Artifact {
+
+ def fromDep(dep: Dep, scalaFull: String, scalaBin: String): Dependency = {
+ dep match {
+ case d: Dep.Java =>
+ import d.dep._
+ val art = JavaArtifact(module.organization, module.name, version)
+ Dependency(art, Scope.Compile)
+ case d: Dep.Scala =>
+ import d.dep._
+ val art = ScalaArtifact(module.organization, module.name, version, scalaBin)
+ Dependency(art, Scope.Compile)
+ case d: Dep.Point =>
+ import d.dep._
+ val art = ScalaArtifact(module.organization, module.name, version, scalaFull)
+ Dependency(art, Scope.Compile)
+ }
+ }
+}
+
+case class JavaArtifact(
+ group: String,
+ name: String,
+ version: String
+) extends Artifact {
+ override def id: String = name
+}
+
+case class ScalaArtifact(
+ group: String,
+ name: String,
+ version: String,
+ scalaVersion: String,
+) extends Artifact {
+
+ override def id: String = s"${name}_$scalaVersion"
+}
+
+sealed trait Scope
+object Scope {
+ case object Compile extends Scope
+ case object Provided extends Scope
+ case object Runtime extends Scope
+ case object Test extends Scope
+}
+
+case class Dependency(
+ artifact: Artifact,
+ scope: Scope
+)
+
+case class License(
+ name: String,
+ url: String,
+ distribution: String = "repo"
+)
+
+case class SCM(
+ url: String,
+ connection: String
+)
+
+case class Developer(
+ id: String,
+ name: String,
+ url: String,
+ organization: String,
+ organizationUrl: String
+)
+
+case class PomSettings(
+ organization: String,
+ url: String,
+ licenses: Seq[License],
+ scm: SCM,
+ developers: Seq[Developer]
+)
+