java generator, fix generator-test when running from main (#4334)
- Part of https://github.com/microsoft/typespec/pull/4315, though before TypeSpec ARM fix, we'll probably will not merge that PR
This commit is contained in:
Родитель
244dbc08c0
Коммит
93377fd7dd
|
@ -43,14 +43,14 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
|
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;
|
private static Yaml yaml = null;
|
||||||
|
|
||||||
// java -jar target/azure-typespec-extension-jar-with-dependencies.jar
|
// java -jar target/azure-typespec-extension-jar-with-dependencies.jar
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
// parameters
|
// parameters
|
||||||
String inputYamlFileName = "typespec-tests/tsp-output/code-model.yaml";
|
String inputYamlFileName = DEFAULT_OUTPUT_DIR + "code-model.yaml";
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
inputYamlFileName = args[0];
|
inputYamlFileName = args[0];
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class Main {
|
||||||
|
|
||||||
// output path
|
// output path
|
||||||
if (CoreUtils.isNullOrEmpty(options.getOutputDir())) {
|
if (CoreUtils.isNullOrEmpty(options.getOutputDir())) {
|
||||||
options.setOutputDir("typespec-tests/tsp-output/");
|
options.setOutputDir(DEFAULT_OUTPUT_DIR);
|
||||||
} else if (!options.getOutputDir().endsWith("/")) {
|
} else if (!options.getOutputDir().endsWith("/")) {
|
||||||
options.setOutputDir(options.getOutputDir() + "/");
|
options.setOutputDir(options.getOutputDir() + "/");
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ public class Main {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
// default if emitterOptions fails
|
// default if emitterOptions fails
|
||||||
options = new EmitterOptions();
|
options = new EmitterOptions();
|
||||||
options.setOutputDir("typespec-tests/tsp-output/");
|
options.setOutputDir(DEFAULT_OUTPUT_DIR);
|
||||||
if (codeModel.getLanguage().getJava() != null && !CoreUtils.isNullOrEmpty(
|
if (codeModel.getLanguage().getJava() != null && !CoreUtils.isNullOrEmpty(
|
||||||
codeModel.getLanguage().getJava().getNamespace())) {
|
codeModel.getLanguage().getJava().getNamespace())) {
|
||||||
options.setNamespace(codeModel.getLanguage().getJava().getNamespace());
|
options.setNamespace(codeModel.getLanguage().getJava().getNamespace());
|
||||||
|
|
Загрузка…
Ссылка в новой задаче