Skip to content

Fix Android error restoring secrets. #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ jobs:
matrix:
os: [macos-12, ubuntu-latest, windows-latest]
architecture: [x64]
python_version: [3.7]
python_version: [3.12]
steps:
- name: setup Xcode version (macos)
if: runner.os == 'macOS'
@@ -74,11 +74,16 @@ jobs:
echo "GHA_INSTALL_CCACHE=1" >> $GITHUB_ENV

- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.architecture }}

- uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin

- name: Add msbuild to PATH
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1.0.2
4 changes: 2 additions & 2 deletions analytics/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions auth/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions database/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions dynamic_links/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions firestore/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions functions/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions gma/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions messaging/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 2 additions & 2 deletions remote_config/testapp/build.gradle
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
@@ -15,7 +15,7 @@ allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}

4 changes: 1 addition & 3 deletions scripts/build_scripts/build_testapps.py
Original file line number Diff line number Diff line change
@@ -84,7 +84,6 @@
from absl import app
from absl import flags
from absl import logging
from distutils import dir_util

import utils
import config_reader
@@ -322,8 +321,7 @@ def _build(
project_dir = os.path.join(project_dir, output_testapp_dir)

logging.info("Copying testapp project to %s", project_dir)
os.makedirs(project_dir)
dir_util.copy_tree(testapp_dir, project_dir)
shutil.copytree(testapp_dir, project_dir)

logging.info("Changing directory to %s", project_dir)
os.chdir(project_dir)
3 changes: 1 addition & 2 deletions scripts/build_scripts/utils.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@
platforms.
"""

import distutils.spawn
import platform
import shutil
import subprocess
@@ -62,7 +61,7 @@ def run_command(cmd, capture_output=False, cwd=None, check=False, as_root=False,

def is_command_installed(tool):
"""Check if a command is installed on the system."""
return distutils.spawn.find_executable(tool)
return shutil.which(tool)


def delete_directory(dir_path):
22 changes: 14 additions & 8 deletions scripts/restore_secrets.py
Original file line number Diff line number Diff line change
@@ -152,21 +152,27 @@ def _patch_reverse_id(service_plist_path):
print("Attempting to patch reverse id in Info.plist")
with open(service_plist_path, "rb") as f:
service_plist = plistlib.load(f)
_patch_file(
path=os.path.join(os.path.dirname(service_plist_path), "testapp", "Info.plist"),
placeholder="REPLACE_WITH_REVERSED_CLIENT_ID",
value=service_plist["REVERSED_CLIENT_ID"])
try:
_patch_file(
path=os.path.join(os.path.dirname(service_plist_path), "testapp", "Info.plist"),
placeholder="REPLACE_WITH_REVERSED_CLIENT_ID",
value=service_plist["REVERSED_CLIENT_ID"])
except KeyError as e:
print("Warning: Missing plist key %s in %s, skipping" % (e.args[0], service_plist_path))


def _patch_bundle_id(service_plist_path):
"""Patches the Info.plist file with the bundle id from the Service plist."""
print("Attempting to patch bundle id in Info.plist")
with open(service_plist_path, "rb") as f:
service_plist = plistlib.load(f)
_patch_file(
path=os.path.join(os.path.dirname(service_plist_path), "testapp", "Info.plist"),
placeholder="$(PRODUCT_BUNDLE_IDENTIFIER)",
value=service_plist["BUNDLE_ID"])
try:
_patch_file(
path=os.path.join(os.path.dirname(service_plist_path), "testapp", "Info.plist"),
placeholder="$(PRODUCT_BUNDLE_IDENTIFIER)",
value=service_plist["BUNDLE_ID"])
except KeyError as e:
print("Warning: Missing plist key %s in %s, skipping" % (e.args[0], service_plist_path))


def _patch_file(path, placeholder, value):
Loading