Switch to importation tool, regression.

Regresses proper depedencies temporarily.
This commit is contained in:
Brad Nelson
2023-12-22 14:00:17 -08:00
parent 1588e20247
commit ca05d3b6b0
12 changed files with 296 additions and 48 deletions

View File

@ -261,57 +261,48 @@ COMMON_FILETOOLS = common/tasks.fs common/streams.fs \
COMMON_DESKTOP = common/desktop.fs \
common/graphics.fs common/graphics_utils.fs common/heart.fs
POSIX_BOOT = $(COMMON_PHASE1) \
posix/posix.fs posix/allocation.fs posix/termios.fs \
$(COMMON_PHASE2) $(COMMON_FILETOOLS) $(COMMON_DESKTOP) \
posix/x11.fs \
posix/graphics.fs \
posix/sockets.fs posix/telnetd.fs posix/httpd.fs posix/web_interface.fs \
posix/autoboot.fs \
common/fini.fs
$(GEN)/posix_boot.h: tools/source_to_string.js $(POSIX_BOOT) | $(GEN)
$< boot $(VERSION) $(REVISION) $(POSIX_BOOT) >$@
$(GEN)/posix_boot_merged.fs: tools/importation.py posix/posix_boot.fs | $(GEN)
$^ -I . -I $(GEN) \
--set-version $(VERSION) \
--set-revision $(REVISION) >$@
WINDOWS_BOOT_EXTRA = windows/windows_user.fs \
windows/windows_gdi.fs \
windows/windows_messages.fs \
windows/graphics.fs
$(GEN)/windows_boot_extra.h: tools/source_to_string.js $(WINDOWS_BOOT_EXTRA) | $(GEN)
$< -win boot_extra $(VERSION) $(REVISION) $(WINDOWS_BOOT_EXTRA) >$@
$(GEN)/posix_boot.h: tools/source_to_string.js $(GEN)/posix_boot_merged.fs | $(GEN)
$< boot $(VERSION) $(REVISION) $(GEN)/posix_boot_merged.fs >$@
WINDOWS_BOOT = $(COMMON_PHASE1) \
windows/windows_core.fs \
windows/windows_files.fs \
windows/windows_console.fs \
windows/allocation.fs \
$(COMMON_PHASE2) $(COMMON_FILETOOLS) $(COMMON_DESKTOP) \
windows/load_extra.fs \
posix/autoboot.fs \
common/fini.fs
$(GEN)/windows_boot.h: tools/source_to_string.js $(WINDOWS_BOOT) | $(GEN)
$< -win boot $(VERSION) $(REVISION) $(WINDOWS_BOOT) >$@
$(GEN)/windows_boot_extra_merged.fs: \
tools/importation.py windows/windows_boot_extra.fs | $(GEN)
$^ -I . -I $(GEN) \
--set-version $(VERSION) \
--set-revision $(REVISION) >$@
PICO_ICE_BOOT = $(COMMON_PHASE1) \
pico-ice/allocation.fs \
$(COMMON_PHASE2) \
common/tasks.fs common/streams.fs \
pico-ice/platform.fs \
pico-ice/autoboot.fs \
common/fini.fs
$(GEN)/pico_ice_boot.h: tools/source_to_string.js $(PICO_ICE_BOOT) | $(GEN)
$< boot $(VERSION) $(REVISION) $(PICO_ICE_BOOT) >$@
$(GEN)/windows_boot_extra.h: tools/source_to_string.js $(GEN)/windows_boot_extra_merged.fs | $(GEN)
$< -win boot_extra $(VERSION) $(REVISION) $(GEN)/windows_boot_extra_merged.fs >$@
ESP32_BOOT = $(COMMON_PHASE1) \
esp32/allocation.fs esp32/bindings.fs \
$(COMMON_PHASE2) $(COMMON_FILETOOLS) \
esp32/platform.fs \
posix/httpd.fs posix/web_interface.fs esp32/web_interface.fs \
esp32/registers.fs \
posix/telnetd.fs \
esp32/optionals.fs \
esp32/autoboot.fs common/fini.fs
$(GEN)/esp32_boot.h: tools/source_to_string.js $(ESP32_BOOT) | $(GEN)
$< boot $(VERSION) $(REVISION) $(ESP32_BOOT) >$@
$(GEN)/windows_boot_merged.fs: tools/importation.py windows/windows_boot.fs | $(GEN)
$^ -I . -I $(GEN) \
--set-version $(VERSION) \
--set-revision $(REVISION) >$@
$(GEN)/windows_boot.h: tools/source_to_string.js $(GEN)/windows_boot_merged.fs | $(GEN)
$< -win boot $(VERSION) $(REVISION) $(GEN)/windows_boot_merged.fs >$@
$(GEN)/pico_ice_boot_merged.fs: \
tools/importation.py pico-ice/pico_ice_boot.fs | $(GEN)
$^ -I . -I $(GEN) \
--set-version $(VERSION) \
--set-revision $(REVISION) >$@
$(GEN)/pico_ice_boot.h: tools/source_to_string.js $(GEN)/pico_ice_boot_merged.fs | $(GEN)
$< boot $(VERSION) $(REVISION) $(GEN)/pico_ice_boot_merged.fs >$@
$(GEN)/esp32_boot_merged.fs: \
tools/importation.py esp32/esp32_boot.fs | $(GEN)
$^ -I . -I $(GEN) \
--set-version $(VERSION) \
--set-revision $(REVISION) >$@
$(GEN)/esp32_boot.h: tools/source_to_string.js $(GEN)/esp32_boot_merged.fs | $(GEN)
$< boot $(VERSION) $(REVISION) $(GEN)/esp32_boot_merged.fs >$@
$(GEN)/esp32_assembler.h: \
tools/source_to_string.js \

21
common/phase1.fs Normal file
View File

@ -0,0 +1,21 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs comments.fs
needs boot.fs
needs io.fs
needs conditionals.fs
needs vocabulary.fs
needs floats.fs
needs structures.fs

18
common/phase2.fs Normal file
View File

@ -0,0 +1,18 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs utils.fs
needs code.fs
needs locals.fs
needs case.fs

18
common/phase_desktop.fs Normal file
View File

@ -0,0 +1,18 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs desktop.fs
needs graphics.fs
needs graphics_utils.fs
needs heart.fs

21
common/phase_filetools.fs Normal file
View File

@ -0,0 +1,21 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs tasks.fs
needs streams.fs
needs filetools.fs
needs including.fs
needs blocks.fs
needs ansi.fs
needs visual.fs

28
esp32/esp32_boot.fs Normal file
View File

@ -0,0 +1,28 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs ../common/phase1.fs
needs allocation.fs
needs bindings.fs
needs ../common/phase2.fs
needs ../common/phase_filetools.fs
needs platform.fs
needs ../posix/httpd.fs
needs ../posix/web_interface.fs
needs web_interface.fs
needs registers.fs
needs ../posix/telnetd.fs
needs optionals.fs
needs autoboot.fs
needs ../common/fini.fs

22
pico-ice/pico_ice_boot.fs Normal file
View File

@ -0,0 +1,22 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs ../common/phase1.fs
needs allocation.fs
needs ../common/phase2.fs
needs ../common/tasks.fs
needs ../common/streams.fs
needs platform.fs
needs autoboot.fs
needs ../common/fini.fs

29
posix/posix_boot.fs Normal file
View File

@ -0,0 +1,29 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs ../common/phase1.fs
needs posix.fs
needs allocation.fs
needs termios.fs
needs ../common/phase2.fs
needs ../common/phase_filetools.fs
needs ../common/phase_desktop.fs
needs x11.fs
needs graphics.fs
needs sockets.fs
needs telnetd.fs
needs httpd.fs
needs web_interface.fs
needs autoboot.fs
needs ../common/fini.fs

57
tools/importation.py Executable file
View File

@ -0,0 +1,57 @@
#! /usr/bin/env python3
import argparse
import os
import sys
parser = argparse.ArgumentParser(
prog='importation',
description='Imports header / fs files')
parser.add_argument('filename')
parser.add_argument('-I', action='append')
parser.add_argument('--set-version')
parser.add_argument('--set-revision')
args = parser.parse_args()
bases = args.I or []
results = []
imported = set()
def Import(filename):
filename = os.path.abspath(filename)
if filename in imported:
return
imported.add(filename)
with open(filename, 'r') as fh:
data = fh.read().splitlines()
for line in data:
if filename.endswith('.fs') and line.startswith('needs '):
sfilename = line.split(' ')[1]
sfilename = os.path.join(os.path.dirname(filename), sfilename)
Import(sfilename)
elif (filename.endswith('.h') or
filename.endswith('.cc') or
filename.endswith('.c')) and line.startswith('#include "'):
sfilename = line.split('"')[1]
done = False
for base in bases:
sfilename = os.path.join(base, sfilename)
if os.path.exists(sfilename):
Import(sfilename)
done = True
break
if not done:
results.append(line)
else:
results.append(line)
def Process():
Import(args.filename)
for line in results:
if args.set_version:
line = line.replace('{{VERSION}}', args.set_version)
if args.set_revision:
line = line.replace('{{REVISION}}', args.set_revision)
print('\n'.join(results))
Process()

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# Copyright 2021 Bradley D. Nelson
#
# Licensed under the Apache License, Version 2.0 (the "License");

25
windows/windows_boot.fs Normal file
View File

@ -0,0 +1,25 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs ../common/phase1.fs
needs windows_core.fs \
needs windows_files.fs \
needs windows_console.fs \
needs allocation.fs \
needs ../common/phase2.fs
needs ../common/phase_filetools.fs
needs ../common/phase_desktop.fs
needs load_extra.fs \
needs ../posix/autoboot.fs \
needs ../common/fini.fs

View File

@ -0,0 +1,18 @@
\ Copyright 2023 Bradley D. Nelson
\
\ 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.
needs windows_user.fs
needs windows_gdi.fs
needs windows_messages.fs
needs graphics.fs