mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Derive the version from the Cargo/pubspec manifests
The version string was duplicated across six places. Collapse it to two ecosystem sources of truth and derive the rest: - backend/src/web_server.rs: omit the OpenAPI info.version so utoipa fills it from CARGO_PKG_VERSION (backend/Cargo.toml); add a test pinning this. - nix/package.nix: read the version from backend/Cargo.toml via fromTOML. - nix/frontend.nix: read the version from frontend/pubspec.yaml by splitting into lines (a whole-file regex triggers catastrophic backtracking in Nix's regex engine). - frontend/lib/about/about.dart: read the version at runtime via package_info_plus instead of a hardcoded constant. Also drop frontend/pubspec.lock.json: it is unreferenced (Nix's autoPubspecLock generates its own JSON from pubspec.lock) and was going stale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
dd089a9cbc
commit
4a1fe60ec3
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
const _version = '0.1.0';
|
||||
// The version is read at runtime from the bundled package metadata
|
||||
// (frontend/pubspec.yaml), so it never needs to be hand-edited here.
|
||||
const _releaseDate = 'May 28, 2026';
|
||||
const _repoUrl = 'https://github.com/rzuasti/oott';
|
||||
const _licenseUrl = 'https://www.gnu.org/licenses/agpl-3.0.html';
|
||||
@@ -28,11 +30,20 @@ class About extends StatelessWidget {
|
||||
style: textTheme.bodyLarge,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'v$_version - released $_releaseDate',
|
||||
style: textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
FutureBuilder<PackageInfo>(
|
||||
future: PackageInfo.fromPlatform(),
|
||||
builder: (context, snapshot) {
|
||||
final version = snapshot.data?.version;
|
||||
final label = version == null
|
||||
? 'Released $_releaseDate'
|
||||
: 'v$version - released $_releaseDate';
|
||||
return Text(
|
||||
label,
|
||||
style: textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_SurfaceContainer(
|
||||
|
||||
Reference in New Issue
Block a user