Skip to content

Commit

Permalink
[sqlite] fix build error on windows (expo#26296)
Browse files Browse the repository at this point in the history
# Why

fixes expo#26206
close ENG-10993

# How

cmake path separator should be `/` always. refer to
Kudo/react-native-v8#132 fix but refine the
method name a little bit

# Test Plan

- ci passed
- test building on windows
  • Loading branch information
Kudo authored Jan 9, 2024
1 parent 785c573 commit 3d88843
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/expo-sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### 🐛 Bug fixes

- Fixed building error on Windows. ([#26296](https://github.com/expo/expo/pull/26296) by [@kudo](https://github.com/kudo))

### 💡 Others

## 13.1.2 - 2023-12-21
Expand Down
12 changes: 11 additions & 1 deletion packages/expo-sqlite/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
Expand All @@ -17,6 +19,14 @@ if (expoModulesCorePlugin.exists()) {
}
}

String toPlatformIndependentPath(File path) {
def result = path.toString()
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
result = result.replace(File.separatorChar, '/' as char)
}
return result
}

def SQLITE_VERSION = '3420000'
def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
Expand Down Expand Up @@ -112,7 +122,7 @@ android {
cmake {
abiFilters (*reactNativeArchitectures())
arguments "-DANDROID_STL=c++_shared",
"-DSQLITE3_SRC_DIR=${SQLITE3_SRC_DIR}"
"-DSQLITE3_SRC_DIR=${toPlatformIndependentPath(SQLITE3_SRC_DIR)}"
}
}
}
Expand Down

0 comments on commit 3d88843

Please sign in to comment.