Skip to content

Commit 865b3f8

Browse files
Fix Android and iOS feature builds (#32)
* Download python dists from jobs for non-release builds * copyBuildDist task * Enable all CI jobs * Cleanup * Re-enable pubspec.lock in apps * Deps updated
1 parent 8a757bd commit 865b3f8

File tree

18 files changed

+146
-1590
lines changed

18 files changed

+146
-1590
lines changed

.appveyor.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ for:
152152
- popd
153153

154154
# package all .so files
155-
- DIST_FILE_NAME=python-android-dist-v$APPVEYOR_BUILD_VERSION.zip
155+
- DIST_FILE_NAME=python-android-dist-v$APPVEYOR_BUILD_VERSION.tar.gz
156156
- pushd ~/.local/share/python-for-android/dists/serious_python/libs
157-
- zip -r $DIST_FILE_NAME .
157+
- tar -czvf $DIST_FILE_NAME *
158158
- appveyor PushArtifact $DIST_FILE_NAME -DeploymentName python-dist-android
159159
- popd
160160

@@ -184,6 +184,13 @@ for:
184184
- flutter config --enable-macos-desktop
185185
- flutter doctor
186186

187+
# download dist for non-releases
188+
- |
189+
if [[ "$APPVEYOR_REPO_TAG_NAME" == "" ]]; then
190+
python3 ci/download_artifact.py "Build Python for iOS" "python-ios-dist-v{version}.tar.gz"
191+
export SERIOUS_PYTHON_IOS_DIST=$APPVEYOR_BUILD_FOLDER/python_dist/dist
192+
fi
193+
187194
build: off
188195

189196
test_script:
@@ -216,6 +223,13 @@ for:
216223
xcrun simctl boot "${UDID:?No Simulator with this name found}"
217224
- flutter doctor -v
218225

226+
# download dist for non-releases
227+
- |
228+
if [[ "$APPVEYOR_REPO_TAG_NAME" == "" ]]; then
229+
python3 ci/download_artifact.py "Build Python for iOS" "python-ios-dist-v{version}.tar.gz"
230+
export SERIOUS_PYTHON_IOS_DIST=$APPVEYOR_BUILD_FOLDER/python_dist/dist
231+
fi
232+
219233
build: off
220234

221235
test_script:
@@ -251,6 +265,13 @@ for:
251265
- flutter upgrade --force
252266
- flutter doctor -v
253267

268+
# download dist for non-releases
269+
- |
270+
if [[ "$APPVEYOR_REPO_TAG_NAME" == "" ]]; then
271+
python3 ci/download_artifact.py "Build Python for Android" "python-android-dist-v{version}.tar.gz"
272+
export SERIOUS_PYTHON_BUILD_DIST=$APPVEYOR_BUILD_FOLDER/python_dist
273+
fi
274+
254275
build: off
255276

256277
test_script:

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ migrate_working_dir/
2323

2424
# Flutter/Dart/Pub related
2525
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26-
/pubspec.lock
26+
pubspec.lock
2727
**/doc/api/
2828
.dart_tool/
2929
.packages
3030
build/
3131
dist/
3232
.cache
33+
.flutter-plugins
34+
.flutter-plugins-dependencies
3335

3436
# Python
3537
.venv/

ci/download_artifact.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import json
2+
import os
3+
import pathlib
4+
import sys
5+
import tarfile
6+
import urllib.request
7+
8+
if len(sys.argv) < 2:
9+
print("Specify artifact job name and artifact deployment name to download")
10+
sys.exit(1)
11+
12+
artifact_job_name = sys.argv[1]
13+
artifact_file_name = sys.argv[2].format(
14+
version=os.environ.get("APPVEYOR_BUILD_VERSION")
15+
)
16+
17+
build_jobs = {}
18+
19+
20+
def download_job_artifact(job_id, file_name, dest_file):
21+
url = f"https://ci.appveyor.com/api/buildjobs/{job_id}/artifacts/{file_name}"
22+
print(f"Downloading {url}...")
23+
urllib.request.urlretrieve(url, dest_file)
24+
25+
26+
def get_build_job_ids():
27+
account_name = os.environ.get("APPVEYOR_ACCOUNT_NAME")
28+
project_slug = os.environ.get("APPVEYOR_PROJECT_SLUG")
29+
build_id = os.environ.get("APPVEYOR_BUILD_ID")
30+
url = f"https://ci.appveyor.com/api/projects/{account_name}/{project_slug}/builds/{build_id}"
31+
print(f"Fetching build details at {url}")
32+
req = urllib.request.Request(url)
33+
req.add_header("Content-type", "application/json")
34+
project = json.loads(urllib.request.urlopen(req).read().decode())
35+
for job in project["build"]["jobs"]:
36+
build_jobs[job["name"]] = job["jobId"]
37+
38+
39+
current_dir = pathlib.Path(os.getcwd())
40+
print("current_dir", current_dir)
41+
42+
get_build_job_ids()
43+
44+
# create "web" directory
45+
dist_path = current_dir.joinpath("python_dist")
46+
dist_path.mkdir(exist_ok=True)
47+
tar_path = current_dir.joinpath(artifact_file_name)
48+
download_job_artifact(build_jobs[artifact_job_name], artifact_file_name, tar_path)
49+
with tarfile.open(tar_path, "r:gz") as tar:
50+
tar.extractall(str(dist_path))
51+
os.remove(tar_path)

src/serious_python/.gitignore

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Dart
2+
!pubspec.lock
3+
4+
# Python
5+
.venv/
6+
__pypackages__/
7+
*.zip

src/serious_python/example/flask_example/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
import FlutterMacOS
66
import Foundation
77

8+
import package_info_plus
89
import path_provider_foundation
910
import serious_python_darwin
1011

1112
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
13+
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
1214
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
1315
SeriousPythonPlugin.register(with: registry.registrar(forPlugin: "SeriousPythonPlugin"))
1416
}

src/serious_python/example/flask_example/pubspec.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ packages:
123123
description: flutter
124124
source: sdk
125125
version: "0.0.0"
126+
flutter_web_plugins:
127+
dependency: transitive
128+
description: flutter
129+
source: sdk
130+
version: "0.0.0"
126131
http:
127132
dependency: "direct main"
128133
description:
@@ -179,6 +184,22 @@ packages:
179184
url: "https://pub.dev"
180185
source: hosted
181186
version: "1.9.1"
187+
package_info_plus:
188+
dependency: transitive
189+
description:
190+
name: package_info_plus
191+
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
192+
url: "https://pub.dev"
193+
source: hosted
194+
version: "4.2.0"
195+
package_info_plus_platform_interface:
196+
dependency: transitive
197+
description:
198+
name: package_info_plus_platform_interface
199+
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
200+
url: "https://pub.dev"
201+
source: hosted
202+
version: "2.0.1"
182203
path:
183204
dependency: transitive
184205
description:

src/serious_python/example/run_example/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
import FlutterMacOS
66
import Foundation
77

8+
import package_info_plus
89
import path_provider_foundation
910
import serious_python_darwin
1011

1112
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
13+
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
1214
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
1315
SeriousPythonPlugin.register(with: registry.registrar(forPlugin: "SeriousPythonPlugin"))
1416
}

src/serious_python/example/run_example/pubspec.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ packages:
128128
description: flutter
129129
source: sdk
130130
version: "0.0.0"
131+
flutter_web_plugins:
132+
dependency: transitive
133+
description: flutter
134+
source: sdk
135+
version: "0.0.0"
131136
fuchsia_remote_debug_protocol:
132137
dependency: transitive
133138
description: flutter
@@ -194,6 +199,22 @@ packages:
194199
url: "https://pub.dev"
195200
source: hosted
196201
version: "1.9.1"
202+
package_info_plus:
203+
dependency: transitive
204+
description:
205+
name: package_info_plus
206+
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
207+
url: "https://pub.dev"
208+
source: hosted
209+
version: "4.2.0"
210+
package_info_plus_platform_interface:
211+
dependency: transitive
212+
description:
213+
name: package_info_plus_platform_interface
214+
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
215+
url: "https://pub.dev"
216+
source: hosted
217+
version: "2.0.1"
197218
path:
198219
dependency: "direct main"
199220
description:

0 commit comments

Comments
 (0)