Skip to content

Commit

Permalink
Release 0.4.0 (#2105)
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Jan 19, 2021
1 parent 3d52a52 commit f2c2ca4
Show file tree
Hide file tree
Showing 8 changed files with 706 additions and 12 deletions.
528 changes: 528 additions & 0 deletions docs/changelog/0.4.0.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/changelog/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _changelog:

Changelog
=========

.. toctree::
:maxdepth: 1

0.4.0
pre-0.4
5 changes: 0 additions & 5 deletions docs/changelog.rst → docs/changelog/pre-0.4.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.. _changelog:

Changelog
=========

0.4.0-M2 (May 23, 2019)
-------------------------

Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

# General information about the project.
project = u'Scala Native'
copyright = u'2016-2020, EPFL'
copyright = u'2016-2021, EPFL'

# author must be defined to keep "make latexpdf" happy but the definition
# # in 'latex_documents' section below appears to be the one actively used.
Expand All @@ -63,9 +63,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.4.0-SNAPSHOT'
version = u'0.4.0'
# The full version, including alpha/beta/rc tags.
release = u'0.4.0-SNAPSHOT'
release = u'0.4.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ and the development process behind the project.
lib/index
contrib/index
blog/index
changelog
changelog/index
faq
4 changes: 2 additions & 2 deletions docs/user/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ To enable JUnit support, add the following lines to your `build.sbt` file:

.. code-block:: scala
libraryDependencies += "org.scala-native" %%% "junit-runtime" % "0.4.0-SNAPSHOT"
addCompilerPlugin("org.scala-native" % "junit-plugin" % "0.4.0-SNAPSHOT" cross CrossVersion.full)
libraryDependencies += "org.scala-native" %%% "junit-runtime" % "0.4.0"
addCompilerPlugin("org.scala-native" % "junit-plugin" % "0.4.0" cross CrossVersion.full)
If you want to get more detailed output from the JUnit runtime, also include the following line:

Expand Down
2 changes: 1 addition & 1 deletion nir/src/main/scala/scala/scalanative/nir/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ object Versions {
final val revision: Int = 8 // a.k.a. MINOR version

/* Current public release version of Scala Native. */
final val current: String = "0.4.0-SNAPSHOT"
final val current: String = "0.4.0"
}
161 changes: 161 additions & 0 deletions scripts/changelog.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
// Based on Ammonite script created by Tomasz Godzik in scalameta/metals https://github.com/scalameta/metals/commits/main/bin/merged_prs.sc
import $ivy.`org.kohsuke:github-api:1.114`

import scala.collection.mutable.ListBuffer
import scala.collection.JavaConverters._
import scala.collection.mutable

import org.kohsuke.github.GitHubBuilder

import java.text.SimpleDateFormat
import java.util.Date

val defaultToken = sys.env.get("GITHUB_TOKEN")

@main
def main(
firstTag: String,
lastTag: String,
githubToken: Seq[String] = defaultToken.toSeq
) = {
val author = os.proc(List("git", "config", "user.name")).call().out.trim()
val commits = os
.proc(List("git", "rev-list", s"${firstTag}..${lastTag}"))
.call()
.out
.trim()
.linesIterator
.size

val contributors = os
.proc(
List("git", "shortlog", "-sn", "--no-merges", s"${firstTag}..${lastTag}")
)
.call()
.out
.trim()
.linesIterator
.toList

val command = List(
"git",
"log",
s"$firstTag..$lastTag",
"--first-parent",
"master",
"--pretty=format:%H"
)

val token = githubToken.headOption.getOrElse {
throw new Exception("No github API token was specified")
}

val output = os.proc(command).call().out.trim()

val gh = new GitHubBuilder()
.withOAuthToken(token)
.build()

val foundPRs = mutable.Set.empty[Int]
val mergedPRs = ListBuffer[String]()
for {
// group in order to optimize API
searchSha <- output
.split('\n')
.grouped(5)
.map(_.mkString("SHA ", " SHA ", ""))
allMatching = gh
.searchIssues()
.q(s"repo:scala-native/scala-native type:pr $searchSha")
.list()
pr <- allMatching.toList().asScala.sortBy(_.getClosedAt()).reverse
prNumber = pr.getNumber()
if !foundPRs(prNumber)
} {
foundPRs += prNumber
val login = pr.getUser().getLogin()
val formattedPR =
s"""|- ${pr.getTitle()}
| [\\#${pr.getNumber()}](${pr.getHtmlUrl()})
| ([$login](https://github.com/$login))""".stripMargin
mergedPRs += formattedPR
}

val releaseNotes =
template(
author,
firstTag,
lastTag,
mergedPRs.toList,
commits,
contributors
)

val pathToReleaseNotes =
os.pwd / os.up / "docs" / "changelog" / s"$today-release-$lastTag.md"
os.write(pathToReleaseNotes, releaseNotes)
}

def today: String = {
val formatter = new SimpleDateFormat("yyyy-MM-dd");
formatter.format(new Date());
}

def template(
author: String,
firstTag: String,
lastTag: String,
mergedPrs: List[String],
commits: Int,
contributos: List[String]
) = {
s"""|
|# Release $lastTag ($today)
|
|We're happy to announce the release of Scala Native $lastTag, which
|
|<table>
|<tbody>
| <tr>
| <td>Commits since last release</td>
| <td align="center">$commits</td>
| </tr>
| <tr>
| <td>Merged PRs</td>
| <td align="center">${mergedPrs.size}</td>
| </tr>
| <tr>
| <td>Contributors</td>
| <td align="center">${contributos.size}</td>
| </tr>
| <tr>
| <td>Closed issues</td>
| <td align="center"></td>
| </tr>
| <tr>
| <td>New features</td>
| <td align="center"></td>
| </tr>
|</tbody>
|</table>
|
|## Contributors
|
|Big thanks to everybody who contributed to this release or reported an issue!
|
|```
|$$ git shortlog -sn --no-merges $firstTag..$lastTag
|${contributos.mkString("\n")}
|```
|
|## Merged PRs
|
|## [$lastTag](https://github.com/scala-native/scala-native/tree/$lastTag) (${today})
|
|[Full Changelog](https://github.com/scala-native/scala-native/compare/$firstTag...$lastTag)
|
|**Merged pull requests:**
|
|${mergedPrs.mkString("\n")}
|""".stripMargin
}

0 comments on commit f2c2ca4

Please sign in to comment.