bundle_assets_and_deps.bat 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. :: Copyright 2018 Google LLC
  2. ::
  3. :: Licensed under the Apache License, Version 2.0 (the "License");
  4. :: you may not use this file except in compliance with the License.
  5. :: You may obtain a copy of the License at
  6. ::
  7. :: http://www.apache.org/licenses/LICENSE-2.0
  8. ::
  9. :: Unless required by applicable law or agreed to in writing, software
  10. :: distributed under the License is distributed on an "AS IS" BASIS,
  11. :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. :: See the License for the specific language governing permissions and
  13. :: limitations under the License.
  14. @echo off
  15. set FLUTTER_CACHE_DIR=%~1
  16. set BUNDLE_DIR=%~2
  17. set EXE_NAME=%~3
  18. set DATA_DIR=%BUNDLE_DIR%data
  19. if not exist "%DATA_DIR%" call mkdir "%DATA_DIR%"
  20. if %errorlevel% neq 0 exit /b %errorlevel%
  21. :: Write the executable name to the location expected by the Flutter tool.
  22. echo %EXE_NAME%>"%FLUTTER_CACHE_DIR%exe_filename"
  23. :: Copy the Flutter assets to the data directory.
  24. set FLUTTER_APP_DIR=%~dp0..\..
  25. set ASSET_DIR_NAME=flutter_assets
  26. set TARGET_ASSET_DIR=%DATA_DIR%\%ASSET_DIR_NAME%
  27. if exist "%TARGET_ASSET_DIR%" call rmdir /s /q "%TARGET_ASSET_DIR%"
  28. if %errorlevel% neq 0 exit /b %errorlevel%
  29. call xcopy /s /e /i /q "%FLUTTER_APP_DIR%\build\%ASSET_DIR_NAME%" "%TARGET_ASSET_DIR%"
  30. if %errorlevel% neq 0 exit /b %errorlevel%
  31. :: Copy the icudtl.dat file from the Flutter tree to the data directory.
  32. call xcopy /y /d /q "%FLUTTER_CACHE_DIR%icudtl.dat" "%DATA_DIR%"
  33. if %errorlevel% neq 0 exit /b %errorlevel%
  34. :: Copy the Flutter DLL to the target location.
  35. call xcopy /y /d /q "%FLUTTER_CACHE_DIR%flutter_windows.dll" "%BUNDLE_DIR%"
  36. if %errorlevel% neq 0 exit /b %errorlevel%