Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/spec-gen-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release

## 2025-12-18 - 0.9.5

- Override 'generateFromTypeSpec' value by the result in 'generateOutput.json' for .NET

## 2025-12-12 - 0.9.4

- Updated 'generateFromTypeSpec' value to the result returned from the language script for .NET
Expand Down
4 changes: 2 additions & 2 deletions tools/spec-gen-sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/spec-gen-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"email": "[email protected]",
"url": "https://github.com/Azure/azure-sdk-tools"
},
"version": "0.9.4",
"version": "0.9.5",
"description": "A TypeScript implementation of the API specification to SDK tool",
"tags": [
"spec-gen-sdk"
Expand Down
24 changes: 16 additions & 8 deletions tools/spec-gen-sdk/src/automation/reportStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { setSdkAutoStatus } from '../utils/runScript';
import { extractPathFromSpecConfig, mapToObject } from '../utils/utils';
import { vsoAddAttachment, vsoLogError, vsoLogWarning } from './logging';
import { ExecutionReport, PackageReport } from '../types/ExecutionReport';
import { deleteTmpJsonFile, writeTmpJsonFile } from '../utils/fsUtils';
import { deleteTmpJsonFile, readTmpJsonFile, writeTmpJsonFile } from '../utils/fsUtils';
import { marked } from "marked";
import { toolError, toolWarning } from '../utils/messageUtils';
import { externalError, toolError, toolWarning } from '../utils/messageUtils';
import { FailureType, WorkflowContext } from '../types/Workflow';
import { setFailureType } from '../utils/workflowUtils';
import { commentDetailView, renderHandlebarTemplate } from '../utils/reportStatusUtils';
import { getGenerateOutput } from '../types/GenerateOutput';

export const generateReport = (context: WorkflowContext) => {
context.logger.log('section', 'Generate report');
Expand All @@ -25,10 +26,9 @@ export const generateReport = (context: WorkflowContext) => {
let markdownContent = '';
let message = "";
let isTypeSpec = false;
let hasPkgFromTypeSpec = false;
let generateFromTypeSpec = false;

if (!context.config.sdkName.includes('net') && context.specConfigPath && context.specConfigPath.endsWith('tspconfig.yaml')) {
if (context.specConfigPath && context.specConfigPath.endsWith('tspconfig.yaml')) {
generateFromTypeSpec = true;
}
for (const pkg of context.handledPackages) {
Expand Down Expand Up @@ -80,12 +80,20 @@ export const generateReport = (context: WorkflowContext) => {
`hasSuppressions [${hasSuppressions}] ` +
`hasAbsentSuppressions [${hasAbsentSuppressions}]`
);
hasPkgFromTypeSpec = hasPkgFromTypeSpec || isTypeSpec;
}

// only for .NET SDK, use the flag returned from the .NET automation to mark the whole generationFromTypeSpec
if (context.config.sdkName.includes('net') && hasPkgFromTypeSpec) {
generateFromTypeSpec = true;
// for .NET SDK in spec PR scenario, override generateFromTypeSpec by the value returned from the .NET automation script
if (context.config.sdkName.includes('net') && context.config.runMode === 'spec-pull-request') {
generateFromTypeSpec = false;
const generateOutputJson = readTmpJsonFile(context, 'generateOutput.json');
if (generateOutputJson === undefined) {
message = externalError('Failed to read generateOutput.json. Please check if the generate script is configured correctly.');
throw new Error(message);
}
const generateOutput = getGenerateOutput(generateOutputJson);
if (generateOutput?.packages?.[0]?.typespecProject) {
generateFromTypeSpec = true;
}
}

if (context.config.pullNumber && markdownContent) {
Expand Down