Skip to content

Commit b31a88b

Browse files
authored
clean up script files location (#369)
1 parent 474900c commit b31a88b

File tree

9 files changed

+67
-24
lines changed

9 files changed

+67
-24
lines changed

.github/workflows/build_starter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ jobs:
214214

215215
trigger_reusable_package:
216216
name: package ${{ needs.check_and_prepare.outputs.release_label }}
217-
needs: [build_android, build_ios, build_linux, build_macos, build_windows, decide_build_branch]
217+
needs: [check_and_prepare, build_android, build_ios, build_linux, build_macos, build_windows, decide_build_branch]
218218
uses: ./.github/workflows/package.yml
219219
if: (needs.check_and_prepare.outputs.should_trigger_package == 'true') && !cancelled() && !failure()
220220
with:
@@ -223,4 +223,6 @@ jobs:
223223
skipIntegrationTests: ${{ needs.check_and_prepare.outputs.skipIntegrationTests }}
224224
build_run_id: ${{ github.run_id }}
225225
working_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
226+
platforms: ${{ needs.check_and_prepare.outputs.platform }}
227+
apis: ${{ needs.check_and_prepare.outputs.apis }}
226228
secrets: inherit

.github/workflows/package.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ on:
3131
description: 'run id for build_starter.yml, search for all output'
3232
required: false
3333
type: string
34+
platforms:
35+
description: 'CSV of Android,iOS,Windows,macOS,Linux,Playmode'
36+
default: 'Android,iOS,Windows,macOS,Linux,Playmode'
37+
required: true
38+
type: string
39+
apis:
40+
description: 'CSV of apis to build and test'
41+
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
42+
required: true
43+
type: string
3444

3545
workflow_dispatch:
3646
inputs:
@@ -81,6 +91,8 @@ jobs:
8191
fail-fast: false
8292
outputs:
8393
skipIntegrationTests: ${{ steps.decide_input.outputs.skipIntegrationTests }}
94+
platforms: ${{ steps.decide_input.outputs.platforms }}
95+
apis: ${{ steps.decide_input.outputs.apis }}
8496
steps:
8597
- name: Decide inputs
8698
id: decide_input
@@ -99,6 +111,8 @@ jobs:
99111
echo "::set-output name=download_linux_run::${{ inputs.build_run_id }}"
100112
echo "::set-output name=download_macos_run::${{ inputs.build_run_id }}"
101113
echo "::set-output name=download_windows_run::${{ inputs.build_run_id }}"
114+
echo "::set-output name=platforms::${{ inputs.platforms }}"
115+
echo "::set-output name=apis::${{ inputs.apis }}"
102116
else
103117
echo "::set-output name=use_new_build::${{ github.event.inputs.use_new_build }}"
104118
echo "::set-output name=workflow_conclusion::success"
@@ -111,6 +125,8 @@ jobs:
111125
echo "::set-output name=download_linux_run::${{ github.event.inputs.download_linux_run }}"
112126
echo "::set-output name=download_macos_run::${{ github.event.inputs.download_macos_run }}"
113127
echo "::set-output name=download_windows_run::${{ github.event.inputs.download_windows_run }}"
128+
echo "::set-output name=platforms::Android,iOS,Windows,macOS,Linux,Playmode"
129+
echo "::set-output name=apis::analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage"
114130
fi
115131
116132
- name: Print inputs
@@ -128,6 +144,8 @@ jobs:
128144
echo download_linux_run: ${{ steps.decide_input.outputs.download_linux_run }}
129145
echo download_macos_run: ${{ steps.decide_input.outputs.download_macos_run }}
130146
echo download_windows_run: ${{ steps.decide_input.outputs.download_windows_run }}
147+
echo platforms: ${{ steps.decide_input.outputs.platforms }}"
148+
echo apis: ${{ steps.decide_input.outputs.apis }}"
131149
132150
- name: Check out base branch
133151
uses: actions/[email protected]
@@ -301,7 +319,7 @@ jobs:
301319
302320
- name: Package unitypackage
303321
run: |
304-
python build_package.py --zip_dir=built_artifact
322+
python scripts/build_scripts/build_package.py --zip_dir=built_artifact
305323
306324
- name: Commit Changes if there is any
307325
if: steps.decide_input.outputs.working_branch != '' || steps.decide_input.outputs.create_new_branch == '1'
@@ -377,7 +395,7 @@ jobs:
377395

378396
- name: Package tgz
379397
run: |
380-
python build_package.py --zip_dir=built_artifact --output_upm=True --output=output_tgz
398+
python scripts/build_scripts/build_package.py --zip_dir=built_artifact --output_upm=True --output=output_tgz
381399
382400
- name: Listing output tgz
383401
run: |
@@ -440,6 +458,10 @@ jobs:
440458
generate_report=(-p test_pull_request nightly-packaging)
441459
fi
442460
set -e
443-
python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} -w integration_tests.yml -p test_packaged_sdk ${{ github.run_id }} -s 10 -A -v
444-
445-
461+
python scripts/gha/trigger_workflow.py \
462+
-t ${{ steps.generate-token.outputs.token }} \
463+
-w integration_tests.yml \
464+
-p test_packaged_sdk ${{ github.run_id }} \
465+
-p platforms ${{ needs.package_sdks.outputs.platforms }} \
466+
-p apis ${{ needs.package_sdks.outputs.apis }} \
467+
-s 10 -A -v

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ directories to your PATH as needed.
2020

2121
- [CMake](https://cmake.org/) version 3.13.3, or newer.
2222
- [Mono](https://www.mono-project.com/) version 5 or newer.
23-
- [Unity](https://unity.com/) version 5 or newer.
24-
- [Swig3](http://www.swig.org/) version 3.0.6 or newer (Not version 4 though).
23+
- [Unity](https://unity.com/) version 2019 or newer.
24+
- [Swig](http://www.swig.org/) version 4 or newer.
2525

2626
### Prerequisites for Windows
2727
On windows, to work around path length issues with google unity resolver enable
@@ -38,8 +38,6 @@ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/
3838
source $HOME/.rvm/scripts/rvm
3939
brew install cmake protobuf python mono swig
4040
sudo chown -R $(whoami) /usr/local
41-
42-
export PATH="/usr/local/opt/swig@3/bin:$PATH"
4341
```
4442

4543
## Building

build_package.py renamed to scripts/build_scripts/build_package.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,14 @@
2727
* ...
2828
2929
Example usage:
30-
python build_package.py --zip_dir=<assets_zip_dir>
30+
python scripts/build_scripts/build_package.py --zip_dir=<assets_zip_dir>
3131
"""
32-
import collections
33-
import json
3432
import os
3533
import sys
3634
import subprocess
3735
import zipfile
3836
import shutil
3937

40-
from github import Github
4138
from absl import app
4239
from absl import flags
4340
from absl import logging
@@ -174,7 +171,7 @@ def main(argv):
174171
error_str = error_str.rstrip("\\n\'")
175172
split_string = error_str.split(" ")
176173
split_string = split_string[3:] # exclude first 3 lines
177-
gen_guids_script_path = os.path.join(os.getcwd(), "gen_guids.py")
174+
gen_guids_script_path = os.path.join(os.getcwd(), "scripts", "build_scripts", "gen_guids.py")
178175
gen_cmd_args = [
179176
sys.executable,
180177
gen_guids_script_path,
File renamed without changes.
File renamed without changes.

unpack_package.py renamed to scripts/build_scripts/unpack_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""Unpack Unity SDK package file.
1919
2020
Example usage:
21-
python unpack_package.py --folder=<sdk folder 1>
21+
python scripts/build_scripts/unpack_package.py --folder=<sdk folder 1>
2222
"""
2323

2424
import os

scripts/gha/build_testapps.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
specified by a flag (home directory, by default).
2424
2525
Build these two testapps for the two given Unity versions:
26-
$ build_testapps.py --t auth,storage --u 2017.4.37f1
26+
$ build_testapps.py --t auth,storage --u 2019.4.39f1
2727
2828
Build auth for 2017.4, using the latest .NET runtime (4.6). Normally the
2929
default runtime for that version of Unity will be used.
30-
$ build_testapps.py --t auth --u 2017.4.37f1 --force_latest_runtime
30+
$ build_testapps.py --t auth --u 2019.4.39f1 --force_latest_runtime
3131
32-
Build all APIs for 2017.4.37f1.
33-
$ build_testapps.py --u 2017.4.37f1
32+
Build all APIs for 2019.4.39f1.
33+
$ build_testapps.py --u 2019.4.39f1
3434
3535
IN-EDITOR TESTING:
3636
@@ -91,6 +91,7 @@
9191

9292
import datetime
9393
from distutils import dir_util
94+
from genericpath import isdir
9495
import glob
9596
import os
9697
import platform
@@ -173,7 +174,7 @@
173174
short_name="t")
174175

175176
flags.DEFINE_list(
176-
"unity_versions", "2017.4.37f1",
177+
"unity_versions", "2019.4.39f1",
177178
"Unity versions to build against. Must match the folder name in your"
178179
" applications directory or Unity Hub subdirectory.",
179180
short_name="u")
@@ -509,8 +510,16 @@ def patch_android_env(unity_version):
509510
fd.write(chunk)
510511
with zipfile.ZipFile(ndk_zip_path, 'r') as zip_ref:
511512
zip_ref.extractall(ndk_path)
512-
os.environ["ANDROID_NDK_HOME"] = os.path.abspath(os.path.join(ndk_path, "android-ndk-r19"))
513-
logging.info("set ANDROID_NDK_HOME: %s", os.environ["ANDROID_NDK_HOME"])
513+
ndk_direct_folder = ""
514+
for subfolder in os.listdir(ndk_path):
515+
if subfolder.startswith("android-ndk-"):
516+
ndk_direct_folder = subfolder
517+
break
518+
if ndk_direct_folder:
519+
os.environ["ANDROID_NDK_HOME"] = os.path.abspath(os.path.join(ndk_path, ndk_direct_folder))
520+
logging.info("set ANDROID_NDK_HOME: %s", os.environ["ANDROID_NDK_HOME"])
521+
else:
522+
logging.warning("No valid android folder unzipped from url %s, ANDROID_NDK_HOME not overwritten", url)
514523
if major_version >= 2020:
515524
try:
516525
# This is a bug from Unity:

scripts/update_versions.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434

3535
FLAGS = flags.FLAGS
3636
flags.DEFINE_string("unity_sdk_version", None,
37-
"Required, will check and upgrade cmake/firebase_unity_version.cmake")
37+
"Required, will check and upgrade cmake/firebase_unity_version.cmake",
38+
short_name="u")
3839

3940
def get_latest_repo_tag(repo_url):
4041
repo = Github().get_repo(repo_url)
@@ -200,6 +201,19 @@ def update_unity_version(unity_sdk_version):
200201
with open(version_cmake_path, "w") as fout:
201202
fout.write(replacement)
202203

204+
def update_readme(unity_sdk_version):
205+
readme_path = os.path.join(os.getcwd(), "docs", "readme.md")
206+
replacement = ""
207+
with open(readme_path, "r") as f:
208+
replacement = f.read()
209+
if "### Upcoming Release" in replacement:
210+
replacement = replacement.replace("### Upcoming Release", "### "+unity_sdk_version)
211+
else:
212+
logging.warning("No upcoming release defined in docs/readme.md")
213+
214+
with open(readme_path, "w") as fout:
215+
fout.write(replacement)
216+
203217
def main(argv):
204218
if len(argv) > 1:
205219
raise app.UsageError('Too many command-line arguments.')
@@ -209,6 +223,7 @@ def main(argv):
209223

210224
update_unity_version(FLAGS.unity_sdk_version)
211225
update_android_deps()
226+
update_readme(FLAGS.unity_sdk_version)
212227

213228
if __name__ == '__main__':
214229
app.run(main)

0 commit comments

Comments
 (0)