Skip to content

Commit e92614e

Browse files
committed
chore: organize operipa-versions in openiap-version.json
1 parent 9e9f7a7 commit e92614e

File tree

5 files changed

+59
-7
lines changed

5 files changed

+59
-7
lines changed

android/build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import groovy.json.JsonSlurper
2+
3+
def openiapVersionsFile = new File(rootDir.parentFile, 'openiap-versions.json')
4+
def openiapVersions = new JsonSlurper().parse(openiapVersionsFile)
5+
def openiapGoogleVersion = openiapVersions['google']
6+
17
group 'dev.hyo.flutterinapppurchase'
28
version '1.0-SNAPSHOT'
39

@@ -51,8 +57,8 @@ android {
5157
}
5258

5359
dependencies {
54-
// OpenIAP Google billing wrapper (1.1.0) includes Google Play Billing
55-
implementation "io.github.hyochan.openiap:openiap-google:1.2.6"
60+
// OpenIAP Google billing wrapper includes Google Play Billing
61+
implementation "io.github.hyochan.openiap:openiap-google:${openiapGoogleVersion}"
5662

5763
// For local debugging with a checked-out module, you can switch to:
5864
// debugImplementation project(":openiap")

example/ios/Podfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# CocoaPods trunk CDN (ensures latest specs like openiap 1.1.9)
22
source 'https://cdn.cocoapods.org/'
33

4+
require 'json'
5+
6+
openiap_versions_path = File.expand_path('../../openiap-versions.json', __dir__)
7+
openiap_versions = JSON.parse(File.read(openiap_versions_path))
8+
49
# Uncomment this line to define a global platform for your project
510
platform :ios, '15.0'
611

@@ -32,8 +37,8 @@ flutter_ios_podfile_setup
3237

3338
target 'Runner' do
3439
use_frameworks!
35-
# Ensure openiap resolves to 1.1.9 even if trunk index is lagging
36-
pod 'openiap', :git => 'https://github.com/hyodotdev/openiap-apple.git', :tag => '1.1.12'
40+
# Ensure openiap resolves to the pinned version even if trunk index is lagging
41+
pod 'openiap', :git => 'https://github.com/hyodotdev/openiap-apple.git', :tag => openiap_versions['apple']
3742
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3843
end
3944

ios/flutter_inapp_purchase.podspec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#
22
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
33
#
4+
require 'json'
5+
require 'pathname'
6+
7+
podspec_dir = Pathname.new(__dir__).realpath
8+
versions_path = podspec_dir.join('..', 'openiap-versions.json')
9+
openiap_versions = JSON.parse(File.read(versions_path))
10+
411
Pod::Spec.new do |s|
512
s.name = 'flutter_inapp_purchase'
613
s.version = '0.0.1'
@@ -15,8 +22,7 @@ In App Purchase plugin for flutter. This project has been forked by react-native
1522
s.source_files = 'Classes/**/*.swift'
1623
s.dependency 'Flutter'
1724
# Use OpenIAP Apple native module (via CocoaPods)
18-
# Pin exactly 1.1.12 to avoid unexpected updates
19-
s.dependency 'openiap', '1.1.12'
25+
s.dependency 'openiap', openiap_versions['apple']
2026

2127
s.ios.deployment_target = '15.0'
2228
s.swift_version = '5.5'

openiap-versions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"apple": "1.2.2",
3+
"google": "1.2.6",
4+
"gql": "1.0.8"
5+
}

scripts/generate-type.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
ZIP_URL="https://github.com/hyodotdev/openiap-gql/releases/download/1.0.8/openiap-dart.zip"
54
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
65
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
76
TARGET_FILE="${REPO_ROOT}/lib/types.dart"
87
TMP_DIR="$(mktemp -d)"
8+
VERSIONS_FILE="${REPO_ROOT}/openiap-versions.json"
9+
10+
if ! command -v python3 >/dev/null 2>&1; then
11+
echo "Error: python3 is required but not installed." >&2
12+
exit 1
13+
fi
14+
15+
OPENIAP_GQL_VERSION=$(python3 - <<'PY'
16+
import json
17+
import sys
18+
from pathlib import Path
19+
versions_path = Path(sys.argv[1])
20+
try:
21+
data = json.loads(versions_path.read_text())
22+
except FileNotFoundError:
23+
print(f"Error: {versions_path} not found", file=sys.stderr)
24+
sys.exit(1)
25+
except json.JSONDecodeError as exc:
26+
print(f"Error parsing {versions_path}: {exc}", file=sys.stderr)
27+
sys.exit(1)
28+
29+
value = data.get('gql')
30+
if not value:
31+
print("Error: 'gql' version missing in openiap-versions.json", file=sys.stderr)
32+
sys.exit(1)
33+
34+
print(value)
35+
PY
36+
"${VERSIONS_FILE}")
37+
38+
ZIP_URL="https://github.com/hyodotdev/openiap-gql/releases/download/${OPENIAP_GQL_VERSION}/openiap-dart.zip"
939

1040
cleanup() {
1141
rm -rf "${TMP_DIR}"

0 commit comments

Comments
 (0)