-
Notifications
You must be signed in to change notification settings - Fork 17
Consolidate actual Scala module builds. #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,13 +1,32 @@ | ||
git.baseVersion := "1.0" | ||
import bintray.Keys._ | ||
|
||
git.baseVersion := "1.0.0" | ||
|
||
versionWithGit | ||
|
||
name := "scala-module-plugin" | ||
name := "scala-module-plugin" | ||
|
||
organization := "org.scala-lang.modules" | ||
|
||
sbtPlugin := true | ||
|
||
organization := "org.scala-lang.modules" | ||
// sbtVersion in Global := "0.13.1" | ||
|
||
sbtPlugin := true | ||
// scalaVersion in Global := "2.10.3" | ||
|
||
publishTo := Some(Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)) | ||
// publishTo := Some(if (version.value.trim.endsWith("SNAPSHOT")) Classpaths.sbtPluginSnapshots else Classpaths.sbtPluginReleases) | ||
|
||
publishMavenStyle := false | ||
|
||
bintrayPublishSettings | ||
|
||
resolvers += Classpaths.sbtPluginReleases | ||
|
||
licenses := Seq("BSD" -> url("http://opensource.org/licenses/BSD")) | ||
|
||
repository in bintray := "sbt-plugins" | ||
|
||
bintrayOrganization in bintray := None | ||
|
||
// this plugin depends on the sbt-osgi plugin -- 2-for-1! | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.7.0") |
This file contains hidden or 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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=0.13.0 | ||
sbt.version=0.13.1 |
This file contains hidden or 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 |
---|---|---|
@@ -1 +1,4 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2") | ||
|
||
// incompatible with sbt-gpg (https://github.com/softprops/bintray-sbt/pull/10) | ||
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.1.1") |
This file contains hidden or 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 |
---|---|---|
@@ -1,100 +1,102 @@ | ||
import sbt._ | ||
import Keys._ | ||
import com.typesafe.sbt.osgi.{OsgiKeys, SbtOsgi} | ||
|
||
object ScalaModulePlugin extends Plugin { | ||
val snapshotScalaBinaryVersion = settingKey[String]("The Scala binary version to use when building against Scala SNAPSHOT.") | ||
val repoName = settingKey[String]("The name of the repository under github.com/scala/.") | ||
|
||
val includeTestDependencies = settingKey[Boolean]("Include testing dependencies when building. Used to break cycles when doing full builds.") | ||
val partestVersion = settingKey[String]("the partest version we want to use.") | ||
|
||
def scalaModuleSettings: Seq[Setting[_]] = | ||
Seq( | ||
partestVersion := "1.0-RC5", | ||
organization := "org.scala-lang.modules", | ||
// don't use for doc scope, scaladoc warnings are not to be reckoned with | ||
scalacOptions in (Compile, compile) ++= Seq("-optimize", "-Xfatal-warnings", "-feature", "-deprecation", "-unchecked", "-Xlint"), | ||
// Generate $name.properties to store our version as well as the scala version used to build | ||
resourceGenerators in Compile <+= Def.task { | ||
val props = new java.util.Properties | ||
props.put("version.number", version.value) | ||
props.put("scala.version.number", scalaVersion.value) | ||
props.put("scala.binary.version.number", scalaBinaryVersion.value) | ||
val file = (resourceManaged in Compile).value / s"${name.value}.properties" | ||
IO.write(props, null, file) | ||
Seq(file) | ||
}, | ||
mappings in (Compile, packageBin) += { | ||
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties" | ||
}, | ||
// maven publishing | ||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (version.value.trim.endsWith("SNAPSHOT")) | ||
Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else | ||
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
}, | ||
publishMavenStyle := true, | ||
publishArtifact in Test := false, | ||
pomIncludeRepository := { _ => false }, | ||
pomExtra := ( | ||
<url>http://www.scala-lang.org/</url> | ||
<inceptionYear>2002</inceptionYear> | ||
<licenses> | ||
<license> | ||
<distribution>repo</distribution> | ||
<name>BSD 3-Clause</name> | ||
<url>https://github.com/scala/{name.value}/blob/master/LICENSE.md</url> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<connection>scm:git:git://github.com/scala/{name.value}.git</connection> | ||
<url>https://github.com/scala/{name.value}</url> | ||
</scm> | ||
<issueManagement> | ||
<system>JIRA</system> | ||
<url>https://issues.scala-lang.org/</url> | ||
</issueManagement> | ||
<developers> | ||
<developer> | ||
<id>epfl</id> | ||
<name>EPFL</name> | ||
</developer> | ||
<developer> | ||
<id>Typesafe</id> | ||
<name>Typesafe, Inc.</name> | ||
</developer> | ||
</developers> | ||
), | ||
// default value must be set here | ||
includeTestDependencies := true, | ||
// the actual partest the interface calls into -- must be binary version close enough to ours | ||
// so that it can link to the compiler/lib we're using (testing) | ||
libraryDependencies ++= ( | ||
if (includeTestDependencies.value) | ||
Seq("org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test", | ||
"org.scala-lang.modules" %% "scala-partest" % partestVersion.value % "test") | ||
else Seq.empty | ||
), | ||
// necessary for partest -- see comments in its build.sbt | ||
conflictWarning ~= { _.copy(failOnConflict = false) }, | ||
fork in Test := true, | ||
javaOptions in Test += "-Xmx1G", | ||
testFrameworks += new TestFramework("scala.tools.partest.Framework"), | ||
definedTests in Test += ( | ||
new sbt.TestDefinition( | ||
"partest", | ||
// marker fingerprint since there are no test classes | ||
// to be discovered by sbt: | ||
new sbt.testing.AnnotatedFingerprint { | ||
def isModule = true | ||
def annotationName = "partest" | ||
}, true, Array()) | ||
) | ||
|
||
// TODO: mima | ||
// import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings | ||
// import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact | ||
// previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value) | ||
) | ||
def deriveBinaryVersion(sv: String, snapshotScalaBinaryVersion: String) = sv match { | ||
case snap_211 if snap_211.startsWith("2.11") && | ||
snap_211.contains("-SNAPSHOT") => snapshotScalaBinaryVersion | ||
case sv => sbt.CrossVersion.binaryScalaVersion(sv) | ||
} | ||
|
||
// a setting-transform to turn the regular version into something osgi can deal with | ||
val osgiVersion = version(_.replace('-', '.')) | ||
|
||
lazy val scalaModuleSettings = Seq( | ||
repoName := name.value, | ||
|
||
organization := "org.scala-lang.modules", | ||
|
||
scalaBinaryVersion := deriveBinaryVersion(scalaVersion.value, snapshotScalaBinaryVersion.value), | ||
|
||
// so we don't have to wait for sonatype to synch to maven central when deploying a new module | ||
resolvers += Resolver.sonatypeRepo("releases"), | ||
|
||
// to allow compiling against snapshot versions of Scala | ||
resolvers += Resolver.sonatypeRepo("snapshots"), | ||
|
||
// don't use for doc scope, scaladoc warnings are not to be reckoned with | ||
// TODO: turn on for nightlies, but don't enable for PR validation... "-Xfatal-warnings" | ||
scalacOptions in compile ++= Seq("-optimize", "-feature", "-deprecation", "-unchecked", "-Xlint"), | ||
|
||
// Generate $name.properties to store our version as well as the scala version used to build | ||
resourceGenerators in Compile <+= Def.task { | ||
val props = new java.util.Properties | ||
props.put("version.number", version.value) | ||
props.put("scala.version.number", scalaVersion.value) | ||
props.put("scala.binary.version.number", scalaBinaryVersion.value) | ||
val file = (resourceManaged in Compile).value / s"${name.value}.properties" | ||
IO.write(props, null, file) | ||
Seq(file) | ||
}, | ||
|
||
mappings in (Compile, packageBin) += { | ||
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties" | ||
}, | ||
|
||
publishArtifact in Test := false, | ||
|
||
// maven publishing | ||
publishTo := Some( | ||
if (version.value.trim.endsWith("SNAPSHOT")) Resolver.sonatypeRepo("snapshots") | ||
else Opts.resolver.sonatypeStaging | ||
), | ||
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"), | ||
|
||
publishMavenStyle := true, | ||
scmInfo := Some(ScmInfo(url(s"https://github.com/scala/${repoName.value}"),s"scm:git:git://github.com/scala/${repoName.value}.git")), | ||
homepage := Some(url("http://www.scala-lang.org/")), | ||
organizationHomepage := Some(url("http://www.scala-lang.org/")), | ||
licenses := Seq("BSD 3-clause" -> url("http://opensource.org/licenses/BSD-3-Clause")), | ||
startYear := Some(2002), | ||
pomIncludeRepository := { _ => false }, | ||
pomExtra := ( | ||
<issueManagement> | ||
<system>JIRA</system> | ||
<url>https://issues.scala-lang.org/</url> | ||
</issueManagement> | ||
<developers> | ||
<developer> | ||
<id>epfl</id> | ||
<name>EPFL</name> | ||
</developer> | ||
<developer> | ||
<id>Typesafe</id> | ||
<name>Typesafe, Inc.</name> | ||
</developer> | ||
</developers> | ||
), | ||
|
||
OsgiKeys.bundleSymbolicName := s"${organization.value}.${name.value}", | ||
OsgiKeys.bundleVersion := osgiVersion.value, | ||
|
||
// Sources should also have a nice MANIFEST file | ||
packageOptions in packageSrc := Seq(Package.ManifestAttributes( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice |
||
("Bundle-SymbolicName", s"${organization.value}.${name.value}.source"), | ||
("Bundle-Name", s"${name.value} sources"), | ||
("Bundle-Version", osgiVersion.value), | ||
("Eclipse-SourceBundle", s"""${organization.value}.${name.value};version="${osgiVersion.value}";roots:="."""") | ||
)) | ||
|
||
|
||
// TODO: mima | ||
// resolvers += Classpaths.typesafeResolver | ||
// addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.5") | ||
// import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings | ||
// import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact | ||
// previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value) | ||
) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? I think the resourceGenerators should ensure the properties file goes into the final jar..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I verified this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only needed when using OSGi apparently: https://github.com/sbt/sbt-osgi/blob/master/src/main/scala/com/typesafe/sbt/osgi/SbtOsgi.scala#L41
We should open a ticket against sbt-osgi about not using the appropriate
resources in Compile
key. I think, even now, this is only accidentally fixing the issue. Doing a fewinspect tree
commands around the scala-xml build leads me to think the current architecture of sbt-osgi is leading to subtle, odd, issues in how to wire things like this.Basically, this should NOT be needed. It represents a bug that is. You should a comment to that effect in this file and I'll try to follow up on a fix.