From 00a19d3dd05f5ff18b3aea85b6a1953d017df9ee Mon Sep 17 00:00:00 2001 From: xiaofeicao Date: Wed, 4 Sep 2024 17:44:37 +0800 Subject: [PATCH] fix generator-test when running from main --- .../microsoft/typespec/http/client/generator/Main.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java index a7326a7ea6..8ee1ea2176 100644 --- a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java +++ b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java @@ -43,14 +43,14 @@ public class Main { private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); - + private static final String DEFAULT_OUTPUT_DIR = "http-client-generator-test/tsp-output/"; private static Yaml yaml = null; // java -jar target/azure-typespec-extension-jar-with-dependencies.jar public static void main(String[] args) throws IOException { // parameters - String inputYamlFileName = "typespec-tests/tsp-output/code-model.yaml"; + String inputYamlFileName = DEFAULT_OUTPUT_DIR + "code-model.yaml"; if (args.length >= 1) { inputYamlFileName = args[0]; } @@ -201,7 +201,7 @@ private static EmitterOptions loadEmitterOptions(CodeModel codeModel) { // output path if (CoreUtils.isNullOrEmpty(options.getOutputDir())) { - options.setOutputDir("typespec-tests/tsp-output/"); + options.setOutputDir(DEFAULT_OUTPUT_DIR); } else if (!options.getOutputDir().endsWith("/")) { options.setOutputDir(options.getOutputDir() + "/"); } @@ -213,7 +213,7 @@ private static EmitterOptions loadEmitterOptions(CodeModel codeModel) { if (options == null) { // default if emitterOptions fails options = new EmitterOptions(); - options.setOutputDir("typespec-tests/tsp-output/"); + options.setOutputDir(DEFAULT_OUTPUT_DIR); if (codeModel.getLanguage().getJava() != null && !CoreUtils.isNullOrEmpty( codeModel.getLanguage().getJava().getNamespace())) { options.setNamespace(codeModel.getLanguage().getJava().getNamespace());