Skip to content

Commit f5fbd84

Browse files
committed
fix: support Xcode 26
1 parent 9120a5a commit f5fbd84

6 files changed

Lines changed: 332 additions & 114 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,23 @@ jobs:
8989
rm -rf ./dist/libmpv*
9090
rm -rf ./dist/release/libmpv
9191
rm -rf ./dist/release/xcframework
92-
92+
93+
- name: Test Build
94+
run: |
95+
rm -rf ./Package.swift
96+
cp -f ./dist/release/Package.test.swift ./Package.swift
97+
98+
xcodebuild -resolvePackageDependencies \
99+
-project Demo/Demo-macOS/Demo-macOS.xcodeproj \
100+
-scheme Demo-macOS
101+
102+
xcodebuild -project Demo/Demo-macOS/Demo-macOS.xcodeproj \
103+
-scheme Demo-macOS \
104+
-configuration Release \
105+
CODE_SIGN_IDENTITY="-" \
106+
CODE_SIGNING_REQUIRED=NO \
107+
CODE_SIGNING_ALLOWED=NO \
108+
build
93109
94110
- name: Build LGPL version
95111
run: |

‎.github/workflows/ci.yml‎

Lines changed: 37 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,56 @@
1-
name: CI Test
1+
name: CI
22

33
on:
44
push:
55
branches:
6-
- ci
6+
- main
77
workflow_dispatch:
8-
inputs:
9-
version:
10-
description: 'Release tag name (default mpv version)'
11-
default: ''
128

139
jobs:
1410
build:
1511
permissions:
1612
contents: write
17-
runs-on: macos-14
13+
runs-on: macos-latest
1814
steps:
1915
- uses: actions/checkout@v4
2016

21-
- name: Check version to release
22-
uses: jannekem/run-python-script-action@v1
23-
with:
24-
script: |
25-
import re
17+
- name: Show Xcode version
18+
run: xcodebuild -version
2619

27-
def normalize_version(version_string):
28-
version_string = re.sub(r'[^.0-9]+|-.+', '', version_string)
29-
parts = re.split(r'\.', version_string)
30-
major = int(parts[0])
31-
minor = int(parts[1]) if len(parts) > 1 else 0
32-
patch = int(parts[2]) if len(parts) > 2 else 0
33-
return f"{major}.{minor}.{patch}"
20+
- name: Show available SDKs
21+
run: xcodebuild -showsdks
3422

35-
file_path = './Sources/BuildScripts/XCFrameworkBuild/main.swift'
36-
with open(file_path, 'r', encoding='utf-8') as file:
37-
content = file.read()
38-
39-
mpvVersion = re.search(r'(case .libmpv[^"]+?)"(.+?)"', content).group(2)
40-
ffmpegVersion = re.search(r'(case .FFmpeg[^"]+?)"(.+?)"', content).group(2)
41-
libplaceboVersion = re.search(r'(case .libplacebo[^"]+?)"(.+?)"', content).group(2)
42-
vulkanVersion = re.search(r'(case .vulkan[^"]+?)"(.+?)"', content).group(2)
43-
44-
print(f'mpv version: {mpvVersion}')
45-
print(f'ffmpeg version: {ffmpegVersion}')
46-
releaseVersion = '${{ github.event.inputs.version }}' or normalize_version(mpvVersion)
47-
print(f'release version: {releaseVersion}')
48-
set_env('BUILD_VERSION', mpvVersion)
49-
set_env('RELEASE_VERSION', releaseVersion)
50-
51-
with open('/tmp/RELEASE_NOTE.txt', 'w', encoding='utf-8') as file:
52-
file.write(f'''
53-
* mpv version: {mpvVersion} ([changelog](https://github.com/mpv-player/mpv/releases/tag/{mpvVersion}))
54-
* ffmpeg version: {ffmpegVersion} ([changelog](https://github.com/FFmpeg/FFmpeg/blob/{ffmpegVersion}/Changelog))
55-
* placebo version: v{libplaceboVersion}
56-
* MoltenVK version: v{vulkanVersion}
57-
''')
58-
59-
60-
- name: Install dependencies
23+
- name: Build macOS
24+
id: build
6125
run: |
62-
brew install autoconf
63-
brew install automake
64-
brew install libtool
65-
python -m pip install meson==1.4.2
66-
brew install ninja
67-
brew install rename
68-
69-
- name: Setup Xcode to support visionOS
26+
xcodebuild -resolvePackageDependencies \
27+
-project Demo/Demo-macOS/Demo-macOS.xcodeproj \
28+
-scheme Demo-macOS
29+
30+
xcodebuild -project Demo/Demo-macOS/Demo-macOS.xcodeproj \
31+
-scheme Demo-macOS \
32+
-configuration Release \
33+
CODE_SIGN_IDENTITY="-" \
34+
CODE_SIGNING_REQUIRED=NO \
35+
CODE_SIGNING_ALLOWED=NO \
36+
build
37+
38+
- name: Build iOS
39+
id: build
7040
run: |
71-
sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
72-
xcodebuild -showsdks
41+
xcodebuild -resolvePackageDependencies \
42+
-project Demo/Demo-iOS/Demo-iOS.xcodeproj \
43+
-scheme Demo-iOS
7344
74-
- name: Build GPL version
75-
run: |
76-
make build enable-gpl version=${{ env.RELEASE_VERSION }} platform=maccatalyst,xros,ios,macos
45+
xcodebuild -project Demo/Demo-iOS/Demo-iOS.xcodeproj \
46+
-scheme Demo-iOS \
47+
-configuration Release \
48+
CODE_SIGN_IDENTITY="-" \
49+
CODE_SIGNING_REQUIRED=NO \
50+
CODE_SIGNING_ALLOWED=NO \
51+
build
7752
78-
cd ./dist/release
79-
rename 's/-all\.zip/-GPL-all\.zip/' *-all.zip
80-
rename 's/\.xcframework\.zip/-GPL\.xcframework\.zip/' *.xcframework.zip
81-
rename 's/\.xcframework\.checksum\.txt/-GPL\.xcframework\.checksum\.txt/' *.xcframework.checksum.txt
53+
54+
- name: Build Succeeded
55+
run: |
56+
echo "Build completed successfully."

‎.github/workflows/test.yml‎

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Test Build
2+
3+
on:
4+
push:
5+
branches:
6+
- ci
7+
- test
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Release tag name (default mpv version)'
12+
default: ''
13+
14+
jobs:
15+
build:
16+
permissions:
17+
contents: write
18+
runs-on: macos-15
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Check version to release
23+
uses: jannekem/run-python-script-action@v1
24+
with:
25+
script: |
26+
import re
27+
28+
def normalize_version(version_string):
29+
version_string = re.sub(r'[^.0-9]+|-.+', '', version_string)
30+
parts = re.split(r'\.', version_string)
31+
major = int(parts[0])
32+
minor = int(parts[1]) if len(parts) > 1 else 0
33+
patch = int(parts[2]) if len(parts) > 2 else 0
34+
return f"{major}.{minor}.{patch}"
35+
36+
file_path = './Sources/BuildScripts/XCFrameworkBuild/main.swift'
37+
with open(file_path, 'r', encoding='utf-8') as file:
38+
content = file.read()
39+
40+
mpvVersion = re.search(r'(case .libmpv[^"]+?)"(.+?)"', content).group(2)
41+
ffmpegVersion = re.search(r'(case .FFmpeg[^"]+?)"(.+?)"', content).group(2)
42+
libplaceboVersion = re.search(r'(case .libplacebo[^"]+?)"(.+?)"', content).group(2)
43+
vulkanVersion = re.search(r'(case .vulkan[^"]+?)"(.+?)"', content).group(2)
44+
45+
print(f'mpv version: {mpvVersion}')
46+
print(f'ffmpeg version: {ffmpegVersion}')
47+
releaseVersion = '${{ github.event.inputs.version }}' or normalize_version(mpvVersion)
48+
print(f'release version: {releaseVersion}')
49+
set_env('BUILD_VERSION', mpvVersion)
50+
set_env('RELEASE_VERSION', releaseVersion)
51+
52+
with open('/tmp/RELEASE_NOTE.txt', 'w', encoding='utf-8') as file:
53+
file.write(f'''
54+
* mpv version: {mpvVersion} ([changelog](https://github.com/mpv-player/mpv/releases/tag/{mpvVersion}))
55+
* ffmpeg version: {ffmpegVersion} ([changelog](https://github.com/FFmpeg/FFmpeg/blob/{ffmpegVersion}/Changelog))
56+
* placebo version: v{libplaceboVersion}
57+
* MoltenVK version: v{vulkanVersion}
58+
''')
59+
60+
61+
- name: Install dependencies
62+
run: |
63+
brew install autoconf
64+
brew install automake
65+
brew install libtool
66+
python -m pip install meson==1.4.2
67+
brew install ninja
68+
brew install rename
69+
70+
- name: Build GPL version
71+
run: |
72+
make build enable-gpl version=${{ env.RELEASE_VERSION }} platform=maccatalyst,xros,ios,macos
73+
74+
cd ./dist/release
75+
rename 's/-all\.zip/-GPL-all\.zip/' *-all.zip
76+
rename 's/\.xcframework\.zip/-GPL\.xcframework\.zip/' *.xcframework.zip
77+
rename 's/\.xcframework\.checksum\.txt/-GPL\.xcframework\.checksum\.txt/' *.xcframework.checksum.txt

‎Sources/BuildScripts/XCFrameworkBuild/base.swift‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ enum Build {
1919
if !FileManager.default.fileExists(atPath: path.path) {
2020
try? FileManager.default.createDirectory(at: path, withIntermediateDirectories: false, attributes: nil)
2121
}
22-
try? FileManager.default.removeItem(atPath: (URL.currentDirectory + "dist/release/Package.swift").path)
22+
try? Utility.removeFiles(extensions: [".swift"], currentDirectoryURL: URL.currentDirectory + ["dist", "release"])
2323
FileManager.default.changeCurrentDirectoryPath(path.path)
2424
BaseBuild.options = options
2525
if !options.platforms.isEmpty {
@@ -775,6 +775,27 @@ class BaseBuild {
775775
""")
776776
try! str.write(toFile: packageFile.path, atomically: true, encoding: .utf8)
777777
}
778+
779+
// for github action test
780+
let templateForTest = URL.currentDirectory + ["../docs/Package.test.swift"]
781+
if FileManager.default.fileExists(atPath: templateForTest.path) {
782+
let packageFileForTest = releaseDirPath + "Package.test.swift"
783+
if !FileManager.default.fileExists(atPath: packageFileForTest.path) {
784+
try! FileManager.default.copyItem(at: templateForTest, to: packageFileForTest)
785+
}
786+
if let data = FileManager.default.contents(atPath: packageFileForTest.path), var str = String(data: data, encoding: .utf8) {
787+
let placeholderChars = "//AUTO_GENERATE_TARGETS_END//"
788+
str = str.replacingOccurrences(of:
789+
"""
790+
\(placeholderChars)
791+
""", with:
792+
"""
793+
\(dependencyTargetContent)
794+
\(placeholderChars)
795+
""")
796+
try! str.write(toFile: packageFileForTest.path, atomically: true, encoding: .utf8)
797+
}
798+
}
778799
}
779800

780801
func getFirstSuccessPlatform() -> PlatformType? {
@@ -932,7 +953,7 @@ enum PlatformType: String, CaseIterable {
932953
}
933954
}
934955

935-
956+
// xcodebuild default ARCHS = "$(ARCHS_STANDARD_64_BIT)" only build arm64e for tvos
936957
var architectures: [ArchType] {
937958
switch self {
938959
case .ios, .xros:

0 commit comments

Comments
 (0)