From b9c3d97655087f459056ab21bcf6a961ef2f0a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Rothenh=C3=A4usler?= Date: Thu, 10 Sep 2020 21:17:55 +0200 Subject: [PATCH 1/2] Add WSL2 robust path to Android build.gradle --- tools/build/android/webrtc-native/build.gradle | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/build/android/webrtc-native/build.gradle b/tools/build/android/webrtc-native/build.gradle index 640325e29..eb90f5457 100755 --- a/tools/build/android/webrtc-native/build.gradle +++ b/tools/build/android/webrtc-native/build.gradle @@ -78,8 +78,15 @@ dependencies { // Merge the libwebrtc.aar containing the Java interop classes for WebRTC // into the mrwebrtc.aar archive containing the native JNI library. task mergeLibwebrtcArchive(type: Exec) { - workingDir "$projectDir" - commandLine 'bash','./merge-archives.sh','-m',"$projectDir/build/outputs/aar/mrwebrtc.aar",'-o','./build/outputs/aar/merged/mrwebrtc.aar' + workingDir "$projectDir" + println "Merge-archive.sh: Current working directory is $projectDir" + + // For a Windows based path amount of backslashes is irrelevant, adding some more to escape + String WslRobustPath = "$projectDir".replaceAll("\\\\","\\\\\\\\") + + commandLine 'bash','./merge-archives.sh','-m', + "$WslRobustPath/build/outputs/aar/mrwebrtc.aar",'-o', + './build/outputs/aar/merged/mrwebrtc.aar' } // Copy the final AAR archive to the Plugins folder of the Unity library. From d6cf9925c49582d992c2fc9909d93a09c8b78576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Rothenh=C3=A4usler?= Date: Thu, 10 Sep 2020 21:24:00 +0200 Subject: [PATCH 2/2] Add Android merge-archives.sh WSL2 path adaption --- .../build/android/webrtc-native/merge-archives.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/build/android/webrtc-native/merge-archives.sh b/tools/build/android/webrtc-native/merge-archives.sh index 5f3d410eb..f9ebf80cc 100755 --- a/tools/build/android/webrtc-native/merge-archives.sh +++ b/tools/build/android/webrtc-native/merge-archives.sh @@ -131,6 +131,20 @@ while getopts l:m:o:vh OPTION; do esac done +# Update path for libwebrtc build under WSL2 +if grep -q microsoft /proc/version; then + echo "WSL-path-adaption: Detected WSL, adapting path now ..." + echo "Raw: ${MRWEBRTC_AAR}" + echo "Adapt to format: /mnt/\$driveletter\\windows_subdir\\..." + MRWEBRTC_AAR="$(sed -r 's/(^\w):/\/mnt\/\L\1/' <<< ${MRWEBRTC_AAR})" + echo "Intermediate path adaption result: ${MRWEBRTC_AAR}" + echo "Now adapt to format: /mnt/\$driveletter/windows_subdir/..." + MRWEBRTC_AAR="$(sed -r 's/\\/\//g' <<< ${MRWEBRTC_AAR})" + echo "Final path adaption result: ${MRWEBRTC_AAR}" +else + echo "WSL-path-adaption: Detected native Linux, skipping path adaption!" +fi + # Ensure all arguments have reasonable values verify-arguments