File tree Expand file tree Collapse file tree 3 files changed +21
-11
lines changed
javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap Expand file tree Collapse file tree 3 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,26 @@ jobs:
96
96
for cds_file in $(find . -type f \( -iname '*.cds' \) -print)
97
97
do
98
98
echo "I am compiling $cds_file"
99
+ _out_path="${cds_file}.json"
99
100
cds compile $cds_file \
100
- -2 json \
101
101
--locations \
102
- > "$cds_file.json" 2> "$cds_file.err"
102
+ --to json \
103
+ --dest "$_out_path" \
104
+ 2> "$cds_file.err"
105
+ # Check if the output is a regular file or a (sub)directory, where
106
+ # files generated in an output directory will need to have the file
107
+ # extension changed from '.json' to '.cds.json', but we don't need
108
+ # to rename anything if the cds compiler just generated a single
109
+ # '.cds.json' file.
110
+ if [ -d "$_out_path" ]
111
+ then
112
+ for json_file in $(find "$_out_path" -type f \( -iname '*.json' \) -print)
113
+ do
114
+ _new_path="${json_file%.json}.cds.json"
115
+ echo "Renaming CDS compiler generated JSON file $json_file to $_new_path"
116
+ mv "$json_file" "$_new_path"
117
+ done
118
+ fi
103
119
done
104
120
popd
105
121
done
Original file line number Diff line number Diff line change @@ -165,8 +165,8 @@ class CdlService extends CdlElement {
165
165
CdlService ( ) { kind = CdlServiceKind ( this .getPropStringValue ( "kind" ) ) }
166
166
167
167
UserDefinedApplicationService getImplementation ( ) {
168
- this .getFile ( ) .getStem ( ) = result . getFile ( ) . getStem ( ) + ".cds" and
169
- this . getFile ( ) . getParentContainer ( ) = this .getFile ( ) .getParentContainer ( )
168
+ result .getFile ( ) .getRelativePath ( ) . regexpReplaceAll ( "\\.[^.]+$" , ".cds.json" ) =
169
+ this .getFile ( ) .getRelativePath ( )
170
170
}
171
171
172
172
/**
Original file line number Diff line number Diff line change @@ -442,13 +442,7 @@ abstract class UserDefinedApplicationService extends UserDefinedService {
442
442
/**
443
443
* Gets the CDS definition of this service.
444
444
*/
445
- CdlService getCdsDeclaration ( ) {
446
- exists ( CdsFile cdsFile |
447
- cdsFile .getStem ( ) = this .getFile ( ) .getStem ( ) + ".cds" and
448
- cdsFile .getParentContainer ( ) = this .getFile ( ) .getParentContainer ( ) and
449
- result .getFile ( ) = cdsFile
450
- )
451
- }
445
+ CdlService getCdsDeclaration ( ) { result .getImplementation ( ) = this }
452
446
453
447
/**
454
448
* Gets the name of this service.
You can’t perform that action at this time.
0 commit comments