@@ -205,6 +205,8 @@ object CommunityBuildPlugin extends AutoPlugin {
205205 (args, extracted) => (scope : Scope , currentScalacOptions : Seq [String ]) =>
206206 val scalaVersion = extracted.get(scope / Keys .scalaVersion)
207207 val safeArgs = args.map(Scala3CommunityBuild .Utils .splitScalacOptionArgs)
208+ val ignoredVersions = safeArgs.lift(2 ).getOrElse(Nil )
209+ val shouldIgnore = ignoredVersions.exists(scalaVersion.startsWith)
208210 val append = safeArgs.lift(0 ).getOrElse(Nil )
209211 lazy val (appendScala3Exclusive, appendScala3Inclusive) =
210212 append.partition { opt =>
@@ -213,7 +215,8 @@ object CommunityBuildPlugin extends AutoPlugin {
213215 // Make sure to not modify Scala 2 project scalacOptions
214216 // these can compiled as transitive dependency of custom startup task
215217 val filteredAppend =
216- if (scalaVersion.startsWith(" 3." )) append
218+ if (shouldIgnore) Nil
219+ else if (scalaVersion.startsWith(" 3." )) append
217220 else {
218221 appendScala3Exclusive.foreach { setting =>
219222 logOnce(
@@ -225,7 +228,8 @@ object CommunityBuildPlugin extends AutoPlugin {
225228
226229 val remove = safeArgs.lift(1 ).getOrElse(Nil )
227230 val filteredRemove =
228- if (scalaVersion.startsWith(" 3." )) remove
231+ if (shouldIgnore) Nil
232+ else if (scalaVersion.startsWith(" 3." )) remove
229233 else remove ++ appendScala3Exclusive
230234
231235 Scala3CommunityBuild .Utils .mapScalacOptions(
0 commit comments