mt-lang 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/Rakefile +1 -1
- data/docs/index.html +9 -0
- data/lib/milk_tea/base.rb +7 -2
- data/lib/milk_tea/bindings/vendored_tools.rb +2 -1
- data/lib/milk_tea/bindings/vendored_tracy.rb +7 -5
- data/lib/milk_tea/tooling/toolchain_cli.rb +68 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 627010e9d898c6ee8f1a1e41ff67c0d255aaefe24af708dcd170622ddd06afa2
|
|
4
|
+
data.tar.gz: e5fd12e5c2a99ab16248088c18d274ace905e339549d6ac20d3f5a30d469dd9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9309828a4cf5f9b5719c7284baa6660e560b532f9430e2b4b58488b68afb4321e6880b3974a48d34cd7b185f84e06e904b9189bbd70ced7cdf71e459e8abf267
|
|
7
|
+
data.tar.gz: b4672748568f0bc2f38364e0c072af36f94aa8c9966b981c63a17649680eacaa2a6fb9a453b53fdf6642a65f247e785d26ebe06dd12aca06d15195a591599844
|
data/README.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Milk Tea
|
|
2
2
|
|
|
3
|
+
A statically typed, indentation-based systems language for games.
|
|
4
|
+
Compiles to readable C. Safe by default, explicit by design.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
gem install mt-lang
|
|
8
|
+
mtc run hello.mt
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
[VS Code extension](https://marketplace.visualstudio.com/items?itemName=teefan.milk-tea-lang) — syntax highlighting, IntelliSense, debugging
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
3
15
|
This README is the primary, implementation-focused language reference for the project.
|
|
4
16
|
It is the preferred first entry point for getting to know the language.
|
|
5
17
|
|
data/Rakefile
CHANGED
|
@@ -296,7 +296,7 @@ namespace :release do
|
|
|
296
296
|
desc "Build and publish the gem to RubyGems.org"
|
|
297
297
|
task :push do
|
|
298
298
|
sh "gem build milk_tea.gemspec"
|
|
299
|
-
gem_file = Dir["
|
|
299
|
+
gem_file = Dir["mt-lang-*.gem"].sort_by { |f| File.mtime(f) }.last
|
|
300
300
|
sh "gem push #{gem_file}"
|
|
301
301
|
end
|
|
302
302
|
end
|
data/docs/index.html
CHANGED
|
@@ -270,7 +270,16 @@ p + p{margin-top:-.25rem}
|
|
|
270
270
|
<div class="hero">
|
|
271
271
|
<h1>Milk Tea <span>Reference</span></h1>
|
|
272
272
|
<p class="tagline">A statically typed, indentation-based systems language for games. Safe by default, explicit by design, compiling to <strong>beautiful C</strong>.</p>
|
|
273
|
+
<div class="code-wrap" style="margin-bottom:1rem">
|
|
274
|
+
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
|
|
275
|
+
<pre><code>$ gem install mt-lang
|
|
276
|
+
$ mtc run hello.mt</code></pre>
|
|
277
|
+
</div>
|
|
273
278
|
<div class="badges">
|
|
279
|
+
<span class="badge">📦 Install: <code>gem install mt-lang</code></span>
|
|
280
|
+
<span class="badge ac"><a href="https://marketplace.visualstudio.com/items?itemName=teefan.milk-tea-lang" style="color:inherit;text-decoration:none">💻 VS Code Extension</a></span>
|
|
281
|
+
</div>
|
|
282
|
+
<div class="badges" style="margin-top:.5rem">
|
|
274
283
|
<span class="badge">⚡ Statically Typed</span>
|
|
275
284
|
<span class="badge">🌎 Compiles to C</span>
|
|
276
285
|
<span class="badge ac">🔒 Safe by Default</span>
|
data/lib/milk_tea/base.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require "pathname"
|
|
4
4
|
|
|
5
5
|
module MilkTea
|
|
6
|
-
VERSION = "0.2.
|
|
6
|
+
VERSION = "0.2.3"
|
|
7
7
|
|
|
8
8
|
def self.root
|
|
9
9
|
@root ||= Pathname.new(File.expand_path("../..", __dir__))
|
|
@@ -11,7 +11,7 @@ module MilkTea
|
|
|
11
11
|
|
|
12
12
|
def self.data_root
|
|
13
13
|
@data_root ||= begin
|
|
14
|
-
if File.writable?(root.to_s)
|
|
14
|
+
if !installed_as_gem? && File.writable?(root.to_s)
|
|
15
15
|
root
|
|
16
16
|
else
|
|
17
17
|
xdg_cache = ENV.fetch("XDG_CACHE_HOME", File.join(Dir.home, ".cache"))
|
|
@@ -20,6 +20,11 @@ module MilkTea
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def self.installed_as_gem?
|
|
24
|
+
root.to_s.match?(%r{/gems/mt-lang-})
|
|
25
|
+
end
|
|
26
|
+
private_class_method :installed_as_gem?
|
|
27
|
+
|
|
23
28
|
def self.writable_root_for(root)
|
|
24
29
|
resolved = Pathname.new(File.expand_path(root.to_s))
|
|
25
30
|
if resolved.to_s == MilkTea.root.to_s
|
|
@@ -9,9 +9,10 @@ module MilkTea
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def self.build_all!(root: MilkTea.root)
|
|
12
|
+
data = MilkTea.writable_root_for(root)
|
|
12
13
|
results = all(root:).map do |tool|
|
|
13
14
|
binary = tool.build!
|
|
14
|
-
install = tool.install_path(root:)
|
|
15
|
+
install = tool.install_path(root: data)
|
|
15
16
|
FileUtils.mkdir_p(File.dirname(install))
|
|
16
17
|
FileUtils.cp(binary, install)
|
|
17
18
|
FileUtils.chmod(0o755, install)
|
|
@@ -5,8 +5,9 @@ require_relative "vendored_tool"
|
|
|
5
5
|
module MilkTea
|
|
6
6
|
module VendoredTracy
|
|
7
7
|
def self.library(root: MilkTea.root)
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
data = MilkTea.writable_root_for(root)
|
|
9
|
+
source = data.join("third_party/tracy-upstream/public/TracyClient.cpp")
|
|
10
|
+
build = data.join("tmp/tracy-lib")
|
|
10
11
|
MilkTea::VendoredCLibrary::Archive.new(
|
|
11
12
|
name: "tracy",
|
|
12
13
|
source_root: source.dirname,
|
|
@@ -20,11 +21,12 @@ module MilkTea
|
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
def self.profiler_tool(root: MilkTea.root)
|
|
23
|
-
|
|
24
|
+
data = MilkTea.writable_root_for(root)
|
|
25
|
+
source_dir = data.join("third_party/tracy-upstream/profiler")
|
|
24
26
|
MilkTea::VendoredTool.new(
|
|
25
27
|
name: "tracy-profiler",
|
|
26
|
-
source_dir:
|
|
27
|
-
build_dir:
|
|
28
|
+
source_dir: source_dir.to_s,
|
|
29
|
+
build_dir: data.join("tmp/tracy-profiler-build").to_s,
|
|
28
30
|
output_binary_name: "tracy-profiler",
|
|
29
31
|
cmake_args: ["-DLEGACY=ON"],
|
|
30
32
|
)
|
|
@@ -11,9 +11,12 @@ module MilkTea
|
|
|
11
11
|
@out = out
|
|
12
12
|
@err = err
|
|
13
13
|
@help_printer = help_printer
|
|
14
|
+
@quiet = false
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def start
|
|
18
|
+
extract_options!
|
|
19
|
+
|
|
17
20
|
subcommand = @argv.shift
|
|
18
21
|
unless subcommand
|
|
19
22
|
@err.puts("missing toolchain subcommand")
|
|
@@ -37,6 +40,29 @@ module MilkTea
|
|
|
37
40
|
|
|
38
41
|
private
|
|
39
42
|
|
|
43
|
+
def extract_options!
|
|
44
|
+
remaining = []
|
|
45
|
+
until @argv.empty?
|
|
46
|
+
arg = @argv.first
|
|
47
|
+
case arg
|
|
48
|
+
when "-q", "--quiet"
|
|
49
|
+
@quiet = true
|
|
50
|
+
@argv.shift
|
|
51
|
+
when "--"
|
|
52
|
+
@argv.shift
|
|
53
|
+
remaining.concat(@argv)
|
|
54
|
+
@argv.clear
|
|
55
|
+
else
|
|
56
|
+
remaining << @argv.shift
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
@argv.replace(remaining)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def info(message)
|
|
63
|
+
@out.puts(message) unless @quiet
|
|
64
|
+
end
|
|
65
|
+
|
|
40
66
|
def print_help
|
|
41
67
|
@help_printer.call(@err)
|
|
42
68
|
end
|
|
@@ -50,12 +76,39 @@ module MilkTea
|
|
|
50
76
|
|
|
51
77
|
require_relative "../bindings"
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
79
|
+
sources = UpstreamSources.default_sources(root: MilkTea.root)
|
|
80
|
+
info "Bootstrapping #{sources.length} vendored libraries..."
|
|
81
|
+
info ""
|
|
82
|
+
|
|
83
|
+
ok = 0
|
|
84
|
+
skipped = 0
|
|
85
|
+
failed = 0
|
|
86
|
+
|
|
87
|
+
sources.each do |source|
|
|
88
|
+
if source.complete?
|
|
89
|
+
info " #{source.name} (already present)"
|
|
90
|
+
skipped += 1
|
|
91
|
+
next
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
info " #{source.name} \e[2mcloning...\e[0m"
|
|
95
|
+
@out.flush
|
|
96
|
+
begin
|
|
97
|
+
result = source.bootstrap!
|
|
98
|
+
verb = result.status == :present ? "kept" : "bootstrapped"
|
|
99
|
+
info "\r #{source.name} \e[32m#{verb}\e[0m"
|
|
100
|
+
ok += 1
|
|
101
|
+
rescue UpstreamSources::Error => e
|
|
102
|
+
info "\r #{source.name} \e[31mfailed\e[0m"
|
|
103
|
+
@err.puts(" #{e.message}")
|
|
104
|
+
failed += 1
|
|
105
|
+
end
|
|
57
106
|
end
|
|
58
|
-
|
|
107
|
+
|
|
108
|
+
info ""
|
|
109
|
+
total = ok + skipped + failed
|
|
110
|
+
info "#{total} source(s): #{ok} bootstrapped, #{skipped} skipped, #{failed} failed"
|
|
111
|
+
failed.zero? ? 0 : 1
|
|
59
112
|
end
|
|
60
113
|
|
|
61
114
|
def doctor_command
|
|
@@ -71,6 +124,7 @@ module MilkTea
|
|
|
71
124
|
ar = ENV.fetch("AR", "ar")
|
|
72
125
|
checks = []
|
|
73
126
|
|
|
127
|
+
info "Checking system tools..."
|
|
74
128
|
checks << ["ruby", true, RUBY_DESCRIPTION]
|
|
75
129
|
checks << ["cc", executable_available?(cc), cc]
|
|
76
130
|
checks << ["ar", executable_available?(ar), ar]
|
|
@@ -80,6 +134,7 @@ module MilkTea
|
|
|
80
134
|
checks << ["cmake", executable_available?(ENV.fetch("CMAKE", "cmake")), ENV.fetch("CMAKE", "cmake")]
|
|
81
135
|
checks << ["ninja", executable_available?("ninja"), "ninja"]
|
|
82
136
|
|
|
137
|
+
info "Checking vendored libraries..."
|
|
83
138
|
UpstreamSources.default_sources(root: MilkTea.root).each do |source|
|
|
84
139
|
missing = source.sentinel_paths.reject do |relative_path|
|
|
85
140
|
File.exist?(source.checkout_root.join(relative_path))
|
|
@@ -91,6 +146,7 @@ module MilkTea
|
|
|
91
146
|
end
|
|
92
147
|
end
|
|
93
148
|
|
|
149
|
+
info "Checking bindings..."
|
|
94
150
|
RawBindings.default_registry(root: MilkTea.root)
|
|
95
151
|
.select { |binding| binding.module_name.start_with?("std.c.") }
|
|
96
152
|
.sort_by(&:name)
|
|
@@ -119,8 +175,9 @@ module MilkTea
|
|
|
119
175
|
end
|
|
120
176
|
end
|
|
121
177
|
|
|
178
|
+
info ""
|
|
122
179
|
checks.each do |name, ok, detail|
|
|
123
|
-
@out.puts("#{ok ?
|
|
180
|
+
@out.puts("#{ok ? "ok" : "fail"} #{name}: #{detail}")
|
|
124
181
|
end
|
|
125
182
|
|
|
126
183
|
checks.all? { |_, ok, _| ok } ? 0 : 1
|
|
@@ -135,9 +192,13 @@ module MilkTea
|
|
|
135
192
|
|
|
136
193
|
require_relative "../bindings"
|
|
137
194
|
|
|
195
|
+
tools = VendoredTools.default_tools(root: MilkTea.root)
|
|
196
|
+
info "Building #{tools.length} vendored tool(s)..."
|
|
197
|
+
info ""
|
|
198
|
+
|
|
138
199
|
results = VendoredTools.build_all!(root: MilkTea.root)
|
|
139
200
|
results.each do |result|
|
|
140
|
-
|
|
201
|
+
info " #{result[:tool].name} \e[32mbuilt\e[0m -> #{result[:binary]}"
|
|
141
202
|
end
|
|
142
203
|
0
|
|
143
204
|
rescue VendoredTool::Error => e
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mt-lang
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Long (Teefan) Tran
|
|
@@ -583,7 +583,7 @@ metadata:
|
|
|
583
583
|
homepage_uri: https://teefan.github.io/mt-lang/
|
|
584
584
|
source_code_uri: https://github.com/teefan/mt-lang
|
|
585
585
|
post_install_message: |
|
|
586
|
-
Milk Tea 0.2.
|
|
586
|
+
Milk Tea 0.2.3 installed!
|
|
587
587
|
|
|
588
588
|
System requirements:
|
|
589
589
|
- A C compiler (gcc or clang) must be available on PATH
|