Skip to content

Commit

Permalink
Merge pull request #402 from mkurz/sbt_1.4_pr
Browse files Browse the repository at this point in the history
Compatibility with sbt 1.4+
  • Loading branch information
mkurz committed Sep 19, 2022
2 parents 7d76b25 + cebf84f commit d10b479
Show file tree
Hide file tree
Showing 28 changed files with 251 additions and 185 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check

on:
pull_request:

push:
branches:
- main # Check branch after merge

concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Tests
uses: playframework/.github/.github/workflows/cmd.yml@v2
with:
java: 11, 8
scala: 2.12.17
cmd: |
sbt ++$MATRIX_SCALA test scripted
finish:
name: Finish
if: github.event_name == 'pull_request'
needs: # Should be last
- "tests"
uses: playframework/.github/.github/workflows/rtm.yml@v2
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish

on:
push:
branches: # Snapshots
- main
tags: ["**"] # Releases
release:
types: [published]

jobs:
publish-artifacts:
name: Publish / Artifacts
uses: playframework/.github/.github/workflows/publish.yml@v2
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Drafter

on:
push:
branches:
- main

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
name: "sbt-eclipse $RESOLVED_VERSION"
config-name: release-drafts/increasing-major-version.yml # located in .github/ in the default branch within this or the .github repo
commitish: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
sbteclipse [![Build Status](https://travis-ci.org/sbt/sbteclipse.svg?branch=master)](https://travis-ci.org/sbt/sbteclipse)
=========================
# sbt-eclipse

Plugin for [sbt](https://github.com/sbt/sbt) to create [Eclipse](http:https://www.eclipse.org/) project definitions. Please see below for installation details and the [Documentation](http:https://github.com/sbt/sbteclipse/wiki/) for information about configuring sbteclipse. Information about contribution policy and license can be found below.
[![Build Status](https://github.com/sbt/sbt-eclipse/actions/workflows/build-test.yml/badge.svg)](https://github.com/sbt/sbt-eclipse/actions/workflows/build-test.yml)
[![Maven](https://img.shields.io/maven-central/v/com.github.sbt/sbt-eclipse_2.12.svg?logo=apache-maven)](https://mvnrepository.com/artifact/com.github.sbt/sbt-eclipse_2.12)
[![Repository size](https://img.shields.io/github/repo-size/sbt/sbt-eclipse.svg?logo=git)](https://github.com/sbt/sbt-eclipse)
[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)

Plugin for [sbt](https://github.com/sbt/sbt) to create [Eclipse](http:https://www.eclipse.org/) project definitions. Please see below for installation details and the [Documentation](http:https://github.com/sbt/sbt-eclipse/wiki/) for information about configuring sbt-eclipse. Information about contribution policy and license can be found below.

Installation and Basic Usage
---------------------

- Open your plugin definition file (or create one if doesn't exist). You can use either:

- the global file (for version 0.13 and up) at *~/.sbt/SBT_VERSION/plugins/plugins.sbt*
- the global file (for version 1.0 and up) at *~/.sbt/SBT_VERSION/plugins/plugins.sbt*
- the project-specific file at *PROJECT_DIR/project/plugins.sbt*

- Add sbteclipse to the plugin definition file:
- Add sbt-eclipse to the plugin definition file:

- Version 6.x+ will only support SBT 1.0+ when it is released. Use 5.2.4 or older for previous versions of SBT
- Version 6.x+ only supports SBT 1.4+. Use 5.2.4 or older for previous versions of SBT

```
addSbtPlugin("com.github.sbt" % "sbt-eclipse" % "6.0.0-RC1")
// For older releases (< version 6.0.0)
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
```

Expand All @@ -28,7 +35,7 @@ addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
Contribution policy
-------------------

Contributions via GitHub pull requests are gladly accepted from their original author. Before we can accept pull requests, you will need to agree to the [Typesafe Contributor License Agreement](http:https://www.typesafe.com/contribute/cla) online, using your GitHub account - it takes 30 seconds.
Contributions via GitHub pull requests are gladly accepted from their original author.


License
Expand All @@ -41,4 +48,4 @@ Maintainers

### Releases

Maintainers must run `git tag` to tag a release. The release can then be pushed to bintray with `sbt ^publish`.
Maintainers must run `git tag` to tag a release. The release can then be pushed with `sbt ^publish`.
33 changes: 9 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
import _root_.bintray.BintrayPlugin.bintrayPublishSettings

val baseVersion = "6.0.0-SNAPSHOT"

lazy val root = (project in file("."))
.enablePlugins(GitVersioning, SbtPlugin)
.enablePlugins(SbtPlugin)
.settings(
versionWithGit ++
sbtrelease.ReleasePlugin.projectSettings ++
bintrayPublishSettings ++
Seq(
organization := "com.typesafe.sbteclipse",
name := "sbteclipse-plugin",
sbtPlugin := true,
git.baseVersion := baseVersion,
sbtVersion in GlobalScope := {
System.getProperty("sbt.build.version", (sbtVersion in GlobalScope).value)
},
organization := "com.github.sbt",
name := "sbt-eclipse",
scalacOptions ++= Seq("-unchecked", "-deprecation", "-target:jvm-1.8"),
scalaVersion := "2.12.16",
scalaVersion := "2.12.17",
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % "1.3.0",
"org.scala-lang.modules" %% "scala-xml" % "2.1.0",
"org.scalaz" %% "scalaz-core" % "7.2.34",
"org.scalaz" %% "scalaz-effect" % "7.2.34",
"org.scalatest" %% "scalatest" % "3.0.9" % "test"
"org.scalatest" %% "scalatest" % "3.2.3" % "test"
),
publishMavenStyle := false,
bintrayOrganization := Some("sbt"),
bintrayPackage := "sbteclipse",
bintrayRepository := "sbt-plugin-releases",
homepage := Some(url("https://github.com/sbt/sbt-eclipse")),
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html")),
publishArtifact in (Compile, packageDoc) := false,
publishArtifact in (Compile, packageSrc) := false,
(Compile / packageDoc / publishArtifact) := false,
(Compile / packageSrc / publishArtifact) := false,
scriptedBufferLog := false,
scriptedLaunchOpts ++= Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.7.1
4 changes: 1 addition & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.0.15")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.6.1")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
52 changes: 26 additions & 26 deletions src/main/scala/com/typesafe/sbteclipse/core/Eclipse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,19 @@ private object Eclipse extends EclipseSDTConfig {
// Getting and transforming mandatory settings and task results

def name(ref: Reference, state: State): Validation[String] =
if (setting(EclipseKeys.useProjectId in ref, state))
settingValidation(Keys.thisProject in ref, state) map (_.id)
if (setting((ref / EclipseKeys.useProjectId), state))
settingValidation((ref / Keys.thisProject), state) map (_.id)
else
settingValidation(Keys.name in ref, state)
settingValidation((ref / Keys.name), state)

def buildDirectory(state: State): Validation[File] =
settingValidation(Keys.baseDirectory in ThisBuild, state)
settingValidation((ThisBuild / Keys.baseDirectory), state)

def baseDirectory(ref: Reference, state: State): Validation[File] =
settingValidation(Keys.baseDirectory in ref, state)
settingValidation((ref / Keys.baseDirectory), state)

def target(ref: Reference, state: State): Validation[File] =
settingValidation(Keys.target in ref, state)
settingValidation((ref / Keys.target), state)

def srcDirectories(
ref: Reference,
Expand All @@ -423,7 +423,7 @@ private object Eclipse extends EclipseSDTConfig {

def dirs(values: ValueSet, key: SettingKey[Seq[File]]): Validation[List[(sbt.File, Option[java.io.File])]] =
if (values subsetOf createSrc)
(settingValidation(key in (ref, configuration), state) |@| classDirectory)((sds, cd) => sds.toList map (_ -> cd))
(settingValidation((ref / configuration / key), state) |@| classDirectory)((sds, cd) => sds.toList map (_ -> cd))
else
scalaz.Validation.success(Nil)
List(
Expand All @@ -436,14 +436,14 @@ private object Eclipse extends EclipseSDTConfig {
def scalacOptions(ref: ProjectRef, state: State): Validation[Seq[(String, String)]] = {
// Here we have to look at scalacOptions *for compilation*, vs. the ones used for testing.
// We have to pick one set, and this should be the most complete set.
(evaluateTask(Keys.scalacOptions in sbt.Compile, ref, state) |@| settingValidation(Keys.scalaVersion in ref, state)) { (options, version) =>
(evaluateTask((sbt.Compile / Keys.scalacOptions), ref, state) |@| settingValidation((ref / Keys.scalaVersion), state)) { (options, version) =>
val ideSettings = fromScalacToSDT(options)
ScalaVersion.parse(version).settingsFrom(ideSettings.toMap).toSeq
} map { options => if (options.nonEmpty) ("scala.compiler.useProjectSettings" -> "true") +: options else options }
}

def compileOrder(ref: ProjectRef, state: State): Validation[Option[String]] =
settingValidation(Keys.compileOrder in ref, state).map(order =>
settingValidation((ref / Keys.compileOrder), state).map(order =>
if (order == xsbti.compile.CompileOrder.Mixed) None
else Some(order.toString))

Expand All @@ -453,7 +453,7 @@ private object Eclipse extends EclipseSDTConfig {
withJavadoc: Boolean,
state: State)(
configuration: Configuration): Validation[Seq[Lib]] = {
def evalTask[A](key: TaskKey[A]) = evaluateTask(key in configuration, ref, state)
def evalTask[A](key: TaskKey[A]) = evaluateTask((configuration / key), ref, state)
def moduleReports(key: TaskKey[UpdateReport]) =
evalTask(key) map { updateReport =>
for {
Expand Down Expand Up @@ -521,7 +521,7 @@ private object Eclipse extends EclipseSDTConfig {
configuration: Configuration): Validation[Seq[String]] = {
val projectDependencies = project.dependencies collect {
case dependency if isInConfiguration(configuration, ref, dependency, state) =>
settingValidation(Keys.name in dependency.project, state)
settingValidation((dependency.project / Keys.name), state)
}
val projectDependenciesSeq = projectDependencies.toList.sequence
state.log.debug("Project dependencies for configuration '%s': %s".format(configuration, projectDependenciesSeq))
Expand All @@ -544,49 +544,49 @@ private object Eclipse extends EclipseSDTConfig {
// Getting and transforming optional settings and task results

def executionEnvironment(ref: Reference, state: State): Option[EclipseExecutionEnvironment.Value] =
setting(EclipseKeys.executionEnvironment in ref, state)
setting((ref / EclipseKeys.executionEnvironment), state)

def skipParents(ref: Reference, state: State): Boolean =
setting(EclipseKeys.skipParents in ref, state)
setting((ref / EclipseKeys.skipParents), state)

def withSource(ref: Reference, state: State): Boolean =
setting(EclipseKeys.withSource in ref, state)
setting((ref / EclipseKeys.withSource), state)

def withJavadoc(ref: Reference, state: State): Boolean =
setting(EclipseKeys.withJavadoc in ref, state)
setting((ref / EclipseKeys.withJavadoc), state)

def withBundledScalaContainers(ref: Reference, state: State): Boolean =
setting(EclipseKeys.withBundledScalaContainers in ref, state)
setting((ref / EclipseKeys.withBundledScalaContainers), state)

def classpathTransformerFactories(ref: Reference, state: State): Seq[EclipseTransformerFactory[RewriteRule]] =
setting(EclipseKeys.classpathTransformerFactories in ref, state)
setting((ref / EclipseKeys.classpathTransformerFactories), state)

def projectTransformerFactories(ref: Reference, state: State): Seq[EclipseTransformerFactory[RewriteRule]] =
setting(EclipseKeys.projectTransformerFactories in ref, state)
setting((ref / EclipseKeys.projectTransformerFactories), state)

def configurations(ref: Reference, state: State): Seq[Configuration] =
setting(EclipseKeys.configurations in ref, state).toSeq
setting((ref / EclipseKeys.configurations), state).toSeq

def createSrc(ref: Reference, state: State)(configuration: Configuration): EclipseCreateSrc.ValueSet =
setting(EclipseKeys.createSrc in (ref, configuration), state)
setting((ref / configuration / EclipseKeys.createSrc), state)

def managedClassDirectories(ref: Reference, state: State)(configuration: Configuration): Seq[sbt.File] =
setting(EclipseKeys.managedClassDirectories in (ref, configuration), state)
setting((ref / configuration / EclipseKeys.managedClassDirectories), state)

def projectFlavor(ref: Reference, state: State) =
setting(EclipseKeys.projectFlavor in ref, state)
setting((ref / EclipseKeys.projectFlavor), state)

def eclipseOutput(ref: ProjectRef, state: State)(config: Configuration): Option[String] =
setting(EclipseKeys.eclipseOutput in (ref, config), state)
setting((ref / config / EclipseKeys.eclipseOutput), state)

def preTasks(ref: ProjectRef, state: State): Seq[(TaskKey[_], ProjectRef)] =
setting(EclipseKeys.preTasks in ref, state).zipAll(Seq.empty, null, ref)
setting((ref / EclipseKeys.preTasks), state).zipAll(Seq.empty, null, ref)

def relativizeLibs(ref: ProjectRef, state: State): Boolean =
setting(EclipseKeys.relativizeLibs in ref, state)
setting((ref / EclipseKeys.relativizeLibs), state)

def skip(ref: ProjectRef, state: State): Boolean =
setting(EclipseKeys.skipProject in ref, state)
setting((ref / EclipseKeys.skipProject), state)

// IO

Expand Down
Loading

0 comments on commit d10b479

Please sign in to comment.