-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update one product build package logic (#423)
- Loading branch information
1 parent
8fba07a
commit a2b9bb5
Showing
15 changed files
with
4,599 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ on: | |
env: | ||
# Use SHA256 for hashing files. | ||
hashCommand: "sha256sum" | ||
default_apis: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage' | ||
|
||
jobs: | ||
package_sdks: | ||
|
@@ -49,6 +50,23 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Check input | ||
# This check the apis input. It detect whether the package is only asking for subset of | ||
# of the products, like auth,firestore only etc. If the input apis are less than the | ||
# default_apis env attribute, we package only the provided apis, for test purposes only. | ||
id: check-input | ||
shell: bash | ||
run: | | ||
IFS=',' read -r -a input_apis <<< "${{ inputs.apis }}" | ||
IFS=',' read -r -a default_apis <<< "${{ env.default_apis }}" | ||
if [[ ${#input_apis[@]} != ${#default_apis[@]} ]]; then | ||
echo "::set-output name=package_for_checks::1" | ||
echo "::set-output name=package_apis::'--apis=${{ inputs.apis }}'" | ||
else | ||
echo "::set-output name=package_for_checks::0" | ||
echo "::set-output name=package_apis::" | ||
fi | ||
- name: Print inputs | ||
shell: bash | ||
run: | | ||
|
@@ -63,6 +81,8 @@ jobs: | |
echo download_windows_run: ${{ inputs.download_windows_run }} | ||
echo platforms: ${{ inputs.platforms }}" | ||
echo apis: ${{ inputs.apis }}" | ||
echo is the package for checks: ${{ steps.check-input.outputs.package_for_checks }} | ||
echo package_apis: ${{ steps.check-input.outputs.package_apis }} | ||
- name: Check out base branch | ||
uses: actions/[email protected] | ||
|
@@ -135,7 +155,7 @@ jobs: | |
- name: Package unitypackage | ||
run: | | ||
python scripts/build_scripts/build_package.py --zip_dir=built_artifact | ||
python scripts/build_scripts/build_package.py --zip_dir=built_artifact ${{ steps.check-input.outputs.package_apis }} | ||
- name: Commit Changes if there is any | ||
if: inputs.working_branch != '' || inputs.create_new_branch == '1' | ||
|
@@ -210,15 +230,18 @@ jobs: | |
path: firebase_unity_sdk.zip | ||
|
||
- name: Package tgz | ||
if: ${{ steps.check-input.outputs.package_for_checks }} == '1' | ||
run: | | ||
python scripts/build_scripts/build_package.py --zip_dir=built_artifact --output_upm=True --output=output_tgz | ||
- name: Listing output tgz | ||
if: ${{ steps.check-input.outputs.package_for_checks }} == '1' | ||
run: | | ||
ls -Rl | ||
working-directory: output_tgz | ||
|
||
- name: compute SDK hash for tgz files | ||
if: ${{ steps.check-input.outputs.package_for_checks }} == '1' | ||
shell: bash | ||
run: | | ||
tgz_files_list=$(find -type f -name '*.tgz') | ||
|
@@ -229,6 +252,7 @@ jobs: | |
working-directory: output_tgz | ||
|
||
- name: Upload Build tgz | ||
if: ${{ steps.check-input.outputs.package_for_checks }} == '1' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: firebase_unity_sdk_tgz | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/python | ||
# | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Based on the unity_packer/exports.json file, generate separate debug | ||
export config for each product. | ||
Example usage: | ||
python scripts/build_scripts/create_debug_export.py | ||
""" | ||
|
||
import os | ||
import json | ||
|
||
from absl import app | ||
from absl import flags | ||
from absl import logging | ||
|
||
API_PACKAGE_MAP = { | ||
"analytics": "FirebaseAnalytics.unitypackage", | ||
"auth": "FirebaseAuth.unitypackage", | ||
"crashlytics": "FirebaseCrashlytics.unitypackage", | ||
"database": "FirebaseDatabase.unitypackage", | ||
"dynamic_links": "FirebaseDynamicLinks.unitypackage", | ||
"firestore": "FirebaseFirestore.unitypackage", | ||
"functions": "FirebaseFunctions.unitypackage", | ||
"installations": "FirebaseInstallations.unitypackage", | ||
"messaging": "FirebaseMessaging.unitypackage", | ||
"remote_config": "FirebaseRemoteConfig.unitypackage", | ||
"storage": "FirebaseStorage.unitypackage", | ||
} | ||
|
||
default_package_names = [ | ||
"FirebaseApp.unitypackage", "SampleCommon.unitypackage"] | ||
|
||
|
||
FLAGS = flags.FLAGS | ||
flags.DEFINE_string('prod_export', "exports.json", | ||
'Production export json template to copy from') | ||
flags.DEFINE_string("json_folder", "unity_packer", | ||
("The root folder for json configs.")) | ||
flags.DEFINE_string("output_folder", "debug_single_export_json", | ||
"Json file with stable guids cache.") | ||
|
||
|
||
def main(argv): | ||
if len(argv) > 1: | ||
raise app.UsageError('Too many command-line arguments.') | ||
prod_export_json_path = os.path.join( | ||
os.getcwd(), FLAGS.json_folder, FLAGS.prod_export) | ||
|
||
with open(prod_export_json_path, "r") as fin: | ||
export_json = json.load(fin) | ||
|
||
# making sure only dotnet4 exists | ||
builds = export_json["builds"] | ||
for idx, dict in enumerate(builds): | ||
if dict["name"] == "dotnet3": | ||
builds.pop(idx) | ||
|
||
packages = export_json["packages"] | ||
|
||
for api_name, package_name in API_PACKAGE_MAP.items(): | ||
output_path = os.path.join( | ||
os.getcwd(), FLAGS.json_folder, FLAGS.output_folder, api_name + ".json") | ||
output_dict = {} | ||
output_package_list = [] | ||
for idx, package_dict in enumerate(packages): | ||
if package_dict["name"] in default_package_names: | ||
output_package_list.append(packages[idx]) | ||
elif package_dict["name"] == package_name: | ||
output_package_list.append(packages[idx]) | ||
output_dict["packages"] = output_package_list | ||
output_dict["builds"] = builds | ||
|
||
with open(output_path, 'w', encoding='utf-8') as fout: | ||
fout.write(json.dumps(output_dict, indent=2)) | ||
logging.info("Write %s", output_path) | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(main) |
Oops, something went wrong.