xccache 1.0.0.rc15341775774 → 1.0.1.rc15390855924

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: 9f7b0d46b9a50e667904aedb052da8fa0605932bcd56c518bb308b9802622d74
4
- data.tar.gz: 3b98c6610a1f5db2223f93747533a5b8c27f35a163b0e2b6d480a264b7a9ffd0
3
+ metadata.gz: 49f968905b37c1abaa715789a33a9541f8bacc2b6cb6dc977b111609a64ebcf0
4
+ data.tar.gz: 27fa86909bc610e202efcf8fef604feca6563c6b88a879363bf021e2345cdc09
5
5
  SHA512:
6
- metadata.gz: 00d1a9e5103c69e770c96b78012ae25ee9dbfd6dbacfee4d2d5b2962d52a116663dfae34e3b7263ead13928470883c555cf11e1d0b17d8c332939d1d8938a1b1
7
- data.tar.gz: efb6d6d67964fe7edd78a08985682101c691d38837f92a322c5e85a395808a88e248db6cce3c01aadc4b9dc8b2f97a4d6340be129c61ef0bd2a8cfe7558b8171
6
+ metadata.gz: e99517798ad0d7b733f918e7d1863f57b551c481913769bb20c255b1accdcbf781984ed87b3d8257ecd16fe0f49aa14b4abadb77b50e654b8800bfdf1b1e4253
7
+ data.tar.gz: d283643742be4fef5b01ce53a98f2651ae1fc896a3d00abab3322242bb11ab984a4688064bb674584d3f4a9866ef849e3a274fea0786ac28eca06a3b25c9749c
@@ -0,0 +1,2 @@
1
+ # Check out this doc for details
2
+ # https://github.com/trinhngocthuyen/xccache/blob/main/docs/configuration.md
@@ -3,7 +3,7 @@ require "xccache/installer"
3
3
  module XCCache
4
4
  class Command
5
5
  class Options
6
- SDK = ["--sdk=foo,bar", "SDKs (iphonesimulator, iphoneos, etc.)"].freeze
6
+ SDK = ["--sdk=foo,bar", "SDKs (iphonesimulator, iphoneos, macos, etc.)"].freeze
7
7
  CONFIG = ["--config=foo", "Configuration (debug, release) (default: debug)"].freeze
8
8
  MERGE_SLICES = [
9
9
  "--merge-slices/--no-merge-slices",
@@ -23,6 +23,10 @@ module XCCache
23
23
 
24
24
  attr_writer :install_config
25
25
 
26
+ def ensure_file!
27
+ Template.new("xccache.yml").render(save_to: path) unless path.exist?
28
+ end
29
+
26
30
  def install_config
27
31
  @install_config || "debug"
28
32
  end
@@ -3,7 +3,7 @@ module XCCache
3
3
  attr_reader :root
4
4
 
5
5
  def initialize(root)
6
- @root = Pathname(root)
6
+ @root = Pathname(root).expand_path
7
7
  end
8
8
 
9
9
  def run(*args, **kwargs)
@@ -14,8 +14,9 @@ class File
14
14
  end
15
15
 
16
16
  class Dir
17
- def self.prepare(dir, clean: false)
17
+ def self.prepare(dir, clean: false, expand: false)
18
18
  dir = Pathname(dir)
19
+ dir = dir.expand_path if expand
19
20
  dir.rmtree if clean && dir.exist?
20
21
  dir.mkpath
21
22
  dir
@@ -19,6 +19,7 @@ module XCCache
19
19
  verify_projects!
20
20
  projects.each { |project| migrate_umbrella_to_proxy(project) }
21
21
  UI.message("Using cache dir: #{config.spm_cache_dir}")
22
+ config.ensure_file!
22
23
  config.in_installation = true
23
24
  sync_lockfile
24
25
  proxy_pkg.prepare(@install_options)
@@ -99,7 +100,7 @@ module XCCache
99
100
  add_file = proc { |p| group[p.basename.to_s] || group.new_file(p) }
100
101
  add_file.call(config.spm_proxy_sandbox / "Package.swift")
101
102
  add_file.call(config.lockfile.path)
102
- add_file.call(config.path) if config.path.exist?
103
+ add_file.call(config.path)
103
104
  group.ensure_synced_group(name: "local-packages", path: config.spm_local_pkgs_dir)
104
105
  end
105
106
 
@@ -3,12 +3,9 @@ require_relative "build"
3
3
  module XCCache
4
4
  module SPM
5
5
  class Macro < Buildable
6
- attr_reader :macosx_sdk
7
-
8
6
  def initialize(options = {})
9
7
  super
10
8
  @library_evolution = false # swift-syntax is not compatible with library evolution
11
- @macosx_sdk = Swift::Sdk.new(:macosx)
12
9
  end
13
10
 
14
11
  def build(_options = {})
@@ -37,7 +34,7 @@ module XCCache
37
34
  end
38
35
 
39
36
  def products_dir
40
- @products_dir ||= pkg_dir / ".build" / macosx_sdk.triple / config
37
+ @products_dir ||= pkg_dir / ".build" / "arm64-apple-macosx" / config
41
38
  end
42
39
  end
43
40
  end
@@ -3,7 +3,8 @@ module XCCache
3
3
  class Package
4
4
  class Proxy < Package
5
5
  class Executable
6
- VERSION = "0.0.1rc3".freeze
6
+ REPO_URL = "https://github.com/trinhngocthuyen/xccache-proxy".freeze
7
+ VERSION_OR_SHA = "1.0.0rc1".freeze
7
8
 
8
9
  def run(cmd)
9
10
  env = { "FORCE_OUTPUT" => "console", "FORCE_COLOR" => "1" } if Config.instance.ansi?
@@ -21,13 +22,35 @@ module XCCache
21
22
  [
22
23
  local_bin_path,
23
24
  default_bin_path,
24
- ].find(&:exist?) || download
25
+ ].find(&:exist?) || download_or_build_from_source
26
+ end
27
+
28
+ def default_use_downloaded?
29
+ VERSION_OR_SHA.include?(".")
30
+ end
31
+
32
+ def download_or_build_from_source
33
+ default_use_downloaded? ? download : build_from_source
34
+ end
35
+
36
+ def build_from_source
37
+ UI.section("Building xccache-proxy binary from source...".magenta) do
38
+ dir = Dir.prepare("~/.xccache/xccache-proxy", expand: true)
39
+ git = Git.new(dir)
40
+ git.init unless git.init?
41
+ git.remote("add", "origin", REPO_URL) unless git.remote(capture: true)[0].strip == "origin"
42
+ git.fetch("origin", VERSION_OR_SHA)
43
+ git.checkout("-f", "FETCH_HEAD", capture: true)
44
+
45
+ Dir.chdir(dir) { Sh.run("make build CONFIGURATION=release") }
46
+ (dir / ".build" / "release" / "xccache-proxy").copy(to: default_bin_path)
47
+ end
25
48
  end
26
49
 
27
50
  def download
28
51
  UI.section("Downloading xccache-proxy binary from remote...".magenta) do
29
52
  Dir.create_tmpdir do |dir|
30
- url = "https://github.com/trinhngocthuyen/xccache-proxy/releases/download/#{VERSION}/xccache-proxy.zip"
53
+ url = "#{REPO_URL}/releases/download/#{VERSION_OR_SHA}/xccache-proxy.zip"
31
54
  default_bin_path.parent.mkpath
32
55
  tmp_path = dir / File.basename(url)
33
56
  Sh.run("curl -fSL -o #{tmp_path} #{url} && unzip -d #{default_bin_path.parent} #{tmp_path}")
@@ -38,7 +61,10 @@ module XCCache
38
61
  end
39
62
 
40
63
  def default_bin_path
41
- @default_bin_path ||= LIBEXEC / ".download" / "xccache-proxy-#{VERSION}" / "xccache-proxy"
64
+ @default_bin_path ||= begin
65
+ dir = LIBEXEC / (default_use_downloaded? ? ".download" : ".build")
66
+ dir / "xccache-proxy-#{VERSION_OR_SHA}" / "xccache-proxy"
67
+ end
42
68
  end
43
69
 
44
70
  def local_bin_path
@@ -8,11 +8,19 @@ module XCCache
8
8
  NAME_TO_TRIPLE = {
9
9
  :iphonesimulator => "arm64-apple-ios-simulator",
10
10
  :iphoneos => "arm64-apple-ios",
11
- :macosx => "arm64-apple-macosx",
11
+ :macos => "arm64-apple-macos",
12
+ :watchos => "arm64-apple-watchos",
13
+ :watchsimulator => "arm64-apple-watchos-simulator",
14
+ :appletvos => "arm64-apple-tvos",
15
+ :appletvsimulator => "arm64-apple-tvos-simulator",
16
+ :xros => "arm64-apple-xros",
17
+ :xrsimulator => "arm64-apple-xros-simulator",
12
18
  }.freeze
13
19
 
14
20
  def initialize(name)
15
21
  @name = name
22
+ return if NAME_TO_TRIPLE.key?(name.to_sym)
23
+ raise GeneralError, "Unknown sdk: #{name}. Must be one of #{NAME_TO_TRIPLE.keys}"
16
24
  end
17
25
 
18
26
  def to_s
@@ -25,11 +33,15 @@ module XCCache
25
33
  res
26
34
  end
27
35
 
36
+ def sdk_name
37
+ name == "macos" ? "macosx" : name
38
+ end
39
+
28
40
  def sdk_path
29
41
  # rubocop:disable Layout/LineLength
30
42
  # /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
31
43
  # rubocop:enable Layout/LineLength
32
- @sdk_path ||= Pathname(Sh.capture_output("xcrun --sdk #{name} --show-sdk-path")).realpath
44
+ @sdk_path ||= Pathname(Sh.capture_output("xcrun --sdk #{sdk_name} --show-sdk-path")).realpath
33
45
  end
34
46
 
35
47
  def sdk_platform_developer_path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xccache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc15341775774
4
+ version: 1.0.1.rc15390855924
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thuyen Trinh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-30 00:00:00.000000000 Z
11
+ date: 2025-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -69,6 +69,7 @@ files:
69
69
  - lib/xccache/assets/templates/framework.modulemap.template
70
70
  - lib/xccache/assets/templates/resource_bundle_accessor.m.template
71
71
  - lib/xccache/assets/templates/resource_bundle_accessor.swift.template
72
+ - lib/xccache/assets/templates/xccache.yml.template
72
73
  - lib/xccache/cache/cachemap.rb
73
74
  - lib/xccache/command.rb
74
75
  - lib/xccache/command/base.rb