xccache 0.0.1.rc14987908371 → 0.0.1.rc14991851613

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0bde9f30b45d9bb5fa1d57f746027a52966b3dbd8e346df12ea7192352b4771
4
- data.tar.gz: 9c00c24e25538a0a7e57d0fb5b523562529f2bef84a5e0dd3db2dcc48b5a2d06
3
+ metadata.gz: fd5e1c42ab55e9d384b998ec94ca4dfe10c1b71cddde74f1b5a45fe8df9e99c5
4
+ data.tar.gz: a516b16ec060985d2bc705eb030b259b2858a96d110fa3ca1e046f89fb3c43f7
5
5
  SHA512:
6
- metadata.gz: 66ede00254ddaf3471eaf2626a8f69548bdaf3afaa5b2fa25ced9b410212b7b63e96dfd2f1252f70b81f894cf39fa2dbe0e04938e37f834ccdce4c4cd08022bb
7
- data.tar.gz: bc0a0ebf9d586e20c8a8af039d3481afa301543d5b4d717f365861e5bbd4cabc644dd6bbf512c1264abff8c833866fb970cc76885a22ea4c96378f99f30c2571
6
+ metadata.gz: 4b1ff0db0ed02e89266e8cd99262a09c53dcac4a2854f48e35f27e56f5b341e5272b63f8afbcffd28241a112ea50c4116793577535a4e8643e693b234bcb7a64
7
+ data.tar.gz: 9d57cf95ec5327a3688e0d437c67022fff096182fa9680a5418d75e5e3199bfb14063af67c2d3a4d0e4d8b4ac09f11faf976c5a713addc31b52500c6953336fe
@@ -40,7 +40,6 @@ enum XCCache {
40
40
  @MainActor
41
41
  struct Config {
42
42
  static let pkgDir = URL(filePath: #filePath).deletingLastPathComponent()
43
- static let repoDir = URL.homeDirectory.appending(path: ".xccache/default")
44
43
  // NOTE: Do NOT change `binariesDir` to `static let`
45
44
  // Somehow, incremental resolution doesnt work causing the `binaryExist` wrongly cached
46
45
  static var binariesDir: URL { pkgDir.appending(path: "binaries") }
@@ -4,7 +4,7 @@ module XCCache
4
4
  class Command
5
5
  class Options
6
6
  SDK = ["--sdk=foo,bar", "SDKs (iphonesimulator, iphoneos, etc.)"].freeze
7
- CONFIG = ["--config=foo", "Configuration (debug, release)"].freeze
7
+ CONFIG = ["--config=foo", "Configuration (debug, release) (default: debug)"].freeze
8
8
  SKIP_RESOLVING_DEPENDENCIES = [
9
9
  "--skip-resolving-dependencies", "Skip resolving package dependencies",
10
10
  ].freeze
@@ -18,11 +18,11 @@ module XCCache
18
18
  ].freeze
19
19
 
20
20
  def self.install_options
21
- [SDK, SKIP_RESOLVING_DEPENDENCIES]
21
+ [SDK, CONFIG, SKIP_RESOLVING_DEPENDENCIES]
22
22
  end
23
23
 
24
24
  def self.build_options
25
- install_options + [CONFIG, MERGE_SLICES, LIBRARY_EVOLUTION]
25
+ install_options + [MERGE_SLICES, LIBRARY_EVOLUTION]
26
26
  end
27
27
  end
28
28
  end
@@ -0,0 +1,32 @@
1
+ module XCCache
2
+ class Command
3
+ class Cache < Command
4
+ class Clean < Cache
5
+ self.summary = "Cleaning/purging cache"
6
+ self.arguments = [CLAide::Argument.new("TARGET", false, true)]
7
+ def self.options
8
+ [
9
+ ["--all", "Whether to remove all cache (default: false)"],
10
+ ["--dry", "Dry run - don't remove cache, just show what shall be removed (default: false)"],
11
+ ].concat(super)
12
+ end
13
+
14
+ def initialize(argv)
15
+ super
16
+ @all = argv.flag?("all")
17
+ @dry = argv.flag?("dry")
18
+ @targets = argv.arguments!
19
+ end
20
+
21
+ def run
22
+ to_remove = @targets.flat_map { |t| config.spm_cache_dir.glob("#{t}/*") }
23
+ to_remove = config.spm_cache_dir.glob("*/*") if @all
24
+ to_remove.each do |p|
25
+ UI.info("Removing #{p.basename.to_s.yellow}")
26
+ p.rmtree unless @dry
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ module XCCache
2
+ class Command
3
+ class Cache < Command
4
+ class List < Cache
5
+ self.summary = "Listing cache"
6
+
7
+ def run
8
+ target_paths = config.spm_cache_dir.glob("*")
9
+ target_paths.each do |target_path|
10
+ next if (paths = target_path.glob("*")).empty?
11
+ descs = paths.map { |p| " #{p.basename.to_s.green}" }
12
+ UI.info <<~DESC
13
+ #{target_path.basename.to_s.cyan}:
14
+ #{descs.join('\n')}
15
+ DESC
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ require_relative "base"
2
+ require "xccache/command/cache/clean"
3
+ require "xccache/command/cache/list"
4
+
5
+ module XCCache
6
+ class Command
7
+ class Cache < Command
8
+ self.abstract_command = true
9
+ self.summary = "Working with cache (list, clean, etc.)"
10
+ end
11
+ end
12
+ end
@@ -10,6 +10,7 @@ module XCCache
10
10
  self.summary = "Working with remote cache"
11
11
  def self.options
12
12
  [
13
+ Options::CONFIG,
13
14
  ["--branch=foo", "Cache branch (if using git) (default: main)"],
14
15
  ].concat(super)
15
16
  end
@@ -16,13 +16,14 @@ module XCCache
16
16
  def initialize(argv)
17
17
  super
18
18
  config.verbose = verbose unless verbose.nil?
19
+ config.install_config = argv.option("config", "debug")
19
20
  @install_options = {
20
21
  :sdks => str_to_sdks(argv.option("sdk")),
22
+ :config => config.install_config,
21
23
  :skip_resolving_dependencies => argv.flag?("skip-resolving-dependencies"),
22
24
  }
23
25
  @build_options = {
24
26
  **@install_options,
25
- :config => argv.option("config"),
26
27
  :recursive => argv.flag?("recursive"),
27
28
  :merge_slices => argv.flag?("merge-slices", true),
28
29
  :library_evolution => argv.flag?("library-evolution"),
@@ -20,6 +20,12 @@ module XCCache
20
20
  attr_accessor :in_installation
21
21
  alias in_installation? in_installation
22
22
 
23
+ attr_writer :install_config
24
+
25
+ def install_config
26
+ @install_config || "debug"
27
+ end
28
+
23
29
  def sandbox
24
30
  @sandbox = Dir.prepare("xccache").expand_path
25
31
  end
@@ -36,8 +42,8 @@ module XCCache
36
42
  @spm_xcconfig_dir ||= Dir.prepare(spm_sandbox / "xcconfigs")
37
43
  end
38
44
 
39
- def spm_repo_dir
40
- @spm_repo_dir ||= Dir.prepare(Pathname("~/.xccache/default").expand_path)
45
+ def spm_cache_dir
46
+ @spm_cache_dir ||= Dir.prepare(Pathname("~/.xccache/#{install_config}").expand_path)
41
47
  end
42
48
 
43
49
  def spm_binaries_dir
@@ -79,7 +85,7 @@ module XCCache
79
85
  end
80
86
 
81
87
  def remote_config
82
- raw["remote"] || {}
88
+ pick_per_install_config(raw["remote"] || {})
83
89
  end
84
90
 
85
91
  def ignore_list
@@ -106,5 +112,11 @@ module XCCache
106
112
  def default_sdk
107
113
  raw["default_sdk"] || "iphonesimulator"
108
114
  end
115
+
116
+ private
117
+
118
+ def pick_per_install_config(hash)
119
+ hash[install_config] || hash["default"] || {}
120
+ end
109
121
  end
110
122
  end
@@ -12,7 +12,7 @@ module XCCache
12
12
  perform_install do
13
13
  umbrella_pkg.build(
14
14
  targets: @targets,
15
- out_dir: config.spm_repo_dir,
15
+ out_dir: config.spm_cache_dir,
16
16
  checksum: true,
17
17
  **@build_options,
18
18
  )
@@ -14,8 +14,8 @@ module XCCache
14
14
  end
15
15
 
16
16
  def perform_install
17
+ UI.message("Using cache dir: #{config.spm_cache_dir}")
17
18
  config.in_installation = true
18
- verify_projects!
19
19
  if @umbrella_pkg.nil?
20
20
  sync_lockfile
21
21
  umbrella_pkg.prepare(**@install_options)
@@ -53,6 +53,7 @@ module XCCache
53
53
  end
54
54
 
55
55
  def update_projects
56
+ verify_projects!
56
57
  projects.each do |project|
57
58
  yield project if block_given?
58
59
  project.save
@@ -91,7 +91,7 @@ module XCCache
91
91
  def binary_path(name, checksum: nil, in_repo: false)
92
92
  suffix = checksum.nil? ? "" : "-#{checksum}"
93
93
  ext = File.extname(name) == ".macro" ? ".macro" : ".xcframework"
94
- binaries_dir = in_repo ? config.spm_repo_dir : config.spm_binaries_dir
94
+ binaries_dir = in_repo ? config.spm_cache_dir : config.spm_binaries_dir
95
95
  p = binaries_dir / File.basename(name, ".*")
96
96
  p / "#{p.basename}#{suffix}#{ext}"
97
97
  end
@@ -34,7 +34,7 @@ module XCCache
34
34
  private
35
35
 
36
36
  def git
37
- @git ||= Git.new(config.spm_repo_dir)
37
+ @git ||= Git.new(config.spm_cache_dir)
38
38
  end
39
39
 
40
40
  def ensure_remote
@@ -12,11 +12,11 @@ module XCCache
12
12
  end
13
13
 
14
14
  def pull
15
- s3_sync(src: @uri, dst: config.spm_repo_dir)
15
+ s3_sync(src: @uri, dst: config.spm_cache_dir)
16
16
  end
17
17
 
18
18
  def push
19
- s3_sync(src: config.spm_repo_dir, dst: @uri)
19
+ s3_sync(src: config.spm_cache_dir, dst: @uri)
20
20
  end
21
21
 
22
22
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xccache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.rc14987908371
4
+ version: 0.0.1.rc14991851613
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thuyen Trinh
@@ -74,6 +74,9 @@ files:
74
74
  - lib/xccache/command.rb
75
75
  - lib/xccache/command/base.rb
76
76
  - lib/xccache/command/build.rb
77
+ - lib/xccache/command/cache.rb
78
+ - lib/xccache/command/cache/clean.rb
79
+ - lib/xccache/command/cache/list.rb
77
80
  - lib/xccache/command/pkg.rb
78
81
  - lib/xccache/command/pkg/build.rb
79
82
  - lib/xccache/command/remote.rb