Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc kits logic update #519

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions lib/engines/hckinstall/hckinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HCKInstall
PLATFORMS_JSON_DIR = 'lib/engines/hcktest/platforms'
CONFIG_JSON = 'lib/engines/hckinstall/hckinstall.json'
ISO_JSON = 'lib/engines/hckinstall/iso.json'
KIT_JSON = 'lib/engines/hckinstall/kit.json'
KIT_JSON_DIR = 'lib/engines/hckinstall/kits'
FW_JSON = 'lib/setupmanagers/qemuhck/fw.json'
DRIVERS_JSON_DIR = 'lib/engines/hcktest/drivers'
ENGINE_MODE = 'install'
Expand Down Expand Up @@ -50,12 +50,12 @@ def read_iso(platform_name)
res || raise(InvalidConfigFile, "ISO info for #{platform_name} does not exist")
end

sig { params(kit_name: String).returns(Models::Kit) }
def read_kit(kit_name)
kit_list = Json.read_json(KIT_JSON, @logger)
kit_json = "#{KIT_JSON_DIR}/#{kit_name}.json"

@logger.info("Loading kit by name: #{kit_name}")
res = kit_list[kit_name]
@logger.fatal("Kit info with name #{kit_name} does not exist") unless res
res || raise(InvalidConfigFile, "Kit info with name #{kit_name} does not exist")
Models::Kit.from_json_file(kit_json, @logger)
end

def init_config
Expand All @@ -68,7 +68,7 @@ def init_config
end

def studio_platform(kit)
res = @kit_info['studio_platform']
res = @kit_info.studio_platform
@logger.info("Loading studio platform for kit: #{kit}")
@logger.fatal("Kit studio platform for kit #{kit} does not exist") unless res
res || raise(InvalidConfigFile, "Kit studio platform for kit #{kit} does not exist")
Expand All @@ -93,13 +93,11 @@ def init_class_variables
end

def prepare_extra_sw
[@kit_info, @project.engine_platform].each do |source|
next if source['extra_software'].nil?
extra_software = [*@kit_info.extra_software, *@project.engine_platform['extra_software']]

@project.extra_sw_manager.prepare_software_packages(
source['extra_software'], @project.engine_platform['kit'], ENGINE_MODE
)
end
@project.extra_sw_manager.prepare_software_packages(
extra_software, @project.engine_platform['kit'], ENGINE_MODE
)

@project.extra_sw_manager.copy_to_setup_scripts(@hck_setup_scripts_path)
end
Expand Down Expand Up @@ -255,11 +253,11 @@ def prepare_setup_scripts_config
@kit_path = find_kit(kit_type, kit_version)

if @kit_path.nil?
if @kit_info['download_url'].nil?
if @kit_info.download_url.nil?
raise(EngineError, 'HLK installer download URL is not provided and installer is not found')
end

@kit_path = download_kit_installer(@kit_info['download_url'],
@kit_path = download_kit_installer(@kit_info.download_url,
"#{kit_type}#{kit_version}", @hck_setup_scripts_path)
else
@logger.info("HLK installer #{kit_type}#{kit_version} already exists")
Expand Down
82 changes: 0 additions & 82 deletions lib/engines/hckinstall/kit.json

This file was deleted.

4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HCK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2012R2x64",
"name": "HCK"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK11_22H2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2250318",
"extra_software": [
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK11_22H2"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK11_23H2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2250318",
"extra_software": [
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK11_23H2"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK11_24H2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2289283",
"extra_software": [
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK11_24H2"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK11_next.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extra_software": [
"Disable_SNV",
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK11_next"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1507.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1507"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1511.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1511"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK1607.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"download_url": "https://go.microsoft.com/fwlink/p/?LinkID=404112",
"extra_software": [
"winfsp"
],
"studio_platform": "Win2016x64",
"name": "HLK1607"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1703.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1703"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1709.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1709"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1803.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1803"
}
10 changes: 10 additions & 0 deletions lib/engines/hckinstall/kits/HLK1809.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2026646",
"extra_software": [
"HLK_GRFX_FOD",
"WDTFNetData_1809",
"winfsp"
],
"studio_platform": "Win2019x64",
"name": "HLK1809"
}
11 changes: 11 additions & 0 deletions lib/engines/hckinstall/kits/HLK1809server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2026646",
"extra_software": [
"FOD_2019",
"HLK_GRFX_FOD",
"WDTFNetData_1809",
"winfsp"
],
"studio_platform": "Win2019x64",
"name": "HLK1809server"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1903.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1903"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK1909.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK1909"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK2004.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2128655",
"extra_software": [
"winfsp"
],
"studio_platform": "Win2016x64",
"name": "HLK2004"
}
10 changes: 10 additions & 0 deletions lib/engines/hckinstall/kits/HLK2022.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2164257",
"extra_software": [
"FOD_2022",
"Test-NETHLK",
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK2022"
}
8 changes: 8 additions & 0 deletions lib/engines/hckinstall/kits/HLK2022_next.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extra_software": [
"Disable_SNV",
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK2022_next"
}
9 changes: 9 additions & 0 deletions lib/engines/hckinstall/kits/HLK2025.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"download_url": "https://go.microsoft.com/fwlink/?linkid=2289283",
"extra_software": [
"Test-NETHLK",
"winfsp"
],
"studio_platform": "Win2022x64",
"name": "HLK2025"
}
4 changes: 4 additions & 0 deletions lib/engines/hckinstall/kits/HLK20H2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"studio_platform": "Win2016x64",
"name": "HLK20H2"
}
1 change: 1 addition & 0 deletions lib/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Models
autoload_relative :CommandInfo, 'models/command_info'
autoload_relative :DriverInstallMethods, 'models/driver_install_methods'
autoload_relative :Driver, 'models/driver'
autoload_relative :Kit, 'models/kit'
autoload_relative :HCKTestConfig, 'models/hcktest_config'
autoload_relative :JsonHelper, 'models/json_helper'
autoload_relative :SVVPConfig, 'models/svvp_config'
Expand Down
17 changes: 17 additions & 0 deletions lib/models/kit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# typed: strict
# frozen_string_literal: true

module AutoHCK
module Models
class Kit < T::Struct
extend T::Sig
extend JsonHelper

const :name, String
const :studio_platform, String
const :extra_software, T::Array[String], default: []

const :download_url, T.nilable(String)
end
end
end
1 change: 1 addition & 0 deletions spec/srb_json_load_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

JSON_TYPES_MAP = {
'./lib/engines/hcktest/drivers/*.json' => AutoHCK::Models::Driver,
'./lib/engines/hckinstall/kits/*.json' => AutoHCK::Models::Kit,
'./lib/engines/hcktest/hcktest.json' => AutoHCK::Models::HCKTestConfig,
'./svvp.json' => AutoHCK::Models::SVVPConfig,
'./lib/setupmanagers/qemuhck/devices/*.json' => AutoHCK::Models::QemuHCKDevice
Expand Down
Loading