Skip to content

Commit

Permalink
Add Erlang application resource file extension (#6297)
Browse files Browse the repository at this point in the history
Co-authored-by: Colin Seymour <colin@github.com>
  • Loading branch information
gionea and lildude authored Mar 15, 2023
1 parent 9b53b4b commit 9358f09
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/linguist/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extensions:
- ".7"
- ".8"
- ".9"
- ".app"
- ".cmp"
- ".sol"
- ".stl"
Expand Down
4 changes: 4 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ disambiguations:
- pattern: '\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|INTERFACE|PERMISSIONSET|PERMISSIONSETEXTENSION|ENTITLEMENT))\b'
# Open-ended fallback to Perl AutoLoader
- language: Perl
- extensions: ['.app']
rules:
- language: Erlang
pattern: '(?m)^{\s*(?:application|''application'')\s*,\s*(?:[a-z]+[\w@]*|''[^'']+'')\s*,\s*\[.*?\]\s*}\.[ \t]*$'
- extensions: ['.as']
rules:
- language: ActionScript
Expand Down
1 change: 1 addition & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,7 @@ Erlang:
color: "#B83998"
extensions:
- ".erl"
- ".app"
- ".app.src"
- ".es"
- ".escript"
Expand Down
85 changes: 85 additions & 0 deletions samples/Erlang/compiler.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
% This is an -*- erlang -*- file.
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1997-2022. All Rights Reserved.
%%
%% 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.
%%
%% %CopyrightEnd%

{application, compiler,
[{description, "ERTS CXC 138 10"},
{vsn, "8.2.2"},
{modules, [
beam_a,
beam_asm,
beam_bounds,
beam_block,
beam_call_types,
beam_clean,
beam_dict,
beam_digraph,
beam_disasm,
beam_flatten,
beam_jump,
beam_kernel_to_ssa,
beam_listing,
beam_opcodes,
beam_ssa,
beam_ssa_bc_size,
beam_ssa_bool,
beam_ssa_bsm,
beam_ssa_codegen,
beam_ssa_dead,
beam_ssa_lint,
beam_ssa_opt,
beam_ssa_pp,
beam_ssa_pre_codegen,
beam_ssa_recv,
beam_ssa_share,
beam_ssa_throw,
beam_ssa_type,
beam_trim,
beam_types,
beam_utils,
beam_validator,
beam_z,
cerl,
cerl_clauses,
cerl_inline,
cerl_trees,
compile,
core_scan,
core_lint,
core_parse,
core_pp,
core_lib,
erl_bifs,
rec_env,
sys_core_alias,
sys_core_bsm,
sys_core_fold,
sys_core_fold_lists,
sys_core_inline,
sys_core_prepare,
sys_messages,
sys_pre_attributes,
v3_core,
v3_kernel,
v3_kernel_pp
]},
{registered, []},
{applications, [kernel, stdlib]},
{env, []},
{runtime_dependencies, ["stdlib-4.0","kernel-8.4","erts-13.0",
"crypto-5.1"]}]}.
164 changes: 164 additions & 0 deletions samples/Erlang/kernel.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1996-2022. All Rights Reserved.
%%
%% 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.
%%
%% %CopyrightEnd%
%%
%% This is an -*- erlang -*- file.
%%
{application, kernel,
[
{description, "ERTS CXC 138 10"},
{vsn, "8.5.2"},
{modules, [application,
application_controller,
application_master,
application_starter,
auth,
code,
code_server,
dist_util,
erl_boot_server,
erl_compile_server,
erl_distribution,
erl_erts_errors,
erl_reply,
erl_kernel_errors,
erl_signal_handler,
erpc,
error_handler,
error_logger,
file,
file_server,
file_io_server,
global,
global_group,
global_search,
group,
group_history,
heart,
inet6_tcp,
inet6_tcp_dist,
inet6_udp,
inet6_sctp,
inet_config,
inet_hosts,
inet_gethost_native,
inet_tcp_dist,
kernel,
kernel_config,
kernel_refc,
local_tcp,
local_udp,
logger,
logger_backend,
logger_config,
logger_disk_log_h,
logger_filters,
logger_formatter,
logger_h_common,
logger_handler_watcher,
logger_olp,
logger_proxy,
logger_server,
logger_simple_h,
logger_std_h,
logger_sup,
net,
net_adm,
net_kernel,
os,
ram_file,
rpc,
user_drv,
user_sup,
prim_tty,
disk_log,
disk_log_1,
disk_log_server,
disk_log_sup,
dist_ac,
erl_ddll,
erl_epmd,
erts_debug,
gen_tcp,
gen_tcp_socket,
gen_udp,
gen_udp_socket,
gen_sctp,
inet,
inet_db,
inet_dns,
inet_parse,
inet_res,
inet_tcp,
inet_udp,
inet_sctp,
pg,
pg2,
raw_file_io,
raw_file_io_compressed,
raw_file_io_deflate,
raw_file_io_delayed,
raw_file_io_inflate,
raw_file_io_list,
seq_trace,
socket,
standard_error,
wrap_log_reader]},
{registered, [application_controller,
erl_reply,
auth,
boot_server,
code_server,
disk_log_server,
disk_log_sup,
erl_prim_loader,
error_logger,
file_server_2,
fixtable_server,
global_group,
global_name_server,
heart,
init,
kernel_config,
kernel_refc,
kernel_sup,
logger,
logger_handler_watcher,
logger_sup,
net_kernel,
net_sup,
rex,
user,
os_server,
ddll_server,
erl_epmd,
inet_db,
pg]},
{applications, []},
{env, [{logger_level, notice},
{logger_sasl_compatible, false},
{net_tickintensity, 4},
{net_ticktime, 60},
{prevent_overlapping_partitions, true},
{shell_docs_ansi,auto}
]},
{mod, {kernel, []}},
{runtime_dependencies, ["erts-@OTP-18248@", "stdlib-@OTP-17932@",
"sasl-3.0", "crypto-5.0"]}
]
}.
15 changes: 15 additions & 0 deletions test/fixtures/Generic/app/Erlang/regular.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{application, regular, [
{applications, [
kernel,
stdlib
]},
{description, "Regular application"},
{mod, {regular_app, []}},
{modules, [
regular,
regular_app,
regular_server,
regular_sup]},
{registered, [regular_server]},
{vsn, "0.1.0"}
]}.
1 change: 1 addition & 0 deletions test/fixtures/Generic/app/nil/ignored.app
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Not an Erlang application resource file.
7 changes: 7 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ def test_al_by_heuristics
})
end

def test_app_by_heuristics
assert_heuristics({
"Erlang" => Dir.glob("#{fixtures_path}/Generic/app/Erlang/*"),
nil => Dir.glob("#{fixtures_path}/Generic/app/nil/*")
})
end

def test_as_by_heuristics
assert_heuristics({
"ActionScript" => all_fixtures("ActionScript", "*.as"),
Expand Down

0 comments on commit 9358f09

Please sign in to comment.