akcache 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +3 -20
- data/.github/workflows/main.yml +0 -18
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -13
- data/.vscode/launch.json +0 -12
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -55
- data/LICENSE.txt +0 -21
- data/README.md +0 -44
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/kcache.gemspec +0 -38
- data/lib/kcache/README.md +0 -29
- data/lib/kcache/version.rb +0 -5
- data/lib/kcache.rb +0 -852
- data/lib/pod_plugin.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4369582924b54b8726037e8c644c6ae3cfab4df668c3123f5ae24f7ccf6ed6af
|
4
|
+
data.tar.gz: 9be701fddb92e20f9290d63c0ce2742bd1627b294619f448444774110a48c7eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 902da61b7bafde61bbf7e8665a67ca5515e2892314e0a49cc9cfcc09745be1f54566598c3695c346246b9f57c85bdad055585012fc91c2686284882b816e6fc3
|
7
|
+
data.tar.gz: 4731b53c0145a785e4ec796e21eb41323d3b7b373f6fe34cf080134ecd95f649902a05b0e440a008f180848863d41e4daa3709e912494cc5891d1801c1cb977b
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akcache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yusheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -32,24 +32,7 @@ executables:
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
-
- ".github/workflows/main.yml"
|
36
|
-
- ".gitignore"
|
37
|
-
- ".rubocop.yml"
|
38
|
-
- ".vscode/launch.json"
|
39
|
-
- CODE_OF_CONDUCT.md
|
40
|
-
- Gemfile
|
41
|
-
- Gemfile.lock
|
42
|
-
- LICENSE.txt
|
43
|
-
- README.md
|
44
|
-
- Rakefile
|
45
|
-
- bin/console
|
46
35
|
- bin/kcache
|
47
|
-
- bin/setup
|
48
|
-
- kcache.gemspec
|
49
|
-
- lib/kcache.rb
|
50
|
-
- lib/kcache/README.md
|
51
|
-
- lib/kcache/version.rb
|
52
|
-
- lib/pod_plugin.rb
|
53
36
|
homepage: https://github.com/yusheng00
|
54
37
|
licenses:
|
55
38
|
- MIT
|
@@ -72,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
55
|
- !ruby/object:Gem::Version
|
73
56
|
version: '0'
|
74
57
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
58
|
+
rubygems_version: 3.2.3
|
76
59
|
signing_key:
|
77
60
|
specification_version: 4
|
78
61
|
summary: a cache tool
|
data/.github/workflows/main.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on: [push,pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@v2
|
10
|
-
- name: Set up Ruby
|
11
|
-
uses: ruby/setup-ruby@v1
|
12
|
-
with:
|
13
|
-
ruby-version: 2.6.3
|
14
|
-
- name: Run the default task
|
15
|
-
run: |
|
16
|
-
gem install bundler -v 2.2.6
|
17
|
-
bundle install
|
18
|
-
bundle exec rake
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
data/.vscode/launch.json
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
-
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
-
|
9
|
-
## Our Standards
|
10
|
-
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
-
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
-
|
19
|
-
Examples of unacceptable behavior include:
|
20
|
-
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
22
|
-
advances of any kind
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
-
* Public or private harassment
|
25
|
-
* Publishing others' private information, such as a physical or email
|
26
|
-
address, without their explicit permission
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
-
professional setting
|
29
|
-
|
30
|
-
## Enforcement Responsibilities
|
31
|
-
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
-
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
-
|
36
|
-
## Scope
|
37
|
-
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
-
|
40
|
-
## Enforcement
|
41
|
-
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at yusheng@akulaku.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
-
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
-
|
46
|
-
## Enforcement Guidelines
|
47
|
-
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
-
|
50
|
-
### 1. Correction
|
51
|
-
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
-
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
-
|
56
|
-
### 2. Warning
|
57
|
-
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
-
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
-
|
62
|
-
### 3. Temporary Ban
|
63
|
-
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
-
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
-
|
68
|
-
### 4. Permanent Ban
|
69
|
-
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
-
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
-
|
74
|
-
## Attribution
|
75
|
-
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
-
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
-
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
82
|
-
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
akcache (1.0.2)
|
5
|
-
xcodeproj (~> 1.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
CFPropertyList (3.0.4)
|
11
|
-
rexml
|
12
|
-
ast (2.4.2)
|
13
|
-
atomos (0.1.3)
|
14
|
-
claide (1.0.3)
|
15
|
-
colored2 (3.1.2)
|
16
|
-
nanaimo (0.3.0)
|
17
|
-
parallel (1.20.1)
|
18
|
-
parser (3.0.2.0)
|
19
|
-
ast (~> 2.4.1)
|
20
|
-
rainbow (3.0.0)
|
21
|
-
rake (13.0.6)
|
22
|
-
regexp_parser (2.1.1)
|
23
|
-
rexml (3.2.5)
|
24
|
-
rubocop (1.18.4)
|
25
|
-
parallel (~> 1.10)
|
26
|
-
parser (>= 3.0.0.0)
|
27
|
-
rainbow (>= 2.2.2, < 4.0)
|
28
|
-
regexp_parser (>= 1.8, < 3.0)
|
29
|
-
rexml
|
30
|
-
rubocop-ast (>= 1.8.0, < 2.0)
|
31
|
-
ruby-progressbar (~> 1.7)
|
32
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
33
|
-
rubocop-ast (1.8.0)
|
34
|
-
parser (>= 3.0.1.1)
|
35
|
-
ruby-progressbar (1.11.0)
|
36
|
-
unicode-display_width (2.0.0)
|
37
|
-
xcodeproj (1.21.0)
|
38
|
-
CFPropertyList (>= 2.3.3, < 4.0)
|
39
|
-
atomos (~> 0.1.3)
|
40
|
-
claide (>= 1.0.2, < 2.0)
|
41
|
-
colored2 (~> 3.1)
|
42
|
-
nanaimo (~> 0.3.0)
|
43
|
-
rexml (~> 3.2.4)
|
44
|
-
|
45
|
-
PLATFORMS
|
46
|
-
universal-darwin-20
|
47
|
-
universal-darwin-21
|
48
|
-
|
49
|
-
DEPENDENCIES
|
50
|
-
akcache!
|
51
|
-
rake (~> 13.0)
|
52
|
-
rubocop (~> 1.7)
|
53
|
-
|
54
|
-
BUNDLED WITH
|
55
|
-
2.2.6
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2021 yusheng
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# AKCache
|
2
|
-
|
3
|
-
|
4
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/kcache`. To experiment with that code, run `bin/console` for an interactive prompt.
|
5
|
-
|
6
|
-
TODO: Delete this and the text above, and describe your gem
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Add this line to your application's Gemfile:
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
gem 'kcache'
|
14
|
-
```
|
15
|
-
|
16
|
-
And then execute:
|
17
|
-
|
18
|
-
$ bundle install
|
19
|
-
|
20
|
-
Or install it yourself as:
|
21
|
-
|
22
|
-
$ gem install kcache
|
23
|
-
|
24
|
-
## Usage
|
25
|
-
|
26
|
-
TODO: Write usage instructions here
|
27
|
-
|
28
|
-
## Development
|
29
|
-
|
30
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
-
|
32
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
-
|
34
|
-
## Contributing
|
35
|
-
|
36
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/kcache. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/kcache/blob/master/CODE_OF_CONDUCT.md).
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
-
|
42
|
-
## Code of Conduct
|
43
|
-
|
44
|
-
Everyone interacting in the Kcache project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/kcache/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "kcache"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/kcache.gemspec
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
require_relative "lib/kcache/version"
|
7
|
-
|
8
|
-
Gem::Specification.new do |spec|
|
9
|
-
spec.name = "akcache"
|
10
|
-
spec.version = Kcache::VERSION
|
11
|
-
spec.authors = ["yusheng"]
|
12
|
-
spec.email = ["1433233832@qq.com"]
|
13
|
-
|
14
|
-
spec.summary = "a cache tool"
|
15
|
-
spec.description = "a cache tool that can reduce xcode archive time"
|
16
|
-
spec.homepage = "https://github.com/yusheng00"
|
17
|
-
spec.license = "MIT"
|
18
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
22
|
-
spec.metadata["changelog_uri"] = spec.homepage
|
23
|
-
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
25
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
28
|
-
end
|
29
|
-
spec.bindir = "bin"
|
30
|
-
spec.executables = "kcache"
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
# Uncomment to register a new dependency of your gem
|
34
|
-
spec.add_dependency "xcodeproj", "~> 1.0"
|
35
|
-
|
36
|
-
# For more information and examples about making a new gem, checkout our
|
37
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
-
end
|
data/lib/kcache/README.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# AKMall
|
2
|
-
|
3
|
-
[![CI Status](https://img.shields.io/travis/pangyulei/AKMall.svg?style=flat)](https://travis-ci.org/pangyulei/AKMall)
|
4
|
-
[![Version](https://img.shields.io/cocoapods/v/AKMall.svg?style=flat)](https://cocoapods.org/pods/AKMall)
|
5
|
-
[![License](https://img.shields.io/cocoapods/l/AKMall.svg?style=flat)](https://cocoapods.org/pods/AKMall)
|
6
|
-
[![Platform](https://img.shields.io/cocoapods/p/AKMall.svg?style=flat)](https://cocoapods.org/pods/AKMall)
|
7
|
-
|
8
|
-
## Example
|
9
|
-
|
10
|
-
To run the example project, clone the repo, and run `pod install` from the Example directory first.
|
11
|
-
|
12
|
-
## Requirements
|
13
|
-
|
14
|
-
## Installation
|
15
|
-
|
16
|
-
AKMall is available through [CocoaPods](https://cocoapods.org). To install
|
17
|
-
it, simply add the following line to your Podfile:
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
pod 'AKMall'
|
21
|
-
```
|
22
|
-
|
23
|
-
## Author
|
24
|
-
|
25
|
-
pangyulei, pangyulei@gmail.com
|
26
|
-
|
27
|
-
## License
|
28
|
-
|
29
|
-
AKMall is available under the MIT license. See the LICENSE file for more info.
|
data/lib/kcache/version.rb
DELETED
data/lib/kcache.rb
DELETED
@@ -1,852 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "kcache/version"
|
4
|
-
require 'yaml'
|
5
|
-
require 'json/ext'
|
6
|
-
require 'xcodeproj'
|
7
|
-
require 'pathname'
|
8
|
-
require "find"
|
9
|
-
require 'set'
|
10
|
-
|
11
|
-
#配置
|
12
|
-
|
13
|
-
TARGET_CACHE_CONFIG = "target_cache_config.yml"
|
14
|
-
|
15
|
-
CACHE_STATUS_MISS = "miss"
|
16
|
-
CACHE_STATUS_READY = "ready"
|
17
|
-
CACHE_STATUS_HIT = "hit"
|
18
|
-
|
19
|
-
FILE_NAME_PRODUCT = "product.tar"
|
20
|
-
FILE_NAME_CONTEXT = "context.yml"
|
21
|
-
FILE_NAME_TARGET_CONTEXT = "target_context.yml"
|
22
|
-
|
23
|
-
#Xcode编译相关常量
|
24
|
-
MODULEMAP_FILE = "MODULEMAP_FILE"
|
25
|
-
FULL_PRODUCT_NAME = "FULL_PRODUCT_NAME"
|
26
|
-
CONFIGURATION_BUILD_DIR = "CONFIGURATION_BUILD_DIR"
|
27
|
-
CONFIGURATION_TEMP_DIR = "CONFIGURATION_TEMP_DIR"
|
28
|
-
TARGET_TEMP_DIR = "TARGET_TEMP_DIR"
|
29
|
-
TARGET_BUILD_DIR = "TARGET_BUILD_DIR"
|
30
|
-
|
31
|
-
PODS_XCFRAMEWORKS_BUILD_DIR = "PODS_XCFRAMEWORKS_BUILD_DIR"
|
32
|
-
SYMROOT = "SYMROOT"
|
33
|
-
SRCROOT = "SRCROOT"
|
34
|
-
OBJROOT = "OBJROOT"
|
35
|
-
|
36
|
-
|
37
|
-
#变量
|
38
|
-
$target_build_configuration = "Release"
|
39
|
-
$project_build_branch = "master"
|
40
|
-
$podfile_spec_checksums = nil
|
41
|
-
$file_md5_hash = {}
|
42
|
-
$exclude_target = []
|
43
|
-
|
44
|
-
class CacheManager
|
45
|
-
|
46
|
-
def get_cache_root
|
47
|
-
return Dir.home + "/ysCache" +"/#{$project_build_branch}"
|
48
|
-
end
|
49
|
-
|
50
|
-
def get_default_cache_root
|
51
|
-
return Dir.home + "/ysCache/master"
|
52
|
-
end
|
53
|
-
|
54
|
-
def is_private_target(target)
|
55
|
-
if target.name.start_with? "AK" or target.name.start_with? "EUR" or target.name.start_with? "A4K"
|
56
|
-
return true
|
57
|
-
else
|
58
|
-
return false
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def get_content_without_pwd(content)
|
63
|
-
content = content.gsub("#{Dir.pwd}/", "").gsub(/#{Dir.pwd}(\W|$)/, '\1')
|
64
|
-
return content
|
65
|
-
end
|
66
|
-
|
67
|
-
def get_file_md5(file)
|
68
|
-
if $file_md5_hash.has_key? file
|
69
|
-
return $file_md5_hash[file]
|
70
|
-
end
|
71
|
-
md5 = Digest::MD5.hexdigest(File.read(file))
|
72
|
-
$file_md5_hash[file] = md5
|
73
|
-
return md5
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
def get_projects
|
78
|
-
pods_project = Xcodeproj::Project.open("Pods/Pods.xcodeproj")
|
79
|
-
super_project_paths = get_super_project(pods_project)
|
80
|
-
super_projects = []
|
81
|
-
super_project_paths.each do | path |
|
82
|
-
next if path.end_with? "Pods/Pods.xcodeproj"
|
83
|
-
project = Xcodeproj::Project.open(path)
|
84
|
-
super_projects.push project
|
85
|
-
end
|
86
|
-
return (super_projects + [pods_project])
|
87
|
-
end
|
88
|
-
|
89
|
-
def get_super_project(project)
|
90
|
-
wrapper_projects = project.files.select{|file|file.last_known_file_type=="wrapper.pb-project"}
|
91
|
-
wrapper_project_paths = []
|
92
|
-
wrapper_projects.each do | wrapper_project_file |
|
93
|
-
wrapper_project_file_path = wrapper_project_file.real_path.to_s
|
94
|
-
wrapper_project_paths.push wrapper_project_file_path
|
95
|
-
end
|
96
|
-
return wrapper_project_paths.uniq
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
def backup_project(project)
|
101
|
-
command = "cp \"#{project.path}/project.pbxproj\" \"#{project.path}/ysTest_backup.pbxproj\""
|
102
|
-
raise unless system command
|
103
|
-
end
|
104
|
-
|
105
|
-
def clean_temp_files
|
106
|
-
# command = "rm -rf Pods/*.xcodeproj/ysTest_backup.pbxproj"
|
107
|
-
# raise unless system command
|
108
|
-
|
109
|
-
command = "rm -rf Pods/*.xcodeproj/*.#{FILE_NAME_TARGET_CONTEXT}"
|
110
|
-
raise unless system command
|
111
|
-
end
|
112
|
-
|
113
|
-
def restore_project(project)
|
114
|
-
if File.exist? "#{project.path}/ysTest_backup.pbxproj"
|
115
|
-
command = "mv \"#{project.path}/ysTest_backup.pbxproj\" \"#{project.path}/project.pbxproj\""
|
116
|
-
raise unless system command
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
|
121
|
-
def can_cache_target(target)
|
122
|
-
if target.product_type == "com.apple.product-type.bundle" or
|
123
|
-
target.product_type == "com.apple.product-type.library.static" or
|
124
|
-
target.product_type == "com.apple.product-type.framework"
|
125
|
-
return true
|
126
|
-
end
|
127
|
-
return false
|
128
|
-
end
|
129
|
-
|
130
|
-
def get_target_dependency_files(target, intermediate_dir, product_dir, xcframeworks_build_dir, src_path)
|
131
|
-
dependency_files = []
|
132
|
-
Dir.glob("#{intermediate_dir}/**/*.d").each do | dependency_file |
|
133
|
-
content = File.read(dependency_file)
|
134
|
-
files = content.scan(/(?:\S(?:\\ )*)+/).flatten.uniq
|
135
|
-
files = files - ["dependencies:", "\\", ":"]
|
136
|
-
files.each do | file |
|
137
|
-
file = file.gsub("\\ ", " ")
|
138
|
-
if file.start_with? target.name
|
139
|
-
file = src_path + "/" + file
|
140
|
-
end
|
141
|
-
unless File.exist? file
|
142
|
-
puts "<ERROR> #{target.name} #{file} should exist in dependency file #{dependency_file}"
|
143
|
-
return []
|
144
|
-
end
|
145
|
-
|
146
|
-
if file.start_with? intermediate_dir + "/" or
|
147
|
-
file.start_with? product_dir + "/"
|
148
|
-
next
|
149
|
-
end
|
150
|
-
|
151
|
-
if xcframeworks_build_dir and xcframeworks_build_dir.size > 0 and file.start_with? xcframeworks_build_dir + "/"
|
152
|
-
next
|
153
|
-
end
|
154
|
-
dependency_files.push file
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
return dependency_files.uniq
|
159
|
-
end
|
160
|
-
|
161
|
-
|
162
|
-
def get_target_source_files(target)
|
163
|
-
files = []
|
164
|
-
#获取所有可执行文件(.m .swift .cpp .mm)
|
165
|
-
target.source_build_phase.files.each do | file |
|
166
|
-
file_path = file.file_ref.real_path.to_s
|
167
|
-
files.push file_path
|
168
|
-
end
|
169
|
-
|
170
|
-
#获取所有头文件(.h)
|
171
|
-
target.headers_build_phase.files.each do | file |
|
172
|
-
file_path = file.file_ref.real_path.to_s
|
173
|
-
files.push file_path
|
174
|
-
end
|
175
|
-
#获取所有资源文件(.png,.strings .json .html)
|
176
|
-
target.resources_build_phase.files.each do | file |
|
177
|
-
file_path = file.file_ref.real_path.to_s
|
178
|
-
files.push file_path
|
179
|
-
end
|
180
|
-
expand_files = []
|
181
|
-
files.uniq.each do | file |
|
182
|
-
next unless File.exist? file
|
183
|
-
if File.file? file
|
184
|
-
expand_files.push file
|
185
|
-
else
|
186
|
-
Find.find(file).each do | file_in_dir |
|
187
|
-
if File.file? file_in_dir
|
188
|
-
expand_files.push file_in_dir
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
return expand_files.uniq
|
194
|
-
end
|
195
|
-
|
196
|
-
|
197
|
-
def generate_target_all_infomation(project, target, source_files)
|
198
|
-
|
199
|
-
if $podfile_spec_checksums == nil and File.exist? "Podfile.lock"
|
200
|
-
podfile_lock = YAML.load(File.read("Podfile.lock"))
|
201
|
-
$podfile_spec_checksums = podfile_lock["SPEC CHECKSUMS"]
|
202
|
-
end
|
203
|
-
|
204
|
-
project_configuration = project.build_configurations.detect { | config | config.name == $target_build_configuration}
|
205
|
-
project_configuration_content = project_configuration.pretty_print.to_yaml
|
206
|
-
|
207
|
-
project_xcconfig = ""
|
208
|
-
if project_configuration.base_configuration_reference
|
209
|
-
config_file_path = project_configuration.base_configuration_reference.real_path
|
210
|
-
if File.exist? config_file_path
|
211
|
-
project_xcconfig = File.read(config_file_path).lines.reject{|line|line.include? "_SEARCH_PATHS"}.sort.join("")
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
target_configuration = target.build_configurations.detect { | config | config.name == $target_build_configuration}
|
216
|
-
target_configuration_content = target_configuration.pretty_print.to_yaml
|
217
|
-
|
218
|
-
target_xcconfig = ""
|
219
|
-
if target_configuration.base_configuration_reference
|
220
|
-
config_file_path = target_configuration.base_configuration_reference.real_path
|
221
|
-
if File.exist? config_file_path
|
222
|
-
target_xcconfig = File.read(config_file_path).lines.reject{|line|line.include? "_SEARCH_PATHS"}.sort.join("")
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
|
227
|
-
files_configuration = []
|
228
|
-
build_phases = []
|
229
|
-
build_phases.push target.source_build_phase if target.methods.include? :source_build_phase
|
230
|
-
build_phases.push target.resources_build_phase if target.methods.include? :resources_build_phase
|
231
|
-
build_phases.each do | build_phase |
|
232
|
-
target.source_build_phase.files_references.each do | files_reference |
|
233
|
-
files_reference.build_files.each do |build_file|
|
234
|
-
if build_file.settings and build_file.settings.class == Hash
|
235
|
-
files_configuration.push File.basename(build_file.file_ref.real_path.to_s) + "\n" + build_file.settings.to_yaml
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
240
|
-
files_configuration = files_configuration.sort.uniq.join("\n")
|
241
|
-
|
242
|
-
|
243
|
-
source_md5_list = []
|
244
|
-
has_found_checksum = false
|
245
|
-
split_parts = target.name.split("-")
|
246
|
-
split_parts.each_with_index do | part, index |
|
247
|
-
spec_name = split_parts[0..index].join("-")
|
248
|
-
if $podfile_spec_checksums.has_key? spec_name
|
249
|
-
source_md5_list.push "SPEC CHECKSUM : #{spec_name} #{$podfile_spec_checksums[spec_name]}"
|
250
|
-
has_found_checksum = true
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
if has_found_checksum
|
255
|
-
if target.name.start_with? "AK" or target.name.start_with? "EUR"
|
256
|
-
|
257
|
-
source_md5_list.push "Project : #{File.basename(project.path)}"
|
258
|
-
source_md5_list.push "Project configuration : "
|
259
|
-
source_md5_list.push project_configuration_content.strip
|
260
|
-
source_md5_list.push "Project xcconfig : "
|
261
|
-
source_md5_list.push project_xcconfig.strip
|
262
|
-
|
263
|
-
source_md5_list.push "Target : #{target.name}, #{target.product_type}"
|
264
|
-
source_md5_list.push "Target configuration : "
|
265
|
-
source_md5_list.push target_configuration_content.strip
|
266
|
-
source_md5_list.push "Target xcconfig : "
|
267
|
-
source_md5_list.push target_xcconfig.strip
|
268
|
-
source_md5_list.push "Files settings : "
|
269
|
-
source_md5_list.push files_configuration.strip
|
270
|
-
|
271
|
-
source_md5_list.push "Files MD5 : "
|
272
|
-
source_files.uniq.sort.each do | file |
|
273
|
-
path = get_content_without_pwd(file)
|
274
|
-
if target.name == "AKULocalizedStrings" or target.name == "EURLocalizedStrings"
|
275
|
-
if file.include? ".swift"
|
276
|
-
source_md5_list.push path + " : " + get_file_md5(path)
|
277
|
-
end
|
278
|
-
else
|
279
|
-
source_md5_list.push path + " : " + get_file_md5(path)
|
280
|
-
end
|
281
|
-
end
|
282
|
-
else
|
283
|
-
source_md5_list.push "Target configuration: #{$target_build_configuration}"
|
284
|
-
end
|
285
|
-
|
286
|
-
source_md5_content = source_md5_list.join("\n")
|
287
|
-
return source_md5_content
|
288
|
-
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
def get_target_cache(target, target_md5)
|
295
|
-
|
296
|
-
dependency_start_time = Time.now
|
297
|
-
|
298
|
-
if is_private_target(target)
|
299
|
-
target_cache_dirs = Dir.glob(get_cache_root + "/" + target.name + "-" + target_md5 + "-*")
|
300
|
-
else
|
301
|
-
target_cache_dirs = Dir.glob(get_default_cache_root + "/" + target.name + "-" + target_md5 + "-*")
|
302
|
-
end
|
303
|
-
|
304
|
-
hit_results = []
|
305
|
-
|
306
|
-
target_cache_dirs.each do |target_cache_dir|
|
307
|
-
unless File.exist? target_cache_dir + "/" + FILE_NAME_PRODUCT
|
308
|
-
puts "<ERROR> #{target.name} target cache dir missed files: #{target_cache_dir}"
|
309
|
-
next
|
310
|
-
end
|
311
|
-
unless File.exist? target_cache_dir + "/" + FILE_NAME_CONTEXT
|
312
|
-
puts "<ERROR> #{target.name} target cache dir missed files: #{target_cache_dir}"
|
313
|
-
next
|
314
|
-
end
|
315
|
-
|
316
|
-
target_context = YAML.load(File.read(target_cache_dir + "/" + FILE_NAME_CONTEXT))
|
317
|
-
|
318
|
-
if target_context[:target_md5] != target_md5 or target_context[:product_md5] != get_file_md5(target_cache_dir + "/" + FILE_NAME_PRODUCT)
|
319
|
-
command = "rm -rf \"#{target_cache_dir}\""
|
320
|
-
raise unless system command
|
321
|
-
puts "<ERROR> #{target.name} target md5 does not match: #{target_cache_dir}"
|
322
|
-
end
|
323
|
-
|
324
|
-
dependency_exit = true
|
325
|
-
|
326
|
-
if target_context[:dependency_files_md5]
|
327
|
-
target_context[:dependency_files_md5].each do | item |
|
328
|
-
dependency_file = item[0]
|
329
|
-
dependency_md5 = item[1]
|
330
|
-
unless File.exist? dependency_file
|
331
|
-
puts "<WARNING> #{target.name} dependency file miss: #{dependency_file}"
|
332
|
-
dependency_exit = false
|
333
|
-
break
|
334
|
-
end
|
335
|
-
unless get_file_md5(dependency_file) == dependency_md5
|
336
|
-
puts "<WARNING> #{target.name} dependency file md5 does not match: #{dependency_file}"
|
337
|
-
dependency_exit = false
|
338
|
-
break
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
if dependency_exit
|
344
|
-
hit_results.push target_cache_dir
|
345
|
-
end
|
346
|
-
end
|
347
|
-
|
348
|
-
return hit_results
|
349
|
-
|
350
|
-
end
|
351
|
-
|
352
|
-
def set_prama_to_yaml
|
353
|
-
target_name = ARGV[1]
|
354
|
-
project_path = ARGV[2]
|
355
|
-
if File.exist? "#{project_path}/#{target_name}.#{FILE_NAME_TARGET_CONTEXT}"
|
356
|
-
target_context = YAML.load(File.read("#{project_path}/#{target_name}.#{FILE_NAME_TARGET_CONTEXT}"))
|
357
|
-
|
358
|
-
[SYMROOT, OBJROOT, SRCROOT, CONFIGURATION_BUILD_DIR, CONFIGURATION_TEMP_DIR, TARGET_BUILD_DIR, TARGET_TEMP_DIR, PODS_XCFRAMEWORKS_BUILD_DIR, MODULEMAP_FILE, FULL_PRODUCT_NAME].sort.each do | key |
|
359
|
-
if ENV[key]
|
360
|
-
target_context[key] = ENV[key]
|
361
|
-
end
|
362
|
-
end
|
363
|
-
target_context[:target_status] = CACHE_STATUS_READY
|
364
|
-
File.write("#{project_path}/#{target_name}.#{FILE_NAME_TARGET_CONTEXT}", target_context.to_yaml)
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
def inject_flag_action(project, target)
|
369
|
-
command_exec = "\"#{$0}\""
|
370
|
-
inject_phase = target.new_shell_script_build_phase("ys_inject_#{target.name}")
|
371
|
-
inject_phase.shell_script = "#{command_exec} #{"inject"} #{target.name} \"#{project.path}\""
|
372
|
-
inject_phase.show_env_vars_in_log = '1'
|
373
|
-
end
|
374
|
-
|
375
|
-
def inject_copy_action(project, target, target_context)
|
376
|
-
target_cache_dir = target_context[:hit_target_cache_dir]
|
377
|
-
|
378
|
-
target.build_phases.delete_if { | build_phase |
|
379
|
-
build_phase.class == Xcodeproj::Project::Object::PBXHeadersBuildPhase or
|
380
|
-
build_phase.class == Xcodeproj::Project::Object::PBXSourcesBuildPhase or
|
381
|
-
build_phase.class == Xcodeproj::Project::Object::PBXResourcesBuildPhase
|
382
|
-
}
|
383
|
-
|
384
|
-
command_exec = "\"#{$0}\""
|
385
|
-
inject_phase = target.new_shell_script_build_phase("ys_copy_#{target.name}")
|
386
|
-
inject_phase.shell_script = "#{command_exec} #{"copy"} \"#{target_cache_dir}\""
|
387
|
-
inject_phase.show_env_vars_in_log = '1'
|
388
|
-
end
|
389
|
-
|
390
|
-
def copy_cache
|
391
|
-
|
392
|
-
puts "<INFO> #{Time.now.to_f.to_s}"
|
393
|
-
start_time = Time.now
|
394
|
-
target_cache_dir = ARGV[1]
|
395
|
-
cache_product_path = target_cache_dir + "/#{FILE_NAME_PRODUCT}"
|
396
|
-
|
397
|
-
[SYMROOT, CONFIGURATION_BUILD_DIR, CONFIGURATION_TEMP_DIR, OBJROOT, TARGET_BUILD_DIR, TARGET_TEMP_DIR, SRCROOT, FULL_PRODUCT_NAME].sort.each do | key |
|
398
|
-
unless ENV.has_key? key and ENV[key] and ENV[key].size > 0
|
399
|
-
raise "<INFO> #{$0} should have #{key}"
|
400
|
-
break
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
command = "mkdir -p \"#{ENV[CONFIGURATION_BUILD_DIR]}\" && cd \"#{File.dirname(ENV[CONFIGURATION_BUILD_DIR])}/\" && tar -xf \"#{cache_product_path}\""
|
405
|
-
raise unless system command
|
406
|
-
|
407
|
-
if ENV[CONFIGURATION_BUILD_DIR] != ENV[TARGET_BUILD_DIR]
|
408
|
-
|
409
|
-
command = "rm -rf \"#{ENV[TARGET_BUILD_DIR]+"/"+ENV[FULL_PRODUCT_NAME]}\""
|
410
|
-
raise unless system command
|
411
|
-
|
412
|
-
command = "mkdir -p \"#{File.dirname(ENV[TARGET_BUILD_DIR]+"/"+ENV[FULL_PRODUCT_NAME])}\""
|
413
|
-
raise unless system command
|
414
|
-
|
415
|
-
command = "mv \"#{ENV[CONFIGURATION_BUILD_DIR]+"/"+ENV[FULL_PRODUCT_NAME]}\" \"#{ENV[TARGET_BUILD_DIR]+"/"+ENV[FULL_PRODUCT_NAME]}\""
|
416
|
-
raise unless system command
|
417
|
-
|
418
|
-
command = "/bin/ln -sfh \"#{ENV[TARGET_BUILD_DIR]+"/"+ENV[FULL_PRODUCT_NAME]}\" \"#{ENV[CONFIGURATION_BUILD_DIR]+"/"+ENV[FULL_PRODUCT_NAME]}\""
|
419
|
-
raise unless system command
|
420
|
-
end
|
421
|
-
|
422
|
-
puts "<INFO> duration = #{((Time.now - start_time)*1000).to_i} ms in copy cache action"
|
423
|
-
puts "<INFO> #{Time.now.to_f.to_s}"
|
424
|
-
end
|
425
|
-
|
426
|
-
|
427
|
-
def add_cache(target, target_info)
|
428
|
-
target_md5 = target_info[:target_md5]
|
429
|
-
product_dir = target_info[CONFIGURATION_BUILD_DIR]
|
430
|
-
full_product_name = target_info[FULL_PRODUCT_NAME]
|
431
|
-
|
432
|
-
Dir.glob("#{product_dir}/**/*.modulemap").each do | modulemap |
|
433
|
-
modulemap_content = File.read(modulemap)
|
434
|
-
if modulemap_content.include? File.dirname(modulemap) + "/"
|
435
|
-
modulemap_content = modulemap_content.gsub(File.dirname(modulemap) + "/", "")
|
436
|
-
File.write(modulemap, modulemap_content)
|
437
|
-
end
|
438
|
-
end
|
439
|
-
|
440
|
-
unless full_product_name and full_product_name.size > 0 and File.exist? "#{product_dir}/#{full_product_name}"
|
441
|
-
puts "<ERROR> #{target.name} #{product_dir}/#{full_product_name} should exist"
|
442
|
-
return false
|
443
|
-
end
|
444
|
-
|
445
|
-
zip_start_time = Time.now
|
446
|
-
|
447
|
-
command = "cd \"#{File.dirname(product_dir)}\" && tar -L -c -f #{target.name}.#{FILE_NAME_PRODUCT} #{File.basename(product_dir)}/#{full_product_name}"
|
448
|
-
if target.product_type == "com.apple.product-type.library.static"
|
449
|
-
command = "cd \"#{File.dirname(product_dir)}\" && tar --exclude=*.bundle --exclude=*.framework -L -c -f #{target.name}.#{FILE_NAME_PRODUCT} #{File.basename(product_dir)}"
|
450
|
-
end
|
451
|
-
|
452
|
-
unless system command
|
453
|
-
puts "<INFO> #{command} should succeed"
|
454
|
-
return false
|
455
|
-
end
|
456
|
-
|
457
|
-
|
458
|
-
if is_private_target(target)
|
459
|
-
already_target_cache_dirs = Dir.glob(get_cache_root + "/" + target.name + "-" + target_md5 + "-*")
|
460
|
-
else
|
461
|
-
already_target_cache_dirs = Dir.glob(get_default_cache_root + "/" + target.name + "-" + target_md5 + "-*")
|
462
|
-
end
|
463
|
-
|
464
|
-
already_target_cache_dirs.each do |path|
|
465
|
-
if File.exist? path
|
466
|
-
raise unless system "rm -rf \"#{path}\""
|
467
|
-
end
|
468
|
-
end
|
469
|
-
|
470
|
-
if is_private_target(target)
|
471
|
-
target_cache_dir = get_cache_root + "/" + target.name + "-" + target_md5 + "-" + (Time.now.to_f * 1000).to_i.to_s
|
472
|
-
else
|
473
|
-
target_cache_dir = get_default_cache_root + "/" + target.name + "-" + target_md5 + "-" + (Time.now.to_f * 1000).to_i.to_s
|
474
|
-
end
|
475
|
-
|
476
|
-
if File.exist? target_cache_dir
|
477
|
-
puts "<INFO> #{target_cache_dir} should not exist"
|
478
|
-
raise unless system "rm -rf \"#{target_cache_dir}\""
|
479
|
-
return false
|
480
|
-
end
|
481
|
-
|
482
|
-
command = "mkdir -p \"#{target_cache_dir}\""
|
483
|
-
unless system command
|
484
|
-
puts "<INFO> #{command} should succeed"
|
485
|
-
return false
|
486
|
-
end
|
487
|
-
|
488
|
-
cache_product_path = target_cache_dir + "/#{FILE_NAME_PRODUCT}"
|
489
|
-
command = "mv \"#{File.dirname(product_dir)}/#{target.name}.#{FILE_NAME_PRODUCT}\" \"#{cache_product_path}\""
|
490
|
-
unless system command
|
491
|
-
puts "<INFO> #{command} should succeed"
|
492
|
-
return false
|
493
|
-
end
|
494
|
-
unless File.exist? cache_product_path
|
495
|
-
puts "<INFO> #{cache_product_path} should exist after mv"
|
496
|
-
return false
|
497
|
-
end
|
498
|
-
|
499
|
-
target_info[:product_md5] = get_file_md5(cache_product_path)
|
500
|
-
target_info[:build_product_dir] = target_info[CONFIGURATION_BUILD_DIR].gsub(target_info[SYMROOT] + "/", "")
|
501
|
-
target_info[:build_intermediate_dir] = target_info[TARGET_TEMP_DIR].gsub(target_info[OBJROOT] + "/", "")
|
502
|
-
if target_info[MODULEMAP_FILE]
|
503
|
-
target_info[MODULEMAP_FILE] = get_content_without_pwd(target_info[MODULEMAP_FILE])
|
504
|
-
end
|
505
|
-
|
506
|
-
target_info = target_info.clone
|
507
|
-
target_info.delete(:dependency_files)
|
508
|
-
target_info.delete(:target_status)
|
509
|
-
target_info.delete(:hit_target_cache_dir)
|
510
|
-
target_info.delete(:target_md5_content)
|
511
|
-
[SYMROOT, CONFIGURATION_BUILD_DIR, CONFIGURATION_TEMP_DIR, OBJROOT, TARGET_TEMP_DIR, TARGET_BUILD_DIR, PODS_XCFRAMEWORKS_BUILD_DIR, SRCROOT].each do | key |
|
512
|
-
target_info.delete(key)
|
513
|
-
end
|
514
|
-
|
515
|
-
File.write(target_cache_dir + "/" + FILE_NAME_CONTEXT, target_info.to_yaml)
|
516
|
-
|
517
|
-
return true
|
518
|
-
|
519
|
-
end
|
520
|
-
|
521
|
-
def get_custom_config_information
|
522
|
-
if File.exist? "project_cache_config.yml"
|
523
|
-
custom_config = YAML.load (File.read("project_cache_config.yml"))
|
524
|
-
$exclude_target = custom_config[:exclude_targets]
|
525
|
-
else
|
526
|
-
source = {
|
527
|
-
:description => nil,
|
528
|
-
:dependency_check => true,
|
529
|
-
:exclude_targets => ["target1", "target2"],
|
530
|
-
}.to_yaml
|
531
|
-
|
532
|
-
substitution_list = {
|
533
|
-
/:description:/ => "# You can assign values to these parameters to achieve some custom functions\n",
|
534
|
-
/:dependency_check:/ => "\n\n# Whether to check the dependencies of the target. For exzample: target A depends on target B. Under normal circumstances, target B is recompiled, then target A will be recompiled, but if the dependencies are not checked, target A will not be recompiled at this time\n:dependency_check:",
|
535
|
-
/:exclude_targets:/ => "\n\n# the targets that will not participate in cache dependency detection\n:exclude_targets:",
|
536
|
-
}
|
537
|
-
|
538
|
-
substitution_list.each do |pattern, replacement|
|
539
|
-
source.gsub!(pattern, replacement)
|
540
|
-
end
|
541
|
-
puts source
|
542
|
-
File.write("project_cache_config.yml", source)
|
543
|
-
end
|
544
|
-
|
545
|
-
end
|
546
|
-
|
547
|
-
|
548
|
-
def project_task_begin(argv)
|
549
|
-
|
550
|
-
argv.each do |prama|
|
551
|
-
if prama.include? "configuration"
|
552
|
-
if prama.include? "Debug"
|
553
|
-
$target_build_configuration = "Debug"
|
554
|
-
elsif prama.include? "Release"
|
555
|
-
$target_build_configuration = "Release"
|
556
|
-
end
|
557
|
-
elsif prama.include? "branch:"
|
558
|
-
$project_build_branch = prama.dup.gsub!("branch:", "")
|
559
|
-
end
|
560
|
-
end
|
561
|
-
|
562
|
-
projects = get_projects
|
563
|
-
total_count = 0
|
564
|
-
hit_count = 0
|
565
|
-
miss_count = 0
|
566
|
-
error_count = 0
|
567
|
-
hit_target_md5_cache_set = Set.new
|
568
|
-
miss_target_cache_set = Set.new
|
569
|
-
|
570
|
-
get_custom_config_information
|
571
|
-
|
572
|
-
pre_targets_info = {}
|
573
|
-
|
574
|
-
projects.each do |project|
|
575
|
-
restore_project(project)
|
576
|
-
backup_project(project)
|
577
|
-
end
|
578
|
-
|
579
|
-
clean_temp_files
|
580
|
-
|
581
|
-
projects = get_projects
|
582
|
-
|
583
|
-
projects.each do |project|
|
584
|
-
project.native_targets.each do |target|
|
585
|
-
target.build_phases.delete_if { |phase|
|
586
|
-
phase.class == Xcodeproj::Project::Object::PBXShellScriptBuildPhase and phase.name.include? "ys_"
|
587
|
-
}
|
588
|
-
if can_cache_target(target)
|
589
|
-
total_count = total_count + 1
|
590
|
-
source_files = get_target_source_files(target)
|
591
|
-
target_md5_content = generate_target_all_infomation(project, target, source_files)
|
592
|
-
unless target_md5_content
|
593
|
-
puts "<ERROR> target md5 content can not generate: #{target.name}"
|
594
|
-
error_count = error_count + 1
|
595
|
-
next
|
596
|
-
end
|
597
|
-
|
598
|
-
target_md5 = Digest::MD5.hexdigest(target_md5_content)
|
599
|
-
hit_target_cache_dirs = get_target_cache(target, target_md5)
|
600
|
-
target_info = {}
|
601
|
-
target_info[:target_md5] = target_md5
|
602
|
-
|
603
|
-
if hit_target_cache_dirs.count == 0
|
604
|
-
puts "<INFO> #{target.name} #{target_md5} does not hit any cache"
|
605
|
-
target_info[:target_status] = CACHE_STATUS_MISS
|
606
|
-
inject_flag_action(project, target)
|
607
|
-
miss_count = miss_count + 1
|
608
|
-
File.write("#{project.path}/#{target.name}.#{FILE_NAME_TARGET_CONTEXT}", target_info.to_yaml)
|
609
|
-
else
|
610
|
-
target_info[:hit_target_cache_dir] = hit_target_cache_dirs
|
611
|
-
hit_target_md5_cache_set.add "#{target.name}-#{target_info[:target_md5]}"
|
612
|
-
end
|
613
|
-
pre_targets_info[target] = target_info
|
614
|
-
end
|
615
|
-
end
|
616
|
-
end
|
617
|
-
|
618
|
-
while true
|
619
|
-
projects.each do |project|
|
620
|
-
project.native_targets.each do |target|
|
621
|
-
target_info = pre_targets_info[target]
|
622
|
-
next unless target_info and target_info[:target_status] != CACHE_STATUS_MISS
|
623
|
-
next unless target_info and target_info[:target_status] != CACHE_STATUS_HIT
|
624
|
-
hit_target_cache_dirs = target_info[:hit_target_cache_dir]
|
625
|
-
next unless hit_target_cache_dirs and hit_target_cache_dirs.count > 0
|
626
|
-
target_md5 = target_info[:target_md5]
|
627
|
-
|
628
|
-
target_really_hit_dir = ""
|
629
|
-
target_really_miss = false
|
630
|
-
hit_target_cache_dirs.each do |hit_target_cache_dir|
|
631
|
-
all_dependency_target_exist = true
|
632
|
-
target_really_miss = false
|
633
|
-
hit_targets_info = YAML.load(File.read(hit_target_cache_dir + "/" + FILE_NAME_CONTEXT))
|
634
|
-
if hit_targets_info[:dependency_targets_md5]
|
635
|
-
hit_targets_info[:dependency_targets_md5].each do | item |
|
636
|
-
dependency_target = item[0]
|
637
|
-
dependency_target_md5 = item[1]
|
638
|
-
if $exclude_target.include? dependency_target
|
639
|
-
puts "<INFO> #{target.name} #{target_md5} hit cache, dependency target #{dependency_target}-#{dependency_target_md5} skip check"
|
640
|
-
next
|
641
|
-
end
|
642
|
-
|
643
|
-
if miss_target_cache_set.include? "#{dependency_target}"
|
644
|
-
puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5} does not hit"
|
645
|
-
target_really_miss = true
|
646
|
-
all_dependency_target_exist = false
|
647
|
-
break
|
648
|
-
end
|
649
|
-
|
650
|
-
unless hit_target_md5_cache_set.include? "#{dependency_target}-#{dependency_target_md5}"
|
651
|
-
puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5} does not hit"
|
652
|
-
all_dependency_target_exist = false
|
653
|
-
target_really_miss = true
|
654
|
-
break
|
655
|
-
end
|
656
|
-
end
|
657
|
-
|
658
|
-
if all_dependency_target_exist
|
659
|
-
target_really_hit_dir = hit_target_cache_dir
|
660
|
-
break
|
661
|
-
end
|
662
|
-
|
663
|
-
if target_really_miss
|
664
|
-
break
|
665
|
-
end
|
666
|
-
end
|
667
|
-
end
|
668
|
-
|
669
|
-
if target_really_hit_dir.length > 0
|
670
|
-
puts "<INFO> #{target.name} #{target_md5} hit cache"
|
671
|
-
hit_count = hit_count + 1
|
672
|
-
hit_target_info = YAML.load(File.read(target_really_hit_dir + "/" + FILE_NAME_CONTEXT))
|
673
|
-
target_info = target_info.merge!(hit_target_info)
|
674
|
-
target_info[:target_status] = CACHE_STATUS_HIT
|
675
|
-
target_info[:hit_target_cache_dir] = target_really_hit_dir
|
676
|
-
inject_copy_action(project, target, target_info)
|
677
|
-
end
|
678
|
-
|
679
|
-
if target_really_miss
|
680
|
-
miss_count = miss_count + 1
|
681
|
-
miss_target_cache_set.add "#{target.name}"
|
682
|
-
hit_target_md5_cache_set.delete "#{target.name}-#{target_info[:target_md5]}"
|
683
|
-
target_info[:target_status] = CACHE_STATUS_MISS
|
684
|
-
target_info.delete(:hit_target_cache_dir)
|
685
|
-
inject_flag_action(project, target)
|
686
|
-
end
|
687
|
-
|
688
|
-
File.write("#{project.path}/#{target.name}.#{FILE_NAME_TARGET_CONTEXT}", target_info.to_yaml)
|
689
|
-
end
|
690
|
-
project.save
|
691
|
-
end
|
692
|
-
if total_count == hit_count + miss_count + error_count
|
693
|
-
break
|
694
|
-
else
|
695
|
-
puts "<INFO> continue to find hit cache"
|
696
|
-
end
|
697
|
-
end
|
698
|
-
puts "<INFO> total count: #{total_count}, hit count: #{hit_count}, miss_count: #{miss_count}, error_count: #{error_count}"
|
699
|
-
end
|
700
|
-
|
701
|
-
|
702
|
-
def project_task_end
|
703
|
-
|
704
|
-
projects = get_projects
|
705
|
-
post_targets_context = {}
|
706
|
-
total_add_count = 0
|
707
|
-
|
708
|
-
projects.each do |project|
|
709
|
-
project.native_targets.each do | target |
|
710
|
-
target_context_file = "#{project.path}/#{target.name}.#{FILE_NAME_TARGET_CONTEXT}"
|
711
|
-
next unless File.exist? target_context_file
|
712
|
-
if can_cache_target(target)
|
713
|
-
target_info = YAML.load(File.read(target_context_file))
|
714
|
-
if target_info[:target_status] == CACHE_STATUS_READY
|
715
|
-
# 保证编译前后MD5不变
|
716
|
-
source_files = get_target_source_files(target)
|
717
|
-
target_md5_content = generate_target_all_infomation(project, target, source_files)
|
718
|
-
target_md5 = Digest::MD5.hexdigest(target_md5_content)
|
719
|
-
unless target_info[:target_md5] == target_md5
|
720
|
-
puts "<ERROR> #{target.name} md5 should not be changed after build"
|
721
|
-
next
|
722
|
-
end
|
723
|
-
|
724
|
-
target_info[:target_md5_content] = target_md5_content
|
725
|
-
|
726
|
-
product_dir = target_info[CONFIGURATION_BUILD_DIR]
|
727
|
-
intermediate_dir = target_info[TARGET_TEMP_DIR].to_s
|
728
|
-
xcframeworks_build_dir = target_info[PODS_XCFRAMEWORKS_BUILD_DIR]
|
729
|
-
src_path = target_info[SRCROOT]
|
730
|
-
|
731
|
-
unless intermediate_dir.length > 0
|
732
|
-
puts "<ERROR> #{target.name} should have intermediate_dir"
|
733
|
-
next
|
734
|
-
end
|
735
|
-
dependency_files = get_target_dependency_files(target, intermediate_dir, product_dir, xcframeworks_build_dir, src_path)
|
736
|
-
if source_files.size > 0 and dependency_files.size == 0 and target.product_type != "com.apple.product-type.bundle"
|
737
|
-
puts "<ERROR> #{target.name} should have dependency files"
|
738
|
-
next
|
739
|
-
end
|
740
|
-
target_info[:dependency_files] = dependency_files - source_files
|
741
|
-
|
742
|
-
module_file_path = target_info[MODULEMAP_FILE]
|
743
|
-
|
744
|
-
if src_path and src_path.size > 0 and module_file_path and module_file_path.size > 0
|
745
|
-
if File.exist? Dir.pwd + "/" + get_content_without_pwd("#{src_path}/#{module_file_path}")
|
746
|
-
target_info[MODULEMAP_FILE] = get_content_without_pwd("#{src_path}/#{module_file_path}")
|
747
|
-
else
|
748
|
-
puts "<ERROR> #{target.name} #{module_file_path} should be supported"
|
749
|
-
next
|
750
|
-
end
|
751
|
-
end
|
752
|
-
elsif target_info[:target_status] == CACHE_STATUS_HIT
|
753
|
-
module_file_path = target_info[MODULEMAP_FILE]
|
754
|
-
if module_file_path and module_file_path.size > 0
|
755
|
-
if not File.exist? Dir.pwd + "/" + target_info[MODULEMAP_FILE]
|
756
|
-
puts "<ERROR> #{target.name} #{module_file_path} should be supported"
|
757
|
-
next
|
758
|
-
end
|
759
|
-
end
|
760
|
-
end
|
761
|
-
post_targets_context[target] = target_info
|
762
|
-
|
763
|
-
end
|
764
|
-
end
|
765
|
-
end
|
766
|
-
|
767
|
-
projects.each do |project|
|
768
|
-
project.native_targets.each do | target |
|
769
|
-
if post_targets_context.has_key? target
|
770
|
-
target_info = post_targets_context[target]
|
771
|
-
next unless target_info[:target_status] == CACHE_STATUS_READY
|
772
|
-
|
773
|
-
dependency_targets_set = Set.new
|
774
|
-
implicit_dependencies = []
|
775
|
-
|
776
|
-
post_targets_context.each do | other_target, other_target_context |
|
777
|
-
next if target == other_target
|
778
|
-
next if target.product_type == "com.apple.product-type.bundle"
|
779
|
-
next if other_target.product_type == "com.apple.product-type.bundle"
|
780
|
-
|
781
|
-
configuration_build_dir = other_target_context[CONFIGURATION_BUILD_DIR]
|
782
|
-
target_temp_dir = other_target_context[TARGET_TEMP_DIR]
|
783
|
-
build_product_dir = other_target_context[:build_product_dir]
|
784
|
-
build_intermediate_dir = other_target_context[:build_intermediate_dir]
|
785
|
-
|
786
|
-
target_info[:dependency_files].each do | dependency |
|
787
|
-
if configuration_build_dir and configuration_build_dir.size > 0 and dependency.start_with? configuration_build_dir + "/"
|
788
|
-
dependency_targets_set.add other_target
|
789
|
-
implicit_dependencies.push dependency
|
790
|
-
end
|
791
|
-
|
792
|
-
if target_temp_dir and target_temp_dir.size > 0 and dependency.start_with? target_temp_dir + "/"
|
793
|
-
dependency_targets_set.add other_target
|
794
|
-
implicit_dependencies.push dependency
|
795
|
-
end
|
796
|
-
|
797
|
-
if build_product_dir and build_product_dir.size > 0 and dependency.start_with? target_info[SYMROOT] + "/" + build_product_dir + "/"
|
798
|
-
dependency_targets_set.add other_target
|
799
|
-
implicit_dependencies.push dependency
|
800
|
-
end
|
801
|
-
|
802
|
-
if build_intermediate_dir and build_intermediate_dir.size > 0 and dependency.start_with? target_info[OBJROOT] + "/" + build_intermediate_dir + "/"
|
803
|
-
dependency_targets_set.add other_target
|
804
|
-
implicit_dependencies.push dependency
|
805
|
-
end
|
806
|
-
|
807
|
-
end
|
808
|
-
target_info[:dependency_files] = target_info[:dependency_files] - implicit_dependencies
|
809
|
-
|
810
|
-
end
|
811
|
-
target_info[:dependency_files] = target_info[:dependency_files] - implicit_dependencies
|
812
|
-
|
813
|
-
dependency_files_md5 = []
|
814
|
-
|
815
|
-
should_cache = true
|
816
|
-
if target_info and target_info[:dependency_files].size > 0
|
817
|
-
target_info[:dependency_files].each do | file |
|
818
|
-
if file.start_with? target_info[OBJROOT] + "/" or file.start_with? target_info[SYMROOT] + "/"
|
819
|
-
puts "#{target.name} #{file} dependecy should not include build path"
|
820
|
-
should_cache = false
|
821
|
-
break
|
822
|
-
end
|
823
|
-
dependency_files_md5.push [get_content_without_pwd(file), get_file_md5(file)]
|
824
|
-
end
|
825
|
-
end
|
826
|
-
next unless should_cache
|
827
|
-
|
828
|
-
target_info[:dependency_files_md5] = dependency_files_md5.sort.uniq
|
829
|
-
dependency_targets_md5 = dependency_targets_set.to_a.map { | target | [target.name, post_targets_context[target][:target_md5]]}
|
830
|
-
target_info[:dependency_targets_md5] = dependency_targets_md5
|
831
|
-
|
832
|
-
if add_cache(target, target_info)
|
833
|
-
puts "<INFO> #{target} is being added to cache dir"
|
834
|
-
total_add_count = total_add_count + 1
|
835
|
-
target.build_phases.delete_if { |phase|
|
836
|
-
phase.class == Xcodeproj::Project::Object::PBXShellScriptBuildPhase and phase.name.include? "ys_"
|
837
|
-
}
|
838
|
-
end
|
839
|
-
|
840
|
-
end
|
841
|
-
end
|
842
|
-
restore_project(project)
|
843
|
-
end
|
844
|
-
|
845
|
-
puts "<INFO> total add cache count: #{total_add_count}"
|
846
|
-
end
|
847
|
-
|
848
|
-
end
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
data/lib/pod_plugin.rb
DELETED
File without changes
|