Compiling an unrelated executable compiles StaticBuildConfigPluginExecutable

Abierto
#776 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
swift
Área
build-system

Línea de trabajo

Comienza con el reproductor de Package.swift descrito en el issue, que añade swiftlang/swift-java como una dependencia no utilizada; después ejecuta swift run Target e inspecciona el registro de compilación. Confirma si StaticBuildConfigPluginExecutable y los targets relacionados de SwiftSyntax y Subprocess se compilan a pesar de la dependencia no utilizada; el issue no especifica una solución en el repositorio.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

build

I'm encountering a rather annoying issue which is causing swift-java's StaticBuildConfigPluginExecutable target to be built when building unrelated SwiftPM targets that don't import anything from swift-java at all.

I believe this is a SwiftPM issue, but I figured I'd report it here first in case anyone else has encountered the issue and found a workaround.

I'll file a SwiftPM issue once I've got a more minimal reproducer.

Reproducing

Add swiftlang/swift-java to a package (without actually using it anywhere);

// swift-tools-version: 6.1

import PackageDescription

let package = Package(
    name: "SwiftJavaUser",
    platforms: [.macOS(.v10_15)],
    dependencies: [
        .package(
            url: "https://github.com/swiftlang/swift-java",
            .upToNextMinor(from: "0.4.0")
        ),
    ],
    targets: [
        .executableTarget(name: "Target"),
    ]
)

Build and run an executable target that has nothing to do with swift-java;

swift run Target

Observe that StaticBuildConfigPluginExecutable related targets (such as SwiftSyntax and Subprocess) appear in the build log, and that the target takes significantly longer to build than if you remove the unused swift-java dependency.

SwiftPM itself even states that the swift-java dependency is unused (which is a bit contradictory).

Here's a simple Swift package that reproduces the issue: SwiftJavaUser.zip

Lenguaje dominante
Swift
Estrellas
1.3k
Forks
127
Merge medio
2 d 14 h
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de swiftlang/swift-java

Todos los issues de swiftlang/swift-java

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.