Skip to content

Commit

Permalink
Rename modules
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-vrijswijk committed Nov 10, 2023
1 parent da23298 commit 34e650e
Show file tree
Hide file tree
Showing 32 changed files with 42 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
java-version: 11
cache: 'sbt'
- name: Run tests
# Only publish stryker4s-core -api and -testrunner, sbt-stryker4s is published by scripted tests
run: sbt 'stryker4s-core2_12/publishLocal; stryker4s-api2_12/publishLocal; sbt-stryker4s-testrunner2_12/publishLocal; scripted sbt-stryker4s/test-1'
# Only publish core, api and, sbtTestRunner, sbtPlugin is published by scripted tests
run: sbt 'core2_12/publishLocal; testRunnerApi2_12/publishLocal; sbtTestRunner2_12/publishLocal; scripted sbtPlugin/test-1'
maven-plugin:
name: Test Maven plugin
runs-on: ubuntu-latest
Expand All @@ -48,7 +48,7 @@ jobs:
cache: 'maven'
- name: Cleanup M2
run: rm -rf ~/.m2/repository/io/stryker-mutator/*/SET-BY-SBT-SNAPSHOT/
- name: Publish stryker4s-core
- name: Publish core
run: sbt 'publishM2Local'
- name: Run Maven tests
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mutation-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Create Stryker4s config
run: echo 'stryker4s{reporters=["console","dashboard"],base-dir="modules/core",dashboard.module="core"}' > stryker4s.conf
- name: Run Stryker4s
run: sbt 'project stryker4s-core; stryker'
run: sbt 'project core; stryker'
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

Expand All @@ -40,9 +40,9 @@ jobs:
java-version: 17
cache: 'sbt'
- name: Create Stryker4s config
run: echo 'stryker4s{reporters=["console","dashboard"],base-dir="modules/command-runner",dashboard.module="command-runner"}' > stryker4s.conf
run: echo 'stryker4s{reporters=["console","dashboard"],base-dir="modules/commandRunner",dashboard.module="command-runner"}' > stryker4s.conf
- name: Run Stryker4s
run: sbt 'project stryker4s-command-runner; stryker'
run: sbt 'project commandRunner; stryker'
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

Expand Down
48 changes: 22 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,53 @@ lazy val root = (project withId "stryker4s" in file("."))
// Publish locally for sbt plugin testing
addCommandAlias(
"publishPluginLocal",
"set ThisBuild / version := \"0.0.0-TEST-SNAPSHOT\"; stryker4s-core2_12/publishLocal; stryker4s-api2_12/publishLocal; sbt-stryker4s2_12/publishLocal; stryker4s-api/publishLocal; sbt-stryker4s-testrunner/publishLocal"
"set ThisBuild / version := \"0.0.0-TEST-SNAPSHOT\"; core2_12/publishLocal; testRunnerApi2_12/publishLocal; sbtPlugin/publishLocal; testRunnerApi/publishLocal; sbtTestRunner/publishLocal"
),
// Publish to .m2 folder for Maven plugin testing
addCommandAlias(
"publishM2Local",
"set ThisBuild / version := \"SET-BY-SBT-SNAPSHOT\"; stryker4s-core/publishM2; stryker4s-api/publishM2"
"set ThisBuild / version := \"SET-BY-SBT-SNAPSHOT\"; core/publishM2; testRunnerApi/publishM2"
),
// Publish to .ivy folder for command runner local testing
addCommandAlias(
"publishCommandRunnerLocal",
"set ThisBuild / version := \"0.0.0-TEST-SNAPSHOT\"; stryker4s-core/publishLocal; stryker4s-api/publishLocal; stryker4s-command-runner/publishLocal"
"set ThisBuild / version := \"0.0.0-TEST-SNAPSHOT\"; core/publishLocal; testRunnerApi/publishLocal; commandRunner/publishLocal"
)
)
.aggregate(
(stryker4sCore.projectRefs ++
stryker4sCommandRunner.projectRefs ++
sbtStryker4s.projectRefs ++
stryker4sApi.projectRefs ++
(core.projectRefs ++
commandRunner.projectRefs ++
sbtPlugin.projectRefs ++
testRunnerApi.projectRefs ++
sbtTestRunner.projectRefs)*
)

lazy val stryker4sCore = newProject("stryker4s-core", "core")
.settings(coreSettings)
.dependsOn(stryker4sApi)
lazy val core = (projectMatrix in file("modules") / "core")
.settings(name := "stryker4s-core", commonSettings, coreSettings)
.dependsOn(testRunnerApi)
.jvmPlatform(scalaVersions = versions.crossScalaVersions)

lazy val stryker4sCommandRunner = newProject("stryker4s-command-runner", "command-runner")
.settings(commandRunnerSettings)
.dependsOn(stryker4sCore, stryker4sCore % "test->test")
lazy val commandRunner = (projectMatrix in file("modules") / "commandRunner")
.settings(name := "stryker4s-command-runner", commonSettings, commandRunnerSettings)
.dependsOn(core, core % "test->test")
.jvmPlatform(scalaVersions = versions.crossScalaVersions)

// sbt plugins have to use Scala 2.12
lazy val sbtStryker4s = newProject("sbt-stryker4s", "sbt")
lazy val sbtPlugin = (projectMatrix in file("modules") / "sbt")
.enablePlugins(SbtPlugin)
.settings(sbtPluginSettings)
.dependsOn(stryker4sCore)
.defaultAxes(VirtualAxis.scalaPartialVersion("2.12"), VirtualAxis.jvm)
.settings(name := "sbt-stryker4s", commonSettings, sbtPluginSettings)
.dependsOn(core)
.jvmPlatform(scalaVersions = Seq(versions.scala212))

lazy val sbtTestRunner = newProject("sbt-stryker4s-testrunner", "sbt-testrunner")
.settings(sbtTestrunnerSettings)
.dependsOn(stryker4sApi)
lazy val sbtTestRunner = (projectMatrix in file("modules") / "sbtTestRunner")
.settings(name := "stryker4s-sbt-testrunner", commonSettings, sbtTestRunnerSettings)
.dependsOn(testRunnerApi)
.jvmPlatform(scalaVersions = versions.fullCrossScalaVersions)

lazy val stryker4sApi = newProject("stryker4s-api", "api")
.settings(apiSettings)
lazy val testRunnerApi = (projectMatrix in file("modules") / "testRunnerApi")
.settings(name := "stryker4s-testrunner-api", commonSettings, testRunnerApiSettings)
.jvmPlatform(scalaVersions = versions.fullCrossScalaVersions)

def newProject(projectName: String, dir: String) =
sbt.internal
.ProjectMatrix(projectName, file("modules") / dir)
.settings(commonSettings)

lazy val writeHooks = taskKey[Unit]("Write git hooks")
Global / writeHooks := GitHooks(file("git-hooks"), file(".git/hooks"), streams.value.log)
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ To debug in VS Code, you can use (and edit) this `launch.json`:
"request": "attach",
"hostName": "127.0.0.1",
"port": 8000,
"buildTarget": "sbt-stryker4s-testrunner"
"buildTarget": "sbtTestRunner"
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you are having issues with setup, or want to keep a clean environment you can

New features are welcome! Both as ideas or in the form of a pull request.

1. Please [create an issue](https://github.com/stryker-mutator/stryker4s/issues/new) with your idea first or let us know via [Gitter](https://gitter.im/stryker-mutator/stryker4s).
1. Please [create an issue](https://github.com/stryker-mutator/stryker4s/issues/new) with your idea first or let us know via [Slack](https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM).
2. Create a fork on your GitHub account.
3. When writing your code, please conform the existing coding style. We use Scalafmt as a code formatter. You can format your code by running `./bin/scalafmt`, or with editor-specific settings. It also helps to take a moment to review the [Scala style guide](https://docs.scala-lang.org/style/).
4. Please create or edit unit/integration tests for any changed or added code.
Expand All @@ -39,7 +39,7 @@ We support mutation testing Stryker4s with Stryker4s! The easiest way is to foll

1. Run `sbt publishPluginLocal` to publish a test snapshot as `0.0.0-TEST-SNAPSHOT` version to your local ivy repository.
2. Add the sbt plugin to `project/plugins.sbt` with `0.0.0-TEST-SNAPSHOT` as the version number.
1. If the project you are running against is not a 2.13 project, publish `stryker4s-api` and `stryker4s-sbt-testrunner` manually for your appropriate version (.e.g. `sbt "stryker4s-api2_11/publishLocal; stryker4s-sbt-testrunner2_11/publishLocal"`)
1. If the project you are running against is not a 2.13 project, publish `stryker4s-api` and `stryker4s-sbt-testrunner` manually for your appropriate version (.e.g. `sbt "testRunnerApi3/publishLocal; sbtTestRunner3/publishLocal"`)
3. Run stryker4s as described in the readme.

## Learning resources
Expand Down Expand Up @@ -84,4 +84,4 @@ Want to help in some other ways? Great! Here are some things you could do:
- Evangelize mutation testing
- Mutation testing is still relatively new, especially in Scala. Please help us get the word out there!
- Share your stories in blog posts and on social media. And please let us know about it!
- Did you use Stryker4s? Your feedback is very valuable to us. Both good and bad! Please [contact us](https://gitter.im/stryker-mutator/stryker4s) to let us know what you think.
- Did you use Stryker4s? Your feedback is very valuable to us. Both good and bad! Please [contact us](https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM) to let us know what you think.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Stryker4sSbtRunner(

val fullSettings = settings ++ Seq(
libraryDependencies +=
"io.stryker-mutator" %% "sbt-stryker4s-testrunner" % stryker4sVersion
"io.stryker-mutator" %% "stryker4s-sbt-testrunner" % stryker4sVersion
)
val newState = extracted.appendWithSession(fullSettings, state)

Expand Down
2 changes: 1 addition & 1 deletion modules/sbt/src/sbt-test/sbt-stryker4s/test-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a test project for the Stryker4s SBT plugin.

To run it, first
run `sbt stryker4s-core2_12/publishLocal; stryker4s-api2_12/publishLocal; sbt-stryker4s-testrunner2_12/publishLocal` in
run `sbt core2_12/publishLocal; testRunnerApi2_12/publishLocal; sbtTestRunner2_12/publishLocal` in
the root Stryker4s project.

Then run 'sbt scripted' in the root of the Stryker4s project.
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object Dependencies {
*/
val crossScalaVersions = Seq(scala213, scala212)

/** Fuller cross-versions (used for injected packages like stryker4s-api and sbt-stryker4s-testrunner)
/** Fuller cross-versions (used for injected packages like testRunnerApi and sbtTestRunner)
*/
val fullCrossScalaVersions = crossScalaVersions ++ Seq(scala3)

Expand Down
1 change: 1 addition & 0 deletions project/GitHooks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ object GitHooks {
IO.listFiles(hooksSourceDir)
.map(hook => (hook, hooksTargetDir / hook.name))
.filterNot(_._2.exists()) // Don't write if hook already exists
.filterNot(_ => sys.env.contains("CI")) // Don't write hooks in CI
.foreach { case (originalHook, targetHook) =>
log.info(s"Copying ${originalHook.name} hook to $targetHook")
Files.copy(originalHook.asPath, targetHook.asPath)
Expand Down
5 changes: 2 additions & 3 deletions project/Release.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ object Release {
private val stryker4sReleaseAll = "stryker4sReleaseAll"
// Helper command names
private val stryker4sMvnDeploy = "stryker4sMvnDeploy"
private val publishM2Core = "stryker4s-core/publishM2"
private val publishM2Api = "stryker4s-api/publishM2"
private val crossPublish = "publish"
private val publishM2Core = "core/publishM2"
private val publishM2Api = "testRunnerApi/publishM2"
private val crossPublishSigned = "publishSigned"
private val sonatypePrepare = "sonatypePrepare"
private val sonatypeReleaseAll = "sonatypeReleaseAll"
Expand Down
8 changes: 4 additions & 4 deletions project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ object Settings {
scriptedBufferLog := false
)

lazy val sbtTestrunnerSettings: Seq[Setting[?]] = Seq(
lazy val sbtTestRunnerSettings: Seq[Setting[?]] = Seq(
libraryDependencies ++= Seq(
Dependencies.testInterface
)
)

lazy val apiSettings: Seq[Setting[?]] = Seq(
lazy val testRunnerApiSettings: Seq[Setting[?]] = Seq(
Compile / PB.targets := Seq(
scalapb.gen(grpc = false, lenses = false) -> (Compile / sourceManaged).value / "scalapb"
),
Expand All @@ -95,8 +95,8 @@ object Settings {
// Prevent version clash warnings when running Stryker4s on a locally-published on Stryker4s
libraryDependencySchemes ++= Seq(
"io.stryker-mutator" %% "stryker4s-core" % VersionScheme.Always,
"io.stryker-mutator" %% "stryker4s-api" % VersionScheme.Always,
"io.stryker-mutator" %% "sbt-stryker4s-testrunner" % VersionScheme.Always
"io.stryker-mutator" %% "stryker4s-testrunner-api" % VersionScheme.Always,
"io.stryker-mutator" %% "stryker4s-sbt-testrunner" % VersionScheme.Always
),
description := "Stryker4s, the mutation testing framework for Scala.",
organization := "io.stryker-mutator",
Expand Down

0 comments on commit 34e650e

Please sign in to comment.