You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2024/08/13 09:39:00 UTC

[jira] [Updated] (SPARK-49221) sbt compilation warning: `Regular tasks always evaluate task dependencies (.value) regardless of if expressions`

     [ https://issues.apache.org/jira/browse/SPARK-49221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yang Jie updated SPARK-49221:
-----------------------------
    Component/s: Build
                     (was: Project Infra)

> sbt compilation warning: `Regular tasks always evaluate task dependencies (.value) regardless of if expressions`
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-49221
>                 URL: https://issues.apache.org/jira/browse/SPARK-49221
>             Project: Spark
>          Issue Type: Improvement
>          Components: Build
>    Affects Versions: 4.0.0
>            Reporter: Yang Jie
>            Priority: Major
>
> {code:java}
> [warn] /Users/yangjie01/SourceCode/git/spark-sbt/project/SparkBuild.scala:1554:77: value lookup of `/` inside an `if` expression
> [warn] 
> [warn] problem: `/.value` is inside an `if` expression of a regular task.
> [warn]   Regular tasks always evaluate task dependencies (`.value`) regardless of `if` expressions.
> [warn] solution:
> [warn]   1. Use a conditional task `Def.taskIf(...)` to evaluate it when the `if` predicate is true or false.
> [warn]   2. Or turn the task body into a single `if` expression; the task is then auto-converted to a conditional task. 
> [warn]   3. Or make the static evaluation explicit by declaring `/.value` outside the `if` expression.
> [warn]   4. If you still want to force the static lookup, you may annotate the task lookup with `@sbtUnchecked`, e.g. `(/.value: @sbtUnchecked)`.
> [warn]   5. Add `import sbt.dsl.LinterLevel.Ignore` to your build file to disable all task linting.
> [warn]     
> [warn]         val replClasspathes = (LocalProject("connect-client-jvm") / Compile / dependencyClasspath)
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org