GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — swingwebview/run-windows-password-demo.bat at master · webliteca/swingwebview Expand file tree/ Copy pathrun-windows-password-demo.batMore file actions 221 lines (205 loc) · 9.29 KB / Copy pathrun-windows-password-demo.batFile metadata and controls221 lines (205 loc) · 9.29 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 @echo off REM ============================================================================ REM run-windows-password-demo.bat REM REM One-shot build & launch of WebViewPasswordDemo on Windows. Builds the REM WebView2-backed native DLL, packages WebView.jar, compiles the demo, and REM runs it. No Ant required. REM REM Exercises the programmatic saveCredential / getCredential / REM deleteCredential API, the enable/disable gate, and the Keychain vs REM in-memory store swap. See demos\WebViewPasswordDemo\README.md. REM REM Automatic login-capture, the "Save password?" prompt, and autofill on REM reload are wired on Windows (Canvas 28): the native __webview_pw__ REM channel routes through WebView2's WebMessageReceived, and credentials REM are stored in the Windows Credential Manager (this library's own REM namespace, not the Edge profile; Edge autosave is disabled). Requires a REM WebView2 Runtime exposing ICoreWebView2Settings4 for the autosave REM toggle; the capture/store path itself works on any Evergreen runtime. REM REM Requires: REM - JAVA_HOME set to a JDK 8+ install. REM - Visual Studio 2019 or newer with "Desktop development with C++". REM - The WebView2 runtime (ships with Windows 11; install Evergreen on REM older Windows: https://aka.ms/webview2 ). REM ============================================================================ setlocal enabledelayedexpansion set "REPO_DIR=%~dp0" if "%REPO_DIR:~-1%"=="\" set "REPO_DIR=%REPO_DIR:~0,-1%" echo Repo: %REPO_DIR% REM --------------------------------------------------------------------------- REM 1. Resolve JAVA_HOME REM --------------------------------------------------------------------------- if "%JAVA_HOME%"=="" ( echo. echo JAVA_HOME is not set. Set it to your JDK install and re-run, e.g.: echo. echo set "JAVA_HOME=C:\Program Files\Amazon Corretto\jdk1.8.0_xxx" echo run-windows-password-demo.bat echo. exit /b 1 ) if not exist "%JAVA_HOME%\bin\javac.exe" ( echo ERROR: javac.exe not found in "%JAVA_HOME%\bin". echo Check that JAVA_HOME points at the JDK root, not the JRE. exit /b 1 ) echo Using JAVA_HOME=%JAVA_HOME% REM --------------------------------------------------------------------------- REM 2. Locate Visual Studio via vswhere REM --------------------------------------------------------------------------- set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" set "vswhere=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" ( echo ERROR: vswhere.exe not found. echo Install Visual Studio 2019 or newer with the echo "Desktop development with C++" workload. exit /b 1 ) set "vc_dir=" for /f "usebackq tokens=*" %%i in (`"%vswhere%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( set "vc_dir=%%i" ) if "%vc_dir%"=="" ( echo ERROR: Could not locate a Visual Studio installation with VC tools x86/x64. exit /b 1 ) echo Visual Studio: %vc_dir% REM --------------------------------------------------------------------------- REM 3. Activate the MSVC x64 environment REM --------------------------------------------------------------------------- call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -arch=x64 -host_arch=x64 if errorlevel 1 ( echo ERROR: vsdevcmd.bat failed. exit /b 1 ) set "SDK_OK=" for %%I in ("%INCLUDE:;=";"%") do ( if exist "%%~I\windows.h" set "SDK_OK=1" ) if defined SDK_OK goto :sdk_check_done set "KITS_ROOT=C:\Program Files (x86)\Windows Kits\10" set "SDK_VER=" if not exist "%KITS_ROOT%\Include" goto :sdk_check_done for /f "delims=" %%V in ('dir /b /ad /on "%KITS_ROOT%\Include" 2^>nul') do ( if exist "%KITS_ROOT%\Include\%%V\um\windows.h" set "SDK_VER=%%V" ) if "%SDK_VER%"=="" goto :sdk_check_done echo NOTE: vsdevcmd did not register a Windows SDK, but one is present echo on disk. Manually adding Windows SDK %SDK_VER% at %KITS_ROOT%. set "INCLUDE=%INCLUDE%;%KITS_ROOT%\Include\%SDK_VER%\ucrt;%KITS_ROOT%\Include\%SDK_VER%\um;%KITS_ROOT%\Include\%SDK_VER%\shared;%KITS_ROOT%\Include\%SDK_VER%\winrt;%KITS_ROOT%\Include\%SDK_VER%\cppwinrt" set "LIB=%LIB%;%KITS_ROOT%\Lib\%SDK_VER%\ucrt\x64;%KITS_ROOT%\Lib\%SDK_VER%\um\x64" set "SDK_OK=1" :sdk_check_done if defined SDK_OK goto :build_dll echo. echo ERROR: Windows SDK headers not found on the cl.exe INCLUDE path. echo vsdevcmd activated successfully but no SDK provides windows.h. echo. echo Fix: open the Visual Studio Installer, click Modify on your VS install, echo and on the "Individual components" tab tick a "Windows 11 SDK" or echo "Windows 10 SDK" entry, then re-run this script. echo. exit /b 1 :build_dll REM --------------------------------------------------------------------------- REM 4. Build webview.dll (x64) REM --------------------------------------------------------------------------- set "NATIVE_DIR=windows_64" set "DLL_OUT=%REPO_DIR%\src\%NATIVE_DIR%" if not exist "%DLL_OUT%" mkdir "%DLL_OUT%" set "BUILD_DIR=%REPO_DIR%\build" if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%" set "WEBVIEW2_VERSION=1.0.2592.51" set "WEBVIEW2_DIR=%REPO_DIR%\windows\script\Microsoft.Web.WebView2.%WEBVIEW2_VERSION%" set "WEBVIEW2_NUPKG=%WEBVIEW2_DIR%\Microsoft.Web.WebView2.%WEBVIEW2_VERSION%.nupkg" set "WEBVIEW2_URL=https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/%WEBVIEW2_VERSION%" set "PWSH=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" if not exist "%PWSH%" set "PWSH=powershell.exe" if exist "%WEBVIEW2_DIR%\build\native\include\WebView2.h" goto :webview2_ready if not exist "%WEBVIEW2_DIR%" mkdir "%WEBVIEW2_DIR%" if exist "%WEBVIEW2_NUPKG%" goto :webview2_extract echo Downloading Microsoft.Web.WebView2 %WEBVIEW2_VERSION% from NuGet ... "%PWSH%" -NoProfile -Command "$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%WEBVIEW2_URL%' -OutFile '%WEBVIEW2_NUPKG%' -UseBasicParsing" if not exist "%WEBVIEW2_NUPKG%" ( echo ERROR: failed to download WebView2 SDK from %WEBVIEW2_URL%. exit /b 1 ) :webview2_extract echo Extracting Microsoft.Web.WebView2.%WEBVIEW2_VERSION%.nupkg ... "%PWSH%" -NoProfile -Command "Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('%WEBVIEW2_NUPKG%', '%WEBVIEW2_DIR%')" if not exist "%WEBVIEW2_DIR%\build\native\include\WebView2.h" ( echo ERROR: failed to extract WebView2 SDK. exit /b 1 ) :webview2_ready echo Building webview.dll (x64) ... cl /nologo ^ /D "WEBVIEW_API=__declspec(dllexport)" ^ /D "_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS" ^ /I "%JAVA_HOME%\include" ^ /I "%JAVA_HOME%\include\win32" ^ /I "%REPO_DIR%\windows" ^ /I "%WEBVIEW2_DIR%\build\native\include" ^ /std:c++17 /EHsc ^ /Fo"%BUILD_DIR%\\" ^ "%REPO_DIR%\windows\webview.cc" ^ "%REPO_DIR%\windows\webview_embed.cc" ^ /link /DLL ^ "%WEBVIEW2_DIR%\build\native\x64\WebView2LoaderStatic.lib" ^ "%JAVA_HOME%\lib\jawt.lib" ^ advapi32.lib ole32.lib oleaut32.lib shlwapi.lib shell32.lib user32.lib version.lib winhttp.lib ^ /OUT:"%BUILD_DIR%\webview.dll" if errorlevel 1 ( echo ERROR: cl.exe build failed. exit /b 1 ) copy /Y "%BUILD_DIR%\webview.dll" "%DLL_OUT%\webview.dll" >nul echo Built %DLL_OUT%\webview.dll REM --------------------------------------------------------------------------- REM 5. Compile WebView Java sources REM --------------------------------------------------------------------------- set "WV_CLASSES=%BUILD_DIR%\classes-webview" if exist "%WV_CLASSES%" rmdir /s /q "%WV_CLASSES%" mkdir "%WV_CLASSES%" echo Compiling WebView Java sources ... dir /s /b "%REPO_DIR%\src\*.java" > "%BUILD_DIR%\wv-sources.txt" "%JAVA_HOME%\bin\javac.exe" -d "%WV_CLASSES%" -classpath "%REPO_DIR%\lib\*" @"%BUILD_DIR%\wv-sources.txt" if errorlevel 1 ( echo ERROR: javac failed. exit /b 1 ) REM --------------------------------------------------------------------------- REM 6. Build WebView.jar REM --------------------------------------------------------------------------- set "WV_JAR=%REPO_DIR%\dist\WebView.jar" if not exist "%REPO_DIR%\dist" mkdir "%REPO_DIR%\dist" set "STAGE=%BUILD_DIR%\stage-webview" if exist "%STAGE%" rmdir /s /q "%STAGE%" mkdir "%STAGE%\%NATIVE_DIR%" "%SystemRoot%\System32\xcopy.exe" /e /q /y "%WV_CLASSES%\*" "%STAGE%\" >nul if errorlevel 1 ( echo ERROR: xcopy of compiled classes into the jar staging dir failed. exit /b 1 ) copy /Y "%DLL_OUT%\webview.dll" "%STAGE%\%NATIVE_DIR%\webview.dll" >nul pushd "%STAGE%" "%JAVA_HOME%\bin\jar.exe" cf "%WV_JAR%" . popd echo Built %WV_JAR% REM --------------------------------------------------------------------------- REM 7. Compile and launch the password demo REM --------------------------------------------------------------------------- set "DEMO_DIR=%REPO_DIR%\demos\WebViewPasswordDemo" set "DEMO_CLASSES=%BUILD_DIR%\classes-password-demo" if not exist "%DEMO_CLASSES%" mkdir "%DEMO_CLASSES%" echo Compiling demo ... "%JAVA_HOME%\bin\javac.exe" -d "%DEMO_CLASSES%" -classpath "%WV_JAR%" "%DEMO_DIR%\src\ca\weblite\webview\demos\WebViewPasswordDemo.java" if errorlevel 1 ( echo ERROR: javac failed on demo. exit /b 1 ) echo Launching WebViewPasswordDemo ... "%JAVA_HOME%\bin\java.exe" -cp "%DEMO_CLASSES%;%WV_JAR%" ca.weblite.webview.demos.WebViewPasswordDemo endlocal |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |