mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 772f870eb3 | |||
| e29b375de5 | |||
| 72e12ef398 | |||
| 9903ba70d5 | |||
| 9b35616a20 | |||
| a988691931 | |||
| ad7f7f76bc | |||
| 55a7d317bd | |||
| cec6551c5e | |||
| 3a230b563f | |||
| f9aa4d3b60 | |||
| b498cddcad | |||
| 3e5df3c7f1 | |||
| 9ccb17bfd0 | |||
| 12d6336421 | |||
| cf2d16c1fd | |||
| bf389e3914 | |||
| f7c19469a7 | |||
| f1265c527e | |||
| b083d1d41c | |||
| 56fb047d89 | |||
| ae4cb4e861 | |||
| 33172946ca | |||
| 3c7a2187db | |||
| 437ca0ffd5 | |||
| 162720423f | |||
| 946b6020c9 | |||
| 49a6b1aa3c | |||
| 4b4fcdd47c | |||
| 5c1d62bb6a | |||
| 97e60e181e | |||
| 1683e240d9 | |||
| dc5f0b6e7b | |||
| 772f0215a6 | |||
| 435aa99656 | |||
| 8efaaffadb | |||
| 5f457dba8e |
@@ -1,3 +1,11 @@
|
||||
|
||||
<!--
|
||||
READ CAREFULLY: Before submitting your PR, please ensure you have created an issue for your PR.
|
||||
It is essential that you do this so that we can discuss the proposed changes before you spend time on them.
|
||||
If you do not create an issue, your PR may be rejected without review.
|
||||
If a relevant issue already exists, please reference it in your PR by including `Fixes #<issue number>` in your PR description.
|
||||
-->
|
||||
|
||||
# Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v11.1
|
||||
uses: tj-actions/verify-changed-files@v17
|
||||
id: verify-changed-files
|
||||
with:
|
||||
files: |
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
go-version: [1.19]
|
||||
go-version: ['1.20']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
- name: Verify Changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
uses: tj-actions/changed-files@v41
|
||||
with:
|
||||
files: |
|
||||
website/**/*.mdx
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
<samp>
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) · [Francais](README.fr.md)
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
<samp>
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
<p align="center" style="text-align: center">
|
||||
<img src="./assets/images/logo-universal.png" width="55%"><br/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Go va Web texnologiyalaridan foydalangan holda ish stoli ilovalarini yarating
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE">
|
||||
<img alt="GitHub" src="https://img.shields.io/github/license/wailsapp/wails"/>
|
||||
</a>
|
||||
<a href="https://goreportcard.com/report/github.com/wailsapp/wails">
|
||||
<img src="https://goreportcard.com/badge/github.com/wailsapp/wails" />
|
||||
</a>
|
||||
<a href="https://pkg.go.dev/github.com/wailsapp/wails">
|
||||
<img src="https://pkg.go.dev/badge/github.com/wailsapp/wails.svg" alt="Go Reference"/>
|
||||
</a>
|
||||
<a href="https://github.com/wailsapp/wails/issues">
|
||||
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" />
|
||||
</a>
|
||||
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status">
|
||||
<img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield" />
|
||||
</a>
|
||||
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
|
||||
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
|
||||
</a>
|
||||
<a href="https://discord.gg/BrRSWTaxVK">
|
||||
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
|
||||
<img src="https://img.shields.io/github/actions/workflow/status/wailsapp/wails/build-and-test.yml?branch=master&logo=Github" alt="Build" />
|
||||
</a>
|
||||
<a href="https://github.com/wailsapp/wails/tags" rel="nofollow">
|
||||
<img alt="GitHub tag (latest SemVer pre-release)" src="https://img.shields.io/github/v/tag/wailsapp/wails?include_prereleases&label=version"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<strong>
|
||||
<samp>
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
## Tarkib
|
||||
|
||||
- [Tarkib](#tarkib)
|
||||
- [Kirish](#kirish)
|
||||
- [Xususiyatlari](#xususiyatlari)
|
||||
- [Yo'l xaritasi](#yol-xaritasi)
|
||||
- [Ishni boshlash](#ishni-boshlash)
|
||||
- [Homiylar](#homiylar)
|
||||
- [FAQ](#faq)
|
||||
- [Vaqt o'tishi bilan yulduzlar](#vaqt-otishi-bilan-yulduzlar)
|
||||
- [Ishtirokchilar](#homiylar)
|
||||
- [Litsenziya](#litsenziya)
|
||||
- [Ilhomlanish](#ilhomlanish)
|
||||
|
||||
## Kirish
|
||||
|
||||
Odatda, Go dasturlari uchun veb-interfeyslar o'rnatilgan veb-server va veb-brauzerdir.
|
||||
Walls boshqacha yondashuvni qo'llaydi: u Go kodini ham, veb-interfeysni ham bitta ikkilik (e.g: EXE)fayliga o'raydi.
|
||||
Loyihalarni yaratish, kompilyatsiya qilish va birlashtirishni boshqarish orqali ilovangizni yaratishni osonlashtiradi.
|
||||
Hamma narsa faqat sizning tasavvuringiz bilan cheklangan!
|
||||
|
||||
## Xususiyatlari
|
||||
|
||||
- Backend uchun standart Go dan foydalaning
|
||||
- UI yaratish uchun siz allaqachon tanish bo'lgan har qanday frontend texnologiyasidan foydalaning
|
||||
- Oldindan tayyorlangan shablonlardan foydalanib, Go dasturlaringiz uchun tezda boy frontendlarni yarating
|
||||
- Javascriptdan Go methodlarini osongina chaqiring
|
||||
- Go struktura va methodlari uchun avtomatik yaratilgan Typescript ta'riflari
|
||||
- Mahalliy Dialoglar va Menyular
|
||||
- Mahalliy Dark / Light rejimini qo'llab-quvvatlash
|
||||
- Zamonaviy shaffoflik va "muzli oyna" effektlarini qo'llab-quvvatlaydi
|
||||
- Go va Javascript o'rtasidagi yagona hodisa tizimi
|
||||
- Loyihalaringizni tezda yaratish va qurish uchun kuchli cli vositasi
|
||||
- Ko'p platformali
|
||||
- Mahalliy renderlash mexanizmlaridan foydalanadi - _o'rnatilgan brauzer yo'q_!
|
||||
|
||||
### Yo'l xaritasi
|
||||
|
||||
Loyihaning yoʻl xaritasini [bu yerdan](https://github.com/wailsapp/wails/discussions/1484) topish mumkin. Iltimos, maslahatlashing
|
||||
Buni yaxshilash so'rovini ochishdan oldin.
|
||||
|
||||
## Ishni boshlash
|
||||
|
||||
O'rnatish bo'yicha ko'rsatmalar [Rasmiy veb saytda](https://wails.io/docs/gettingstarted/installation) mavjud.
|
||||
|
||||
## Homiylar
|
||||
|
||||
Ushbu loyiha quyidagi mehribon odamlar / kompaniyalar tomonidan qo'llab-quvvatlanadi:
|
||||
<img src="website/static/img/sponsors.svg" style="width:100%;max-width:800px;"/>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://wails.io/img/sponsor/jetbrains-grayscale.webp" style="width: 100px"/>
|
||||
</p>
|
||||
|
||||
## FAQ
|
||||
|
||||
- Bu Elektronga muqobilmi?
|
||||
|
||||
Sizning talablaringizga bog'liq. Bu Go dasturchilariga yengil ish stoli yaratishni osonlashtirish uchun yaratilgan
|
||||
ilovalar yoki ularning mavjud ilovalariga frontend qo'shing. Wails menyular kabi mahalliy elementlarni taklif qiladi
|
||||
va dialoglar, shuning uchun uni yengil elektron muqobili deb hisoblash mumkin.
|
||||
|
||||
- Ushbu loyiha kimlar uchun?
|
||||
|
||||
Server yaratmasdan va uni ko'rish uchun brauzerni ochmasdan, o'z ilovalari bilan HTML/JS/CSS orqali frontendini birlashtirmoqchi bo'lgan dasturchilar uchun.
|
||||
|
||||
- Bu qanday nom?
|
||||
|
||||
Men WebViewni ko'rganimda, men shunday deb o'yladim: "Menga WebView ilovasini yaratish uchun vositalar kerak.
|
||||
biroz Rails for Rubyga o'xshaydi." Demak, dastlab bu so'zlar ustida o'yin edi (Railsda Webview). Shunday bo'ldi.
|
||||
u men kelgan [Mamlakat](https://en.wikipedia.org/wiki/Wales)ning inglizcha nomining omofonidir.
|
||||
|
||||
## Vaqt o'tishi bilan yulduzlar
|
||||
|
||||
<a href="https://star-history.com/#wailsapp/wails&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=wailsapp/wails&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=wailsapp/wails&type=Date" />
|
||||
<img alt="Yulduzlar tarixi jadvali" src="https://api.star-history.com/svg?repos=wailsapp/wails&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## Ishtirokchilar
|
||||
|
||||
Ishtirokchilar roʻyxati oʻqish uchun juda kattalashib bormoqda! Bunga hissa qo'shgan barcha ajoyib odamlarning
|
||||
loyihada o'z sahifasi bor [bu yerga](https://wails.io/credits#contributors).
|
||||
|
||||
## Litsenziya
|
||||
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_large)
|
||||
|
||||
## Ilhomlanish
|
||||
|
||||
Ushbu loyiha asosan quyidagi albomlar uchun kodlangan:
|
||||
|
||||
- [Manic Street Preachers - Resistance Is Futile](https://open.spotify.com/album/1R2rsEUqXjIvAbzM0yHrxA)
|
||||
- [Manic Street Preachers - This Is My Truth, Tell Me Yours](https://open.spotify.com/album/4VzCL9kjhgGQeKCiojK1YN)
|
||||
- [The Midnight - Endless Summer](https://open.spotify.com/album/4Krg8zvprquh7TVn9OxZn8)
|
||||
- [Gary Newman - Savage (Songs from a Broken World)](https://open.spotify.com/album/3kMfsD07Q32HRWKRrpcexr)
|
||||
- [Steve Vai - Passion & Warfare](https://open.spotify.com/album/0oL0OhrE2rYVns4IGj8h2m)
|
||||
- [Ben Howard - Every Kingdom](https://open.spotify.com/album/1nJsbWm3Yy2DW1KIc1OKle)
|
||||
- [Ben Howard - Noonday Dream](https://open.spotify.com/album/6astw05cTiXEc2OvyByaPs)
|
||||
- [Adwaith - Melyn](https://open.spotify.com/album/2vBE40Rp60tl7rNqIZjaXM)
|
||||
- [Gwidaith Hen Fran - Cedors Hen Wrach](https://open.spotify.com/album/3v2hrfNGINPLuDP0YDTOjm)
|
||||
- [Metallica - Metallica](https://open.spotify.com/album/2Kh43m04B1UkVcpcRa1Zug)
|
||||
- [Bloc Party - Silent Alarm](https://open.spotify.com/album/6SsIdN05HQg2GwYLfXuzLB)
|
||||
- [Maxthor - Another World](https://open.spotify.com/album/3tklE2Fgw1hCIUstIwPBJF)
|
||||
- [Alun Tan Lan - Y Distawrwydd](https://open.spotify.com/album/0c32OywcLpdJCWWMC6vB8v)
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
|
||||
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
|
||||
[한국어](README.ko.md) · [Español](README.es.md) · [Português](README.pt-br.md) ·
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md)
|
||||
[Русский](README.ru.md) · [Francais](README.fr.md) · [Uzbek](README.uz.md)
|
||||
|
||||
</samp>
|
||||
</strong>
|
||||
|
||||
+30
-47
@@ -108,7 +108,7 @@ func buildApplication(f *flags.Build) error {
|
||||
{"Tags", "[" + strings.Join(f.GetTags(), ",") + "]"},
|
||||
{"Race Detector", bool2Str(f.RaceDetector)},
|
||||
}...)
|
||||
if len(buildOptions.OutputFile) > 0 && f.GetTargets().Length() == 1 {
|
||||
if len(buildOptions.OutputFile) > 0 && len(f.GetTargets()) == 1 {
|
||||
tableData = append(tableData, []string{"Output File", f.OutputFilename})
|
||||
}
|
||||
pterm.DefaultSection.Println("Build Options")
|
||||
@@ -145,16 +145,11 @@ func buildApplication(f *flags.Build) error {
|
||||
|
||||
// Allows cancelling the build after the first error. It would be nice if targets.Each would support funcs
|
||||
// returning an error.
|
||||
var targetErr error
|
||||
targets := f.GetTargets()
|
||||
targets.Each(func(platform string) {
|
||||
if targetErr != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !validPlatformArch.Contains(platform) {
|
||||
buildOptions.Logger.Println("platform '%s' is not supported - skipping. Supported platforms: %s", platform, validPlatformArch.Join(","))
|
||||
return
|
||||
for _, target := range targets {
|
||||
if !validPlatformArch.Contains(target.Platform) {
|
||||
buildOptions.Logger.Println("platform '%s' is not supported - skipping. Supported platforms: %s", target.Platform, validPlatformArch.Join(","))
|
||||
continue
|
||||
}
|
||||
|
||||
desiredFilename := projectOptions.OutputFilename
|
||||
@@ -163,17 +158,13 @@ func buildApplication(f *flags.Build) error {
|
||||
}
|
||||
desiredFilename = strings.TrimSuffix(desiredFilename, ".exe")
|
||||
|
||||
// Calculate platform and arch
|
||||
platformSplit := strings.Split(platform, "/")
|
||||
buildOptions.Platform = platformSplit[0]
|
||||
buildOptions.Arch = f.GetDefaultArch()
|
||||
if len(platformSplit) > 1 {
|
||||
buildOptions.Arch = platformSplit[1]
|
||||
}
|
||||
buildOptions.Platform = target.Platform
|
||||
buildOptions.Arch = target.Arch
|
||||
|
||||
banner := "Building target: " + buildOptions.Platform + "/" + buildOptions.Arch
|
||||
pterm.DefaultSection.Println(banner)
|
||||
|
||||
if f.Upx && platform == "darwin/universal" {
|
||||
if f.Upx && target.String() == "darwin/universal" {
|
||||
pterm.Warning.Println("Warning: compress flag unsupported for universal binaries. Ignoring.")
|
||||
f.Upx = false
|
||||
}
|
||||
@@ -182,22 +173,19 @@ func buildApplication(f *flags.Build) error {
|
||||
case "linux":
|
||||
if runtime.GOOS != "linux" {
|
||||
pterm.Warning.Println("Crosscompiling to Linux not currently supported.")
|
||||
return
|
||||
continue
|
||||
}
|
||||
case "darwin":
|
||||
if runtime.GOOS != "darwin" {
|
||||
pterm.Warning.Println("Crosscompiling to Mac not currently supported.")
|
||||
return
|
||||
continue
|
||||
}
|
||||
macTargets := targets.Filter(func(platform string) bool {
|
||||
return strings.HasPrefix(platform, "darwin")
|
||||
})
|
||||
if macTargets.Length() == 2 {
|
||||
if targets.MacTargetsCount() == 2 {
|
||||
buildOptions.BundleName = fmt.Sprintf("%s-%s.app", desiredFilename, buildOptions.Arch)
|
||||
}
|
||||
}
|
||||
|
||||
if targets.Length() > 1 {
|
||||
if len(targets) > 1 {
|
||||
// target filename
|
||||
switch buildOptions.Platform {
|
||||
case "windows":
|
||||
@@ -219,32 +207,27 @@ func buildApplication(f *flags.Build) error {
|
||||
pterm.Warning.Println("obfuscated flag overrides skipbindings flag.")
|
||||
buildOptions.SkipBindings = false
|
||||
}
|
||||
}
|
||||
|
||||
if !f.DryRun {
|
||||
// Start Time
|
||||
start := time.Now()
|
||||
if !f.DryRun {
|
||||
// Start Time
|
||||
start := time.Now()
|
||||
|
||||
compiledBinary, err := build.Build(buildOptions)
|
||||
if err != nil {
|
||||
pterm.Error.Println(err.Error())
|
||||
targetErr = err
|
||||
return
|
||||
}
|
||||
|
||||
buildOptions.IgnoreFrontend = true
|
||||
buildOptions.CleanBinDirectory = false
|
||||
|
||||
// Output stats
|
||||
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
|
||||
|
||||
outputBinaries[buildOptions.Platform+"/"+buildOptions.Arch] = compiledBinary
|
||||
} else {
|
||||
pterm.Info.Println("Dry run: skipped build.")
|
||||
compiledBinary, err := build.Build(buildOptions)
|
||||
if err != nil {
|
||||
pterm.Error.Println(err.Error())
|
||||
return err
|
||||
}
|
||||
})
|
||||
|
||||
if targetErr != nil {
|
||||
return targetErr
|
||||
buildOptions.IgnoreFrontend = true
|
||||
buildOptions.CleanBinDirectory = false
|
||||
|
||||
// Output stats
|
||||
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
|
||||
|
||||
outputBinaries[buildOptions.Platform+"/"+buildOptions.Arch] = compiledBinary
|
||||
} else {
|
||||
pterm.Info.Println("Dry run: skipped build.")
|
||||
}
|
||||
|
||||
if f.DryRun {
|
||||
|
||||
+44
-3
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/wailsapp/wails/v2/internal/shell"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
@@ -93,7 +94,14 @@ func diagnoseEnvironment(f *flags.Doctor) error {
|
||||
systemTabledata = append(systemTabledata, []string{prefix, cpu.Model})
|
||||
}
|
||||
} else {
|
||||
systemTabledata = append(systemTabledata, []string{"CPU", "Unknown"})
|
||||
cpuInfo := "Unknown"
|
||||
if runtime.GOOS == "darwin" {
|
||||
// Try to get CPU info from sysctl
|
||||
if stdout, _, err := shell.RunCommand("", "sysctl", "-n", "machdep.cpu.brand_string"); err == nil {
|
||||
cpuInfo = strings.TrimSpace(stdout)
|
||||
}
|
||||
}
|
||||
systemTabledata = append(systemTabledata, []string{"CPU", cpuInfo})
|
||||
}
|
||||
|
||||
// Probe GPU
|
||||
@@ -112,14 +120,47 @@ func diagnoseEnvironment(f *flags.Doctor) error {
|
||||
systemTabledata = append(systemTabledata, []string{prefix, details})
|
||||
}
|
||||
} else {
|
||||
systemTabledata = append(systemTabledata, []string{"GPU", "Unknown"})
|
||||
gpuInfo := "Unknown"
|
||||
if runtime.GOOS == "darwin" {
|
||||
// Try to get GPU info from system_profiler
|
||||
if stdout, _, err := shell.RunCommand("", "system_profiler", "SPDisplaysDataType"); err == nil {
|
||||
var (
|
||||
startCapturing bool
|
||||
gpuInfoDetails []string
|
||||
)
|
||||
for _, line := range strings.Split(stdout, "\n") {
|
||||
if strings.Contains(line, "Chipset Model") {
|
||||
startCapturing = true
|
||||
}
|
||||
if startCapturing {
|
||||
gpuInfoDetails = append(gpuInfoDetails, strings.TrimSpace(line))
|
||||
}
|
||||
if strings.Contains(line, "Metal Support") {
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(gpuInfoDetails) > 0 {
|
||||
gpuInfo = strings.Join(gpuInfoDetails, " ")
|
||||
}
|
||||
}
|
||||
}
|
||||
systemTabledata = append(systemTabledata, []string{"GPU", gpuInfo})
|
||||
}
|
||||
|
||||
memory, _ := ghw.Memory()
|
||||
if memory != nil {
|
||||
systemTabledata = append(systemTabledata, []string{"Memory", strconv.Itoa(int(memory.TotalPhysicalBytes/1024/1024/1024)) + "GB"})
|
||||
} else {
|
||||
systemTabledata = append(systemTabledata, []string{"Memory", "Unknown"})
|
||||
memInfo := "Unknown"
|
||||
if runtime.GOOS == "darwin" {
|
||||
// Try to get Memory info from sysctl
|
||||
if stdout, _, err := shell.RunCommand("", "sysctl", "-n", "hw.memsize"); err == nil {
|
||||
if memSize, err := strconv.Atoi(strings.TrimSpace(stdout)); err == nil {
|
||||
memInfo = strconv.Itoa(memSize/1024/1024/1024) + "GB"
|
||||
}
|
||||
}
|
||||
}
|
||||
systemTabledata = append(systemTabledata, []string{"Memory", memInfo})
|
||||
}
|
||||
|
||||
err = pterm.DefaultTable.WithBoxed().WithData(systemTabledata).Render()
|
||||
|
||||
@@ -2,13 +2,10 @@ package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/wailsapp/wails/v2/internal/system"
|
||||
"github.com/wailsapp/wails/v2/pkg/commands/build"
|
||||
"github.com/wailsapp/wails/v2/pkg/commands/buildtags"
|
||||
)
|
||||
@@ -49,29 +46,15 @@ type Build struct {
|
||||
compilerPath string
|
||||
userTags []string
|
||||
wv2rtstrategy string // WebView2 runtime strategy
|
||||
defaultArch string // Default architecture
|
||||
}
|
||||
|
||||
func (b *Build) Default() *Build {
|
||||
defaultPlatform := os.Getenv("GOOS")
|
||||
if defaultPlatform == "" {
|
||||
defaultPlatform = runtime.GOOS
|
||||
}
|
||||
defaultArch := os.Getenv("GOARCH")
|
||||
if defaultArch == "" {
|
||||
if system.IsAppleSilicon {
|
||||
defaultArch = "arm64"
|
||||
} else {
|
||||
defaultArch = runtime.GOARCH
|
||||
}
|
||||
}
|
||||
target := defaultTarget()
|
||||
|
||||
result := &Build{
|
||||
Platform: defaultPlatform + "/" + defaultArch,
|
||||
Platform: target.Platform,
|
||||
WebView2: "download",
|
||||
GarbleArgs: "-literals -tiny -seed=random",
|
||||
|
||||
defaultArch: defaultArch,
|
||||
}
|
||||
result.BuildCommon = result.BuildCommon.Default()
|
||||
return result
|
||||
@@ -88,11 +71,8 @@ func (b *Build) GetWebView2Strategy() string {
|
||||
return b.wv2rtstrategy
|
||||
}
|
||||
|
||||
func (b *Build) GetTargets() *slicer.StringSlicer {
|
||||
var targets slicer.StringSlicer
|
||||
targets.AddSlice(strings.Split(b.Platform, ","))
|
||||
targets.Deduplicate()
|
||||
return &targets
|
||||
func (b *Build) GetTargets() TargetsCollection {
|
||||
return parseTargets(b.Platform)
|
||||
}
|
||||
|
||||
func (b *Build) GetCompilerPath() string {
|
||||
@@ -144,10 +124,6 @@ func (b *Build) GetBuildModeAsString() string {
|
||||
return "production"
|
||||
}
|
||||
|
||||
func (b *Build) GetDefaultArch() string {
|
||||
return b.defaultArch
|
||||
}
|
||||
|
||||
/*
|
||||
_, _ = fmt.Fprintf(w, "Frontend Directory: \t%s\n", projectOptions.GetFrontendDir())
|
||||
_, _ = fmt.Fprintf(w, "Obfuscated: \t%t\n", buildOptions.Obfuscated)
|
||||
|
||||
@@ -1,5 +1,103 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/wailsapp/wails/v2/internal/system"
|
||||
)
|
||||
|
||||
type Common struct {
|
||||
NoColour bool `description:"Disable colour in output"`
|
||||
}
|
||||
|
||||
type Target struct {
|
||||
Platform string
|
||||
Arch string
|
||||
}
|
||||
|
||||
func defaultTarget() Target {
|
||||
defaultPlatform := os.Getenv("GOOS")
|
||||
if defaultPlatform == "" {
|
||||
defaultPlatform = runtime.GOOS
|
||||
}
|
||||
defaultArch := os.Getenv("GOARCH")
|
||||
if defaultArch == "" {
|
||||
if system.IsAppleSilicon {
|
||||
defaultArch = "arm64"
|
||||
} else {
|
||||
defaultArch = runtime.GOARCH
|
||||
}
|
||||
}
|
||||
|
||||
return Target{
|
||||
Platform: defaultPlatform,
|
||||
Arch: defaultArch,
|
||||
}
|
||||
}
|
||||
|
||||
type TargetsCollection []Target
|
||||
|
||||
func (c TargetsCollection) MacTargetsCount() int {
|
||||
count := 0
|
||||
|
||||
for _, t := range c {
|
||||
if strings.HasPrefix(t.Platform, "darwin") {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
func (t Target) String() string {
|
||||
if t.Arch != "" {
|
||||
return fmt.Sprintf("%s/%s", t.Platform, t.Arch)
|
||||
}
|
||||
|
||||
return t.Platform
|
||||
}
|
||||
|
||||
func parseTargets(platform string) TargetsCollection {
|
||||
allowedPlatforms := map[string]bool{
|
||||
"windows": true,
|
||||
"linux": true,
|
||||
"darwin": true,
|
||||
}
|
||||
|
||||
if !allowedPlatforms[platform] {
|
||||
pterm.Error.Println("platform argument must be one of 'windows', 'linux', or 'darwin'")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var result []Target
|
||||
var targets slicer.StringSlicer
|
||||
|
||||
targets.AddSlice(strings.Split(platform, ","))
|
||||
targets.Deduplicate()
|
||||
|
||||
targets.Each(func(platform string) {
|
||||
target := Target{
|
||||
Platform: "",
|
||||
Arch: "",
|
||||
}
|
||||
|
||||
platformSplit := strings.Split(platform, "/")
|
||||
|
||||
target.Platform = platformSplit[0]
|
||||
|
||||
if len(platformSplit) > 1 {
|
||||
target.Arch = platformSplit[1]
|
||||
} else {
|
||||
target.Arch = defaultTarget().Arch
|
||||
}
|
||||
|
||||
result = append(result, target)
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/samber/lo"
|
||||
"github.com/wailsapp/wails/v2/internal/project"
|
||||
@@ -17,6 +16,7 @@ type Dev struct {
|
||||
BuildCommon
|
||||
|
||||
AssetDir string `flag:"assetdir" description:"Serve assets from the given directory instead of using the provided asset FS"`
|
||||
Platform string `flag:"platform" description:"Platform to target"`
|
||||
Extensions string `flag:"e" description:"Extensions to trigger rebuilds (comma separated) eg go"`
|
||||
ReloadDirs string `flag:"reloaddirs" description:"Additional directories to trigger reloads (comma separated)"`
|
||||
Browser bool `flag:"browser" description:"Open the application in a browser"`
|
||||
@@ -38,10 +38,13 @@ type Dev struct {
|
||||
}
|
||||
|
||||
func (*Dev) Default() *Dev {
|
||||
target := defaultTarget()
|
||||
result := &Dev{
|
||||
Extensions: "go",
|
||||
Debounce: 100,
|
||||
Platform: target.Platform,
|
||||
}
|
||||
|
||||
result.BuildCommon = result.BuildCommon.Default()
|
||||
return result
|
||||
}
|
||||
@@ -116,13 +119,15 @@ func (d *Dev) loadAndMergeProjectConfig() error {
|
||||
|
||||
// GenerateBuildOptions creates a build.Options using the flags
|
||||
func (d *Dev) GenerateBuildOptions() *build.Options {
|
||||
targets := parseTargets(d.Platform)
|
||||
|
||||
result := &build.Options{
|
||||
OutputType: "dev",
|
||||
Mode: build.Dev,
|
||||
Devtools: true,
|
||||
Arch: runtime.GOARCH,
|
||||
Arch: targets[0].Arch,
|
||||
Pack: true,
|
||||
Platform: runtime.GOOS,
|
||||
Platform: targets[0].Platform,
|
||||
LDFlags: d.LdFlags,
|
||||
Compiler: d.Compiler,
|
||||
ForceBuild: d.ForceBuild,
|
||||
|
||||
@@ -2,6 +2,7 @@ package flags
|
||||
|
||||
type GenerateModule struct {
|
||||
Common
|
||||
Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"`
|
||||
Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"`
|
||||
Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"`
|
||||
}
|
||||
@@ -12,3 +13,9 @@ type GenerateTemplate struct {
|
||||
Frontend string `description:"Frontend to use for the template"`
|
||||
Quiet bool `description:"Suppress output"`
|
||||
}
|
||||
|
||||
func (c *GenerateModule) Default() *GenerateModule {
|
||||
return &GenerateModule{
|
||||
Compiler: "go",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ func generateModule(f *flags.GenerateModule) error {
|
||||
}
|
||||
|
||||
_, err = bindings.GenerateBindings(bindings.Options{
|
||||
Compiler: f.Compiler,
|
||||
Tags: buildTags,
|
||||
TsPrefix: projectConfig.Bindings.TsGeneration.Prefix,
|
||||
TsSuffix: projectConfig.Bindings.TsGeneration.Suffix,
|
||||
|
||||
@@ -61,7 +61,7 @@ func Application(f *flags.Dev, logger *clilogger.CLILogger) error {
|
||||
}
|
||||
|
||||
// Run go mod tidy to ensure we're up-to-date
|
||||
err = runCommand(cwd, false, "go", "mod", "tidy")
|
||||
err = runCommand(cwd, false, f.Compiler, "mod", "tidy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -268,6 +268,16 @@ func runFrontendDevWatcherCommand(frontendDirectory string, devCommand string, d
|
||||
}, viteServerURL, viteVersion, nil
|
||||
}
|
||||
|
||||
func isWsl() bool {
|
||||
version, err := os.ReadFile("/proc/version")
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return strings.Contains(strings.ToLower(string(version)), "wsl")
|
||||
}
|
||||
|
||||
// restartApp does the actual rebuilding of the application when files change
|
||||
func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process, f *flags.Dev, exitCodeChannel chan int, legacyUseDevServerInsteadofCustomScheme bool) (*process.Process, string, error) {
|
||||
appBinary, err := build.Build(buildOptions)
|
||||
@@ -306,6 +316,12 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
|
||||
os.Setenv("devserver", f.DevServer)
|
||||
os.Setenv("frontenddevserverurl", f.FrontendDevServerURL)
|
||||
|
||||
if buildOptions.IsWindowsTargetPlatform() && isWsl() {
|
||||
// In the case of building a Windows executable under WSL, we need to specify this variable with a list of
|
||||
// variables that will be passed through
|
||||
os.Setenv("WSLENV", "loglevel/w:frontenddevserverurl/w:devserver/w:assetdir/w")
|
||||
}
|
||||
|
||||
// Start up new binary with correct args
|
||||
newProcess := process.NewProcess(appBinary, args...)
|
||||
err = newProcess.Start(exitCodeChannel)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user