|
| 1 | +/* |
| 2 | + * Copyright 2010-2011 Christos KK Loverdos |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import java.util.Calendar |
| 18 | +import sbt._ |
| 19 | + |
| 20 | +class Maybe(info: ProjectInfo) extends DefaultProject(info) { |
| 21 | + override def compileOptions = super.compileOptions ++ |
| 22 | + Seq("-deprecation", |
| 23 | + "-Xmigration", |
| 24 | + "-Xcheckinit", |
| 25 | + "-optimise", |
| 26 | + "-explaintypes", |
| 27 | + "-unchecked", |
| 28 | + "-encoding", "utf8") |
| 29 | + .map(CompileOption(_)) |
| 30 | + |
| 31 | + def extraResources = "LICENSE.txt" |
| 32 | + override def mainResources = super.mainResources +++ extraResources |
| 33 | + |
| 34 | + val lib_scalatest = "org.scalatest" % "scalatest_2.9.0" % "1.4.1" % "test" withSources() |
| 35 | + |
| 36 | + override def packageDocsJar = defaultJarPath("-javadoc.jar") |
| 37 | + override def packageSrcJar= defaultJarPath("-sources.jar") |
| 38 | + val sourceArtifact = Artifact.sources(artifactID) |
| 39 | + val docsArtifact = Artifact.javadoc(artifactID) |
| 40 | + override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageDocs, packageSrc) |
| 41 | + |
| 42 | + override def packageAction = super.packageAction dependsOn test |
| 43 | + |
| 44 | + override def managedStyle = ManagedStyle.Maven |
| 45 | + |
| 46 | + override def pomExtra = |
| 47 | + <licenses> |
| 48 | + <license> |
| 49 | + <name>Apache 2</name> |
| 50 | + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> |
| 51 | + <distribution>repo</distribution> |
| 52 | + </license> |
| 53 | + </licenses> |
| 54 | + <developers> |
| 55 | + <developer> |
| 56 | + <id>loverdos</id> |
| 57 | + <name>Christos KK Loverdos</name> |
| 58 | + </developer> |
| 59 | + </developers>; |
| 60 | + |
| 61 | + override def repositories = |
| 62 | + if (version.toString.endsWith("-SNAPSHOT")) super.repositories + ScalaToolsSnapshots |
| 63 | + else super.repositories |
| 64 | + |
| 65 | + // Set up publish repository (the tuple avoids SBT's ReflectiveRepositories detection) |
| 66 | + private lazy val ScalaToolsReleases_t = ("Scala Tools Releases" -> "http://nexus.scala-tools.org/content/repositories/releases/") |
| 67 | + private lazy val ScalaToolsSnapshots_t = ("Scala Tools Snapshots" -> "http://nexus.scala-tools.org/content/repositories/snapshots/") |
| 68 | + |
| 69 | + lazy val publishTo = |
| 70 | + if (version.toString.endsWith("-SNAPSHOT")) { |
| 71 | + println("====> publishing SNAPSHOT: " + version) |
| 72 | + ScalaToolsSnapshots_t._1 at ScalaToolsSnapshots_t._2 |
| 73 | + } |
| 74 | + else { |
| 75 | + println("====> publishing RELEASE: " + version) |
| 76 | + ScalaToolsReleases_t._1 at ScalaToolsReleases_t._2 |
| 77 | + } |
| 78 | + |
| 79 | + Credentials(Path.userHome / ".ivy2" / ".credentials", log) |
| 80 | + |
| 81 | + lazy val publishRemote = propertyOptional[Boolean](false, true) |
| 82 | + |
| 83 | + private lazy val localDestRepo = Resolver.file("maven-local", Path.userHome / ".m2" / "repository" asFile) |
| 84 | + override def defaultPublishRepository = |
| 85 | + if (!publishRemote.value) Some(localDestRepo) |
| 86 | + else super.defaultPublishRepository |
| 87 | + |
| 88 | + lazy val projectInceptionYear = "2010" |
| 89 | + |
| 90 | + private lazy val docBottom = |
| 91 | + "Copyright (c) Christos KK Loverdos. " + |
| 92 | + projectInceptionYear + "-" + Calendar.getInstance().get(Calendar.YEAR) + |
| 93 | + ". All Rights Reserved." |
| 94 | +} |
0 commit comments