File tree Expand file tree Collapse file tree
modules/deviceconnect-codegen/src/main
java/org/deviceconnect/codegen Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,7 +162,12 @@ public static void main(String[] args) {
162162 }
163163 }
164164 if (cmd .hasOption ("t" )) {
165- clientOpts .getProperties ().put (CodegenConstants .TEMPLATE_DIR , String .valueOf (cmd .getOptionValue ("t" )));
165+ String dirPath = String .valueOf (cmd .getOptionValue ("t" ));
166+ if (!new File (dirPath ).exists ()) {
167+ reportError (new Errors .TemplateDirNotFound (dirPath ));
168+ return ;
169+ }
170+ clientOpts .getProperties ().put (CodegenConstants .TEMPLATE_DIR , dirPath );
166171 }
167172
168173 String displayName ;
Original file line number Diff line number Diff line change @@ -79,6 +79,14 @@ public UnrecognizedOption(final UnrecognizedOptionException e) {
7979 }
8080 }
8181
82+ public static class TemplateDirNotFound extends CodegenError {
83+
84+ public TemplateDirNotFound (final String dirPath ) {
85+ String message = getMessageForKey ("errorTemplateDirNotFound" );
86+ mMessage = message + ": " + dirPath ;
87+ }
88+ }
89+
8290 public static class InvalidJson extends CodegenError {
8391 public InvalidJson (final File file , final JsonProcessingException e ) {
8492 ErrorFormat format = new ErrorFormat ("json" );
Original file line number Diff line number Diff line change 11errorMissingOption =Missing option
22errorMissingArgument =Missing argument for option
33errorAlreadySelectedOption =Already selected option
4+ errorTemplateDirNotFound =Template directory is not Found
45errorUndefinedOption =Undefined option
56errorInvalidSwagger =Invalid Swagger 2.0 file
67
Original file line number Diff line number Diff line change 11errorMissingOption =必須オプションが指定されていません
22errorMissingArgument =オプションに対して引数が指定されていません
33errorAlreadySelectedOption =選択済みのオプションです
4+ errorTemplateDirNotFound =テンプレート用ディレクトリが見つかりません
45errorUndefinedOption =未定義のオプションが指定されています
56errorInvalidSwagger =Swagger 2.0 として不正なファイルが入力されました
67
Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ DISPLAY_NAME="MyPlugin"
2121# スケルトンコード生成ツールのバイナリ
2222JAR_FILE=" ../bin/deviceconnect-codegen.jar"
2323
24- ARGS=" --input-spec $SPEC --lang deviceConnectAndroidPlugin --config configs/android-plugin.json --template-dir $TEMPLATE_DIR --package-name $PACKAGE_NAME --connection-type $CONNECTION_TYPE --display-name $DISPLAY_NAME --output $OUTPUT_DIR "
24+ ARGS=" --overwrite -- input-spec $SPEC --lang deviceConnectAndroidPlugin --config configs/android-plugin.json --template-dir $TEMPLATE_DIR --package-name $PACKAGE_NAME --connection-type $CONNECTION_TYPE --display-name $DISPLAY_NAME --output $OUTPUT_DIR "
2525
2626java -Dfile.encoding=UTF-8 -jar $JAR_FILE $ARGS
You can’t perform that action at this time.
0 commit comments