Skip to content

Commit

Permalink
Merge branch 'main' into users/nityagi/GraphClientPoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tyaginidhi committed Oct 30, 2023
2 parents e85f5fd + df54ee5 commit 01ddbec
Show file tree
Hide file tree
Showing 13 changed files with 10,445 additions and 7,020 deletions.
42 changes: 21 additions & 21 deletions .azure-pipelines/OfficialBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#
# Official build to produce versioned and signed VSIX

parameters:
- name: isPreRelease
displayName: 'Build as pre-release extension'
type: boolean
default: true

variables:
# https://aka.ms/gdn-injection
GDN_CODESIGN_TARGETDIRECTORY: "$(Build.SourcesDirectory)\\package"
Expand All @@ -15,7 +21,6 @@ variables:
# set the following in the pipeline's web UI editor:
# GITHUB_TOKEN # GitHub PAT with scopes: repo; must have SSO enabled for GH org 'microsoft' for corp user
# AZ_DevOps_Read_PAT # PAT to read from AzDO feed in msazure
# VSIX_VERSION # VSIX package/release version; must be manually managed for now!

# trigger:
# - release/*
Expand All @@ -27,12 +32,6 @@ pool:
vmImage: 'windows-latest'

steps:
- script: echo "##vso[build.updatebuildnumber]$(VSIX_VERSION)
displayName: Set Job version

- script: mkdir package && echo $(VSIX_VERSION),$(Build.SourceVersion) > package/version.csv
displayName: Capture build version in package/version.csv

- task: NodeTool@0
displayName: 'Use nodejs 18.x'
inputs:
Expand All @@ -51,28 +50,29 @@ steps:
customCommand: run set-git-authn -- --repoToken $(GITHUB_TOKEN)

- task: Npm@1
displayName: 'set version via npm'
displayName: 'increment version'
inputs:
command: custom
customCommand: run increment-version-npm

# - task: Npm@1
# displayName: 'increment version'
# inputs:
# command: custom
# customCommand: run increment-version
customCommand: run increment-version

- task: Npm@1
displayName: 'Official Build and Package VSIX'
- task: PowerShell@2
displayName: 'Record build version'
inputs:
command: custom
customCommand: run dist -- --feedPAT $(AZ_DevOps_Read_PAT) --isOfficialBuild true
targetType: 'inline'
script: |
$version = npm pkg get version
# Set the ADO Build number
Write-Host "##vso[build.updatebuildnumber]$version"
mkdir package
echo $version,$(Build.SourceVersion) > package/version.csv
- task: Npm@1
displayName: 'Preview Build and Package VSIX'
displayName: 'Build and Package VSIX'
inputs:
command: custom
customCommand: run dist -- --feedPAT $(AZ_DevOps_Read_PAT) --isPreviewBuild true
customCommand: run dist -- --feedPAT $(AZ_DevOps_Read_PAT) --isOfficialBuild true --isPreviewBuild ${{ parameter.isPreRelease }}

# https://microsoft.sharepoint.com/teams/prss/esrp/info/ESRP%20Onboarding%20Wiki/Generating%20Signing%20JSON.aspx
# https://microsoft.sharepoint.com/teams/prss/esrp/info/ESRP%20Onboarding%20Wiki/Selecting%20CodeSign%20Certificates.aspx
Expand Down
34 changes: 34 additions & 0 deletions .release-it.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# https://github.com/release-it/release-it/blob/master/config/release-it.json

hooks: {}

# https://github.com/release-it/release-it/blob/master/docs/git.md
git:
addUntrackedFiles: false
commit: false
push: false # ADO build pushes the tag when build is complete, and fails if it's already there
# need to specify pushRepo, since AzDO insists on disconnected refs, breaking upstream
requireUpstream: false
pushArgs: [ '--tags' ]
pushRepo: https://github.com/microsoft/powerplatform-vscode

# requireBranch: main
requireCommits: false
requireCleanWorkingDir: false
tag: true
tagArgs: [ '--force' ]
tagAnnotation: |
build ${version}:
${changelog}
tagName: 'v${version}'
getLatestTagFromAllRefs: true

#https://github.com/release-it/release-it/blob/master/docs/npm.md
npm:
ignoreVersion: true
publish: false

# https://github.com/release-it/release-it/blob/master/docs/github-releases.md
github:
draft: true
release: false
56 changes: 13 additions & 43 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { createRequire } from "node:module";
const require = createRequire(import.meta.url);

import webpackConfig from './webpack.config.js';
const [nodeConfig, webConfig] = webpackConfig;
const [nodeConfig, webConfig, webWorkerConfig] = webpackConfig;
const distdir = path.resolve('./dist');
const outdir = path.resolve('./out');
const packagedir = path.resolve('./package');
Expand All @@ -54,7 +54,7 @@ async function clean() {
}

function setTelemetryTarget() {
const telemetryConfigurationSource = isOfficialBuild && !isPreviewBuild
const telemetryConfigurationSource = isOfficialBuild
? 'src/common/telemetry/telemetryConfigurationProd.ts'
: 'src/common/telemetry/telemetryConfigurationDev.ts';

Expand All @@ -81,6 +81,14 @@ function compileWeb() {
.pipe(gulp.dest(path.resolve(`${distdir}/web`)));
}

// compile the web worker for vscode for web
function compileWorker() {
return gulp
.src(["src/web/**/*.ts"])
.pipe(gulpWebpack(webWorkerConfig, webpack))
.pipe(gulp.dest(path.resolve(`${distdir}/web`)));
}

async function nugetInstall(nugetSource, packageName, version, targetDir) {
// https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource
const feeds = {
Expand Down Expand Up @@ -246,45 +254,11 @@ const testDesktopIntegration = gulp.series(compileIntegrationTests, async () =>
const testDesktopInt = gulp.series(testDesktopIntegration);

async function packageVsix() {
const standardHeader = '# Power Platform Extension';
const previewHeader = '# Power Platform Tools [PREVIEW]\n\n## This extension is used for internal testing against targets such as vscode.dev which require Marketplace published extensions, and is not supported.';
const standardPackageOptions = {
name: 'powerplatform-vscode',
displayName: 'Power Platform Tools',
description: 'Tooling to create Power Platform solutions & packages, manage Power Platform environments and edit Power Apps Portals',
readmeHeader: standardHeader,
readmeReplacementTarget: previewHeader,
};
const previewPackageOptions = {
name: 'powerplatform-vscode-preview',
displayName: 'Power Platform Tools [PREVIEW]',
description: 'Unsupported extension for testing Power Platform Tools',
readmeHeader: previewHeader,
readmeReplacementTarget: standardHeader,
};

const setPackageInfo = async function(pkgOptions) {
await npm(['pkg', 'set', `name=${pkgOptions.name}`]);
await npm(['pkg', 'set', `displayName="${pkgOptions.displayName}"`]);
await npm(['pkg', 'set', `description="${pkgOptions.description}"`]);

gulp.src('README.md')
.pipe(replace(pkgOptions.readmeReplacementTarget, pkgOptions.readmeHeader))
.pipe(gulp.dest('./'));
}

await setPackageInfo(isPreviewBuild ? previewPackageOptions : standardPackageOptions);

fs.ensureDirSync(packagedir);
await vsce.createVSIX({
packagePath: packagedir,
preRelease: isPreviewBuild,
});

// Reset to non-preview settings to prevent polluting git diffs
if (isPreviewBuild) {
await setPackageInfo(standardPackageOptions);
}
}

async function git(args) {
Expand All @@ -293,12 +267,6 @@ async function git(args) {
return { stdout: stdout, stderr: stderr };
}

async function npm(args) {
args.unshift('npm');
const {stdout, stderr } = await exec(args.join(' '));
return {stdout: stdout, stderr: stderr};
}

async function npx(args) {
args.unshift('npx');
const {stdout, stderr } = await exec(args.join(' '));
Expand Down Expand Up @@ -378,7 +346,8 @@ const recompile = gulp.series(
translationsImport,
setTelemetryTarget,
compile,
compileWeb
compileWeb,
compileWorker,
);

const dist = gulp.series(
Expand Down Expand Up @@ -440,6 +409,7 @@ export {
clean,
compile,
compileWeb,
compileWorker,
recompile,
snapshot,
lint,
Expand Down
Loading

0 comments on commit 01ddbec

Please sign in to comment.