diff --git a/.gitignore b/.gitignore index 36c5645..2f7896d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1 @@ -/.settings/ -/.idea/ target/ -*.log -*.iml -/\.target/ -/\.cache -/\.project -/\.classpath -.history -.DS_Store -/tmp/ -/bin/ -/.cache-main -/.cache-tests -admin/.coursier -admin/.scalafmt* diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..2dddf96 --- /dev/null +++ b/build.sbt @@ -0,0 +1,11 @@ +lazy val root = project.in(file(".")) + .settings(ScalaModulePlugin.scalaModuleSettings) + .settings( + name := "scala-library-next", + scalacOptions ++= Seq("-deprecation", "-feature", "-Werror"), + scalaModuleMimaPreviousVersion := None, + libraryDependencies ++= Seq( + "junit" % "junit" % "4.13.1" % Test, + "org.scalacheck" %% "scalacheck" % "1.14.3" % Test, + ) + ) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..bd12a25 --- /dev/null +++ b/build.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +set -e + +# Builds of tagged revisions are published to sonatype staging. + +# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. +# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. + +# sbt-dynver sets the version number from the tag +# sbt-travisci sets the Scala version from the travis job matrix + +# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: +# - check out the tag for the version that needs to be published +# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary +# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., +# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) + +isReleaseJob() { + if [[ "$ADOPTOPENJDK" == "8" ]]; then + true + else + false + fi +} + +if [[ "$SCALAJS_VERSION" == "" ]]; then + projectPrefix="" +else + projectPrefix="TODO/" +fi + +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" +tagPat="^v$verPat(#.*)?$" + +if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then + releaseTask="ci-release" + if ! isReleaseJob; then + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" + exit 0 + fi +fi + +# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions +export CI_RELEASE="${projectPrefix}publishSigned" +export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" + +# default is sonatypeBundleRelease, which closes and releases the staging repo +# see https://github.com/xerial/sbt-sonatype#commands +# for now, until we're confident in the new release scripts, just close the staging repo. +export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" + +sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..08e4d79 --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.4.1 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..81fac90 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3") diff --git a/src/main/scala/scala/SampleAddition.scala b/src/main/scala/scala/SampleAddition.scala new file mode 100644 index 0000000..d038538 --- /dev/null +++ b/src/main/scala/scala/SampleAddition.scala @@ -0,0 +1,15 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala + +object SampleAddition