Skip to content

Commit

Permalink
Merge pull request #16 from atomvm/examples-cleanup
Browse files Browse the repository at this point in the history
Examples cleanup
  • Loading branch information
fadushin committed Nov 24, 2023
2 parents aa3b77a + 44c3fcb commit f3e53cf
Show file tree
Hide file tree
Showing 41 changed files with 802 additions and 53 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,4 @@ jobs:
- name: "Build Erlang Example Programs"
run: |
REBAR="/tmp/rebar3/rebar3"
EXAMPLES="arepl_example blinky esp_nvs deep_sleep gpio_interrupt i2c_example hello_world ledc_example read_priv spi_example system_info tcp_client tcp_server uart_example udp_client udp_server wifi"
for i in ${EXAMPLES}; do cd ./erlang/$i; ${REBAR} fmt -c || exit 1; ${REBAR} packbeam -p -f -i || exit 1; cd ../..; done
PATH=/tmp/rebar3:$PATH ./build.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/_build/**
**/deps/**
**/mix.lock
**/rebar3.crashdump
31 changes: 31 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# This file is part of AtomVM.
#
# Copyright 2023 Fred Dushin <fred@dushin.net>
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#

REBAR="rebar3"
cd erlang
ERLANG_EXAMPLES="$(/bin/ls | grep -v README.md)"
for i in ${ERLANG_EXAMPLES}; do
cd $i
rm -rf _build
${REBAR} atomvm packbeam -l || exit 1
${REBAR} as check fmt -c || exit 1
cd ..
done
26 changes: 25 additions & 1 deletion erlang/arepl_example/rebar.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [
atomvm_rebar3_plugin, erlfmt
atomvm_rebar3_plugin
]}.
{atomvm_rebar3_plugin, [
{packbeam, [prune]}
]}.
{profiles, [
{check, [
{plugins, [erlfmt]}
]}
]}.
21 changes: 20 additions & 1 deletion erlang/arepl_example/src/arepl_example.app.src
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{application, arepl_example, [
{description, "An AtomVM application"},
{vsn, "0.1.0"},
Expand All @@ -7,6 +26,6 @@
]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{licenses, ["Apache-2.0"]},
{links, []}
]}.
26 changes: 25 additions & 1 deletion erlang/blinky/rebar.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [
atomvm_rebar3_plugin, erlfmt
atomvm_rebar3_plugin
]}.
{atomvm_rebar3_plugin, [
{packbeam, [prune]}
]}.
{profiles, [
{check, [
{plugins, [erlfmt]}
]}
]}.
21 changes: 20 additions & 1 deletion erlang/blinky/src/blinky.app.src
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{application, blinky, [
{description, "An AtomVM application"},
{vsn, "0.1.0"},
Expand All @@ -7,6 +26,6 @@
]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{licenses, ["Apache-2.0"]},
{links, []}
]}.
26 changes: 25 additions & 1 deletion erlang/deep_sleep/rebar.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [
atomvm_rebar3_plugin, erlfmt
atomvm_rebar3_plugin
]}.
{atomvm_rebar3_plugin, [
{packbeam, [prune]}
]}.
{profiles, [
{check, [
{plugins, [erlfmt]}
]}
]}.
21 changes: 20 additions & 1 deletion erlang/deep_sleep/src/deep_sleep.app.src
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{application, deep_sleep, [
{description, "An AtomVM application"},
{vsn, "0.1.0"},
Expand All @@ -7,6 +26,6 @@
]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{licenses, ["Apache-2.0"]},
{links, []}
]}.
26 changes: 25 additions & 1 deletion erlang/esp_nvs/rebar.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [
atomvm_rebar3_plugin, erlfmt
atomvm_rebar3_plugin
]}.
{atomvm_rebar3_plugin, [
{packbeam, [prune]}
]}.
{profiles, [
{check, [
{plugins, [erlfmt]}
]}
]}.
21 changes: 20 additions & 1 deletion erlang/esp_nvs/src/esp_nvs.app.src
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{application, esp_nvs, [
{description, "An AtomVM application"},
{vsn, "0.1.0"},
Expand All @@ -7,6 +26,6 @@
]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{licenses, ["Apache-2.0"]},
{links, []}
]}.
29 changes: 28 additions & 1 deletion erlang/gpio_interrupt/rebar.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [
atomvm_rebar3_plugin, erlfmt
atomvm_rebar3_plugin
]}.
{atomvm_rebar3_plugin, [
{packbeam, [prune]}
]}.
{profiles, [
{check, [
{plugins, [erlfmt]}
]}
]}.
21 changes: 20 additions & 1 deletion erlang/gpio_interrupt/src/gpio_interrupt.app.src
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
%
% This file is part of AtomVM.
%
% Copyright 2023 Fred Dushin <fred@dushin.net>
%
% 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.
%
% SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
%
{application, gpio_interrupt, [
{description, "An AtomVM application"},
{vsn, "0.1.0"},
Expand All @@ -7,6 +26,6 @@
]},
{env, []},
{modules, []},
{licenses, ["Apache 2.0"]},
{licenses, ["Apache-2.0"]},
{links, []}
]}.
Loading

0 comments on commit f3e53cf

Please sign in to comment.