Skip to content

Commit

Permalink
Merge pull request #103 from DominicD/master
Browse files Browse the repository at this point in the history
enable windows users to build the android project
  • Loading branch information
StuartHarris authored May 14, 2023
2 parents 288fda5 + 85e8870 commit 8990bea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
32 changes: 24 additions & 8 deletions examples/counter/Android/shared/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,40 @@ afterEvaluate {
task bindGen(type: Exec) {
def outDir = "${projectDir}/src/main/java"
workingDir "../../"
commandLine(
"sh", "-c",
"""\
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine(
"cmd", "/c",
"target\\debug\\uniffi-bindgen generate shared\\src\\shared.udl " +
"--language kotlin " +
"--out-dir " + outDir.replace('/', '\\')
)
} else {
commandLine(
"sh", "-c",
"""\
target/debug/uniffi-bindgen generate shared/src/shared.udl \
--language kotlin \
--out-dir $outDir
"""
)
)
}
}

task typesGen(type: Exec) {
def outDir = "${projectDir}/src/main/java"
def srcDir = "shared_types/generated/java/com"
workingDir "../../"
commandLine(
"sh", "-c",
"""\
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine(
"cmd", "/c",
"xcopy /e /y " + srcDir.replace('/', '\\') + " " + outDir.replace('/', '\\')
)
} else {
commandLine(
"sh", "-c",
"""\
cp -r $srcDir $outDir
"""
)
)
}
}
4 changes: 4 additions & 0 deletions examples/counter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ pnpm install
pnpm dev
```

### Notes:

On Windows if you get "ℹ️ Installing wasm-pack" it does not work. You can solve it by installing it manually from: https://rustwasm.github.io/wasm-pack/installer/

## iOS

You will need XCode, which you can get in the Mac AppStore
Expand Down

0 comments on commit 8990bea

Please sign in to comment.