Skip to content

Commit ece6774

Browse files
committed
Merge remote-tracking branch 'origin/master' into snappy2
2 parents 06b5a2f + e376c29 commit ece6774

File tree

174 files changed

+3041
-1208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+3041
-1208
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
gem "cocoapods"
4+
gem "octokit", "~> 4.19"
5+
gem "xcodeproj", "~> 1.21"
6+
gem "plist"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.5)
5+
rexml
6+
addressable (2.8.0)
7+
public_suffix (>= 2.0.2, < 5.0)
8+
atomos (0.1.3)
9+
claide (1.1.0)
10+
colored2 (3.1.2)
11+
faraday (1.1.0)
12+
multipart-post (>= 1.2, < 3)
13+
ruby2_keywords
14+
multipart-post (2.1.1)
15+
nanaimo (0.3.0)
16+
octokit (4.19.0)
17+
faraday (>= 0.9)
18+
sawyer (~> 0.8.0, >= 0.5.3)
19+
plist (3.6.0)
20+
public_suffix (4.0.6)
21+
rexml (3.2.5)
22+
ruby2_keywords (0.0.2)
23+
sawyer (0.8.2)
24+
addressable (>= 2.3.5)
25+
faraday (> 0.8, < 2.0)
26+
xcodeproj (1.21.0)
27+
CFPropertyList (>= 2.3.3, < 4.0)
28+
atomos (~> 0.1.3)
29+
claide (>= 1.0.2, < 2.0)
30+
colored2 (~> 3.1)
31+
nanaimo (~> 0.3.0)
32+
rexml (~> 3.2.4)
33+
34+
PLATFORMS
35+
ruby
36+
37+
DEPENDENCIES
38+
octokit (~> 4.19)
39+
plist
40+
xcodeproj (~> 1.21)
41+
42+
BUNDLED WITH
43+
2.3.11
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Generate NOTICES'
2+
description: 'Generate a NOTICES containning SDK licenses.'
3+
inputs:
4+
pods:
5+
description: 'Targeted Pods for licences'
6+
required: true
7+
sources:
8+
description: 'Sources of PodSpecs'
9+
required: true
10+
default: 'https://cdn.cocoapods.org'
11+
min-ios-version:
12+
description: 'The minimum version of iOS'
13+
required: true
14+
default: '10.0'
15+
search-local-pod-version:
16+
description: 'Add pod version from local spec repo'
17+
required: true
18+
default: false
19+
type: boolean
20+
notices-path:
21+
description: 'Path of Notices file containing all licences.'
22+
required: true
23+
outputs:
24+
notices_contents:
25+
description: 'contents of notices'
26+
runs:
27+
using: 'composite'
28+
steps:
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: "2.7"
32+
- name: Generate a NOTICES file
33+
run: |
34+
cd "${{ github.action_path }}"
35+
bundle install
36+
if ${{ inputs.search-local-pod-version == 'true' }} ; then
37+
ruby app.rb --pods ${{ inputs.pods }} --sources ${{ inputs.sources }} --min_ios_version ${{ inputs.min-ios-version }} --search_local_pod_version --notices_path ${{ inputs.notices-path }}
38+
else
39+
ruby app.rb --pods ${{ inputs.pods }} --sources ${{ inputs.sources }} --min_ios_version ${{ inputs.min-ios-version }} --notices_path ${{ inputs.notices-path }}
40+
fi
41+
shell: bash
42+
- name: Upload artifacts
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: notices
46+
path: ${{ inputs.notices-path }}
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright 2022 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
require 'cocoapods'
18+
require 'digest'
19+
require 'optparse'
20+
require 'plist'
21+
require 'tmpdir'
22+
require 'xcodeproj'
23+
24+
DEFAULT_TESTAPP_TARGET = "testApp"
25+
26+
# Default sources of min iOS version
27+
SOURCES=["https://cdn.cocoapods.org/"]
28+
MIN_IOS_VERSION="12.0"
29+
NOTICES_OUTPUT_PATH="./CoreOnly/NOTICES"
30+
SEARCH_LOCAL_POD_VERSION=false
31+
32+
@options = {
33+
sources: SOURCES,
34+
min_ios_version: MIN_IOS_VERSION,
35+
output_path: NOTICES_OUTPUT_PATH,
36+
search_local_pod_version: false
37+
}
38+
begin
39+
OptionParser.new do |opts|
40+
opts.banner = "Usage: app.rb [options]"
41+
opts.on('-p', '--pods PODS', 'Pods seperated by space or comma.') { |v| @options[:pods] = v.split(/[ ,]/) }
42+
opts.on('-s', '--sources SOURCES', 'Sources of Pods') { |v| @options[:sources] = v.split(/[ ,]/) }
43+
opts.on('-m', '--min_ios_version MIN_IOS_VERSION', 'Minimum iOS version') { |v| @options[:min_ios_version] = v }
44+
opts.on('-n', '--notices_path OUTPUT_PATH', 'The output path of NOTICES') { |v| @options[:output_path] = v }
45+
opts.on('-v', '--search_local_pod_version', 'Attach the latest pod version to a pod in Podfile') { |v| @options[:search_local_pod_version] = true }
46+
end.parse!
47+
48+
raise OptionParser::MissingArgument if @options[:pods].nil?
49+
rescue OptionParser::MissingArgument
50+
puts "Argument `--pods` should not be empty."
51+
raise
52+
end
53+
54+
PODS = @options[:pods]
55+
SOURCES = @options[:sources]
56+
MIN_IOS_VERSION = @options[:min_ios_version]
57+
NOTICES_OUTPUT_PATH = @options[:output_path]
58+
SEARCH_LOCAL_POD_VERSION = @options[:search_local_pod_version]
59+
60+
def create_podfile(path: , sources: , target: , pods: [], min_ios_version: , search_local_pod_version: )
61+
output = ""
62+
for source in sources do
63+
output += "source \'#{source}\'\n"
64+
end
65+
if search_local_pod_version
66+
for source in sources do
67+
if source == "https://cdn.cocoapods.org/"
68+
next
69+
end
70+
`pod repo add #{Digest::MD5.hexdigest source} #{source}`
71+
end
72+
end
73+
output += "use_frameworks! :linkage => :static\n"
74+
75+
output += "platform :ios, #{min_ios_version}\n"
76+
output += "target \'#{target}\' do\n"
77+
for pod in pods do
78+
if search_local_pod_version
79+
# `pod search` will search a pod locally and generate a corresonding pod
80+
# config in a Podfile with `grep`, e.g.
81+
# pod search Firebase | grep "pod.*" -m 1
82+
# will generate
83+
# pod 'Firebase', '~> 9.0.0'
84+
output += `pod search "#{pod}" | grep "pod.*" -m 1`
85+
else
86+
output += "pod \'#{pod}\'\n"
87+
end
88+
end
89+
output += "end\n"
90+
91+
# Remove default footers and headers generated by CocoaPods.
92+
output += "
93+
class ::Pod::Generator::Acknowledgements
94+
def header_text
95+
''
96+
end
97+
def header_title
98+
''
99+
end
100+
def footnote_text
101+
''
102+
end
103+
end
104+
"
105+
puts "------Podfile------\n#{output}\n-------------------\n"
106+
podfile = File.new("#{path}/Podfile", "w")
107+
podfile.puts(output)
108+
podfile.close
109+
end
110+
111+
def generate_notices_content(sources: SOURCES, pods: PODS, min_ios_version: MIN_IOS_VERSION)
112+
content = ""
113+
Dir.mktmpdir do |temp_dir|
114+
Dir.chdir(temp_dir) do
115+
project_path = "#{temp_dir}/barebone_app.xcodeproj"
116+
project_path = "barebone_app.xcodeproj"
117+
project = Xcodeproj::Project.new(project_path)
118+
project.new_target(:application, DEFAULT_TESTAPP_TARGET, :ios)
119+
project.save()
120+
create_podfile(path: temp_dir, sources: sources, target: DEFAULT_TESTAPP_TARGET,pods: pods, min_ios_version: min_ios_version, search_local_pod_version: SEARCH_LOCAL_POD_VERSION)
121+
pod_install_result = `pod install --allow-root`
122+
puts pod_install_result
123+
licenses = Plist.parse_xml("Pods/Target Support Files/Pods-testApp/Pods-testApp-acknowledgements.plist")
124+
125+
existing_licenses={}
126+
for license in licenses["PreferenceSpecifiers"] do
127+
if existing_licenses.include?(license["FooterText"])
128+
existing_licenses.store(license["FooterText"], existing_licenses.fetch(license["FooterText"])+"\n"+license["Title"])
129+
next
130+
end
131+
existing_licenses.store(license["FooterText"], license["Title"])
132+
end
133+
existing_licenses.each{ |license, title|
134+
# The NOTICES format is like:
135+
# ```
136+
# ${title}
137+
# ${license}
138+
#
139+
# ${title}
140+
# ${license}
141+
# ...
142+
# ```
143+
content += "#{title}\n#{license}\n\n"
144+
}
145+
end
146+
end
147+
return content.strip
148+
end
149+
150+
def main()
151+
content = generate_notices_content(sources: SOURCES, pods: PODS, min_ios_version: MIN_IOS_VERSION)
152+
notices = File.new(NOTICES_OUTPUT_PATH, "w")
153+
notices.puts(content)
154+
notices.close
155+
end
156+
157+
main()

.github/workflows/abtesting.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ jobs:
2020
# Don't run on private repo unless it is a PR.
2121
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
2222

23-
runs-on: macos-11
23+
runs-on: macos-12
2424
strategy:
2525
matrix:
2626
target: [ios, tvos, macos, watchos]
2727
steps:
2828
- uses: actions/checkout@v2
29+
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
30+
with:
31+
ruby-version: '2.7'
2932
- name: Setup Bundler
3033
run: scripts/setup_bundler.sh
3134
- name: Build and test
@@ -36,7 +39,7 @@ jobs:
3639
spm:
3740
# Don't run on private repo unless it is a PR.
3841
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
39-
runs-on: macos-11
42+
runs-on: macos-12
4043
strategy:
4144
matrix:
4245
target: [iOS, tvOS, macOS, catalyst, watchOS]
@@ -54,12 +57,15 @@ jobs:
5457
# Don't run on private repo unless it is a PR.
5558
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
5659

57-
runs-on: macos-11
60+
runs-on: macos-12
5861
steps:
5962
- uses: actions/checkout@v2
6063
- uses: mikehardy/buildcache-action@50738c6c77de7f34e66b870e4f8ede333b69d077
6164
with:
6265
cache_key: ${{ matrix.os }}
66+
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
67+
with:
68+
ruby-version: '2.7'
6369
- name: Setup Bundler
6470
run: scripts/setup_bundler.sh
6571
- name: Setup project and Build for Catalyst
@@ -72,9 +78,13 @@ jobs:
7278
env:
7379
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
7480
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
75-
runs-on: macos-11
81+
runs-on: macos-12
7682
steps:
7783
- uses: actions/checkout@v2
84+
- uses: actions/checkout@v2
85+
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
86+
with:
87+
ruby-version: '2.7'
7888
- name: Setup quickstart
7989
env:
8090
LEGACY: true
@@ -91,7 +101,7 @@ jobs:
91101
# Don't run on private repo.
92102
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
93103

94-
runs-on: macos-11
104+
runs-on: macos-12
95105
strategy:
96106
matrix:
97107
target: [ios, tvos, macos]
@@ -101,6 +111,9 @@ jobs:
101111
needs: pod-lib-lint
102112
steps:
103113
- uses: actions/checkout@v2
114+
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
115+
with:
116+
ruby-version: '2.7'
104117
- name: Setup Bundler
105118
run: scripts/setup_bundler.sh
106119
- name: PodLibLint ABTesting Cron

.github/workflows/analytics.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ jobs:
2121
# Don't run on private repo unless it is a PR.
2222
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
2323

24-
runs-on: macos-11
24+
runs-on: macos-12
2525

2626
strategy:
2727
matrix:
2828
target: [ios, tvos, macos]
2929
steps:
3030
- uses: actions/checkout@v2
31+
- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
32+
with:
33+
ruby-version: '2.7'
3134
- name: Setup Bundler
3235
run: scripts/setup_bundler.sh
3336
- name: GoogleAppMeasurement

0 commit comments

Comments
 (0)