summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <benjamin@barenblat.name>2016-08-19 12:13:15 -0400
committerGravatar Benjamin Barenblat <benjamin@barenblat.name>2016-08-19 12:13:15 -0400
commit9a1db8ef5d2d8c791ea499fae5a57f29416a3bcc (patch)
tree09b2d37719e52a9ec9e9a2cb3f94c423cfb19afc
parent62023a04aa51782b66b81a2b2f7d463ddb8d65f3 (diff)
Move MDL classes into their own library
-rw-r--r--.gitignore4
-rw-r--r--Makefile11
-rwxr-xr-xbuild_scripts/generate_mdl8
-rw-r--r--main.ur2
-rw-r--r--mdl/lib.urp3
-rw-r--r--mdl/mdl.ur15
6 files changed, 31 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index c0813ec..eb235cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,8 @@
.*.swp
# MDL
-mdl/lib.urp
-mdl/mdl.ur
+mdl/mdlClasses.ur
+mdl/mdlClasses.urp
# Ur/Web
*.db
diff --git a/Makefile b/Makefile
index 7b78731..7d6aa97 100644
--- a/Makefile
+++ b/Makefile
@@ -12,12 +12,13 @@
# License for the specific language governing permissions and limitations under
# the License.
-MDL = mdl/lib.urp mdl/mdl.ur
+MDL_GENERATED = mdl/mdlClasses.urp mdl/mdlClasses.ur
.PHONY: all
all: ugtd ugtd.db
-ugtd initialize.sql: ugtd.urp $(MDL) main.urs main.ur
+ugtd initialize.sql: ugtd.urp $(MDL_GENERATED) mdl/lib.urp mdl/mdl.ur main.urs \
+ main.ur
urweb -ccompiler build_scripts/clang -output ugtd ugtd
ugtd.db: initialize.sql prepopulate.sql
@@ -26,12 +27,12 @@ ugtd.db: initialize.sql prepopulate.sql
sqlite3 $@ <prepopulate.sql
.PHONY: mdl
-mdl: $(MDL)
-$(MDL): mdl/classes
+mdl: $(MDL_GENERATED)
+$(MDL_GENERATED): mdl/classes
build_scripts/generate_mdl <$<
.PHONY: clean
clean:
- $(RM) $(MDL)
+ $(RM) $(MDL_GENERATED)
$(RM) ugtd.db
$(RM) ugtd initialize.sql
diff --git a/build_scripts/generate_mdl b/build_scripts/generate_mdl
index 61945e5..3e06aaf 100755
--- a/build_scripts/generate_mdl
+++ b/build_scripts/generate_mdl
@@ -27,13 +27,13 @@ for css_name in fileinput.input():
css_name.startswith("mdl-progress")):
urweb_name = css_name.replace("--", "---").replace("-", "_")
urp_lines.append(
- "rewrite style Mdl/{} {}".format(urweb_name, css_name))
+ "rewrite style MdlClasses/{} {}".format(urweb_name, css_name))
ur_lines.append("style {} (* {} *)".format(urweb_name, css_name))
urp_lines.append("")
-urp_lines.append("mdl")
+urp_lines.append("mdlClasses")
-with open("mdl/lib.urp", "w") as urp_file:
+with open("mdl/mdlClasses.urp", "w") as urp_file:
urp_file.write('\n'.join(urp_lines))
-with open("mdl/mdl.ur", "w") as ur_file:
+with open("mdl/mdlClasses.ur", "w") as ur_file:
ur_file.write('\n'.join(ur_lines))
diff --git a/main.ur b/main.ur
index 79e5f2b..970171e 100644
--- a/main.ur
+++ b/main.ur
@@ -12,7 +12,7 @@ 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. *)
-open Mdl
+open Mdl.Classes
table nextAction : {
Id : int,
diff --git a/mdl/lib.urp b/mdl/lib.urp
new file mode 100644
index 0000000..fabf5a8
--- /dev/null
+++ b/mdl/lib.urp
@@ -0,0 +1,3 @@
+library mdlClasses
+
+mdl
diff --git a/mdl/mdl.ur b/mdl/mdl.ur
new file mode 100644
index 0000000..f3dec74
--- /dev/null
+++ b/mdl/mdl.ur
@@ -0,0 +1,15 @@
+(* Copyright 2015 Google Inc.
+Copyright 2016 Benjamin Barenblat
+
+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. *)
+
+structure Classes = MdlClasses