I would like to:
- use the Frege programming language to write a simple "Hello World" piece of code,
- then using the Frege compiler generating the equivalent Java source code,
- then building an executable Jar file to run from the command line,
- all the previous steps should be "controlled" by Gradle.
I am able to generate the source code (items 1. and 2. from the previous list), but I am not able to specify a "package" structure of the Java source code in output, i.e. I can not see the package
Java statement as the first line of code in the generate Java source code. I can specify to the Frege compiler where to put the generated code though (via the -d
argument).
I think this is the reason why when building an executable Jar, then launching it, I am seeing similar errors (according to different attempts on Gradle tasks) e.g.: no main manifest attribute
.
The Frege source code is saved in a file named HelloFrege.fr
, the generated Java source code is in a file named HelloFrege.java
(I verified the file contains the expected main
method).
Here there's a version of the Gradle "Jar task":
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Hello Frege Jar Example',
'Implementation-Version': version,
'Main-Class': 'HelloFrege'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
Here there's another version of the Gradle "Jar" task:
jar {
manifest {
attributes 'Main-Class': 'HelloFrege'
}
}
How can I solve this problem? I would like to avoid to manually add the package reference to the automatically generated Java source code file.