Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java generator, fix generator-test when running from main #4334

Merged
merged 1 commit into from
Sep 5, 2024
Merged
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
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
Loading