119 String title = _props.getProperty("title", ""); |
119 String title = _props.getProperty("title", ""); |
120 if (title.isEmpty()) { throw new RuntimeException(error_message("Missing title")); } |
120 if (title.isEmpty()) { throw new RuntimeException(error_message("Missing title")); } |
121 else return title; |
121 else return title; |
122 } |
122 } |
123 |
123 |
|
124 public String no_module() { return _props.getProperty("no_module", ""); } |
124 public String module() { return _props.getProperty("module", ""); } |
125 public String module() { return _props.getProperty("module", ""); } |
|
126 public String module_name() { |
|
127 if (!module().isEmpty() && !no_module().isEmpty()) { |
|
128 throw new RuntimeException(error_message("Conflict of module and no_module")); |
|
129 } |
|
130 if (!module().isEmpty()) { return module(); } |
|
131 else { return no_module(); } |
|
132 } |
125 public String scalac_options() { return _props.getProperty("scalac_options", ""); } |
133 public String scalac_options() { return _props.getProperty("scalac_options", ""); } |
126 public String javac_options() { return _props.getProperty("javac_options", ""); } |
134 public String javac_options() { return _props.getProperty("javac_options", ""); } |
127 public String main() { return _props.getProperty("main", ""); } |
135 public String main() { return _props.getProperty("main", ""); } |
128 |
136 |
129 private List<String> get_list(String name) |
137 private List<String> get_list(String name) |
151 } |
159 } |
152 public boolean exists(String file) |
160 public boolean exists(String file) |
153 throws IOException, InterruptedException |
161 throws IOException, InterruptedException |
154 { |
162 { |
155 return Files.exists(path(file)); |
163 return Files.exists(path(file)); |
|
164 } |
|
165 |
|
166 public List<Path> requirement_paths(String s) |
|
167 throws IOException, InterruptedException |
|
168 { |
|
169 if (s.startsWith("env:")) { |
|
170 List<Path> paths = new LinkedList<Path>(); |
|
171 for (String p : Environment.getenv(s.substring(4)).split(":", -1)) { |
|
172 if (!p.isEmpty()) { |
|
173 Path path = Path.of(Environment.platform_path(p)); |
|
174 paths.add(path); |
|
175 } |
|
176 } |
|
177 return List.copyOf(paths); |
|
178 } |
|
179 else { return List.of(path(s)); } |
156 } |
180 } |
157 |
181 |
158 public String item_name(String s) |
182 public String item_name(String s) |
159 { |
183 { |
160 int i = s.indexOf(':'); |
184 int i = s.indexOf(':'); |
452 List<Path> compiler_deps = new LinkedList<Path>(); |
476 List<Path> compiler_deps = new LinkedList<Path>(); |
453 { |
477 { |
454 StringBuilder _shasum = new StringBuilder(); |
478 StringBuilder _shasum = new StringBuilder(); |
455 _shasum.append(context.shasum_props()); |
479 _shasum.append(context.shasum_props()); |
456 for (String s : requirements) { |
480 for (String s : requirements) { |
457 if (s.startsWith("env:")) { |
481 List<Path> paths = context.requirement_paths(s); |
458 List<Path> paths = new LinkedList<Path>(); |
482 compiler_deps.addAll(paths); |
459 for (String p : Environment.getenv(s.substring(4)).split(":", -1)) { |
483 _shasum.append(context.shasum(s, paths)); |
460 if (!p.isEmpty()) { |
|
461 Path path = Path.of(Environment.platform_path(p)); |
|
462 compiler_deps.add(path); |
|
463 paths.add(path); |
|
464 } |
|
465 } |
|
466 _shasum.append(context.shasum(s, paths)); |
|
467 } |
|
468 else { |
|
469 compiler_deps.add(context.path(s)); |
|
470 _shasum.append(context.shasum(s)); |
|
471 } |
|
472 } |
484 } |
473 for (String s : resources) { |
485 for (String s : resources) { |
474 _shasum.append(context.shasum(context.item_name(s))); |
486 _shasum.append(context.shasum(context.item_name(s))); |
475 } |
487 } |
476 for (String s : sources) { _shasum.append(context.shasum(s)); } |
488 for (String s : sources) { _shasum.append(context.shasum(s)); } |