uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

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

Open LBeernaertProton opened this issue 1 year ago • 6 comments

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 {

LBeernaertProton avatar Mar 28 '24 14:03 LBeernaertProton

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.

badboy avatar Apr 02 '24 12:04 badboy

The version bundled with the docker file of the repo:

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

LBeernaertProton avatar Apr 03 '24 07:04 LBeernaertProton

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)

badboy avatar Apr 03 '24 12:04 badboy

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?

LBeernaertProton avatar Apr 11 '24 12:04 LBeernaertProton

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!)

badboy avatar Apr 11 '24 12:04 badboy

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

LBeernaertProton avatar May 29 '24 12:05 LBeernaertProton