-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
antlr4: add package #4369
base: dev
Are you sure you want to change the base?
antlr4: add package #4369
Conversation
expected: target("antlr4-lua")
set_kind("static")
add_files("g4/LuaLexer.g4", {rules = "@antlr4/lexer"})
add_files("g4/LuaParser.g4", {rules = "@antlr4/parser"})
-- add_rules("@antlr4/lexer")
-- add_rules("@antlr4/parser")
add_includedirs(".")
add_packages("antlr4", "antlr4-runtime")
on_load(function (target)
if target:is_shared() then
target:add("defines", "ANTLR4CPP_EXPORTS")
elseif target:is_static() then
target:add("defines", "ANTLR4CPP_STATIC", {public = true})
end
end) But |
on_install("windows|x64", "linux|x86_64", "macosx|x86_64", "macosx|arm64", "mingw|x86_64", function (package) | ||
local source = "antlr-" .. package:version() .. "-complete.jar" | ||
local target = path.join(package:installdir("lib"), "antlr-complete.jar") | ||
os.vcp("../" .. source, package:installdir("lib")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥解压出来会调到 source 目录外面去?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接下的 jar,不会解压
packages/a/antlr4/xmake.lua
Outdated
local target = path.join(package:installdir("lib"), "antlr-complete.jar") | ||
os.vcp("../" .. source, package:installdir("lib")) | ||
os.vmv(package:installdir("lib", source), target) | ||
package:addenv("CLASSPATH", target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添加路径环境变量,用相对路径,不要用 package:installdir(),否则跑到云端预编译,路径就不对了
然后再用 package:mark_as_pathenv("CLASSPATH")
将它标记为路径,就能自动处理相对路径了。
包 rule 是有限制的,有些地方不好实现,目前不支持 add_files,只能走 add_rules |
import("lib.detect.find_tool") | ||
|
||
assert(target:pkg("antlr4"), "Please configure add_packages(antlr4) for target(" .. target:name() .. ")") | ||
local envs = target:pkg("antlr4"):get("envs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接用 target:pkgenvs()
就行了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但这里拿到的 CLASSPATH
还是相对路径
回头我看下 这两天还没空看 |
I'll check it out later. I haven't had time to look at it in the past two days. |
这个 jdk 的 sha 是不是会变,我看校验都不过么 |
Will the sha of this jdk change? I don’t think it can pass the verification. |
hash没变呀 |
The hash has not changed |
哪没变了? elseif is_host("macosx") then
if is_arch("x86_64") then
add_urls("https://download.oracle.com/java/$(version)/latest/jdk-$(version)_macos-x64_bin.tar.gz")
add_versions("21", "197a923b1f7ea2b224fafdfb9c3ef5fc8eb197d9817d7631d96da02b619f5975") $ shasum -a 256 ~/Downloads/jdk-21_macos-x64_bin.tar.gz
f51a83c6328d1327aac38eb7345e0846fea8e859ef5bcf65f98a5793aa027253 /Users/ruki/Downloads/jdk-21_macos-x64_bin.tar.gz |
No description provided.