From a6f04cf53b4ca64566a24591920f1769d710cb52 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 4 Nov 2013 17:55:55 +0100 Subject: [PATCH] Add specialized copy methods to IncOptions class. Add methods that allow one to set a new value to one of the fields of IncOptions class. These methods are meant to be an alternative to copy method that is hard to keep binary compatible when new fields are added to the class. Each copying method is related to one field of the class so when new fields are added existing methods (and their signatures) are unaffected. --- .../src/main/scala/sbt/inc/IncOptions.scala | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/compile/inc/src/main/scala/sbt/inc/IncOptions.scala b/compile/inc/src/main/scala/sbt/inc/IncOptions.scala index c5ebc649a..800eae4b3 100644 --- a/compile/inc/src/main/scala/sbt/inc/IncOptions.scala +++ b/compile/inc/src/main/scala/sbt/inc/IncOptions.scala @@ -49,8 +49,43 @@ final class IncOptions( val newClassfileManager: () => ClassfileManager ) extends Product with Serializable { + def withTransitiveStep(transitiveStep: Int): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + + def withRecompileAllFraction(recompileAllFraction: Double): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + + def withRelationsDebug(relationsDebug: Boolean): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + + def withApiDebug(apiDebug: Boolean): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + + def withApiDiffContextSize(apiDiffContextSize: Int): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + + def withApiDumpDirectory(apiDumpDirectory: Option[File]): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + + def withNewClassfileManager(newClassfileManager: () => ClassfileManager): IncOptions = { + new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, + apiDumpDirectory, newClassfileManager) + } + //- EXPANDED CASE CLASS METHOD BEGIN -// - @deprecated("Methods generated for case class will be removed in the future.", "0.13.2") + @deprecated("Use `with$nameOfTheField` copying methods instead.", "0.13.2") def copy(transitiveStep: Int = this.transitiveStep, recompileAllFraction: Double = this.recompileAllFraction, relationsDebug: Boolean = this.relationsDebug, apiDebug: Boolean = this.apiDebug, apiDiffContextSize: Int = this.apiDiffContextSize,