diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index cabb23720c..998de5afb3 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -21,6 +21,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1185[#1185]: Fix icd not working in zsh on older macOS * https://github.com/devonfw/IDEasy/issues/1754[#1754]: Add version support to vscode plugins * https://github.com/devonfw/IDEasy/issues/796[#796]: cannot install aws on Mac +* https://github.com/devonfw/IDEasy/issues/865[#865]: az not working on Mac * https://github.com/devonfw/IDEasy/issues/1800[#1800]: IDEasy will automatically switch to IntelliJ standard edition when installing newer ultimate edition versions * https://github.com/devonfw/IDEasy/issues/1552[#1552]: User-defined MAVEN_ARGS appends and no longer overwrites IDEasy's defaults * https://github.com/devonfw/IDEasy/issues/1833[#1833]: No settings repo update with missing `.commit.id` diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/az/Azure.java b/cli/src/main/java/com/devonfw/tools/ide/tool/az/Azure.java index 4bd55168c6..b75b988f2e 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/az/Azure.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/az/Azure.java @@ -10,6 +10,7 @@ import com.devonfw.tools.ide.tool.LocalToolCommandlet; import com.devonfw.tools.ide.tool.ToolCommandlet; import com.devonfw.tools.ide.tool.ToolInstallation; +import com.devonfw.tools.ide.tool.python.Python; /** * {@link ToolCommandlet} for azure CLI (azure). @@ -52,5 +53,10 @@ public void setEnvironment(EnvironmentContext environmentContext, ToolInstallati super.setEnvironment(environmentContext, toolInstallation, additionalInstallation); environmentContext.withEnvVar("AZURE_CONFIG_DIR", this.context.getConfPath().resolve(".azure").toString()); + if (this.context.getSystemInfo().isMac()) { + Python python = this.context.getCommandletManager().getCommandlet(Python.class); + Path pythonBin = python.getToolBinPath().resolve("python3"); + environmentContext.withEnvVar("AZ_PYTHON", pythonBin.toString()); + } } } diff --git a/url-updater/src/main/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdater.java b/url-updater/src/main/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdater.java index 028b745ccb..6e3deff96a 100644 --- a/url-updater/src/main/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdater.java +++ b/url-updater/src/main/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdater.java @@ -1,6 +1,7 @@ package com.devonfw.tools.ide.url.tool.az; import com.devonfw.tools.ide.os.OperatingSystem; +import com.devonfw.tools.ide.os.SystemArchitecture; import com.devonfw.tools.ide.url.model.folder.UrlVersion; import com.devonfw.tools.ide.url.updater.GithubUrlTagUpdater; import com.devonfw.tools.ide.version.VersionIdentifier; @@ -12,6 +13,8 @@ public class AzureUrlUpdater extends GithubUrlTagUpdater { private static final VersionIdentifier MIN_AZURE_VID = VersionIdentifier.of("2.17.0"); + private static final VersionIdentifier MIN_AZURE_MAC_VID = VersionIdentifier.of("2.84.0"); + @Override public String getTool() { @@ -23,6 +26,22 @@ protected void addVersion(UrlVersion urlVersion) { doAddVersion(urlVersion, getDownloadBaseUrl() + "/msi/azure-cli-${version}.msi", OperatingSystem.WINDOWS); + VersionIdentifier vid = urlVersion.getVersionIdentifier(); + if (vid.compareVersion(MIN_AZURE_MAC_VID).isGreater()) { + String macBaseUrl = getMacDownloadBaseUrl() + "/" + getGithubRepositoryPath() + + "/releases/download/azure-cli-${version}/azure-cli-${version}-macos-"; + doAddVersion(urlVersion, macBaseUrl + "x86_64.tar.gz", OperatingSystem.MAC, SystemArchitecture.X64); + doAddVersion(urlVersion, macBaseUrl + "arm64.tar.gz", OperatingSystem.MAC, SystemArchitecture.ARM64); + } + } + + /** + * @return base URL for the macOS tarball downloads (GitHub releases). Separate hook from {@link #getDownloadBaseUrl()} + * because Windows MSIs live on Microsoft blob storage while mac tarballs live on GitHub. + */ + protected String getMacDownloadBaseUrl() { + + return GITHUB_BASE_URL; } @Override diff --git a/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterMock.java b/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterMock.java index 6b93753232..4380d042e2 100644 --- a/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterMock.java +++ b/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterMock.java @@ -19,6 +19,11 @@ protected String getDownloadBaseUrl() { return this.baseUrl; } + @Override + protected String getMacDownloadBaseUrl() { + return this.baseUrl; + } + @Override protected String doGetVersionUrl() { diff --git a/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterTest.java b/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterTest.java index 576eba4eb0..afa791dd7b 100644 --- a/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterTest.java +++ b/url-updater/src/test/java/com/devonfw/tools/ide/url/tool/az/AzureUrlUpdaterTest.java @@ -33,6 +33,8 @@ void testAzureUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir, W stubFor(get(urlMatching("/repos/Azure/azure-cli/git/refs/tags")).willReturn(aResponse().withStatus(200) .withBody(readAndResolve(PATH_INTEGRATION_TEST.resolve("AzureUrlUpdater").resolve("azure-cli-tags.json"), wmRuntimeInfo)))); stubFor(any(urlMatching("/msi/azure-cli-.*\\.msi")).willReturn(aResponse().withStatus(200).withBody(DOWNLOAD_CONTENT))); + stubFor(any(urlMatching("/Azure/azure-cli/releases/download/azure-cli-.*/azure-cli-.*-macos-.*\\.tar\\.gz")) + .willReturn(aResponse().withStatus(200).withBody(DOWNLOAD_CONTENT))); UrlRepository urlRepository = UrlRepository.load(tempDir); AzureUrlUpdaterMock updater = new AzureUrlUpdaterMock(wmRuntimeInfo); @@ -44,5 +46,6 @@ void testAzureUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir, W Path azEditionDir = tempDir.resolve("az").resolve("az"); assertUrlVersion(azEditionDir.resolve("2.18.0"), List.of("windows_x64")); assertUrlVersion(azEditionDir.resolve("2.20.0"), List.of("windows_x64")); + assertUrlVersion(azEditionDir.resolve("2.85.0"), List.of("windows_x64", "mac_x64", "mac_arm64")); } } diff --git a/url-updater/src/test/resources/integrationtest/AzureUrlUpdater/azure-cli-tags.json b/url-updater/src/test/resources/integrationtest/AzureUrlUpdater/azure-cli-tags.json index e66d527a75..935b0f2eeb 100644 --- a/url-updater/src/test/resources/integrationtest/AzureUrlUpdater/azure-cli-tags.json +++ b/url-updater/src/test/resources/integrationtest/AzureUrlUpdater/azure-cli-tags.json @@ -4,6 +4,8 @@ }, { "ref": "refs/tags/azure-cli-2.20.0" + }, + { + "ref": "refs/tags/azure-cli-2.85.0" } ] -