Skip to content

Commit

Permalink
Make sure all platform files are correctly distributed
Browse files Browse the repository at this point in the history
after a change in those files.
fixes #1947
  • Loading branch information
marcmo authored and DmitryAstafyev committed Nov 3, 2023
1 parent f870164 commit 277f29b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 76 deletions.
2 changes: 1 addition & 1 deletion application/holder/src/service/sessions/holder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Holder {
cancel: (uuid: string): Promise<void> => {
const operation = this.observing.active.get(uuid);
if (operation === undefined) {
return Promise.reject(new Error(`Operation isn't found`));
return Promise.reject(new Error(`AAA Operation isn't found`));
}
return new Promise((resolve) => {
operation.observer
Expand Down
1 change: 1 addition & 0 deletions rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'set'
require './scripts/elements/wasm'
require './scripts/elements/bindings'
require './scripts/elements/platform'
require './scripts/elements/client'
require './scripts/elements/electron'
require './scripts/elements/release'
Expand Down
12 changes: 10 additions & 2 deletions scripts/elements/electron.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module Electron
task reinstall: ['electron:clean_installation', 'electron:install']

task :install do
puts 'trying to install electron yarn stuff'
Shell.chdir(Paths::ELECTRON) do
Reporter.log 'Installing Electron libraries'
duration = Shell.timed_sh('yarn install', 'yarn install electron')
Expand Down Expand Up @@ -61,8 +62,15 @@ module Electron
platform_dest = "#{rustcore_dest}/node_modules/platform"
Shell.rm_rf(platform_dest)
FileUtils.mkdir_p platform_dest
files_to_copy = Dir["#{Paths::PLATFORM}/*"].reject { |f| File.basename(f) == 'node_modules' }
duration = Shell.cp_r files_to_copy, platform_dest, 'copy platform to electron'
platform_files_to_copy = Dir["#{Paths::PLATFORM}/*"].reject { |f| File.basename(f) == 'node_modules' }
duration = Shell.cp_r platform_files_to_copy, platform_dest, 'copy platform rustcore in to electron'
Reporter.done('electron', "copy platform to #{short_dest}", '', duration)
# update electron dependencies manually since it's a local dependency and update does
# not work since we do not change the module versions
platform_dest2 = "#{Electron::NODE_MODULES}/platform"
Shell.rm_rf(platform_dest2)
FileUtils.mkdir_p platform_dest2
duration = Shell.cp_r platform_files_to_copy, platform_dest2, 'copy platform to electron'
Reporter.done('electron', "copy platform to #{short_dest}", '', duration)
end

Expand Down
18 changes: 18 additions & 0 deletions scripts/elements/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ module Platform
end

namespace :platform do
desc 'check if copied files are synced'
task :check_sync do
require 'digest'
require 'find'
path_to_check = "#{Paths::PLATFORM}/ipc/request/file/checksum.ts"
reference_checksum = Digest::MD5.file(path_to_check).hexdigest
root_p = Pathname.new(Paths::ROOT)
puts "compare with reference : #{Pathname.new(path_to_check).relative_path_from(root_p)}"
Find.find("#{Paths::ROOT}/application") do |path|
if path =~ /request\/file\/checksum.ts/
p = Pathname.new(path)
p_rel = p.relative_path_from(root_p)
checksum = Digest::MD5.file(path).hexdigest
puts "path: #{p_rel}: #{checksum == reference_checksum ? 'OK' : 'OUT OF SYNC!'}"
end
end
end

task :clean do
Platform::TARGETS.each do |path|
path = "#{path}/.node_integrity" if File.basename(path) == 'node_modules'
Expand Down
72 changes: 0 additions & 72 deletions scripts/elements/utils.rb

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/tools/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.timed_sh(cmd, desc)
def self.cp_r(src, dest, desc = nil)
cmd = "cp_r(#{src}, #{dest})"
desc = cmd if desc.nil?
timed_operation(-> { FileUtils.cp_r src, dest }, desc)
timed_operation(-> { FileUtils.cp_r src, dest, verbose: true }, desc)
end

def self.timed_operation(cmd, tag)
Expand Down

0 comments on commit 277f29b

Please sign in to comment.