Merge: Rationalize the usages of tools on packages
authorJean Privat <jean@pryen.org>
Tue, 13 Oct 2015 16:29:43 +0000 (12:29 -0400)
committerJean Privat <jean@pryen.org>
Tue, 13 Oct 2015 16:29:43 +0000 (12:29 -0400)
In order to have autonomous packages, they should be coherent and work as is without specific user hack.

The remaining issues are:

* The absence of required source files (eg. because generated by nitcc or nitserial) that make tools unusable or reports error. The proposed solution is a new optional Makefile goal `pre-build` that has to generate the missing files. close #1720

* The requirement of arbitrary `-I` that make the tools (eg the vim plugin) unusable on the projects without prior knowledge.
The only project that use a rogue -I is `online_editor` that require things from nitc.
The proposed solution is to virtually move src to contrib/nitc as a symbolic link.
New project could then choose to import nitc (or parts of it) without being in src.

* The presence of broken nit files. Currently, only 3 broken files remain: `contrib/pep8analysis/src/parser/parser_abs.nit`, `contrib/nitc/parser/parser_abs.nit` and `contrib/nitcc/src/nitcc_lexer0.nit`. These are still open issues and will be dealt latter.

Pull-Request: #1749
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

12 files changed:
contrib/benitlux/Makefile
contrib/crazy_moles/Makefile
contrib/jwrapper/Makefile
contrib/memory/Makefile
contrib/nitc [new symlink]
contrib/objcwrapper/Makefile
contrib/online_ide/Makefile
contrib/online_ide/sources/nit/pnacl_nit.nit
contrib/simplan/Makefile
contrib/tinks/Makefile
lib/json/Makefile
src/Makefile

index 9bf30ac..7041b04 100644 (file)
@@ -1,5 +1,7 @@
 all: server
 
+pre-build: src/benitlux_serial.nit
+
 server:
        mkdir -p bin/
        ../../bin/nitc --dir bin/ src/benitlux_daily.nit src/benitlux_web.nit
index 113329d..232ec08 100644 (file)
@@ -4,6 +4,8 @@ SVG2PNG=../inkscape_tools/bin/svg_to_png_and_nit
 
 default: bin/moles
 
+pre-build: assets/images/drawing.png
+
 bin/moles: $(shell ../../bin/nitls -M src/moles_linux.nit) assets/images/drawing.png
        mkdir -p bin
        ../../bin/nitc -o bin/moles src/moles_linux.nit
index 7c41505..3173333 100644 (file)
@@ -1,5 +1,7 @@
 all: bin/jwrapper
 
+pre-build: src/javap_test_parser.nit src/serial.nit
+
 ../nitcc/src/nitcc:
        make -C ../nitcc
 
index ac91a73..a5a8c6d 100644 (file)
@@ -14,6 +14,8 @@
 
 all: bin/memory
 
+pre-build: assets/images/drawing.png
+
 bin/memory: assets/images/drawing.png src/*.nit
        mkdir -p bin
        ../../bin/nitc -o bin/memory src/memory.nit -m ../../lib/mnit/linux/linux.nit
diff --git a/contrib/nitc b/contrib/nitc
new file mode 120000 (symlink)
index 0000000..5cd551c
--- /dev/null
@@ -0,0 +1 @@
+../src
\ No newline at end of file
index e248fb1..33ed110 100644 (file)
@@ -1,5 +1,7 @@
 all: bin/objcwrapper
 
+pre-build: src/objc_parser.nit
+
 ../nitcc/src/nitcc:
        make -C ../nitcc
 
index 6c06cf5..c8d231e 100644 (file)
@@ -2,7 +2,7 @@
 ACE_BUILDS ?= ../../../ace-builds/
 
 default:
-       ../../bin/nitc --semi-global sources/nit/pnacl_nit.nit -I ../../src/
+       ../../bin/nitc --semi-global sources/nit/pnacl_nit.nit
        cp pnacl_nit/pnacl_nit.pexe www/pnacl/ -f
        rm -rf pnacl_nit/
 
index ed8151d..567b0a2 100644 (file)
 # A version of the naive Nit interpreter for PNaCl.
 module pnacl_nit
 
-import interpreter::naive_interpreter
-import interpreter::debugger
+import nitc::interpreter::naive_interpreter
+import nitc::interpreter::debugger
 import pnacl
-intrude import toolcontext
-intrude import loader
+intrude import nitc::toolcontext
+intrude import nitc::loader
 intrude import core::file
 
 # We redefine exit to start a new thread before killing the one that called exit.
index 530c25e..367868e 100644 (file)
@@ -3,6 +3,8 @@ NITCC=../nitcc/src/nitcc
 
 all: simplan
 
+pre-build: simplan_parser.nit
+
 simplan: simplan.nit simplan_parser.nit
        ${NITC} simplan.nit
 
index ee13360..aeb7fbf 100644 (file)
 
 all: bin/server bin/tinks
 
+pre-build: assets/images/drawing.png src/client/client_serialize.nit src/server/server_serialize.nit
+
 # Client
 bin/tinks: assets/images/drawing.png src/client/client_serialize.nit $(shell ../../bin/nitls -M src/client/linux_client.nit)
        ../../bin/nitc -o bin/tinks src/client/linux_client.nit -m src/client/client_serialize.nit
 
-src/client/client_serialize.nit: $(shell ../../bin/nitls -M src/client/client.nit)
+src/client/client_serialize.nit: assets/images/drawing.png $(shell ../../bin/nitls -M src/client/client.nit)
        ../../bin/nitserial -o src/client/client_serialize.nit src/client/client.nit
 
 assets/images/drawing.png: art/drawing.svg
index 8d0650f..a8a5eb9 100644 (file)
@@ -1,6 +1,6 @@
 NITCCDIR=../../contrib/nitcc/
 
-compile-parser: $(NITCCDIR)src/nitcc
+pre-build: $(NITCCDIR)src/nitcc
        $(NITCCDIR)src/nitcc $(NITCCDIR)examples/json.sablecc
 
 $(NITCCDIR)src/nitcc:
index b46e488..6b9866a 100644 (file)
@@ -22,6 +22,9 @@ BINS=$(patsubst %,../bin/%,$(OBJS))
 
 all: bin/nitc
 
+pre-build:
+       ./git-gen-version.sh
+
 nitc_0: ../c_src/nitc parser/parser.nit
        @echo '***************************************************************'
        @echo '* Compile nitc_0 from NIT source files                        *'