Merge pull request #344 from bnema/chore/upstream-foundations
chore(deps): integrate approved upstream foundations
921 files · +28709 -25527
M docs/first-presentation.md +5 -2
| @@ -46,5 +46,8 @@ labels. Set `DUMBER_MACHINE_GPU_PROFILE` to one of `generic-gpu`, | |||
| 46 | 46 | `integrated-gpu`, `discrete-gpu`, `hybrid-gpu`, `virtual-gpu`, or `unknown-gpu`; | |
| 47 | 47 | do not use a device model or other identifier. Publish only the seven reviewed | |
| 48 | 48 | JSON files to an external Gist. Raw logs and temporary XDG homes are removed and | |
| 49 | - | must not be published. A missing or incomplete timeline, non-DMABUF backend, or | |
| 50 | - | invalid run fails collection. | |
| 49 | + | must not be published. `metadata.json` derives the selected | |
| 50 | + | `github.com/bnema/purego-cef2gtk` pseudo-version and its full immutable Git | |
| 51 | + | origin hash from Go module metadata; branch selectors or missing origin metadata | |
| 52 | + | fail collection. A missing or incomplete timeline, non-DMABUF backend, or invalid | |
| 53 | + | run also fails collection. | |
| @@ -46,5 +46,8 @@ labels. Set `DUMBER_MACHINE_GPU_PROFILE` to one of `generic-gpu`, | |||||
| 46 | `integrated-gpu`, `discrete-gpu`, `hybrid-gpu`, `virtual-gpu`, or `unknown-gpu`; | 46 | `integrated-gpu`, `discrete-gpu`, `hybrid-gpu`, `virtual-gpu`, or `unknown-gpu`; | ||
| 47 | do not use a device model or other identifier. Publish only the seven reviewed | 47 | do not use a device model or other identifier. Publish only the seven reviewed | ||
| 48 | JSON files to an external Gist. Raw logs and temporary XDG homes are removed and | 48 | JSON files to an external Gist. Raw logs and temporary XDG homes are removed and | ||
| 49 | - | must not be published. A missing or incomplete timeline, non-DMABUF backend, or | 49 | + | must not be published. `metadata.json` derives the selected |
| 50 | - | invalid run fails collection. | 50 | + | `github.com/bnema/purego-cef2gtk` pseudo-version and its full immutable Git |
| 51 | + | origin hash from Go module metadata; branch selectors or missing origin metadata | |||
| 52 | + | fail collection. A missing or incomplete timeline, non-DMABUF backend, or invalid | |||
| 53 | + | run also fails collection. | |||
M go.mod +5 -5
| @@ -6,11 +6,11 @@ require ( | |||
| 6 | 6 | github.com/a-h/templ v0.3.1020 | |
| 7 | 7 | github.com/andybalholm/brotli v1.2.2 | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | |
| 9 | - | github.com/bnema/purego-cef v0.13.3 | |
| 10 | - | github.com/bnema/purego-cef2gtk v0.8.4 | |
| 11 | - | github.com/bnema/purego-pipewire v0.1.4 | |
| 12 | - | github.com/bnema/purego-sqlite v0.1.3 | |
| 13 | - | github.com/bnema/puregotk v0.7.0 | |
| 9 | + | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e | |
| 10 | + | github.com/bnema/purego-cef2gtk v0.8.4-0.20260714160309-bbd397409ebe | |
| 11 | + | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a | |
| 12 | + | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c | |
| 13 | + | github.com/bnema/puregotk v0.7.1-0.20260714170452-0b6b9b901234 | |
| 14 | 14 | github.com/charmbracelet/bubbles v1.0.0 | |
| 15 | 15 | github.com/charmbracelet/bubbletea v1.3.10 | |
| 16 | 16 | github.com/charmbracelet/lipgloss v1.1.0 | |
| @@ -6,11 +6,11 @@ require ( | |||||
| 6 | github.com/a-h/templ v0.3.1020 | 6 | github.com/a-h/templ v0.3.1020 | ||
| 7 | github.com/andybalholm/brotli v1.2.2 | 7 | github.com/andybalholm/brotli v1.2.2 | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.4 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | ||
| 9 | - | github.com/bnema/purego-cef v0.13.3 | 9 | + | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e |
| 10 | - | github.com/bnema/purego-cef2gtk v0.8.4 | 10 | + | github.com/bnema/purego-cef2gtk v0.8.4-0.20260714160309-bbd397409ebe |
| 11 | - | github.com/bnema/purego-pipewire v0.1.4 | 11 | + | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a |
| 12 | - | github.com/bnema/purego-sqlite v0.1.3 | 12 | + | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c |
| 13 | - | github.com/bnema/puregotk v0.7.0 | 13 | + | github.com/bnema/puregotk v0.7.1-0.20260714170452-0b6b9b901234 |
| 14 | github.com/charmbracelet/bubbles v1.0.0 | 14 | github.com/charmbracelet/bubbles v1.0.0 | ||
| 15 | github.com/charmbracelet/bubbletea v1.3.10 | 15 | github.com/charmbracelet/bubbletea v1.3.10 | ||
| 16 | github.com/charmbracelet/lipgloss v1.1.0 | 16 | github.com/charmbracelet/lipgloss v1.1.0 | ||
M go.sum +12 -0 generated file: collapsed
A internal/infrastructure/persistence/sqlite/history_repo_benchmark_test.go +71 -0
| @@ -0,0 +1,71 @@ | |||
| 1 | + | package sqlite_test | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "fmt" | |
| 5 | + | "path/filepath" | |
| 6 | + | "testing" | |
| 7 | + | ||
| 8 | + | "github.com/bnema/dumber/internal/domain/entity" | |
| 9 | + | "github.com/bnema/dumber/internal/domain/repository" | |
| 10 | + | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | |
| 11 | + | ) | |
| 12 | + | ||
| 13 | + | // newHistoryBenchmarkRepository creates a representative local history corpus | |
| 14 | + | // outside the measured operation. Sidebar reads use GetRecent and omnibox | |
| 15 | + | // history suggestions use Search. | |
| 16 | + | func newHistoryBenchmarkRepository(b *testing.B) (repository.HistoryRepository, func()) { | |
| 17 | + | b.Helper() | |
| 18 | + | ||
| 19 | + | ctx := historyTestCtx() | |
| 20 | + | db, err := sqlite.NewConnection(ctx, filepath.Join(b.TempDir(), "dumber.db")) | |
| 21 | + | if err != nil { | |
| 22 | + | b.Fatal(err) | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | b.Cleanup(func() { | |
| 26 | + | if err := db.Close(); err != nil { | |
| 27 | + | b.Errorf("close benchmark database: %v", err) | |
| 28 | + | } | |
| 29 | + | }) | |
| 30 | + | ||
| 31 | + | repo := sqlite.NewHistoryRepository(db) | |
| 32 | + | for i := range 200 { | |
| 33 | + | entry := &entity.HistoryEntry{ | |
| 34 | + | URL: fmt.Sprintf("https://example%d.test/dumber/history/%d", i%20, i), | |
| 35 | + | Title: fmt.Sprintf("Dumber history entry %d", i), | |
| 36 | + | } | |
| 37 | + | if err := repo.Save(ctx, entry); err != nil { | |
| 38 | + | b.Fatal(err) | |
| 39 | + | } | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | return repo, func() {} | |
| 43 | + | } | |
| 44 | + | ||
| 45 | + | func BenchmarkHistorySQLiteSidebarRecent(b *testing.B) { | |
| 46 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |
| 47 | + | defer closeDB() | |
| 48 | + | ctx := historyTestCtx() | |
| 49 | + | ||
| 50 | + | b.ReportAllocs() | |
| 51 | + | b.ResetTimer() | |
| 52 | + | for range b.N { | |
| 53 | + | if _, err := repo.GetRecent(ctx, 50, 0); err != nil { | |
| 54 | + | b.Fatal(err) | |
| 55 | + | } | |
| 56 | + | } | |
| 57 | + | } | |
| 58 | + | ||
| 59 | + | func BenchmarkHistorySQLiteOmniboxSearch(b *testing.B) { | |
| 60 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |
| 61 | + | defer closeDB() | |
| 62 | + | ctx := historyTestCtx() | |
| 63 | + | ||
| 64 | + | b.ReportAllocs() | |
| 65 | + | b.ResetTimer() | |
| 66 | + | for range b.N { | |
| 67 | + | if _, err := repo.Search(ctx, "dumber history", 10); err != nil { | |
| 68 | + | b.Fatal(err) | |
| 69 | + | } | |
| 70 | + | } | |
| 71 | + | } | |
| @@ -0,0 +1,71 @@ | |||||
| 1 | + | package sqlite_test | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "fmt" | |||
| 5 | + | "path/filepath" | |||
| 6 | + | "testing" | |||
| 7 | + | ||||
| 8 | + | "github.com/bnema/dumber/internal/domain/entity" | |||
| 9 | + | "github.com/bnema/dumber/internal/domain/repository" | |||
| 10 | + | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | |||
| 11 | + | ) | |||
| 12 | + | ||||
| 13 | + | // newHistoryBenchmarkRepository creates a representative local history corpus | |||
| 14 | + | // outside the measured operation. Sidebar reads use GetRecent and omnibox | |||
| 15 | + | // history suggestions use Search. | |||
| 16 | + | func newHistoryBenchmarkRepository(b *testing.B) (repository.HistoryRepository, func()) { | |||
| 17 | + | b.Helper() | |||
| 18 | + | ||||
| 19 | + | ctx := historyTestCtx() | |||
| 20 | + | db, err := sqlite.NewConnection(ctx, filepath.Join(b.TempDir(), "dumber.db")) | |||
| 21 | + | if err != nil { | |||
| 22 | + | b.Fatal(err) | |||
| 23 | + | } | |||
| 24 | + | ||||
| 25 | + | b.Cleanup(func() { | |||
| 26 | + | if err := db.Close(); err != nil { | |||
| 27 | + | b.Errorf("close benchmark database: %v", err) | |||
| 28 | + | } | |||
| 29 | + | }) | |||
| 30 | + | ||||
| 31 | + | repo := sqlite.NewHistoryRepository(db) | |||
| 32 | + | for i := range 200 { | |||
| 33 | + | entry := &entity.HistoryEntry{ | |||
| 34 | + | URL: fmt.Sprintf("https://example%d.test/dumber/history/%d", i%20, i), | |||
| 35 | + | Title: fmt.Sprintf("Dumber history entry %d", i), | |||
| 36 | + | } | |||
| 37 | + | if err := repo.Save(ctx, entry); err != nil { | |||
| 38 | + | b.Fatal(err) | |||
| 39 | + | } | |||
| 40 | + | } | |||
| 41 | + | ||||
| 42 | + | return repo, func() {} | |||
| 43 | + | } | |||
| 44 | + | ||||
| 45 | + | func BenchmarkHistorySQLiteSidebarRecent(b *testing.B) { | |||
| 46 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |||
| 47 | + | defer closeDB() | |||
| 48 | + | ctx := historyTestCtx() | |||
| 49 | + | ||||
| 50 | + | b.ReportAllocs() | |||
| 51 | + | b.ResetTimer() | |||
| 52 | + | for range b.N { | |||
| 53 | + | if _, err := repo.GetRecent(ctx, 50, 0); err != nil { | |||
| 54 | + | b.Fatal(err) | |||
| 55 | + | } | |||
| 56 | + | } | |||
| 57 | + | } | |||
| 58 | + | ||||
| 59 | + | func BenchmarkHistorySQLiteOmniboxSearch(b *testing.B) { | |||
| 60 | + | repo, closeDB := newHistoryBenchmarkRepository(b) | |||
| 61 | + | defer closeDB() | |||
| 62 | + | ctx := historyTestCtx() | |||
| 63 | + | ||||
| 64 | + | b.ReportAllocs() | |||
| 65 | + | b.ResetTimer() | |||
| 66 | + | for range b.N { | |||
| 67 | + | if _, err := repo.Search(ctx, "dumber history", 10); err != nil { | |||
| 68 | + | b.Fatal(err) | |||
| 69 | + | } | |||
| 70 | + | } | |||
| 71 | + | } | |||
M internal/logging/first_presentation_collector_test.go +132 -1
| @@ -2,6 +2,7 @@ package logging | |||
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | 4 | "encoding/json" | |
| 5 | + | "fmt" | |
| 5 | 6 | "os" | |
| 6 | 7 | "os/exec" | |
| 7 | 8 | "path/filepath" | |
| @@ -143,8 +144,9 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||
| 143 | 144 | } | |
| 144 | 145 | for _, required := range []string{ | |
| 145 | 146 | `"measured_source_revision"`, | |
| 147 | + | `"version": "v0.8.4-0.20260714160309-bbd397409ebe"`, | |
| 146 | 148 | `"tag": "v0.8.4"`, | |
| 147 | - | `"revision": "f217ece342dea3ef2a3f98671fcd16a39ad0037d"`, | |
| 149 | + | `"revision": "bbd397409ebed75a5979c1e4566a2ef319f6a484"`, | |
| 148 | 150 | } { | |
| 149 | 151 | require.Contains(t, artifacts.String(), required) | |
| 150 | 152 | } | |
| @@ -166,6 +168,135 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||
| 166 | 168 | require.Equal(t, "integrated-gpu", metadata.Comparison.MachineGPUProfile) | |
| 167 | 169 | } | |
| 168 | 170 | ||
| 171 | + | func TestFirstPresentationCollectorDerivesSelectedImmutableModuleProvenance(t *testing.T) { | |
| 172 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |
| 173 | + | require.NoError(t, err) | |
| 174 | + | temp := t.TempDir() | |
| 175 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |
| 176 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |
| 177 | + | binary := filepath.Join(temp, "dumber") | |
| 178 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |
| 179 | + | ||
| 180 | + | // This exact pseudo-version is deliberately newer than the former v0.8.4 | |
| 181 | + | // hardcode; the collector must report what the selected module says. | |
| 182 | + | const version = "v0.8.5-0.20300102030405-bbd397409ebe" | |
| 183 | + | const revision = "bbd397409ebed75a5979c1e4566a2ef319f6a484" | |
| 184 | + | goBin := collectorProvenanceGo(t, temp, version, revision, "") | |
| 185 | + | output := filepath.Join(temp, "artifacts") | |
| 186 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |
| 187 | + | cmd.Dir = repoRoot | |
| 188 | + | cmd.Env = append(os.Environ(), | |
| 189 | + | "DISPLAY=:test", | |
| 190 | + | "DUMBER_CEF_DIR="+runtime, | |
| 191 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |
| 192 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |
| 193 | + | "DUMBER_FIRST_PRESENTATION_TIMEOUT_SECONDS=1", | |
| 194 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |
| 195 | + | ) | |
| 196 | + | result, err := cmd.CombinedOutput() | |
| 197 | + | require.NoErrorf(t, err, "collector failed: %s", result) | |
| 198 | + | ||
| 199 | + | var metadata struct { | |
| 200 | + | Upstream struct { | |
| 201 | + | Module string `json:"module"` | |
| 202 | + | Version string `json:"version"` | |
| 203 | + | Tag string `json:"tag"` | |
| 204 | + | Revision string `json:"revision"` | |
| 205 | + | } `json:"upstream"` | |
| 206 | + | } | |
| 207 | + | contents, err := os.ReadFile(filepath.Join(output, "metadata.json")) | |
| 208 | + | require.NoError(t, err) | |
| 209 | + | require.NoError(t, json.Unmarshal(contents, &metadata)) | |
| 210 | + | require.Equal(t, "github.com/bnema/purego-cef2gtk", metadata.Upstream.Module) | |
| 211 | + | require.Equal(t, version, metadata.Upstream.Version) | |
| 212 | + | require.Equal(t, "v0.8.5", metadata.Upstream.Tag) | |
| 213 | + | require.Equal(t, revision, metadata.Upstream.Revision) | |
| 214 | + | ||
| 215 | + | script, err := os.ReadFile(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |
| 216 | + | require.NoError(t, err) | |
| 217 | + | require.NotContains(t, string(script), "f217ece342dea3ef2a3f98671fcd16a39ad0037d") | |
| 218 | + | } | |
| 219 | + | ||
| 220 | + | func TestFirstPresentationCollectorRejectsNonImmutableModuleProvenanceWithoutLeaks(t *testing.T) { | |
| 221 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |
| 222 | + | require.NoError(t, err) | |
| 223 | + | ||
| 224 | + | for _, test := range []struct { | |
| 225 | + | name, version, revision, ref string | |
| 226 | + | }{ | |
| 227 | + | {name: "branch selector", version: "main", ref: "main"}, | |
| 228 | + | {name: "missing origin", version: "v0.8.5-0.20300102030405-bbd397409ebe"}, | |
| 229 | + | {name: "named origin ref", version: "v0.8.5-0.20300102030405-bbd397409ebe", revision: "bbd397409ebed75a5979c1e4566a2ef319f6a484", ref: "main"}, | |
| 230 | + | } { | |
| 231 | + | t.Run(test.name, func(t *testing.T) { | |
| 232 | + | temp := t.TempDir() | |
| 233 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |
| 234 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |
| 235 | + | binary := filepath.Join(temp, "dumber") | |
| 236 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |
| 237 | + | ||
| 238 | + | goBin := collectorProvenanceGo(t, temp, test.version, test.revision, test.ref) | |
| 239 | + | output := filepath.Join(temp, "artifacts") | |
| 240 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |
| 241 | + | cmd.Dir = repoRoot | |
| 242 | + | cmd.Env = append(os.Environ(), | |
| 243 | + | "DISPLAY=:test", | |
| 244 | + | "DUMBER_CEF_DIR="+runtime, | |
| 245 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |
| 246 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |
| 247 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |
| 248 | + | ) | |
| 249 | + | result, runErr := cmd.CombinedOutput() | |
| 250 | + | require.Errorf(t, runErr, "collector accepted nonimmutable module provenance: %s", result) | |
| 251 | + | require.Contains(t, string(result), "immutable module provenance is unavailable") | |
| 252 | + | require.NotContains(t, string(result), temp) | |
| 253 | + | require.NoFileExists(t, filepath.Join(output, "metadata.json")) | |
| 254 | + | for _, name := range runArtifactNames() { | |
| 255 | + | require.NoFileExists(t, filepath.Join(output, name)) | |
| 256 | + | } | |
| 257 | + | }) | |
| 258 | + | } | |
| 259 | + | } | |
| 260 | + | ||
| 261 | + | func collectorProvenanceGo(t *testing.T, temp, version, revision, ref string) string { | |
| 262 | + | t.Helper() | |
| 263 | + | infoPath := filepath.Join(temp, "module.info") | |
| 264 | + | info := map[string]any{"Version": version} | |
| 265 | + | if revision != "" { | |
| 266 | + | info["Origin"] = map[string]string{ | |
| 267 | + | "VCS": "git", "URL": "https://github.com/bnema/purego-cef2gtk", "Hash": revision, "Ref": ref, | |
| 268 | + | } | |
| 269 | + | } | |
| 270 | + | infoJSON, err := json.Marshal(info) | |
| 271 | + | require.NoError(t, err) | |
| 272 | + | require.NoError(t, os.WriteFile(infoPath, infoJSON, 0o600)) | |
| 273 | + | ||
| 274 | + | selectedJSON, err := json.Marshal(map[string]string{ | |
| 275 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, | |
| 276 | + | }) | |
| 277 | + | require.NoError(t, err) | |
| 278 | + | downloadedJSON, err := json.Marshal(map[string]string{ | |
| 279 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, "Info": infoPath, | |
| 280 | + | }) | |
| 281 | + | require.NoError(t, err) | |
| 282 | + | binDir := filepath.Join(temp, "bin") | |
| 283 | + | require.NoError(t, os.Mkdir(binDir, 0o755)) | |
| 284 | + | goBin := filepath.Join(binDir, "go") | |
| 285 | + | script := fmt.Sprintf(`#!/bin/sh | |
| 286 | + | if [ "$1" = "list" ] && [ "$2" = "-m" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk" ]; then | |
| 287 | + | printf '%%s\n' '%s' | |
| 288 | + | exit 0 | |
| 289 | + | fi | |
| 290 | + | if [ "$1" = "mod" ] && [ "$2" = "download" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk@%s" ]; then | |
| 291 | + | printf '%%s\n' '%s' | |
| 292 | + | exit 0 | |
| 293 | + | fi | |
| 294 | + | exit 1 | |
| 295 | + | `, selectedJSON, version, downloadedJSON) | |
| 296 | + | require.NoError(t, os.WriteFile(goBin, []byte(script), 0o755)) | |
| 297 | + | return goBin | |
| 298 | + | } | |
| 299 | + | ||
| 169 | 300 | func TestFirstPresentationCollectorDefaultsToXDGStateEvidenceDirectory(t *testing.T) { | |
| 170 | 301 | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |
| 171 | 302 | require.NoError(t, err) | |
| @@ -2,6 +2,7 @@ package logging | |||||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | "encoding/json" | 4 | "encoding/json" | ||
| 5 | + | "fmt" | |||
| 5 | "os" | 6 | "os" | ||
| 6 | "os/exec" | 7 | "os/exec" | ||
| 7 | "path/filepath" | 8 | "path/filepath" | ||
| @@ -143,8 +144,9 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||||
| 143 | } | 144 | } | ||
| 144 | for _, required := range []string{ | 145 | for _, required := range []string{ | ||
| 145 | `"measured_source_revision"`, | 146 | `"measured_source_revision"`, | ||
| 147 | + | `"version": "v0.8.4-0.20260714160309-bbd397409ebe"`, | |||
| 146 | `"tag": "v0.8.4"`, | 148 | `"tag": "v0.8.4"`, | ||
| 147 | - | `"revision": "f217ece342dea3ef2a3f98671fcd16a39ad0037d"`, | 149 | + | `"revision": "bbd397409ebed75a5979c1e4566a2ef319f6a484"`, |
| 148 | } { | 150 | } { | ||
| 149 | require.Contains(t, artifacts.String(), required) | 151 | require.Contains(t, artifacts.String(), required) | ||
| 150 | } | 152 | } | ||
| @@ -166,6 +168,135 @@ func TestFirstPresentationCollectorSanitizesMachineLocalValues(t *testing.T) { | |||||
| 166 | require.Equal(t, "integrated-gpu", metadata.Comparison.MachineGPUProfile) | 168 | require.Equal(t, "integrated-gpu", metadata.Comparison.MachineGPUProfile) | ||
| 167 | } | 169 | } | ||
| 168 | 170 | ||||
| 171 | + | func TestFirstPresentationCollectorDerivesSelectedImmutableModuleProvenance(t *testing.T) { | |||
| 172 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |||
| 173 | + | require.NoError(t, err) | |||
| 174 | + | temp := t.TempDir() | |||
| 175 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |||
| 176 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |||
| 177 | + | binary := filepath.Join(temp, "dumber") | |||
| 178 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |||
| 179 | + | ||||
| 180 | + | // This exact pseudo-version is deliberately newer than the former v0.8.4 | |||
| 181 | + | // hardcode; the collector must report what the selected module says. | |||
| 182 | + | const version = "v0.8.5-0.20300102030405-bbd397409ebe" | |||
| 183 | + | const revision = "bbd397409ebed75a5979c1e4566a2ef319f6a484" | |||
| 184 | + | goBin := collectorProvenanceGo(t, temp, version, revision, "") | |||
| 185 | + | output := filepath.Join(temp, "artifacts") | |||
| 186 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |||
| 187 | + | cmd.Dir = repoRoot | |||
| 188 | + | cmd.Env = append(os.Environ(), | |||
| 189 | + | "DISPLAY=:test", | |||
| 190 | + | "DUMBER_CEF_DIR="+runtime, | |||
| 191 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |||
| 192 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |||
| 193 | + | "DUMBER_FIRST_PRESENTATION_TIMEOUT_SECONDS=1", | |||
| 194 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |||
| 195 | + | ) | |||
| 196 | + | result, err := cmd.CombinedOutput() | |||
| 197 | + | require.NoErrorf(t, err, "collector failed: %s", result) | |||
| 198 | + | ||||
| 199 | + | var metadata struct { | |||
| 200 | + | Upstream struct { | |||
| 201 | + | Module string `json:"module"` | |||
| 202 | + | Version string `json:"version"` | |||
| 203 | + | Tag string `json:"tag"` | |||
| 204 | + | Revision string `json:"revision"` | |||
| 205 | + | } `json:"upstream"` | |||
| 206 | + | } | |||
| 207 | + | contents, err := os.ReadFile(filepath.Join(output, "metadata.json")) | |||
| 208 | + | require.NoError(t, err) | |||
| 209 | + | require.NoError(t, json.Unmarshal(contents, &metadata)) | |||
| 210 | + | require.Equal(t, "github.com/bnema/purego-cef2gtk", metadata.Upstream.Module) | |||
| 211 | + | require.Equal(t, version, metadata.Upstream.Version) | |||
| 212 | + | require.Equal(t, "v0.8.5", metadata.Upstream.Tag) | |||
| 213 | + | require.Equal(t, revision, metadata.Upstream.Revision) | |||
| 214 | + | ||||
| 215 | + | script, err := os.ReadFile(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |||
| 216 | + | require.NoError(t, err) | |||
| 217 | + | require.NotContains(t, string(script), "f217ece342dea3ef2a3f98671fcd16a39ad0037d") | |||
| 218 | + | } | |||
| 219 | + | ||||
| 220 | + | func TestFirstPresentationCollectorRejectsNonImmutableModuleProvenanceWithoutLeaks(t *testing.T) { | |||
| 221 | + | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | |||
| 222 | + | require.NoError(t, err) | |||
| 223 | + | ||||
| 224 | + | for _, test := range []struct { | |||
| 225 | + | name, version, revision, ref string | |||
| 226 | + | }{ | |||
| 227 | + | {name: "branch selector", version: "main", ref: "main"}, | |||
| 228 | + | {name: "missing origin", version: "v0.8.5-0.20300102030405-bbd397409ebe"}, | |||
| 229 | + | {name: "named origin ref", version: "v0.8.5-0.20300102030405-bbd397409ebe", revision: "bbd397409ebed75a5979c1e4566a2ef319f6a484", ref: "main"}, | |||
| 230 | + | } { | |||
| 231 | + | t.Run(test.name, func(t *testing.T) { | |||
| 232 | + | temp := t.TempDir() | |||
| 233 | + | runtime := filepath.Join(temp, "cef-147-runtime") | |||
| 234 | + | require.NoError(t, os.Mkdir(runtime, 0o755)) | |||
| 235 | + | binary := filepath.Join(temp, "dumber") | |||
| 236 | + | require.NoError(t, os.WriteFile(binary, collectorTestBinary(validFirstPresentationLog), 0o755)) | |||
| 237 | + | ||||
| 238 | + | goBin := collectorProvenanceGo(t, temp, test.version, test.revision, test.ref) | |||
| 239 | + | output := filepath.Join(temp, "artifacts") | |||
| 240 | + | cmd := exec.Command(filepath.Join(repoRoot, "scripts", "collect_first_presentation.sh")) | |||
| 241 | + | cmd.Dir = repoRoot | |||
| 242 | + | cmd.Env = append(os.Environ(), | |||
| 243 | + | "DISPLAY=:test", | |||
| 244 | + | "DUMBER_CEF_DIR="+runtime, | |||
| 245 | + | "DUMBER_FIRST_PRESENTATION_BIN="+binary, | |||
| 246 | + | "DUMBER_FIRST_PRESENTATION_OUTPUT="+output, | |||
| 247 | + | "PATH="+filepath.Dir(goBin)+":"+os.Getenv("PATH"), | |||
| 248 | + | ) | |||
| 249 | + | result, runErr := cmd.CombinedOutput() | |||
| 250 | + | require.Errorf(t, runErr, "collector accepted nonimmutable module provenance: %s", result) | |||
| 251 | + | require.Contains(t, string(result), "immutable module provenance is unavailable") | |||
| 252 | + | require.NotContains(t, string(result), temp) | |||
| 253 | + | require.NoFileExists(t, filepath.Join(output, "metadata.json")) | |||
| 254 | + | for _, name := range runArtifactNames() { | |||
| 255 | + | require.NoFileExists(t, filepath.Join(output, name)) | |||
| 256 | + | } | |||
| 257 | + | }) | |||
| 258 | + | } | |||
| 259 | + | } | |||
| 260 | + | ||||
| 261 | + | func collectorProvenanceGo(t *testing.T, temp, version, revision, ref string) string { | |||
| 262 | + | t.Helper() | |||
| 263 | + | infoPath := filepath.Join(temp, "module.info") | |||
| 264 | + | info := map[string]any{"Version": version} | |||
| 265 | + | if revision != "" { | |||
| 266 | + | info["Origin"] = map[string]string{ | |||
| 267 | + | "VCS": "git", "URL": "https://github.com/bnema/purego-cef2gtk", "Hash": revision, "Ref": ref, | |||
| 268 | + | } | |||
| 269 | + | } | |||
| 270 | + | infoJSON, err := json.Marshal(info) | |||
| 271 | + | require.NoError(t, err) | |||
| 272 | + | require.NoError(t, os.WriteFile(infoPath, infoJSON, 0o600)) | |||
| 273 | + | ||||
| 274 | + | selectedJSON, err := json.Marshal(map[string]string{ | |||
| 275 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, | |||
| 276 | + | }) | |||
| 277 | + | require.NoError(t, err) | |||
| 278 | + | downloadedJSON, err := json.Marshal(map[string]string{ | |||
| 279 | + | "Path": "github.com/bnema/purego-cef2gtk", "Version": version, "Info": infoPath, | |||
| 280 | + | }) | |||
| 281 | + | require.NoError(t, err) | |||
| 282 | + | binDir := filepath.Join(temp, "bin") | |||
| 283 | + | require.NoError(t, os.Mkdir(binDir, 0o755)) | |||
| 284 | + | goBin := filepath.Join(binDir, "go") | |||
| 285 | + | script := fmt.Sprintf(`#!/bin/sh | |||
| 286 | + | if [ "$1" = "list" ] && [ "$2" = "-m" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk" ]; then | |||
| 287 | + | printf '%%s\n' '%s' | |||
| 288 | + | exit 0 | |||
| 289 | + | fi | |||
| 290 | + | if [ "$1" = "mod" ] && [ "$2" = "download" ] && [ "$3" = "-json" ] && [ "$4" = "github.com/bnema/purego-cef2gtk@%s" ]; then | |||
| 291 | + | printf '%%s\n' '%s' | |||
| 292 | + | exit 0 | |||
| 293 | + | fi | |||
| 294 | + | exit 1 | |||
| 295 | + | `, selectedJSON, version, downloadedJSON) | |||
| 296 | + | require.NoError(t, os.WriteFile(goBin, []byte(script), 0o755)) | |||
| 297 | + | return goBin | |||
| 298 | + | } | |||
| 299 | + | ||||
| 169 | func TestFirstPresentationCollectorDefaultsToXDGStateEvidenceDirectory(t *testing.T) { | 300 | func TestFirstPresentationCollectorDefaultsToXDGStateEvidenceDirectory(t *testing.T) { | ||
| 170 | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | 301 | repoRoot, err := filepath.Abs(filepath.Join("..", "..")) | ||
| 171 | require.NoError(t, err) | 302 | require.NoError(t, err) | ||
M scripts/collect_first_presentation.sh +78 -9
| @@ -31,8 +31,78 @@ else | |||
| 31 | 31 | fi | |
| 32 | 32 | readonly output | |
| 33 | 33 | readonly upstream_module="github.com/bnema/purego-cef2gtk" | |
| 34 | - | readonly upstream_tag="v0.8.4" | |
| 35 | - | readonly upstream_revision="f217ece342dea3ef2a3f98671fcd16a39ad0037d" | |
| 34 | + | ||
| 35 | + | # Resolve the version selected by this checkout, then obtain its immutable VCS | |
| 36 | + | # origin from Go's cached module metadata. Do not infer a revision from a tag, | |
| 37 | + | # a branch, or a truncated pseudo-version suffix. | |
| 38 | + | resolve_upstream_provenance() { | |
| 39 | + | local selected_metadata selected_version downloaded_metadata | |
| 40 | + | ||
| 41 | + | selected_metadata="$(go list -m -json "$upstream_module" 2>/dev/null)" || { | |
| 42 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |
| 43 | + | exit 2 | |
| 44 | + | } | |
| 45 | + | selected_version="$(python3 - "$upstream_module" "$selected_metadata" <<'PY' | |
| 46 | + | import json, sys | |
| 47 | + | try: | |
| 48 | + | metadata = json.loads(sys.argv[2]) | |
| 49 | + | if metadata.get("Path") != sys.argv[1] or not isinstance(metadata.get("Version"), str): | |
| 50 | + | raise ValueError | |
| 51 | + | print(metadata["Version"]) | |
| 52 | + | except (AttributeError, TypeError, ValueError, json.JSONDecodeError): | |
| 53 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |
| 54 | + | PY | |
| 55 | + | )" || exit $? | |
| 56 | + | downloaded_metadata="$(go mod download -json "$upstream_module@$selected_version" 2>/dev/null)" || { | |
| 57 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |
| 58 | + | exit 2 | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | python3 - "$upstream_module" "$selected_metadata" "$downloaded_metadata" <<'PY' | |
| 62 | + | import json, re, sys | |
| 63 | + | ||
| 64 | + | module, selected_raw, downloaded_raw = sys.argv[1:] | |
| 65 | + | ||
| 66 | + | def fail(): | |
| 67 | + | # Do not expose Go cache locations or other machine-local values. | |
| 68 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |
| 69 | + | ||
| 70 | + | try: | |
| 71 | + | selected = json.loads(selected_raw) | |
| 72 | + | downloaded = json.loads(downloaded_raw) | |
| 73 | + | version = selected["Version"] | |
| 74 | + | if selected.get("Path") != module or downloaded.get("Path") != module: | |
| 75 | + | fail() | |
| 76 | + | if downloaded.get("Version") != version: | |
| 77 | + | fail() | |
| 78 | + | # A selected pseudo-version is an exact immutable selector, never a branch. | |
| 79 | + | match = re.fullmatch(r"(v\d+\.\d+\.\d+)-0\.\d{14}-([0-9a-f]{12})", version) | |
| 80 | + | if not match: | |
| 81 | + | fail() | |
| 82 | + | info_path = downloaded.get("Info") | |
| 83 | + | if not isinstance(info_path, str) or not info_path: | |
| 84 | + | fail() | |
| 85 | + | with open(info_path, encoding="utf-8") as info_file: | |
| 86 | + | info = json.load(info_file) | |
| 87 | + | origin = info.get("Origin") or downloaded.get("Origin") | |
| 88 | + | if info.get("Version") != version or not isinstance(origin, dict): | |
| 89 | + | fail() | |
| 90 | + | revision = origin.get("Hash") | |
| 91 | + | if origin.get("VCS") != "git" or origin.get("URL") != "https://github.com/bnema/purego-cef2gtk": | |
| 92 | + | fail() | |
| 93 | + | if not isinstance(revision, str) or not re.fullmatch(r"[0-9a-f]{40}", revision): | |
| 94 | + | fail() | |
| 95 | + | if not revision.startswith(match.group(2)): | |
| 96 | + | fail() | |
| 97 | + | # A named ref can move. Only the immutable hash itself is acceptable. | |
| 98 | + | if origin.get("Ref") not in (None, "", revision): | |
| 99 | + | fail() | |
| 100 | + | except (AttributeError, KeyError, OSError, TypeError, ValueError, json.JSONDecodeError): | |
| 101 | + | fail() | |
| 102 | + | ||
| 103 | + | print("\t".join((version, match.group(1), revision))) | |
| 104 | + | PY | |
| 105 | + | } | |
| 36 | 106 | ||
| 37 | 107 | # The artifact destination is caller-controlled. Never empty or recursively | |
| 38 | 108 | # clear it: collection only writes to a newly-created directory whose parent is | |
| @@ -66,10 +136,9 @@ prepare_output | |||
| 66 | 136 | [[ -x "$binary" ]] || { echo "first-presentation: executable not found: $binary" >&2; exit 2; } | |
| 67 | 137 | [[ -d "$runtime" ]] || { echo "first-presentation: CEF runtime not found: $runtime" >&2; exit 2; } | |
| 68 | 138 | [[ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]] || { echo "first-presentation: a current Wayland/X11 display is required" >&2; exit 2; } | |
| 69 | - | [[ "$(go list -m -f '{{.Version}}' "$upstream_module")" == "$upstream_tag" ]] || { | |
| 70 | - | echo "first-presentation: expected $upstream_module@$upstream_tag" >&2 | |
| 71 | - | exit 2 | |
| 72 | - | } | |
| 139 | + | upstream_provenance="$(resolve_upstream_provenance)" || exit $? | |
| 140 | + | IFS=$'\t' read -r upstream_version upstream_tag upstream_revision <<<"$upstream_provenance" | |
| 141 | + | readonly upstream_version upstream_tag upstream_revision | |
| 73 | 142 | ||
| 74 | 143 | # Raw logs and temporary XDG homes may contain machine-local paths. Keep them | |
| 75 | 144 | # outside the committed artifact directory and always remove them. | |
| @@ -80,9 +149,9 @@ cleanup_work_root() { | |||
| 80 | 149 | rm -rf -- "$work_root" | |
| 81 | 150 | } | |
| 82 | 151 | trap cleanup_work_root EXIT | |
| 83 | - | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_tag" "$upstream_revision" <<'PY' | |
| 152 | + | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_version" "$upstream_tag" "$upstream_revision" <<'PY' | |
| 84 | 153 | import hashlib, json, os, platform, subprocess, sys | |
| 85 | - | path, binary, timeout, upstream_module, upstream_tag, upstream_revision = sys.argv[1:] | |
| 154 | + | path, binary, timeout, upstream_module, upstream_version, upstream_tag, upstream_revision = sys.argv[1:] | |
| 86 | 155 | with open(binary, "rb") as candidate: | |
| 87 | 156 | binary_sha256 = hashlib.file_digest(candidate, "sha256").hexdigest() | |
| 88 | 157 | ||
| @@ -102,7 +171,7 @@ json.dump({ | |||
| 102 | 171 | "binary": {"label": "dumber", "sha256": binary_sha256}, | |
| 103 | 172 | "timeout_seconds": int(timeout), | |
| 104 | 173 | "measured_source_revision": subprocess.check_output(["git", "-c", f"safe.directory={os.getcwd()}", "rev-parse", "HEAD"], text=True).strip(), | |
| 105 | - | "upstream": {"module": upstream_module, "tag": upstream_tag, "revision": upstream_revision}, | |
| 174 | + | "upstream": {"module": upstream_module, "version": upstream_version, "tag": upstream_tag, "revision": upstream_revision}, | |
| 106 | 175 | "comparison": {"os": os_label, "architecture": architecture, "display_protocol": display_protocol, "machine_gpu_profile": gpu_profile}, | |
| 107 | 176 | "render_configuration": {"backend": "gdk-dmabuf", "buffer_sharing": "dmabuf", "renderer": "vulkan"} | |
| 108 | 177 | }, open(path, "w"), indent=2, sort_keys=True) | |
| @@ -31,8 +31,78 @@ else | |||||
| 31 | fi | 31 | fi | ||
| 32 | readonly output | 32 | readonly output | ||
| 33 | readonly upstream_module="github.com/bnema/purego-cef2gtk" | 33 | readonly upstream_module="github.com/bnema/purego-cef2gtk" | ||
| 34 | - | readonly upstream_tag="v0.8.4" | 34 | + | |
| 35 | - | readonly upstream_revision="f217ece342dea3ef2a3f98671fcd16a39ad0037d" | 35 | + | # Resolve the version selected by this checkout, then obtain its immutable VCS |
| 36 | + | # origin from Go's cached module metadata. Do not infer a revision from a tag, | |||
| 37 | + | # a branch, or a truncated pseudo-version suffix. | |||
| 38 | + | resolve_upstream_provenance() { | |||
| 39 | + | local selected_metadata selected_version downloaded_metadata | |||
| 40 | + | ||||
| 41 | + | selected_metadata="$(go list -m -json "$upstream_module" 2>/dev/null)" || { | |||
| 42 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |||
| 43 | + | exit 2 | |||
| 44 | + | } | |||
| 45 | + | selected_version="$(python3 - "$upstream_module" "$selected_metadata" <<'PY' | |||
| 46 | + | import json, sys | |||
| 47 | + | try: | |||
| 48 | + | metadata = json.loads(sys.argv[2]) | |||
| 49 | + | if metadata.get("Path") != sys.argv[1] or not isinstance(metadata.get("Version"), str): | |||
| 50 | + | raise ValueError | |||
| 51 | + | print(metadata["Version"]) | |||
| 52 | + | except (AttributeError, TypeError, ValueError, json.JSONDecodeError): | |||
| 53 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |||
| 54 | + | PY | |||
| 55 | + | )" || exit $? | |||
| 56 | + | downloaded_metadata="$(go mod download -json "$upstream_module@$selected_version" 2>/dev/null)" || { | |||
| 57 | + | echo "first-presentation: immutable module provenance is unavailable" >&2 | |||
| 58 | + | exit 2 | |||
| 59 | + | } | |||
| 60 | + | ||||
| 61 | + | python3 - "$upstream_module" "$selected_metadata" "$downloaded_metadata" <<'PY' | |||
| 62 | + | import json, re, sys | |||
| 63 | + | ||||
| 64 | + | module, selected_raw, downloaded_raw = sys.argv[1:] | |||
| 65 | + | ||||
| 66 | + | def fail(): | |||
| 67 | + | # Do not expose Go cache locations or other machine-local values. | |||
| 68 | + | raise SystemExit("first-presentation: immutable module provenance is unavailable") | |||
| 69 | + | ||||
| 70 | + | try: | |||
| 71 | + | selected = json.loads(selected_raw) | |||
| 72 | + | downloaded = json.loads(downloaded_raw) | |||
| 73 | + | version = selected["Version"] | |||
| 74 | + | if selected.get("Path") != module or downloaded.get("Path") != module: | |||
| 75 | + | fail() | |||
| 76 | + | if downloaded.get("Version") != version: | |||
| 77 | + | fail() | |||
| 78 | + | # A selected pseudo-version is an exact immutable selector, never a branch. | |||
| 79 | + | match = re.fullmatch(r"(v\d+\.\d+\.\d+)-0\.\d{14}-([0-9a-f]{12})", version) | |||
| 80 | + | if not match: | |||
| 81 | + | fail() | |||
| 82 | + | info_path = downloaded.get("Info") | |||
| 83 | + | if not isinstance(info_path, str) or not info_path: | |||
| 84 | + | fail() | |||
| 85 | + | with open(info_path, encoding="utf-8") as info_file: | |||
| 86 | + | info = json.load(info_file) | |||
| 87 | + | origin = info.get("Origin") or downloaded.get("Origin") | |||
| 88 | + | if info.get("Version") != version or not isinstance(origin, dict): | |||
| 89 | + | fail() | |||
| 90 | + | revision = origin.get("Hash") | |||
| 91 | + | if origin.get("VCS") != "git" or origin.get("URL") != "https://github.com/bnema/purego-cef2gtk": | |||
| 92 | + | fail() | |||
| 93 | + | if not isinstance(revision, str) or not re.fullmatch(r"[0-9a-f]{40}", revision): | |||
| 94 | + | fail() | |||
| 95 | + | if not revision.startswith(match.group(2)): | |||
| 96 | + | fail() | |||
| 97 | + | # A named ref can move. Only the immutable hash itself is acceptable. | |||
| 98 | + | if origin.get("Ref") not in (None, "", revision): | |||
| 99 | + | fail() | |||
| 100 | + | except (AttributeError, KeyError, OSError, TypeError, ValueError, json.JSONDecodeError): | |||
| 101 | + | fail() | |||
| 102 | + | ||||
| 103 | + | print("\t".join((version, match.group(1), revision))) | |||
| 104 | + | PY | |||
| 105 | + | } | |||
| 36 | 106 | ||||
| 37 | # The artifact destination is caller-controlled. Never empty or recursively | 107 | # The artifact destination is caller-controlled. Never empty or recursively | ||
| 38 | # clear it: collection only writes to a newly-created directory whose parent is | 108 | # clear it: collection only writes to a newly-created directory whose parent is | ||
| @@ -66,10 +136,9 @@ prepare_output | |||||
| 66 | [[ -x "$binary" ]] || { echo "first-presentation: executable not found: $binary" >&2; exit 2; } | 136 | [[ -x "$binary" ]] || { echo "first-presentation: executable not found: $binary" >&2; exit 2; } | ||
| 67 | [[ -d "$runtime" ]] || { echo "first-presentation: CEF runtime not found: $runtime" >&2; exit 2; } | 137 | [[ -d "$runtime" ]] || { echo "first-presentation: CEF runtime not found: $runtime" >&2; exit 2; } | ||
| 68 | [[ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]] || { echo "first-presentation: a current Wayland/X11 display is required" >&2; exit 2; } | 138 | [[ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]] || { echo "first-presentation: a current Wayland/X11 display is required" >&2; exit 2; } | ||
| 69 | - | [[ "$(go list -m -f '{{.Version}}' "$upstream_module")" == "$upstream_tag" ]] || { | 139 | + | upstream_provenance="$(resolve_upstream_provenance)" || exit $? |
| 70 | - | echo "first-presentation: expected $upstream_module@$upstream_tag" >&2 | 140 | + | IFS=$'\t' read -r upstream_version upstream_tag upstream_revision <<<"$upstream_provenance" |
| 71 | - | exit 2 | 141 | + | readonly upstream_version upstream_tag upstream_revision |
| 72 | - | } | |||
| 73 | 142 | ||||
| 74 | # Raw logs and temporary XDG homes may contain machine-local paths. Keep them | 143 | # Raw logs and temporary XDG homes may contain machine-local paths. Keep them | ||
| 75 | # outside the committed artifact directory and always remove them. | 144 | # outside the committed artifact directory and always remove them. | ||
| @@ -80,9 +149,9 @@ cleanup_work_root() { | |||||
| 80 | rm -rf -- "$work_root" | 149 | rm -rf -- "$work_root" | ||
| 81 | } | 150 | } | ||
| 82 | trap cleanup_work_root EXIT | 151 | trap cleanup_work_root EXIT | ||
| 83 | - | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_tag" "$upstream_revision" <<'PY' | 152 | + | python3 - "$output/metadata.json" "$binary" "$timeout_seconds" "$upstream_module" "$upstream_version" "$upstream_tag" "$upstream_revision" <<'PY' |
| 84 | import hashlib, json, os, platform, subprocess, sys | 153 | import hashlib, json, os, platform, subprocess, sys | ||
| 85 | - | path, binary, timeout, upstream_module, upstream_tag, upstream_revision = sys.argv[1:] | 154 | + | path, binary, timeout, upstream_module, upstream_version, upstream_tag, upstream_revision = sys.argv[1:] |
| 86 | with open(binary, "rb") as candidate: | 155 | with open(binary, "rb") as candidate: | ||
| 87 | binary_sha256 = hashlib.file_digest(candidate, "sha256").hexdigest() | 156 | binary_sha256 = hashlib.file_digest(candidate, "sha256").hexdigest() | ||
| 88 | 157 | ||||
| @@ -102,7 +171,7 @@ json.dump({ | |||||
| 102 | "binary": {"label": "dumber", "sha256": binary_sha256}, | 171 | "binary": {"label": "dumber", "sha256": binary_sha256}, | ||
| 103 | "timeout_seconds": int(timeout), | 172 | "timeout_seconds": int(timeout), | ||
| 104 | "measured_source_revision": subprocess.check_output(["git", "-c", f"safe.directory={os.getcwd()}", "rev-parse", "HEAD"], text=True).strip(), | 173 | "measured_source_revision": subprocess.check_output(["git", "-c", f"safe.directory={os.getcwd()}", "rev-parse", "HEAD"], text=True).strip(), | ||
| 105 | - | "upstream": {"module": upstream_module, "tag": upstream_tag, "revision": upstream_revision}, | 174 | + | "upstream": {"module": upstream_module, "version": upstream_version, "tag": upstream_tag, "revision": upstream_revision}, |
| 106 | "comparison": {"os": os_label, "architecture": architecture, "display_protocol": display_protocol, "machine_gpu_profile": gpu_profile}, | 175 | "comparison": {"os": os_label, "architecture": architecture, "display_protocol": display_protocol, "machine_gpu_profile": gpu_profile}, | ||
| 107 | "render_configuration": {"backend": "gdk-dmabuf", "buffer_sharing": "dmabuf", "renderer": "vulkan"} | 176 | "render_configuration": {"backend": "gdk-dmabuf", "buffer_sharing": "dmabuf", "renderer": "vulkan"} | ||
| 108 | }, open(path, "w"), indent=2, sort_keys=True) | 177 | }, open(path, "w"), indent=2, sort_keys=True) | ||
M vendor/github.com/bnema/purego-cef/cef/bridge.go +8 -13 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/cefadapter/accelerated_paint.go +34 -37 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/dmabuf/frame.go +38 -19 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/gtkgdk/renderer.go +89 -69 generated file: collapsed
M vendor/github.com/bnema/purego-pipewire/internal/core/player.go +5 -0 generated file: collapsed
M vendor/github.com/bnema/purego-pipewire/internal/core/player_rt.go +10 -6 generated file: collapsed
M vendor/github.com/bnema/purego-pipewire/internal/core/pwbuffer.go +66 -32 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/driver/driver.go +268 -63 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/core/db.go +8 -0 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/core/rows.go +13 -0 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/loader/loader.go +23 -5 generated file: collapsed
M vendor/github.com/bnema/purego-sqlite/internal/ports/in/ports_gen.go +3 -0 generated file: collapsed
M vendor/github.com/bnema/puregotk/internal/core/core.go +197 -4 generated file: collapsed
M vendor/github.com/bnema/puregotk/pkg/core/core.go +10 -0 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-about-dialog.go +99 -64 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-about-window.go +95 -62 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-accent-color.go +7 -15 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-action-row.go +33 -29 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-alert-dialog.go +66 -47 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-animation-target.go +10 -27 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-animation-util.go +4 -12 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-animation.go +24 -26 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-application-window.go +14 -22 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-application.go +3 -15 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-avatar.go +22 -25 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-banner.go +23 -26 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-bin.go +5 -16 generated file: collapsed
M vendor/github.com/bnema/puregotk/v4/adw/adw-bottom-sheet.go +47 -38
| @@ -5,7 +5,6 @@ import ( | |||
| 5 | 5 | "structs" | |
| 6 | 6 | "unsafe" | |
| 7 | 7 | ||
| 8 | - | "github.com/bnema/purego" | |
| 9 | 8 | "github.com/bnema/puregotk/pkg/core" | |
| 10 | 9 | "github.com/bnema/puregotk/v4/gdk" | |
| 11 | 10 | "github.com/bnema/puregotk/v4/glib" | |
| @@ -113,6 +112,7 @@ type BottomSheet struct { | |||
| 113 | 112 | var xBottomSheetGLibType func() types.GType | |
| 114 | 113 | ||
| 115 | 114 | func BottomSheetGLibType() types.GType { | |
| 115 | + | core.LazyRegister(&xBottomSheetGLibType, "ADW", "adw_bottom_sheet_get_type", false) | |
| 116 | 116 | return xBottomSheetGLibType() | |
| 117 | 117 | } | |
| 118 | 118 | ||
| @@ -126,6 +126,7 @@ var xNewBottomSheet func() uintptr | |||
| 126 | 126 | ||
| 127 | 127 | // Creates a new `AdwBottomSheet`. | |
| 128 | 128 | func NewBottomSheet() *BottomSheet { | |
| 129 | + | core.LazyRegister(&xNewBottomSheet, "ADW", "adw_bottom_sheet_new", false) | |
| 129 | 130 | var cls *BottomSheet | |
| 130 | 131 | ||
| 131 | 132 | cret := xNewBottomSheet() | |
| @@ -143,6 +144,8 @@ var xBottomSheetGetAlign func(uintptr) float32 | |||
| 143 | 144 | ||
| 144 | 145 | // Gets horizontal alignment of the bottom sheet. | |
| 145 | 146 | func (x *BottomSheet) GetAlign() float32 { | |
| 147 | + | core.LazyRegister(&xBottomSheetGetAlign, "ADW", "adw_bottom_sheet_get_align", false) | |
| 148 | + | ||
| 146 | 149 | cret := xBottomSheetGetAlign(x.GoPointer()) | |
| 147 | 150 | return cret | |
| 148 | 151 | } | |
| @@ -151,6 +154,7 @@ var xBottomSheetGetBottomBar func(uintptr) uintptr | |||
| 151 | 154 | ||
| 152 | 155 | // Gets the bottom bar widget for @self. | |
| 153 | 156 | func (x *BottomSheet) GetBottomBar() *gtk.Widget { | |
| 157 | + | core.LazyRegister(&xBottomSheetGetBottomBar, "ADW", "adw_bottom_sheet_get_bottom_bar", false) | |
| 154 | 158 | var cls *gtk.Widget | |
| 155 | 159 | ||
| 156 | 160 | cret := xBottomSheetGetBottomBar(x.GoPointer()) | |
| @@ -171,6 +175,8 @@ var xBottomSheetGetBottomBarHeight func(uintptr) int | |||
| 171 | 175 | // It can be used to shift the content upwards permanently to accommodate for | |
| 172 | 176 | // the bottom bar. | |
| 173 | 177 | func (x *BottomSheet) GetBottomBarHeight() int { | |
| 178 | + | core.LazyRegister(&xBottomSheetGetBottomBarHeight, "ADW", "adw_bottom_sheet_get_bottom_bar_height", false) | |
| 179 | + | ||
| 174 | 180 | cret := xBottomSheetGetBottomBarHeight(x.GoPointer()) | |
| 175 | 181 | return cret | |
| 176 | 182 | } | |
| @@ -179,6 +185,8 @@ var xBottomSheetGetCanClose func(uintptr) bool | |||
| 179 | 185 | ||
| 180 | 186 | // Gets whether the bottom sheet can be closed by user. | |
| 181 | 187 | func (x *BottomSheet) GetCanClose() bool { | |
| 188 | + | core.LazyRegister(&xBottomSheetGetCanClose, "ADW", "adw_bottom_sheet_get_can_close", false) | |
| 189 | + | ||
| 182 | 190 | cret := xBottomSheetGetCanClose(x.GoPointer()) | |
| 183 | 191 | return cret | |
| 184 | 192 | } | |
| @@ -187,6 +195,8 @@ var xBottomSheetGetCanOpen func(uintptr) bool | |||
| 187 | 195 | ||
| 188 | 196 | // Gets whether the bottom sheet can be opened by user. | |
| 189 | 197 | func (x *BottomSheet) GetCanOpen() bool { | |
| 198 | + | core.LazyRegister(&xBottomSheetGetCanOpen, "ADW", "adw_bottom_sheet_get_can_open", false) | |
| 199 | + | ||
| 190 | 200 | cret := xBottomSheetGetCanOpen(x.GoPointer()) | |
| 191 | 201 | return cret | |
| 192 | 202 | } | |
| @@ -195,6 +205,7 @@ var xBottomSheetGetContent func(uintptr) uintptr | |||
| 195 | 205 | ||
| 196 | 206 | // Gets the content widget for @self. | |
| 197 | 207 | func (x *BottomSheet) GetContent() *gtk.Widget { | |
| 208 | + | core.LazyRegister(&xBottomSheetGetContent, "ADW", "adw_bottom_sheet_get_content", false) | |
| 198 | 209 | var cls *gtk.Widget | |
| 199 | 210 | ||
| 200 | 211 | cret := xBottomSheetGetContent(x.GoPointer()) | |
| @@ -212,6 +223,8 @@ var xBottomSheetGetFullWidth func(uintptr) bool | |||
| 212 | 223 | ||
| 213 | 224 | // Gets whether the bottom sheet takes the full width. | |
| 214 | 225 | func (x *BottomSheet) GetFullWidth() bool { | |
| 226 | + | core.LazyRegister(&xBottomSheetGetFullWidth, "ADW", "adw_bottom_sheet_get_full_width", false) | |
| 227 | + | ||
| 215 | 228 | cret := xBottomSheetGetFullWidth(x.GoPointer()) | |
| 216 | 229 | return cret | |
| 217 | 230 | } | |
| @@ -220,6 +233,8 @@ var xBottomSheetGetModal func(uintptr) bool | |||
| 220 | 233 | ||
| 221 | 234 | // Gets whether the bottom sheet is modal. | |
| 222 | 235 | func (x *BottomSheet) GetModal() bool { | |
| 236 | + | core.LazyRegister(&xBottomSheetGetModal, "ADW", "adw_bottom_sheet_get_modal", false) | |
| 237 | + | ||
| 223 | 238 | cret := xBottomSheetGetModal(x.GoPointer()) | |
| 224 | 239 | return cret | |
| 225 | 240 | } | |
| @@ -228,6 +243,8 @@ var xBottomSheetGetOpen func(uintptr) bool | |||
| 228 | 243 | ||
| 229 | 244 | // Gets whether the bottom sheet is open. | |
| 230 | 245 | func (x *BottomSheet) GetOpen() bool { | |
| 246 | + | core.LazyRegister(&xBottomSheetGetOpen, "ADW", "adw_bottom_sheet_get_open", false) | |
| 247 | + | ||
| 231 | 248 | cret := xBottomSheetGetOpen(x.GoPointer()) | |
| 232 | 249 | return cret | |
| 233 | 250 | } | |
| @@ -236,6 +253,8 @@ var xBottomSheetGetRevealBottomBar func(uintptr) bool | |||
| 236 | 253 | ||
| 237 | 254 | // Gets whether the bottom bar is revealed. | |
| 238 | 255 | func (x *BottomSheet) GetRevealBottomBar() bool { | |
| 256 | + | core.LazyRegister(&xBottomSheetGetRevealBottomBar, "ADW", "adw_bottom_sheet_get_reveal_bottom_bar", false) | |
| 257 | + | ||
| 239 | 258 | cret := xBottomSheetGetRevealBottomBar(x.GoPointer()) | |
| 240 | 259 | return cret | |
| 241 | 260 | } | |
| @@ -244,6 +263,7 @@ var xBottomSheetGetSheet func(uintptr) uintptr | |||
| 244 | 263 | ||
| 245 | 264 | // Gets the bottom sheet widget for @self. | |
| 246 | 265 | func (x *BottomSheet) GetSheet() *gtk.Widget { | |
| 266 | + | core.LazyRegister(&xBottomSheetGetSheet, "ADW", "adw_bottom_sheet_get_sheet", false) | |
| 247 | 267 | var cls *gtk.Widget | |
| 248 | 268 | ||
| 249 | 269 | cret := xBottomSheetGetSheet(x.GoPointer()) | |
| @@ -263,6 +283,8 @@ var xBottomSheetGetSheetHeight func(uintptr) int | |||
| 263 | 283 | // | |
| 264 | 284 | // It can be used to shift the content upwards when the bottom sheet is open. | |
| 265 | 285 | func (x *BottomSheet) GetSheetHeight() int { | |
| 286 | + | core.LazyRegister(&xBottomSheetGetSheetHeight, "ADW", "adw_bottom_sheet_get_sheet_height", false) | |
| 287 | + | ||
| 266 | 288 | cret := xBottomSheetGetSheetHeight(x.GoPointer()) | |
| 267 | 289 | return cret | |
| 268 | 290 | } | |
| @@ -271,6 +293,8 @@ var xBottomSheetGetShowDragHandle func(uintptr) bool | |||
| 271 | 293 | ||
| 272 | 294 | // Gets whether to show a drag handle in the bottom sheet. | |
| 273 | 295 | func (x *BottomSheet) GetShowDragHandle() bool { | |
| 296 | + | core.LazyRegister(&xBottomSheetGetShowDragHandle, "ADW", "adw_bottom_sheet_get_show_drag_handle", false) | |
| 297 | + | ||
| 274 | 298 | cret := xBottomSheetGetShowDragHandle(x.GoPointer()) | |
| 275 | 299 | return cret | |
| 276 | 300 | } | |
| @@ -284,6 +308,8 @@ var xBottomSheetSetAlign func(uintptr, float32) | |||
| 284 | 308 | // | |
| 285 | 309 | // Only used when [property@BottomSheet:full-width] is set to `FALSE`. | |
| 286 | 310 | func (x *BottomSheet) SetAlign(AlignVar float32) { | |
| 311 | + | core.LazyRegister(&xBottomSheetSetAlign, "ADW", "adw_bottom_sheet_set_align", false) | |
| 312 | + | ||
| 287 | 313 | xBottomSheetSetAlign(x.GoPointer(), AlignVar) | |
| 288 | 314 | } | |
| 289 | 315 | ||
| @@ -297,6 +323,8 @@ var xBottomSheetSetBottomBar func(uintptr, uintptr) | |||
| 297 | 323 | // Bottom bar can be temporarily hidden using the | |
| 298 | 324 | // [property@BottomSheet:reveal-bottom-bar] property. | |
| 299 | 325 | func (x *BottomSheet) SetBottomBar(BottomBarVar *gtk.Widget) { | |
| 326 | + | core.LazyRegister(&xBottomSheetSetBottomBar, "ADW", "adw_bottom_sheet_set_bottom_bar", false) | |
| 327 | + | ||
| 300 | 328 | xBottomSheetSetBottomBar(x.GoPointer(), BottomBarVar.GoPointer()) | |
| 301 | 329 | } | |
| 302 | 330 | ||
| @@ -309,6 +337,8 @@ var xBottomSheetSetCanClose func(uintptr, bool) | |||
| 309 | 337 | // | |
| 310 | 338 | // Bottom sheet can still be closed using [property@BottomSheet:open]. | |
| 311 | 339 | func (x *BottomSheet) SetCanClose(CanCloseVar bool) { | |
| 340 | + | core.LazyRegister(&xBottomSheetSetCanClose, "ADW", "adw_bottom_sheet_set_can_close", false) | |
| 341 | + | ||
| 312 | 342 | xBottomSheetSetCanClose(x.GoPointer(), CanCloseVar) | |
| 313 | 343 | } | |
| 314 | 344 | ||
| @@ -322,6 +352,8 @@ var xBottomSheetSetCanOpen func(uintptr, bool) | |||
| 322 | 352 | // | |
| 323 | 353 | // Bottom sheet can still be opened using [property@BottomSheet:open]. | |
| 324 | 354 | func (x *BottomSheet) SetCanOpen(CanOpenVar bool) { | |
| 355 | + | core.LazyRegister(&xBottomSheetSetCanOpen, "ADW", "adw_bottom_sheet_set_can_open", false) | |
| 356 | + | ||
| 325 | 357 | xBottomSheetSetCanOpen(x.GoPointer(), CanOpenVar) | |
| 326 | 358 | } | |
| 327 | 359 | ||
| @@ -331,6 +363,8 @@ var xBottomSheetSetContent func(uintptr, uintptr) | |||
| 331 | 363 | // | |
| 332 | 364 | // It's always shown, and the bottom sheet is overlaid over it. | |
| 333 | 365 | func (x *BottomSheet) SetContent(ContentVar *gtk.Widget) { | |
| 366 | + | core.LazyRegister(&xBottomSheetSetContent, "ADW", "adw_bottom_sheet_set_content", false) | |
| 367 | + | ||
| 334 | 368 | xBottomSheetSetContent(x.GoPointer(), ContentVar.GoPointer()) | |
| 335 | 369 | } | |
| 336 | 370 | ||
| @@ -340,6 +374,8 @@ var xBottomSheetSetFullWidth func(uintptr, bool) | |||
| 340 | 374 | // | |
| 341 | 375 | // When full width, [property@BottomSheet:align] is ignored. | |
| 342 | 376 | func (x *BottomSheet) SetFullWidth(FullWidthVar bool) { | |
| 377 | + | core.LazyRegister(&xBottomSheetSetFullWidth, "ADW", "adw_bottom_sheet_set_full_width", false) | |
| 378 | + | ||
| 343 | 379 | xBottomSheetSetFullWidth(x.GoPointer(), FullWidthVar) | |
| 344 | 380 | } | |
| 345 | 381 | ||
| @@ -353,6 +389,8 @@ var xBottomSheetSetModal func(uintptr, bool) | |||
| 353 | 389 | // | |
| 354 | 390 | // Otherwise, the content is accessible even when the bottom sheet is open. | |
| 355 | 391 | func (x *BottomSheet) SetModal(ModalVar bool) { | |
| 392 | + | core.LazyRegister(&xBottomSheetSetModal, "ADW", "adw_bottom_sheet_set_modal", false) | |
| 393 | + | ||
| 356 | 394 | xBottomSheetSetModal(x.GoPointer(), ModalVar) | |
| 357 | 395 | } | |
| 358 | 396 | ||
| @@ -360,6 +398,8 @@ var xBottomSheetSetOpen func(uintptr, bool) | |||
| 360 | 398 | ||
| 361 | 399 | // Sets whether the bottom sheet is open. | |
| 362 | 400 | func (x *BottomSheet) SetOpen(OpenVar bool) { | |
| 401 | + | core.LazyRegister(&xBottomSheetSetOpen, "ADW", "adw_bottom_sheet_set_open", false) | |
| 402 | + | ||
| 363 | 403 | xBottomSheetSetOpen(x.GoPointer(), OpenVar) | |
| 364 | 404 | } | |
| 365 | 405 | ||
| @@ -372,6 +412,8 @@ var xBottomSheetSetRevealBottomBar func(uintptr, bool) | |||
| 372 | 412 | // See [property@BottomSheet:bottom-bar] and | |
| 373 | 413 | // [property@BottomSheet:bottom-bar-height]. | |
| 374 | 414 | func (x *BottomSheet) SetRevealBottomBar(RevealVar bool) { | |
| 415 | + | core.LazyRegister(&xBottomSheetSetRevealBottomBar, "ADW", "adw_bottom_sheet_set_reveal_bottom_bar", false) | |
| 416 | + | ||
| 375 | 417 | xBottomSheetSetRevealBottomBar(x.GoPointer(), RevealVar) | |
| 376 | 418 | } | |
| 377 | 419 | ||
| @@ -381,6 +423,8 @@ var xBottomSheetSetSheet func(uintptr, uintptr) | |||
| 381 | 423 | // | |
| 382 | 424 | // Only shown when [property@BottomSheet:open] is `TRUE`. | |
| 383 | 425 | func (x *BottomSheet) SetSheet(SheetVar *gtk.Widget) { | |
| 426 | + | core.LazyRegister(&xBottomSheetSetSheet, "ADW", "adw_bottom_sheet_set_sheet", false) | |
| 427 | + | ||
| 384 | 428 | xBottomSheetSetSheet(x.GoPointer(), SheetVar.GoPointer()) | |
| 385 | 429 | } | |
| 386 | 430 | ||
| @@ -396,6 +440,8 @@ var xBottomSheetSetShowDragHandle func(uintptr, bool) | |||
| 396 | 440 | // Showing drag handle also allows to swipe the bottom sheet down (and to swipe | |
| 397 | 441 | // the bottom bar up) with a pointer, instead of just touchscreen. | |
| 398 | 442 | func (x *BottomSheet) SetShowDragHandle(ShowDragHandleVar bool) { | |
| 443 | + | core.LazyRegister(&xBottomSheetSetShowDragHandle, "ADW", "adw_bottom_sheet_set_show_drag_handle", false) | |
| 444 | + | ||
| 399 | 445 | xBottomSheetSetShowDragHandle(x.GoPointer(), ShowDragHandleVar) | |
| 400 | 446 | } | |
| 401 | 447 | ||
| @@ -970,41 +1016,4 @@ func (x *BottomSheet) GetBuildableId() string { | |||
| 970 | 1016 | func init() { | |
| 971 | 1017 | core.SetPackageName("ADW", "libadwaita-1") | |
| 972 | 1018 | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0", "libadwaita-1.0.dylib"}) | |
| 973 | - | var libs []uintptr | |
| 974 | - | for _, libPath := range core.GetPaths("ADW") { | |
| 975 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |
| 976 | - | if err != nil { | |
| 977 | - | panic(err) | |
| 978 | - | } | |
| 979 | - | libs = append(libs, lib) | |
| 980 | - | } | |
| 981 | - | ||
| 982 | - | core.PuregoSafeRegister(&xBottomSheetGLibType, libs, "adw_bottom_sheet_get_type") | |
| 983 | - | ||
| 984 | - | core.PuregoSafeRegister(&xNewBottomSheet, libs, "adw_bottom_sheet_new") | |
| 985 | - | ||
| 986 | - | core.PuregoSafeRegister(&xBottomSheetGetAlign, libs, "adw_bottom_sheet_get_align") | |
| 987 | - | core.PuregoSafeRegister(&xBottomSheetGetBottomBar, libs, "adw_bottom_sheet_get_bottom_bar") | |
| 988 | - | core.PuregoSafeRegister(&xBottomSheetGetBottomBarHeight, libs, "adw_bottom_sheet_get_bottom_bar_height") | |
| 989 | - | core.PuregoSafeRegister(&xBottomSheetGetCanClose, libs, "adw_bottom_sheet_get_can_close") | |
| 990 | - | core.PuregoSafeRegister(&xBottomSheetGetCanOpen, libs, "adw_bottom_sheet_get_can_open") | |
| 991 | - | core.PuregoSafeRegister(&xBottomSheetGetContent, libs, "adw_bottom_sheet_get_content") | |
| 992 | - | core.PuregoSafeRegister(&xBottomSheetGetFullWidth, libs, "adw_bottom_sheet_get_full_width") | |
| 993 | - | core.PuregoSafeRegister(&xBottomSheetGetModal, libs, "adw_bottom_sheet_get_modal") | |
| 994 | - | core.PuregoSafeRegister(&xBottomSheetGetOpen, libs, "adw_bottom_sheet_get_open") | |
| 995 | - | core.PuregoSafeRegister(&xBottomSheetGetRevealBottomBar, libs, "adw_bottom_sheet_get_reveal_bottom_bar") | |
| 996 | - | core.PuregoSafeRegister(&xBottomSheetGetSheet, libs, "adw_bottom_sheet_get_sheet") | |
| 997 | - | core.PuregoSafeRegister(&xBottomSheetGetSheetHeight, libs, "adw_bottom_sheet_get_sheet_height") | |
| 998 | - | core.PuregoSafeRegister(&xBottomSheetGetShowDragHandle, libs, "adw_bottom_sheet_get_show_drag_handle") | |
| 999 | - | core.PuregoSafeRegister(&xBottomSheetSetAlign, libs, "adw_bottom_sheet_set_align") | |
| 1000 | - | core.PuregoSafeRegister(&xBottomSheetSetBottomBar, libs, "adw_bottom_sheet_set_bottom_bar") | |
| 1001 | - | core.PuregoSafeRegister(&xBottomSheetSetCanClose, libs, "adw_bottom_sheet_set_can_close") | |
| 1002 | - | core.PuregoSafeRegister(&xBottomSheetSetCanOpen, libs, "adw_bottom_sheet_set_can_open") | |
| 1003 | - | core.PuregoSafeRegister(&xBottomSheetSetContent, libs, "adw_bottom_sheet_set_content") | |
| 1004 | - | core.PuregoSafeRegister(&xBottomSheetSetFullWidth, libs, "adw_bottom_sheet_set_full_width") | |
| 1005 | - | core.PuregoSafeRegister(&xBottomSheetSetModal, libs, "adw_bottom_sheet_set_modal") | |
| 1006 | - | core.PuregoSafeRegister(&xBottomSheetSetOpen, libs, "adw_bottom_sheet_set_open") | |
| 1007 | - | core.PuregoSafeRegister(&xBottomSheetSetRevealBottomBar, libs, "adw_bottom_sheet_set_reveal_bottom_bar") | |
| 1008 | - | core.PuregoSafeRegister(&xBottomSheetSetSheet, libs, "adw_bottom_sheet_set_sheet") | |
| 1009 | - | core.PuregoSafeRegister(&xBottomSheetSetShowDragHandle, libs, "adw_bottom_sheet_set_show_drag_handle") | |
| 1010 | 1019 | } | |
| @@ -5,7 +5,6 @@ import ( | |||||
| 5 | "structs" | 5 | "structs" | ||
| 6 | "unsafe" | 6 | "unsafe" | ||
| 7 | 7 | ||||
| 8 | - | "github.com/bnema/purego" | |||
| 9 | "github.com/bnema/puregotk/pkg/core" | 8 | "github.com/bnema/puregotk/pkg/core" | ||
| 10 | "github.com/bnema/puregotk/v4/gdk" | 9 | "github.com/bnema/puregotk/v4/gdk" | ||
| 11 | "github.com/bnema/puregotk/v4/glib" | 10 | "github.com/bnema/puregotk/v4/glib" | ||
| @@ -113,6 +112,7 @@ type BottomSheet struct { | |||||
| 113 | var xBottomSheetGLibType func() types.GType | 112 | var xBottomSheetGLibType func() types.GType | ||
| 114 | 113 | ||||
| 115 | func BottomSheetGLibType() types.GType { | 114 | func BottomSheetGLibType() types.GType { | ||
| 115 | + | core.LazyRegister(&xBottomSheetGLibType, "ADW", "adw_bottom_sheet_get_type", false) | |||
| 116 | return xBottomSheetGLibType() | 116 | return xBottomSheetGLibType() | ||
| 117 | } | 117 | } | ||
| 118 | 118 | ||||
| @@ -126,6 +126,7 @@ var xNewBottomSheet func() uintptr | |||||
| 126 | 126 | ||||
| 127 | // Creates a new `AdwBottomSheet`. | 127 | // Creates a new `AdwBottomSheet`. | ||
| 128 | func NewBottomSheet() *BottomSheet { | 128 | func NewBottomSheet() *BottomSheet { | ||
| 129 | + | core.LazyRegister(&xNewBottomSheet, "ADW", "adw_bottom_sheet_new", false) | |||
| 129 | var cls *BottomSheet | 130 | var cls *BottomSheet | ||
| 130 | 131 | ||||
| 131 | cret := xNewBottomSheet() | 132 | cret := xNewBottomSheet() | ||
| @@ -143,6 +144,8 @@ var xBottomSheetGetAlign func(uintptr) float32 | |||||
| 143 | 144 | ||||
| 144 | // Gets horizontal alignment of the bottom sheet. | 145 | // Gets horizontal alignment of the bottom sheet. | ||
| 145 | func (x *BottomSheet) GetAlign() float32 { | 146 | func (x *BottomSheet) GetAlign() float32 { | ||
| 147 | + | core.LazyRegister(&xBottomSheetGetAlign, "ADW", "adw_bottom_sheet_get_align", false) | |||
| 148 | + | ||||
| 146 | cret := xBottomSheetGetAlign(x.GoPointer()) | 149 | cret := xBottomSheetGetAlign(x.GoPointer()) | ||
| 147 | return cret | 150 | return cret | ||
| 148 | } | 151 | } | ||
| @@ -151,6 +154,7 @@ var xBottomSheetGetBottomBar func(uintptr) uintptr | |||||
| 151 | 154 | ||||
| 152 | // Gets the bottom bar widget for @self. | 155 | // Gets the bottom bar widget for @self. | ||
| 153 | func (x *BottomSheet) GetBottomBar() *gtk.Widget { | 156 | func (x *BottomSheet) GetBottomBar() *gtk.Widget { | ||
| 157 | + | core.LazyRegister(&xBottomSheetGetBottomBar, "ADW", "adw_bottom_sheet_get_bottom_bar", false) | |||
| 154 | var cls *gtk.Widget | 158 | var cls *gtk.Widget | ||
| 155 | 159 | ||||
| 156 | cret := xBottomSheetGetBottomBar(x.GoPointer()) | 160 | cret := xBottomSheetGetBottomBar(x.GoPointer()) | ||
| @@ -171,6 +175,8 @@ var xBottomSheetGetBottomBarHeight func(uintptr) int | |||||
| 171 | // It can be used to shift the content upwards permanently to accommodate for | 175 | // It can be used to shift the content upwards permanently to accommodate for | ||
| 172 | // the bottom bar. | 176 | // the bottom bar. | ||
| 173 | func (x *BottomSheet) GetBottomBarHeight() int { | 177 | func (x *BottomSheet) GetBottomBarHeight() int { | ||
| 178 | + | core.LazyRegister(&xBottomSheetGetBottomBarHeight, "ADW", "adw_bottom_sheet_get_bottom_bar_height", false) | |||
| 179 | + | ||||
| 174 | cret := xBottomSheetGetBottomBarHeight(x.GoPointer()) | 180 | cret := xBottomSheetGetBottomBarHeight(x.GoPointer()) | ||
| 175 | return cret | 181 | return cret | ||
| 176 | } | 182 | } | ||
| @@ -179,6 +185,8 @@ var xBottomSheetGetCanClose func(uintptr) bool | |||||
| 179 | 185 | ||||
| 180 | // Gets whether the bottom sheet can be closed by user. | 186 | // Gets whether the bottom sheet can be closed by user. | ||
| 181 | func (x *BottomSheet) GetCanClose() bool { | 187 | func (x *BottomSheet) GetCanClose() bool { | ||
| 188 | + | core.LazyRegister(&xBottomSheetGetCanClose, "ADW", "adw_bottom_sheet_get_can_close", false) | |||
| 189 | + | ||||
| 182 | cret := xBottomSheetGetCanClose(x.GoPointer()) | 190 | cret := xBottomSheetGetCanClose(x.GoPointer()) | ||
| 183 | return cret | 191 | return cret | ||
| 184 | } | 192 | } | ||
| @@ -187,6 +195,8 @@ var xBottomSheetGetCanOpen func(uintptr) bool | |||||
| 187 | 195 | ||||
| 188 | // Gets whether the bottom sheet can be opened by user. | 196 | // Gets whether the bottom sheet can be opened by user. | ||
| 189 | func (x *BottomSheet) GetCanOpen() bool { | 197 | func (x *BottomSheet) GetCanOpen() bool { | ||
| 198 | + | core.LazyRegister(&xBottomSheetGetCanOpen, "ADW", "adw_bottom_sheet_get_can_open", false) | |||
| 199 | + | ||||
| 190 | cret := xBottomSheetGetCanOpen(x.GoPointer()) | 200 | cret := xBottomSheetGetCanOpen(x.GoPointer()) | ||
| 191 | return cret | 201 | return cret | ||
| 192 | } | 202 | } | ||
| @@ -195,6 +205,7 @@ var xBottomSheetGetContent func(uintptr) uintptr | |||||
| 195 | 205 | ||||
| 196 | // Gets the content widget for @self. | 206 | // Gets the content widget for @self. | ||
| 197 | func (x *BottomSheet) GetContent() *gtk.Widget { | 207 | func (x *BottomSheet) GetContent() *gtk.Widget { | ||
| 208 | + | core.LazyRegister(&xBottomSheetGetContent, "ADW", "adw_bottom_sheet_get_content", false) | |||
| 198 | var cls *gtk.Widget | 209 | var cls *gtk.Widget | ||
| 199 | 210 | ||||
| 200 | cret := xBottomSheetGetContent(x.GoPointer()) | 211 | cret := xBottomSheetGetContent(x.GoPointer()) | ||
| @@ -212,6 +223,8 @@ var xBottomSheetGetFullWidth func(uintptr) bool | |||||
| 212 | 223 | ||||
| 213 | // Gets whether the bottom sheet takes the full width. | 224 | // Gets whether the bottom sheet takes the full width. | ||
| 214 | func (x *BottomSheet) GetFullWidth() bool { | 225 | func (x *BottomSheet) GetFullWidth() bool { | ||
| 226 | + | core.LazyRegister(&xBottomSheetGetFullWidth, "ADW", "adw_bottom_sheet_get_full_width", false) | |||
| 227 | + | ||||
| 215 | cret := xBottomSheetGetFullWidth(x.GoPointer()) | 228 | cret := xBottomSheetGetFullWidth(x.GoPointer()) | ||
| 216 | return cret | 229 | return cret | ||
| 217 | } | 230 | } | ||
| @@ -220,6 +233,8 @@ var xBottomSheetGetModal func(uintptr) bool | |||||
| 220 | 233 | ||||
| 221 | // Gets whether the bottom sheet is modal. | 234 | // Gets whether the bottom sheet is modal. | ||
| 222 | func (x *BottomSheet) GetModal() bool { | 235 | func (x *BottomSheet) GetModal() bool { | ||
| 236 | + | core.LazyRegister(&xBottomSheetGetModal, "ADW", "adw_bottom_sheet_get_modal", false) | |||
| 237 | + | ||||
| 223 | cret := xBottomSheetGetModal(x.GoPointer()) | 238 | cret := xBottomSheetGetModal(x.GoPointer()) | ||
| 224 | return cret | 239 | return cret | ||
| 225 | } | 240 | } | ||
| @@ -228,6 +243,8 @@ var xBottomSheetGetOpen func(uintptr) bool | |||||
| 228 | 243 | ||||
| 229 | // Gets whether the bottom sheet is open. | 244 | // Gets whether the bottom sheet is open. | ||
| 230 | func (x *BottomSheet) GetOpen() bool { | 245 | func (x *BottomSheet) GetOpen() bool { | ||
| 246 | + | core.LazyRegister(&xBottomSheetGetOpen, "ADW", "adw_bottom_sheet_get_open", false) | |||
| 247 | + | ||||
| 231 | cret := xBottomSheetGetOpen(x.GoPointer()) | 248 | cret := xBottomSheetGetOpen(x.GoPointer()) | ||
| 232 | return cret | 249 | return cret | ||
| 233 | } | 250 | } | ||
| @@ -236,6 +253,8 @@ var xBottomSheetGetRevealBottomBar func(uintptr) bool | |||||
| 236 | 253 | ||||
| 237 | // Gets whether the bottom bar is revealed. | 254 | // Gets whether the bottom bar is revealed. | ||
| 238 | func (x *BottomSheet) GetRevealBottomBar() bool { | 255 | func (x *BottomSheet) GetRevealBottomBar() bool { | ||
| 256 | + | core.LazyRegister(&xBottomSheetGetRevealBottomBar, "ADW", "adw_bottom_sheet_get_reveal_bottom_bar", false) | |||
| 257 | + | ||||
| 239 | cret := xBottomSheetGetRevealBottomBar(x.GoPointer()) | 258 | cret := xBottomSheetGetRevealBottomBar(x.GoPointer()) | ||
| 240 | return cret | 259 | return cret | ||
| 241 | } | 260 | } | ||
| @@ -244,6 +263,7 @@ var xBottomSheetGetSheet func(uintptr) uintptr | |||||
| 244 | 263 | ||||
| 245 | // Gets the bottom sheet widget for @self. | 264 | // Gets the bottom sheet widget for @self. | ||
| 246 | func (x *BottomSheet) GetSheet() *gtk.Widget { | 265 | func (x *BottomSheet) GetSheet() *gtk.Widget { | ||
| 266 | + | core.LazyRegister(&xBottomSheetGetSheet, "ADW", "adw_bottom_sheet_get_sheet", false) | |||
| 247 | var cls *gtk.Widget | 267 | var cls *gtk.Widget | ||
| 248 | 268 | ||||
| 249 | cret := xBottomSheetGetSheet(x.GoPointer()) | 269 | cret := xBottomSheetGetSheet(x.GoPointer()) | ||
| @@ -263,6 +283,8 @@ var xBottomSheetGetSheetHeight func(uintptr) int | |||||
| 263 | // | 283 | // | ||
| 264 | // It can be used to shift the content upwards when the bottom sheet is open. | 284 | // It can be used to shift the content upwards when the bottom sheet is open. | ||
| 265 | func (x *BottomSheet) GetSheetHeight() int { | 285 | func (x *BottomSheet) GetSheetHeight() int { | ||
| 286 | + | core.LazyRegister(&xBottomSheetGetSheetHeight, "ADW", "adw_bottom_sheet_get_sheet_height", false) | |||
| 287 | + | ||||
| 266 | cret := xBottomSheetGetSheetHeight(x.GoPointer()) | 288 | cret := xBottomSheetGetSheetHeight(x.GoPointer()) | ||
| 267 | return cret | 289 | return cret | ||
| 268 | } | 290 | } | ||
| @@ -271,6 +293,8 @@ var xBottomSheetGetShowDragHandle func(uintptr) bool | |||||
| 271 | 293 | ||||
| 272 | // Gets whether to show a drag handle in the bottom sheet. | 294 | // Gets whether to show a drag handle in the bottom sheet. | ||
| 273 | func (x *BottomSheet) GetShowDragHandle() bool { | 295 | func (x *BottomSheet) GetShowDragHandle() bool { | ||
| 296 | + | core.LazyRegister(&xBottomSheetGetShowDragHandle, "ADW", "adw_bottom_sheet_get_show_drag_handle", false) | |||
| 297 | + | ||||
| 274 | cret := xBottomSheetGetShowDragHandle(x.GoPointer()) | 298 | cret := xBottomSheetGetShowDragHandle(x.GoPointer()) | ||
| 275 | return cret | 299 | return cret | ||
| 276 | } | 300 | } | ||
| @@ -284,6 +308,8 @@ var xBottomSheetSetAlign func(uintptr, float32) | |||||
| 284 | // | 308 | // | ||
| 285 | // Only used when [property@BottomSheet:full-width] is set to `FALSE`. | 309 | // Only used when [property@BottomSheet:full-width] is set to `FALSE`. | ||
| 286 | func (x *BottomSheet) SetAlign(AlignVar float32) { | 310 | func (x *BottomSheet) SetAlign(AlignVar float32) { | ||
| 311 | + | core.LazyRegister(&xBottomSheetSetAlign, "ADW", "adw_bottom_sheet_set_align", false) | |||
| 312 | + | ||||
| 287 | xBottomSheetSetAlign(x.GoPointer(), AlignVar) | 313 | xBottomSheetSetAlign(x.GoPointer(), AlignVar) | ||
| 288 | } | 314 | } | ||
| 289 | 315 | ||||
| @@ -297,6 +323,8 @@ var xBottomSheetSetBottomBar func(uintptr, uintptr) | |||||
| 297 | // Bottom bar can be temporarily hidden using the | 323 | // Bottom bar can be temporarily hidden using the | ||
| 298 | // [property@BottomSheet:reveal-bottom-bar] property. | 324 | // [property@BottomSheet:reveal-bottom-bar] property. | ||
| 299 | func (x *BottomSheet) SetBottomBar(BottomBarVar *gtk.Widget) { | 325 | func (x *BottomSheet) SetBottomBar(BottomBarVar *gtk.Widget) { | ||
| 326 | + | core.LazyRegister(&xBottomSheetSetBottomBar, "ADW", "adw_bottom_sheet_set_bottom_bar", false) | |||
| 327 | + | ||||
| 300 | xBottomSheetSetBottomBar(x.GoPointer(), BottomBarVar.GoPointer()) | 328 | xBottomSheetSetBottomBar(x.GoPointer(), BottomBarVar.GoPointer()) | ||
| 301 | } | 329 | } | ||
| 302 | 330 | ||||
| @@ -309,6 +337,8 @@ var xBottomSheetSetCanClose func(uintptr, bool) | |||||
| 309 | // | 337 | // | ||
| 310 | // Bottom sheet can still be closed using [property@BottomSheet:open]. | 338 | // Bottom sheet can still be closed using [property@BottomSheet:open]. | ||
| 311 | func (x *BottomSheet) SetCanClose(CanCloseVar bool) { | 339 | func (x *BottomSheet) SetCanClose(CanCloseVar bool) { | ||
| 340 | + | core.LazyRegister(&xBottomSheetSetCanClose, "ADW", "adw_bottom_sheet_set_can_close", false) | |||
| 341 | + | ||||
| 312 | xBottomSheetSetCanClose(x.GoPointer(), CanCloseVar) | 342 | xBottomSheetSetCanClose(x.GoPointer(), CanCloseVar) | ||
| 313 | } | 343 | } | ||
| 314 | 344 | ||||
| @@ -322,6 +352,8 @@ var xBottomSheetSetCanOpen func(uintptr, bool) | |||||
| 322 | // | 352 | // | ||
| 323 | // Bottom sheet can still be opened using [property@BottomSheet:open]. | 353 | // Bottom sheet can still be opened using [property@BottomSheet:open]. | ||
| 324 | func (x *BottomSheet) SetCanOpen(CanOpenVar bool) { | 354 | func (x *BottomSheet) SetCanOpen(CanOpenVar bool) { | ||
| 355 | + | core.LazyRegister(&xBottomSheetSetCanOpen, "ADW", "adw_bottom_sheet_set_can_open", false) | |||
| 356 | + | ||||
| 325 | xBottomSheetSetCanOpen(x.GoPointer(), CanOpenVar) | 357 | xBottomSheetSetCanOpen(x.GoPointer(), CanOpenVar) | ||
| 326 | } | 358 | } | ||
| 327 | 359 | ||||
| @@ -331,6 +363,8 @@ var xBottomSheetSetContent func(uintptr, uintptr) | |||||
| 331 | // | 363 | // | ||
| 332 | // It's always shown, and the bottom sheet is overlaid over it. | 364 | // It's always shown, and the bottom sheet is overlaid over it. | ||
| 333 | func (x *BottomSheet) SetContent(ContentVar *gtk.Widget) { | 365 | func (x *BottomSheet) SetContent(ContentVar *gtk.Widget) { | ||
| 366 | + | core.LazyRegister(&xBottomSheetSetContent, "ADW", "adw_bottom_sheet_set_content", false) | |||
| 367 | + | ||||
| 334 | xBottomSheetSetContent(x.GoPointer(), ContentVar.GoPointer()) | 368 | xBottomSheetSetContent(x.GoPointer(), ContentVar.GoPointer()) | ||
| 335 | } | 369 | } | ||
| 336 | 370 | ||||
| @@ -340,6 +374,8 @@ var xBottomSheetSetFullWidth func(uintptr, bool) | |||||
| 340 | // | 374 | // | ||
| 341 | // When full width, [property@BottomSheet:align] is ignored. | 375 | // When full width, [property@BottomSheet:align] is ignored. | ||
| 342 | func (x *BottomSheet) SetFullWidth(FullWidthVar bool) { | 376 | func (x *BottomSheet) SetFullWidth(FullWidthVar bool) { | ||
| 377 | + | core.LazyRegister(&xBottomSheetSetFullWidth, "ADW", "adw_bottom_sheet_set_full_width", false) | |||
| 378 | + | ||||
| 343 | xBottomSheetSetFullWidth(x.GoPointer(), FullWidthVar) | 379 | xBottomSheetSetFullWidth(x.GoPointer(), FullWidthVar) | ||
| 344 | } | 380 | } | ||
| 345 | 381 | ||||
| @@ -353,6 +389,8 @@ var xBottomSheetSetModal func(uintptr, bool) | |||||
| 353 | // | 389 | // | ||
| 354 | // Otherwise, the content is accessible even when the bottom sheet is open. | 390 | // Otherwise, the content is accessible even when the bottom sheet is open. | ||
| 355 | func (x *BottomSheet) SetModal(ModalVar bool) { | 391 | func (x *BottomSheet) SetModal(ModalVar bool) { | ||
| 392 | + | core.LazyRegister(&xBottomSheetSetModal, "ADW", "adw_bottom_sheet_set_modal", false) | |||
| 393 | + | ||||
| 356 | xBottomSheetSetModal(x.GoPointer(), ModalVar) | 394 | xBottomSheetSetModal(x.GoPointer(), ModalVar) | ||
| 357 | } | 395 | } | ||
| 358 | 396 | ||||
| @@ -360,6 +398,8 @@ var xBottomSheetSetOpen func(uintptr, bool) | |||||
| 360 | 398 | ||||
| 361 | // Sets whether the bottom sheet is open. | 399 | // Sets whether the bottom sheet is open. | ||
| 362 | func (x *BottomSheet) SetOpen(OpenVar bool) { | 400 | func (x *BottomSheet) SetOpen(OpenVar bool) { | ||
| 401 | + | core.LazyRegister(&xBottomSheetSetOpen, "ADW", "adw_bottom_sheet_set_open", false) | |||
| 402 | + | ||||
| 363 | xBottomSheetSetOpen(x.GoPointer(), OpenVar) | 403 | xBottomSheetSetOpen(x.GoPointer(), OpenVar) | ||
| 364 | } | 404 | } | ||
| 365 | 405 | ||||
| @@ -372,6 +412,8 @@ var xBottomSheetSetRevealBottomBar func(uintptr, bool) | |||||
| 372 | // See [property@BottomSheet:bottom-bar] and | 412 | // See [property@BottomSheet:bottom-bar] and | ||
| 373 | // [property@BottomSheet:bottom-bar-height]. | 413 | // [property@BottomSheet:bottom-bar-height]. | ||
| 374 | func (x *BottomSheet) SetRevealBottomBar(RevealVar bool) { | 414 | func (x *BottomSheet) SetRevealBottomBar(RevealVar bool) { | ||
| 415 | + | core.LazyRegister(&xBottomSheetSetRevealBottomBar, "ADW", "adw_bottom_sheet_set_reveal_bottom_bar", false) | |||
| 416 | + | ||||
| 375 | xBottomSheetSetRevealBottomBar(x.GoPointer(), RevealVar) | 417 | xBottomSheetSetRevealBottomBar(x.GoPointer(), RevealVar) | ||
| 376 | } | 418 | } | ||
| 377 | 419 | ||||
| @@ -381,6 +423,8 @@ var xBottomSheetSetSheet func(uintptr, uintptr) | |||||
| 381 | // | 423 | // | ||
| 382 | // Only shown when [property@BottomSheet:open] is `TRUE`. | 424 | // Only shown when [property@BottomSheet:open] is `TRUE`. | ||
| 383 | func (x *BottomSheet) SetSheet(SheetVar *gtk.Widget) { | 425 | func (x *BottomSheet) SetSheet(SheetVar *gtk.Widget) { | ||
| 426 | + | core.LazyRegister(&xBottomSheetSetSheet, "ADW", "adw_bottom_sheet_set_sheet", false) | |||
| 427 | + | ||||
| 384 | xBottomSheetSetSheet(x.GoPointer(), SheetVar.GoPointer()) | 428 | xBottomSheetSetSheet(x.GoPointer(), SheetVar.GoPointer()) | ||
| 385 | } | 429 | } | ||
| 386 | 430 | ||||
| @@ -396,6 +440,8 @@ var xBottomSheetSetShowDragHandle func(uintptr, bool) | |||||
| 396 | // Showing drag handle also allows to swipe the bottom sheet down (and to swipe | 440 | // Showing drag handle also allows to swipe the bottom sheet down (and to swipe | ||
| 397 | // the bottom bar up) with a pointer, instead of just touchscreen. | 441 | // the bottom bar up) with a pointer, instead of just touchscreen. | ||
| 398 | func (x *BottomSheet) SetShowDragHandle(ShowDragHandleVar bool) { | 442 | func (x *BottomSheet) SetShowDragHandle(ShowDragHandleVar bool) { | ||
| 443 | + | core.LazyRegister(&xBottomSheetSetShowDragHandle, "ADW", "adw_bottom_sheet_set_show_drag_handle", false) | |||
| 444 | + | ||||
| 399 | xBottomSheetSetShowDragHandle(x.GoPointer(), ShowDragHandleVar) | 445 | xBottomSheetSetShowDragHandle(x.GoPointer(), ShowDragHandleVar) | ||
| 400 | } | 446 | } | ||
| 401 | 447 | ||||
| @@ -970,41 +1016,4 @@ func (x *BottomSheet) GetBuildableId() string { | |||||
| 970 | func init() { | 1016 | func init() { | ||
| 971 | core.SetPackageName("ADW", "libadwaita-1") | 1017 | core.SetPackageName("ADW", "libadwaita-1") | ||
| 972 | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0", "libadwaita-1.0.dylib"}) | 1018 | core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0", "libadwaita-1.0.dylib"}) | ||
| 973 | - | var libs []uintptr | |||
| 974 | - | for _, libPath := range core.GetPaths("ADW") { | |||
| 975 | - | lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) | |||
| 976 | - | if err != nil { | |||
| 977 | - | panic(err) | |||
| 978 | - | } | |||
| 979 | - | libs = append(libs, lib) | |||
| 980 | - | } | |||
| 981 | - | ||||
| 982 | - | core.PuregoSafeRegister(&xBottomSheetGLibType, libs, "adw_bottom_sheet_get_type") | |||
| 983 | - | ||||
| 984 | - | core.PuregoSafeRegister(&xNewBottomSheet, libs, "adw_bottom_sheet_new") | |||
| 985 | - | ||||
| 986 | - | core.PuregoSafeRegister(&xBottomSheetGetAlign, libs, "adw_bottom_sheet_get_align") | |||
| 987 | - | core.PuregoSafeRegister(&xBottomSheetGetBottomBar, libs, "adw_bottom_sheet_get_bottom_bar") | |||
| 988 | - | core.PuregoSafeRegister(&xBottomSheetGetBottomBarHeight, libs, "adw_bottom_sheet_get_bottom_bar_height") | |||
| 989 | - | core.PuregoSafeRegister(&xBottomSheetGetCanClose, libs, "adw_bottom_sheet_get_can_close") | |||
| 990 | - | core.PuregoSafeRegister(&xBottomSheetGetCanOpen, libs, "adw_bottom_sheet_get_can_open") | |||
| 991 | - | core.PuregoSafeRegister(&xBottomSheetGetContent, libs, "adw_bottom_sheet_get_content") | |||
| 992 | - | core.PuregoSafeRegister(&xBottomSheetGetFullWidth, libs, "adw_bottom_sheet_get_full_width") | |||
| 993 | - | core.PuregoSafeRegister(&xBottomSheetGetModal, libs, "adw_bottom_sheet_get_modal") | |||
| 994 | - | core.PuregoSafeRegister(&xBottomSheetGetOpen, libs, "adw_bottom_sheet_get_open") | |||
| 995 | - | core.PuregoSafeRegister(&xBottomSheetGetRevealBottomBar, libs, "adw_bottom_sheet_get_reveal_bottom_bar") | |||
| 996 | - | core.PuregoSafeRegister(&xBottomSheetGetSheet, libs, "adw_bottom_sheet_get_sheet") | |||
| 997 | - | core.PuregoSafeRegister(&xBottomSheetGetSheetHeight, libs, "adw_bottom_sheet_get_sheet_height") | |||
| 998 | - | core.PuregoSafeRegister(&xBottomSheetGetShowDragHandle, libs, "adw_bottom_sheet_get_show_drag_handle") | |||
| 999 | - | core.PuregoSafeRegister(&xBottomSheetSetAlign, libs, "adw_bottom_sheet_set_align") | |||
| 1000 | - | core.PuregoSafeRegister(&xBottomSheetSetBottomBar, libs, "adw_bottom_sheet_set_bottom_bar") | |||
| 1001 | - | core.PuregoSafeRegister(&xBottomSheetSetCanClose, libs, "adw_bottom_sheet_set_can_close") | |||
| 1002 | - | core.PuregoSafeRegister(&xBottomSheetSetCanOpen, libs, "adw_bottom_sheet_set_can_open") | |||
| 1003 | - | core.PuregoSafeRegister(&xBottomSheetSetContent, libs, "adw_bottom_sheet_set_content") | |||
| 1004 | - | core.PuregoSafeRegister(&xBottomSheetSetFullWidth, libs, "adw_bottom_sheet_set_full_width") | |||
| 1005 | - | core.PuregoSafeRegister(&xBottomSheetSetModal, libs, "adw_bottom_sheet_set_modal") | |||
| 1006 | - | core.PuregoSafeRegister(&xBottomSheetSetOpen, libs, "adw_bottom_sheet_set_open") | |||
| 1007 | - | core.PuregoSafeRegister(&xBottomSheetSetRevealBottomBar, libs, "adw_bottom_sheet_set_reveal_bottom_bar") | |||
| 1008 | - | core.PuregoSafeRegister(&xBottomSheetSetSheet, libs, "adw_bottom_sheet_set_sheet") | |||
| 1009 | - | core.PuregoSafeRegister(&xBottomSheetSetShowDragHandle, libs, "adw_bottom_sheet_set_show_drag_handle") | |||
| 1010 | } | 1019 | } | ||