# -*- coding: utf-8 -*-
from setuphelpers import *


# https://adoptium.net/installation/windows/
properties = "ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome,FeatureOracleJavaSoft"
# properties = "INSTALLLEVEL=1"


def install():
    # Declaring local variables
    openjdk_version = control.get_software_version().split(".")[0]
    bin_contains = f"OpenJDK{openjdk_version}U"

    bin_name_x86 = glob.glob(f"{bin_contains}*x86-32*.msi")[0]
    install_msi_if_needed(
        bin_name_x86,
        properties=properties,
    )
    
    if "x64" in control.architecture:
        bin_name_x64 = glob.glob(f"{bin_contains}*x64*.msi")[0]
        install_msi_if_needed(
            bin_name_x64,
            properties=properties
        )
