@@ -83,6 +83,7 @@ def main() -> int:
8383 parser .add_argument ("--target-dir" , type = Path , default = ROOT / "target/typst/build" )
8484 parser .add_argument ("--reports" , type = Path , default = ROOT / "target/typst/reports" )
8585 parser .add_argument ("--timeout" , type = float , default = 180 )
86+ parser .add_argument ("--release" , action = "store_true" , help = "Build with Cargo's release profile" )
8687 parser .add_argument ("--case" , action = "append" , choices = CASES , dest = "cases" )
8788 args = parser .parse_args ()
8889 if args .timeout <= 0 :
@@ -97,7 +98,8 @@ def main() -> int:
9798 parser .error (f"missing Typst reporter checkout: { source } " )
9899 # Cargo does not track changes to the backend library or bundled runtime.
99100 # Rebuild JVM artifacts each time, retaining compiled host build tools.
100- jvm_target = target / TARGET_SPEC .stem
101+ profile = "release" if args .release else "debug"
102+ jvm_target = target / TARGET_SPEC .stem / profile
101103 if jvm_target .exists ():
102104 shutil .rmtree (jvm_target )
103105 reports .mkdir (parents = True , exist_ok = True )
@@ -120,13 +122,16 @@ def main() -> int:
120122 "-Zjson-target-spec" , "-Zbuild-std=std,panic_unwind" ,
121123 "-Zbuild-std-features=panic-unwind" , "--target-dir" , str (target ), "-j2" ,
122124 ]
125+ if args .release :
126+ command .append ("--release" )
123127 revision = subprocess .check_output (
124128 ["git" , "rev-parse" , "HEAD" ], cwd = source , text = True
125129 ).strip ()
126130 report = {
127131 "passed" : False ,
128132 "source_revision" : revision ,
129133 "toolchain" : toolchain ,
134+ "profile" : profile ,
130135 "build_command" : command ,
131136 }
132137 original = entry .read_bytes ()
@@ -147,7 +152,7 @@ def main() -> int:
147152 print ((reports / "build.stderr.log" ).read_text (), file = sys .stderr )
148153 return 1
149154
150- jar = target / "jvm-unknown-jvm/debug/ typst-shared.jar"
155+ jar = jvm_target / "typst-shared.jar"
151156 report ["documents" ] = {
152157 case : run_document (jar , case , reports , args .timeout )
153158 for case in args .cases or CASES
0 commit comments