Skip to content

Commit

Permalink
java generator, fix generator-test when running from main (microsoft#…
Browse files Browse the repository at this point in the history
…4334)

- Part of microsoft#4315, though before
TypeSpec ARM fix, we'll probably will not merge that PR
  • Loading branch information
XiaofeiCao authored and sarangan12 committed Sep 16, 2024
1 parent d03d72a commit b99c49e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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() + "/");
}
Expand All @@ -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());
Expand Down

0 comments on commit b99c49e

Please sign in to comment.