xccache 1.0.0.rc15341775774 → 1.0.0

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: 58a60ae32df0e91fde269eb085ee92700365eecd2adb4a6360e9104e3e7091f1
4
+ data.tar.gz: 28caf0fc84bf730a78ec3204c9b908ea67a2aacc609ec41e25f46686cf8daefa
5
5
  SHA512:
6
- metadata.gz: 00d1a9e5103c69e770c96b78012ae25ee9dbfd6dbacfee4d2d5b2962d52a116663dfae34e3b7263ead13928470883c555cf11e1d0b17d8c332939d1d8938a1b1
7
- data.tar.gz: efb6d6d67964fe7edd78a08985682101c691d38837f92a322c5e85a395808a88e248db6cce3c01aadc4b9dc8b2f97a4d6340be129c61ef0bd2a8cfe7558b8171
6
+ metadata.gz: 45e18eafa038e1ad80a6beede33c7b90f942f069aefb32f15236ba215b128f86d982897c0b4fc8edcaba69bd6e5c11007f8d56d5240a7b3b0a02866a5f0b7143
7
+ data.tar.gz: 55d8655668175dd6e4c8939d144a4360cad88dfd561a8e394b36bf551fb68f1bbab7d22ba835a3e1744b36a3a21ba85ff4977eeff4890b7fd7801e6e3edd5370
@@ -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
@@ -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 = "0.0.1".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
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.0
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-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -161,9 +161,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 1.3.1
166
+ version: '0'
167
167
  requirements: []
168
168
  rubygems_version: 3.2.33
169
169
  signing_key: