Skip to content

Commit

Permalink
Add missing license headers
Browse files Browse the repository at this point in the history
Summary:
Most mustache files have license headers. Add headers to the ones that don't with the following command:

```
grep -E -L -r --include \
  '*.mustache' 'Meta Platforms, Inc. and affiliates' \
  thrift/compiler/generate/templates | \
  xargs -I {} sh -c 'cat header {} | sponge {}'
```

Remove meaningless remapping of delimiters in the json_experimental generator. It remapped delimiters in the generator and then undid remapping in every template (🤦).

Reviewed By: yoney

Differential Revision: D56829618

fbshipit-source-id: 12073dc6d2def2f5acfe6bd6fe17cc01be392d93
  • Loading branch information
vitaut authored and facebook-github-bot committed May 1, 2024
1 parent ba67a38 commit af02ef2
Show file tree
Hide file tree
Showing 38 changed files with 629 additions and 9 deletions.
1 change: 0 additions & 1 deletion thrift/compiler/generate/t_json_experimental_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class t_json_experimental_generator : public t_mstch_generator {
using t_mstch_generator::t_mstch_generator;

std::string template_prefix() const override { return "json"; }
bool convert_delimiter() const override { return true; }

void generate_program() override;

Expand Down
17 changes: 17 additions & 0 deletions thrift/compiler/generate/templates/html/index.html.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
<!DOCTYPE html>
<html>
<head>
Expand Down
17 changes: 17 additions & 0 deletions thrift/compiler/generate/templates/java/AutoGenerated.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
/**
* Autogenerated by Thrift
*
Expand Down
17 changes: 17 additions & 0 deletions thrift/compiler/generate/templates/java/Default.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
private static class _{{struct:javaCapitalName}}Lazy {
private static final {{struct:javaCapitalName}} _DEFAULT = new {{struct:javaCapitalName}}.Builder().build();
}
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/const_value.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#value:string?}}"{{value:value}}"{{/value:string?}}{{!
}}{{^value:string?}}{{!
}}{{#value:value}}{{!
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/enums.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#program:enums}}
"{{enum:name}}" : {
"name" : "{{enum:name}}",
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/return_type.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#function:return_type}}{{!
}}{{^function:sink?}}{{> type}}{{/function:sink?}}{{!
}}{{#function:sink?}}{
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/services.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#program:services}}
"{{service:name}}" : { {{#service:extends?}}
{{#service:extends}}
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/structs.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#program:structs}}
"{{struct:name}}" : {
"name" : "{{struct:name}}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#structured_annotation:const_struct?}}{{#structured_annotation:const}}{{#constant:value}}
"{{value:qualified_name}}" : {
"type" : {{#constant:type}}{{> type}}{{/constant:type}},
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/thrift_ast.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{
"__fbthrift": "@{{%!%}}generated",
"thrift_module" : "{{program:name}}",{{%!
Expand Down
18 changes: 17 additions & 1 deletion thrift/compiler/generate/templates/json/type.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<%={{ }}=%>
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#type:void?}}"void"{{/type:void?}}{{!
}}{{#type:string?}}"string"{{/type:string?}}{{!
}}{{#type:binary?}}"binary"{{/type:binary?}}{{!
Expand Down
17 changes: 17 additions & 0 deletions thrift/compiler/generate/templates/py3/clients.pxd.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{#program:auto_migrate?}}
from {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.py3_clients cimport *
{{/program:auto_migrate?}}
Expand Down
17 changes: 17 additions & 0 deletions thrift/compiler/generate/templates/py3/clients.pyi.mustache
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{> py3_clients.pyi }}
17 changes: 17 additions & 0 deletions thrift/compiler/generate/templates/py3/clients.pyx.mustache
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
{{> py3_clients.pyx }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
client, pyfuture, options = <object> userdata {{! so client lives on until we exit }}
if {{#function:exceptions}}{{!
}}result.hasException[{{#field:type}}{{> types/cython_cpp_type}}{{/field:type}}]():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
folly::Promise<{{#function:return_type}}{{> clients/cpp_return_type}}{{/function:return_type}}> _promise;
auto _future = _promise.getFuture();
{{^function:oneway?}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
/**
* Autogenerated by Thrift
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{{!
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}}
#
# Autogenerated by Thrift
#
Expand Down
Loading

0 comments on commit af02ef2

Please sign in to comment.