Giter Club home page Giter Club logo

Comments (5)

RemiBardon avatar RemiBardon commented on July 28, 2024

I see that Driver.swift#L1002-L1006 is the reason why I see ["swift-build"], but it hides the initial binary path so I still think this is not what's expected.

I tried Process.findExecutable(CommandLine.arguments[0]) instead of Process.findExecutable(arguments[0]):

  // We are running as a subcommand, try to find the subcommand adjacent to the executable we are running as.
  // If we didn't find the tool there, let the OS search for it.
  print("arguments", arguments)
  print("path1", String(describing: Process.findExecutable(arguments[0])?.parentDirectory.appending(component: subcommand)))
+ print("path2", String(describing: Process.findExecutable(CommandLine.arguments[0])?.parentDirectory.appending(component: subcommand)))
- let subcommandPath = Process.findExecutable(arguments[0])?.parentDirectory.appending(component: subcommand)
+ let subcommandPath = Process.findExecutable(CommandLine.arguments[0])?.parentDirectory.appending(component: subcommand)
                         ?? Process.findExecutable(subcommand)

Unfortunately, when running swift build, it results in Optional(<AbsolutePath:"/usr/host/bin/swift-build">), which is still not what I'd expect…

When running /usr/x86_64-pc-linux-gnu/lib/swift-5.7/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swift build it obviously works, but it's unfortunate I have to use the absolute path…

Could we easily resolve the symlinks? Would you be against the idea for some reason?

from swift-driver.

RemiBardon avatar RemiBardon commented on July 28, 2024

I tried many different things to patch my issue, but I could not properly resolve the symlink without taking the risk of introducing platform-specific code.

Guess my only option is to add swift-* binaries to the PATH

from swift-driver.

RemiBardon avatar RemiBardon commented on July 28, 2024

I was about to propose a PR for:

- if subcommandPath == nil || !localFileSystem.exists(subcommandPath!) {
+ guard let subcommandPath = subcommandPath, localFileSystem.exists(subcommandPath) else {
    throw Driver.Error.unknownOrMissingSubcommand(subcommand)
  }

  // Execute the subcommand.
- try exec(path: subcommandPath?.pathString ?? "", args: arguments)
+ try exec(path: subcommandPath.pathString, args: arguments)

then I quickly checked if release/5.9 was still like this and I stumbled upon e0de0af and f207c2a 🙄

Seems like I wasn't the first to have those issues 🥲

Could we then merge them into release/* branches to fix the issue for previous releases?

from swift-driver.

finagolfin avatar finagolfin commented on July 28, 2024

Those two commits you mention are in 5.8.1, which is the latest release, while 5.7 is no longer updated. Any reason you're not using 5.8.1?

from swift-driver.

MaxDesiatov avatar MaxDesiatov commented on July 28, 2024

Could we then merge them into release/* branches to fix the issue for previous releases?

Depends on the timeline. At this stage issues that corresponding PRs are fixing have to be quite critical if not blocking to be considered for release/5.8 and release/5.9. No more releases are cut from release/5.7, so it's highly unlikely any PR would be accepted to a branch that old.

from swift-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.