Add Apple Silicon build and Universal build for macOS (#20776)

* use stages

* fix indention

* add jobs section

* fix error

* indention

* arm64 for macos

* other stages not run

* fix container

* fix

* fix stage

* skip tests

* variable

* dependency

* fix name error

* sts

* const

* fall back to x64

* pass in variable

* universal flavor

* fix universal

* fix path

* remove

* special processing

* return on error

* copy instead of move

* restore sts

* release

* fix error

* Fix readme

* remove commented code

* add comments

* add issue

* update comment

* pr comments

* delete universal yml

* update the generated js file
This commit is contained in:
Alan Ren
2022-10-10 19:02:56 -07:00
committed by GitHub
parent bd8e9ec0f0
commit ee2905d372
9 changed files with 277 additions and 107 deletions

View File

@@ -5,7 +5,7 @@
(async () => {
const serviceDownloader = require('@microsoft/ads-service-downloader').ServiceDownloadProvider;
const platform = require('@microsoft/ads-service-downloader/out/platform').PlatformInformation;
const platform = require('@microsoft/ads-service-downloader/out/platform');
const path = require('path');
const fs = require('fs').promises;
const rimraf = require('rimraf');
@@ -15,7 +15,15 @@
async function installService() {
const absoluteConfigPath = require.resolve('../config.json');
const config = require(absoluteConfigPath);
const runtime = (await platform.getCurrent()).runtimeId;
let runtime = (await platform.PlatformInformation.getCurrent()).runtimeId;
const arch = process.env['npm_config_arch'];
// In the build pipeline, macOS x64 image is used to produce arm64 build,
// we need to check the environment variable to determine the actual target runtime.
if (runtime === platform.Runtime.OSX && arch === 'arm64') {
console.log(`Set the target runtime to OSX_ARM64`);
runtime = platform.Runtime.OSX_ARM64;
}
// fix path since it won't be correct
config.installDirectory = path.join(path.dirname(absoluteConfigPath), config.installDirectory);
let installer = new serviceDownloader(config);