# -*- 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"

    
    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
        )

    if "arm" in control.architecture:
        bin_name_arm = glob.glob(f"{bin_contains}*aarch64*.msi")[0]
        install_msi_if_needed(
            bin_name_arm,
            properties=properties
        )