From 9cfb86ce2ea172d8d96d92d52c42cb2b64cb49f7 Mon Sep 17 00:00:00 2001 From: "jose.pereda" Date: Fri, 6 Sep 2024 19:20:23 +0200 Subject: [PATCH] Set macOS min version in plist --- .../gluonhq/substrate/target/MacOSTargetConfiguration.java | 6 +++--- .../java/com/gluonhq/substrate/util/macos/InfoPlist.java | 6 +++++- src/main/resources/native/macosx/assets/Info.plist | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java b/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java index 57de4930..ea5d914e 100644 --- a/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java +++ b/src/main/java/com/gluonhq/substrate/target/MacOSTargetConfiguration.java @@ -47,8 +47,8 @@ public class MacOSTargetConfiguration extends DarwinTargetConfiguration { - private static final String MIN_MACOS_VERSION_AMD64 = "11"; - private static final String MIN_MACOS_VERSION_AARCH64 = "12"; + public static final String MIN_MACOS_AMD64_VERSION = "11"; + public static final String MIN_MACOS_AARCH64_VERSION = "12"; private static final List javaDarwinLibs = Arrays.asList("pthread", "z", "dl", "stdc++"); private static final List javaDarwinFrameworks = Arrays.asList("Foundation", "AppKit"); @@ -71,7 +71,7 @@ public class MacOSTargetConfiguration extends DarwinTargetConfiguration { public MacOSTargetConfiguration(ProcessPaths paths, InternalProjectConfiguration configuration) { super(paths, configuration); - minVersion = Constants.ARCH_AMD64.equals(projectConfiguration.getTargetTriplet().getArch()) ? MIN_MACOS_VERSION_AMD64 : MIN_MACOS_VERSION_AARCH64; + minVersion = Constants.ARCH_AMD64.equals(projectConfiguration.getTargetTriplet().getArch()) ? MIN_MACOS_AMD64_VERSION : MIN_MACOS_AARCH64_VERSION; } @Override diff --git a/src/main/java/com/gluonhq/substrate/util/macos/InfoPlist.java b/src/main/java/com/gluonhq/substrate/util/macos/InfoPlist.java index 36abda0f..c00dfe88 100644 --- a/src/main/java/com/gluonhq/substrate/util/macos/InfoPlist.java +++ b/src/main/java/com/gluonhq/substrate/util/macos/InfoPlist.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Gluon + * Copyright (c) 2019, 2024, Gluon * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ import com.gluonhq.substrate.model.InternalProjectConfiguration; import com.gluonhq.substrate.model.ProcessPaths; import com.gluonhq.substrate.model.ReleaseConfiguration; +import com.gluonhq.substrate.target.MacOSTargetConfiguration; import com.gluonhq.substrate.util.FileOps; import com.gluonhq.substrate.util.Logger; import com.gluonhq.substrate.util.ProcessRunner; @@ -93,6 +94,8 @@ public Path processInfoPlist() throws IOException, InterruptedException { String appName = projectConfiguration.getAppName(); String executableName = getExecutableName(appName, sourceOS); String bundleIdName = getBundleId(getPlistPath(paths, sourceOS), projectConfiguration.getAppId()); + String minVersion = Constants.ARCH_AMD64.equals(projectConfiguration.getTargetTriplet().getArch()) ? + MacOSTargetConfiguration.MIN_MACOS_AMD64_VERSION : MacOSTargetConfiguration.MIN_MACOS_AARCH64_VERSION; ReleaseConfiguration releaseConfiguration = projectConfiguration.getReleaseConfiguration(); String bundleName = Objects.requireNonNullElse(releaseConfiguration.getBundleName(), appName); String bundleVersion = releaseConfiguration.getBundleVersion(); @@ -162,6 +165,7 @@ public Path processInfoPlist() throws IOException, InterruptedException { dict.put("CFBundleVersion", bundleVersion); dict.put("CFBundleShortVersionString", bundleShortVersion); dict.put("LSApplicationCategoryType", appCategory); + dict.put("LSMinimumSystemVersion", minVersion); dict.saveAsXML(plist); } else { boolean modified = false; diff --git a/src/main/resources/native/macosx/assets/Info.plist b/src/main/resources/native/macosx/assets/Info.plist index 2811b439..e1e08aea 100644 --- a/src/main/resources/native/macosx/assets/Info.plist +++ b/src/main/resources/native/macosx/assets/Info.plist @@ -23,7 +23,7 @@ LSApplicationCategoryType $appCategory LSMinimumSystemVersion - 10.11 + $minimumSystemVersion CFBundleDevelopmentRegion English CFBundleAllowMixedLocalizations