mozilla / uniffi-rs

a multi-language bindings generator for rust
https://mozilla.github.io/uniffi-rs/
Mozilla Public License 2.0
2.69k stars 221 forks source link

[tests]: error: consecutive declarations on a line must be separated by ';' #2054

Open LBeernaertProton opened 5 months ago

LBeernaertProton commented 5 months ago

I am trying to run cargo test via the docker image and it is failing with the following error on main:

/mounted_workdir/target/tmp/uniffi-example-async-api-client-f44366ee4daea68c/async_api_client.swift:439:74: error: consecutive declarations on a line must be separated by ';'
    func getIssue(owner: String, repository: String, issueNumber: UInt32) async throws  -> Issue
                                                                         ^
                                                                         ;
/mounted_workdir/target/tmp/uniffi-example-async-api-client-f44366ee4daea68c/async_api_client.swift:439:75: error: expected declaration
    func getIssue(owner: String, repository: String, issueNumber: UInt32) async throws  -> Issue
                                                                          ^
/mounted_workdir/target/tmp/uniffi-example-async-api-client-f44366ee4daea68c/async_api_client.swift:437:17: note: in declaration of 'ApiClientProtocol'
public protocol ApiClientProtocol : AnyObject {
badboy commented 5 months ago

What's the output of swiftc --version on your machine? I think it might be outdated and the error here makes me believe that your version of Swift doesn't know async yet. async/await was implemented in Swift 5.5.

LBeernaertProton commented 5 months ago

The version bundled with the docker file of the repo:

https://github.com/mozilla/uniffi-rs/blob/eeb785c571fb137049c9f9c1c38b7c422d183322/docker/Dockerfile-build#L43

badboy commented 5 months ago

I currently cannot reproduce that in Docker:

$ docker build -t rfkelly/uniffi-ci -f docker/Dockerfile-build .
$ docker run \
    -ti --rm \
    -v $HOME/.cargo/registry:/usr/local/cargo/registry \
    -v $PWD:/mounted_workdir \
    -w /mounted_workdir \
    rfkelly/uniffi-ci:latest bash

# CARGO_TARGET_DIR=/tmp/target cargo test -p uniffi-example-async-api-client
<snip>
test uniffi_foreign_language_testcase_test_async_api_client_swift ... ok
<snip>
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.64s

This is on eeb785c571fb137049c9f9c1c38b7c422d183322 (current main as of this comment)

LBeernaertProton commented 5 months ago

Hmm, i had some issues building the image with podam, so i tried to use the image from the docker registry. Maybe that image is not up to date?

badboy commented 5 months ago

We're using it in CI. :) Are you using janerik/uniffi-ci-test:latest?

.... and only just now I realize that we do reference the old name (rfkelly/uniffi-ci) in the docs (and in my command above, d'oh!)

LBeernaertProton commented 3 months ago

Sorry for for the very late reply, but when switching to the image you suggested I am able to run the tests without issues.