Skip to content

Commit

Permalink
feat: Include Java runtime version in project.properties as well (#442)
Browse files Browse the repository at this point in the history
*Description of changes:*

For the benefit of the DB ESDK nightly build, since it defines `dafnyRuntimeJavaVersion` separately from `dafnyVersion`.

It also turns out I accidentally dropped handling of the `--properties-file` path in #390, so this also allows `writeTemplatedFile` to customize the output path.
  • Loading branch information
robin-aws authored Jun 13, 2024
1 parent b7cec71 commit 647c12f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void generateProjectPropertiesFile(final Path outputPath)
"dafnyVersion",
dafnyVersionString
);
writeTemplatedFile("project.properties", parameters);
writeTemplatedFile("project.properties", outputPath.toString(), parameters);
}

private void generateDafny(final Path outputDir) {
Expand Down Expand Up @@ -734,11 +734,20 @@ private Path standardLibraryPath() {
private void writeTemplatedFile(
String templatePath,
Map<String, String> parameters
) {
writeTemplatedFile(templatePath, templatePath, parameters);
}

private void writeTemplatedFile(
String templatePath,
String outputTemplatePath,
Map<String, String> parameters
) {
IOUtils.writeTemplatedFile(
getClass(),
libraryRoot,
templatePath,
outputTemplatePath,
parameters
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static void writeTemplatedFile(
Class<?> klass,
Path rootPath,
String templatePath,
String templateOutputPath,
Map<String, String> parameters
) {
String content = IoUtils.readUtf8Resource(
Expand All @@ -90,9 +91,9 @@ public static void writeTemplatedFile(
);

content = evalTemplate(content, parameters);
templatePath = evalTemplate(templatePath, parameters);
templateOutputPath = evalTemplate(templateOutputPath, parameters);

Path outputPath = rootPath.resolve(templatePath);
Path outputPath = rootPath.resolve(templateOutputPath);
try {
Files.createDirectories(outputPath.getParent());
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file stores the top level dafny version information.
# All elements of the project need to agree on this version.
dafnyVersion=$dafnyVersion:L
dafnyRuntimeJavaVersion=$dafnyVersion:L

0 comments on commit 647c12f

Please sign in to comment.