build: one version for the app and the plugin
D11 replaces an installed plugin only when the shipped manifest is newer, but the manifest version was kept by hand and still said 1.0.0.1, the version of a test build installed before the snapshot sharing and appPath fixes, so that stale plugin was never replaced. Directory.Build.props now holds the only version, 1.0.1; publish.py stamps it into the shipped manifest and the app shows it in its title. Tests that waited on real time (file retry, popup expiry) use controlled timers, and real process waits have wider margins. Refs #1
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
"""D1/D11: publish the three NativeAOT programs and bundle the plugin assets."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import zipfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
def main():
|
||||
@@ -16,6 +18,11 @@ def main():
|
||||
parser.add_argument('--skip-app', action='store_true')
|
||||
args = parser.parse_args()
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
version = ET.parse(root / 'Directory.Build.props').findtext('.//Version')
|
||||
parts = (version or '').split('.')
|
||||
if len(parts) != 3 or not all(part.isascii() and part.isdigit() for part in parts):
|
||||
parser.error('Directory.Build.props must define a three-part numeric Version.')
|
||||
plugin_version = version + '.0'
|
||||
output = (args.out or root / 'artifacts' / 'publish' / args.rid).resolve()
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
if any(output.iterdir()):
|
||||
@@ -44,6 +51,10 @@ def main():
|
||||
else:
|
||||
shutil.copy2(file, target)
|
||||
shutil.copytree(root / 'src' / 'FinalToken.StreamDeck' / 'plugin', plugin, dirs_exist_ok=True)
|
||||
manifest_path = plugin / 'manifest.json'
|
||||
manifest = json.loads(manifest_path.read_text(encoding='utf-8'))
|
||||
manifest['Version'] = plugin_version
|
||||
manifest_path.write_text(json.dumps(manifest, indent=2) + '\n', encoding='utf-8')
|
||||
archive = output.parent / (output.name + '.zip')
|
||||
if archive.exists():
|
||||
raise RuntimeError('Archive already exists: ' + str(archive))
|
||||
@@ -57,6 +68,7 @@ def main():
|
||||
if file.is_file():
|
||||
print(str(file.relative_to(output)) + ' (' + str(file.stat().st_size) + ' bytes)')
|
||||
print('Archive: ' + str(archive))
|
||||
print('Plugin Version: ' + plugin_version)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user