tng 0.3.0 → 0.3.4

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: 1565b9f82ca06425bf3e88f44f018c0d34e7f3adc5cc91c111a593689303ef77
4
- data.tar.gz: 5a5868449487efa2f07d4d9d57aa3dc4ea1ac050f4b530f225e72bbb7067337a
3
+ metadata.gz: e936ced36e475ba1ae147f9209794b592c639b96eb5573fff15e47175f5729d2
4
+ data.tar.gz: bce3240ea48c7ef6cfbe2629296eaa28165f251625541151d2a9a93673eb5659
5
5
  SHA512:
6
- metadata.gz: 11945827a48c2f3e3ff40b5e7c24f356d466b00c0b1b0bcebf397188477b9ce08c10843d762d2ac1835c9ad582c2d26c283fb569eabff395981aa73273320c02
7
- data.tar.gz: '0644595817a169561541f4f052b417435e2ba21629cbf3c144d92a188006cec4fc953edb638517adaaca82bcab4e648782fdfdcb59795a2c1e8bfb42d334d04e'
6
+ metadata.gz: 7cf2e03008535e3d68dc928c699195aadd750b52c08a01bcf99037c565246c902d57b2cc6aaa7699e41811f86afa4e5ead4b33ce2441320cb7772e09838ad251
7
+ data.tar.gz: 033bed50161aae9f0daf04c608ce9e56023fa3f46cbd30b520ce39307efdf498afc811e55f6564777c22a18092950613fb104e7dd944cfe1cdd2aa4bd4c8e41f
data/Rakefile CHANGED
@@ -19,6 +19,15 @@ RbSys::ExtensionTask.new("tng", GEMSPEC) do |ext|
19
19
  ext.lib_dir = "lib/tng"
20
20
  end
21
21
 
22
+ # Create tasks for pre-compiled Go UI binaries (they already exist, just need to satisfy rb_sys)
23
+ %w[go-ui-darwin-amd64 go-ui-darwin-arm64 go-ui-linux-amd64 go-ui-linux-arm64].each do |binary|
24
+ file "binaries/#{binary}" do
25
+ unless File.exist?("binaries/#{binary}")
26
+ puts "⚠️ Warning: #{binary} not found in binaries/ - run build_both first for full distribution"
27
+ end
28
+ end
29
+ end
30
+
22
31
  # Create a task for the binaries/tng.bundle file that rb_sys expects
23
32
  file "binaries/tng.bundle" do
24
33
  FileUtils.mkdir_p("binaries")
@@ -49,6 +58,7 @@ task :redo do
49
58
  Rake::Task[:compile].invoke
50
59
 
51
60
  puts "Copying compiled binary to binaries/ directory..."
61
+ # Source and destination use simple name (tng.bundle/tng.so) for Ruby loading compatibility
52
62
  binary_name = RUBY_PLATFORM.include?("darwin") ? "tng.bundle" : "tng.so"
53
63
  source_file = File.join("lib", "tng", binary_name)
54
64
  destination_dir = "binaries"
@@ -94,56 +104,43 @@ end
94
104
 
95
105
  desc "Build binaries for both Mac and Linux platforms"
96
106
  task :build_both do
97
- puts "Building tng native extensions for both platforms..."
107
+ puts "Building tng native extensions and go-ui binaries..."
98
108
 
99
- # Clean up and create binaries directory
100
- puts "Cleaning up old binaries..."
101
- FileUtils.rm_rf("binaries")
102
- puts "Creating binaries directory..."
103
- FileUtils.mkdir_p("binaries")
104
- puts "Binaries directory created: #{Dir.pwd}/binaries/"
105
-
106
- # Build Mac version
107
- puts "Building Mac version..."
108
- system("bundle exec rake compile") || (puts "❌ Mac build failed"
109
- exit 1)
110
-
111
- # Copy Mac binary
112
- mac_binary = "lib/tng/tng.bundle"
113
- if File.exist?(mac_binary)
114
- FileUtils.cp(mac_binary, "binaries/tng.bundle")
115
- puts "Mac binary copied to binaries/ for packaging"
116
- else
117
- puts "❌ Mac binary not found"
118
- exit 1
119
- end
109
+ # Ensure the script is executable
110
+ system("chmod +x build_both.sh")
120
111
 
121
- # Ensure it's in lib/tng/ for gem loading
122
- if File.exist?("lib/tng/tng.bundle")
123
- puts "Mac binary confirmed in lib/tng/ for gem loading"
124
- else
125
- puts "Warning: Mac binary not found in lib/tng/ - copying from binaries/"
126
- FileUtils.cp("binaries/tng.bundle", "lib/tng/tng.bundle")
127
- end
112
+ # Delegate to the shell script which handles everything correctly
113
+ # (go-ui binaries, mac binary renaming, linux builds)
114
+ system("./build_both.sh") || (puts "❌ Build failed"; exit 1)
115
+ end
128
116
 
129
- # Build Linux version
130
- puts "Building Linux version..."
131
- system("./build_linux_binaries.sh") || (puts "❌ Linux build failed"
132
- exit 1)
117
+ task :verify_binaries do
118
+ puts "🔍 Verifying binary artifacts..."
119
+ required_go = %w[go-ui-darwin-amd64 go-ui-darwin-arm64 go-ui-linux-amd64 go-ui-linux-arm64]
120
+ missing = required_go.reject { |f| File.exist?("binaries/#{f}") }
133
121
 
134
- puts "Build complete!"
135
- puts "Binaries for packaging:"
136
- system("ls -la binaries/")
137
- puts "Binaries for gem loading:"
138
- system("ls -la lib/tng/*.bundle lib/tng/*.so 2>/dev/null || echo 'No binaries found in lib/tng/'")
122
+ if missing.any?
123
+ abort " Cannot release: Missing binaries in binaries/: #{missing.join(', ')}\nRun 'rake build_both' or './build_both.sh' first!"
124
+ end
125
+ puts " All required binaries present."
126
+ end
127
+
128
+ # Add this task to suppress the native artifact warning
129
+ task release: :build_both do
130
+ # Temporarily rename the binary to avoid the warning during gem build
131
+ puts "📦 Building gem with pre-compiled binaries..." if File.exist?("binaries/tng.bundle")
139
132
  end
140
133
 
134
+ # Ensure verify_binaries runs before release
135
+ task release: :verify_binaries
136
+
141
137
  desc "Development build: compile for current OS and build gem"
142
138
  task :dev do
143
- puts "🧹 Cleaning binaries directory..."
144
- FileUtils.rm_rf("binaries")
139
+ puts "🧹 Cleaning Rust binaries (preserving go-ui)..."
140
+ # Only remove tng binaries, keep go-ui binaries
141
+ Dir.glob("binaries/tng*").each { |f| FileUtils.rm_f(f) }
145
142
  FileUtils.mkdir_p("binaries")
146
- puts "✅ Binaries directory cleaned"
143
+ puts "✅ Rust binaries cleaned"
147
144
 
148
145
  Rake::Task[:redo].invoke
149
146