Skip to content

Commit fd39689

Browse files
cynthiajoanCynthia Jiang
and
Cynthia Jiang
authored
Fix the package logic, and add windows build python logic (#250)
Co-authored-by: Cynthia Jiang <[email protected]>
1 parent 91f0096 commit fd39689

File tree

7 files changed

+66
-11
lines changed

7 files changed

+66
-11
lines changed

.github/workflows/android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818

1919
jobs:
2020
build_android:
21+
name: build-android-macos-${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
2122
runs-on: macos-latest
2223
strategy:
2324
fail-fast: false

.github/workflows/ios.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919

2020
jobs:
2121
build_ios:
22+
name: build-ios-macos-${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
2223
runs-on: macos-latest
2324
strategy:
2425
fail-fast: false

.github/workflows/package.yml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,34 @@ on:
1111
skipIntegrationTests:
1212
description: 'skip integration tests?'
1313
default: 0
14+
required: false
15+
create_new_branch:
16+
description: 'If we need to create new branch to package guids update. 0 means no creation and 1 means create. If working_branch set, will ignore this value. '
17+
default: 0
18+
required: false
1419
working_branch:
1520
description: 'If already a working in progress release branch'
16-
default: None
21+
required: false
22+
download_ios_run:
23+
description: 'run id for ios.yml'
24+
required: false
25+
download_android_run:
26+
description: 'run id for android.yml'
27+
required: false
28+
download_desktop_run:
29+
description: 'run id for sdk_build.yml'
30+
required: false
31+
release_label:
32+
description: 'If the package is intended to run for a release, put <version>-RC## for label'
33+
required: false
1734

1835
env:
1936
# Use SHA256 for hashing files.
2037
hashCommand: "sha256sum"
2138

2239
jobs:
2340
package_sdks:
24-
name: package-${{matrix.os}}
41+
name: package-${{matrix.os}}-${{github.event.inputs.release_label}}
2542
runs-on: ${{matrix.os}}
2643
strategy:
2744
fail-fast: false
@@ -31,6 +48,17 @@ jobs:
3148
- os: ubuntu-latest
3249
package_dir: output
3350
steps:
51+
- name: Print out inputs
52+
shell: bash
53+
run: |
54+
echo operation_system: ${{ github.event.inputs.operating_systems }}
55+
echo skipIntegrationTests: ${{ github.event.inputs.skipIntegrationTests }}
56+
echo create_new_branch: ${{ github.event.inputs.create_new_branch }}
57+
echo working_branch: ${{ github.event.inputs.working_branch }}
58+
echo download_ios_run: ${{ github.event.inputs.download_ios_run }}
59+
echo download_android_run: ${{ github.event.inputs.download_android_run }}
60+
echo download_desktop_run: ${{ github.event.inputs.download_desktop_run }}
61+
3462
- name: Check out base branch
3563
uses: actions/[email protected]
3664
with:
@@ -55,20 +83,20 @@ jobs:
5583
pip install -r scripts/gha/requirements.txt
5684
5785
- name: Name new branch
58-
if: github.event.inputs.working_branch == 'None'
86+
if: github.event.inputs.working_branch == '' && github.event.inputs.create_new_branch == '1'
5987
run: |
6088
date_str=$(date "+%Y%m%d-%H%M%S")
61-
echo "NEW_BRANCH=${{env.branchPrefix}}${{github.event.inputs.package_version_number}}-${date_str}" >> $GITHUB_ENV
89+
echo "NEW_BRANCH=new_branch-${date_str}" >> $GITHUB_ENV
6290
6391
- name: Create new branch
64-
if: github.event.inputs.working_branch == 'None'
92+
if: github.event.inputs.working_branch == '' && github.event.inputs.create_new_branch == '1'
6593
run: |
6694
git remote update
6795
git checkout -b "${NEW_BRANCH}"
6896
echo "UPDATE_LOGFILE=update_log.txt" >> $GITHUB_ENV
6997
7098
- name: Checkout working branch
71-
if: github.event.inputs.working_branch != 'None'
99+
if: github.event.inputs.working_branch != ''
72100
run: |
73101
git remote update
74102
git checkout ${{ github.event.inputs.working_branch }}
@@ -80,21 +108,21 @@ jobs:
80108
uses: dawidd6/action-download-artifact@v2
81109
with:
82110
workflow: 'sdk_build.yml'
83-
run_id: ${{ github.event.inputs.downloadPreviousRun }}
111+
run_id: ${{ github.event.inputs.download_desktop_run }}
84112
path: built_artifect
85113

86114
- name: Fetch iOS Artifacts
87115
uses: dawidd6/action-download-artifact@v2
88116
with:
89117
workflow: 'ios.yml'
90-
run_id: ${{ github.event.inputs.downloadPreviousRun }}
118+
run_id: ${{ github.event.inputs.download_ios_run }}
91119
path: built_artifect
92120

93121
- name: Fetch Android Artifacts
94122
uses: dawidd6/action-download-artifact@v2
95123
with:
96124
workflow: 'android.yml'
97-
run_id: ${{ github.event.inputs.downloadPreviousRun }}
125+
run_id: ${{ github.event.inputs.download_android_run }}
98126
path: built_artifect
99127

100128
- name: move zip files
@@ -129,7 +157,7 @@ jobs:
129157
fi
130158
131159
- name: Create PR if there is None
132-
if: github.event.inputs.working_branch == 'None'
160+
if: github.event.inputs.working_branch == '' && github.event.inputs.create_new_branch == '1'
133161
id: push-branch
134162
run: |
135163
if ! git update-index --refresh; then

.github/workflows/sdk_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ on:
2424

2525
jobs:
2626
build_desktop:
27-
name: build-desktop-${{matrix.os}}-${{matrix.unity_version}}
27+
name: build-desktop-${{matrix.os}}-${{matrix.unity_version}}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
2828
runs-on: ${{matrix.os}}
2929
strategy:
3030
fail-fast: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ gcs_key_file.json
2222
*_unity/
2323
*_unity_seperate/
2424
*_unity_separate/
25+
output/
26+
output_unpack*/
2527

2628
# Windows ignore
2729
vcpkg

cmake/build_shared.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function(build_firebase_shared LIBRARY_NAME ARTIFACT_NAME OUTPUT_NAME)
8383
set_target_properties(${shared_target}
8484
PROPERTIES
8585
PREFIX "lib"
86+
# SUFFIX default is ".so"
8687
)
8788
else()
8889
set_target_properties(${shared_target}

scripts/build_scripts/build_zips.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import subprocess
2626
import zipfile
2727
import tempfile
28+
import sys
2829

2930
from absl import app, flags, logging
3031

@@ -270,6 +271,7 @@ def get_android_args():
270271
result_args.append("-DFIREBASE_ANDROID_BUILD=true")
271272
# android default to build release.
272273
result_args.append("-DCMAKE_BUILD_TYPE=release")
274+
result_args.append("-DANDROID_STL=c++_shared")
273275
return result_args
274276

275277

@@ -350,6 +352,17 @@ def make_android_multi_arch_build(cmake_args, merge_script):
350352
logging.info("Generated Android multi-arch (%s) zip %s",
351353
",".join(g_mobile_target_architectures), final_zip_path)
352354

355+
def get_windows_args():
356+
"""Get the cmake args for windows platform specific.
357+
358+
Returns:
359+
camke args for windows platform.
360+
"""
361+
result_args = []
362+
result_args.append('-G \"Visual Studio 16 2019\"')
363+
result_args.append('-A x64') # TODO flexibily for x32
364+
result_args.append("-DFIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=%s" % sys.executable)
365+
return result_args
353366

354367
def is_android_build():
355368
"""
@@ -366,6 +379,13 @@ def is_ios_build():
366379
"""
367380
return FLAGS.platform == "ios"
368381

382+
def is_windows_build():
383+
"""
384+
Returns:
385+
If the build platform is windows
386+
"""
387+
return FLAGS.platform == "windows"
388+
369389

370390
def main(argv):
371391
if len(argv) > 1:
@@ -411,6 +431,8 @@ def main(argv):
411431
cmake_setup_args.extend(get_ios_args(source_path))
412432
elif is_android_build():
413433
cmake_setup_args.extend(get_android_args())
434+
elif is_windows_build():
435+
cmake_setup_args.extend(get_windows_args())
414436

415437
global g_mobile_target_architectures
416438
logging.info("cmake_setup_args is: " + " ".join(cmake_setup_args))

0 commit comments

Comments
 (0)