This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-06
Channels
- # adventofcode (10)
- # ai (2)
- # aleph (2)
- # announcements (21)
- # beginners (25)
- # calva (7)
- # cider (19)
- # clj-kondo (28)
- # clj-on-windows (3)
- # cljdoc (6)
- # clojure (80)
- # clojure-dev (15)
- # clojure-europe (29)
- # clojure-italy (3)
- # clojure-nl (37)
- # clojure-uk (4)
- # clojurescript (3)
- # cloverage (1)
- # conjure (6)
- # core-async (2)
- # cursive (17)
- # datalevin (9)
- # datomic (7)
- # deps-new (23)
- # emacs (4)
- # figwheel-main (6)
- # fulcro (6)
- # honeysql (19)
- # improve-getting-started (4)
- # inf-clojure (2)
- # introduce-yourself (5)
- # jobs (1)
- # leiningen (6)
- # lsp (73)
- # malli (1)
- # nrepl (2)
- # off-topic (37)
- # polylith (9)
- # quil (2)
- # reitit (16)
- # releases (2)
- # remote-jobs (6)
- # rewrite-clj (38)
- # shadow-cljs (1)
- # tools-build (1)
Ever wanted to build Java programs with Java - no maven or gradle? I made a very basic wrapper around tools.build that should make it easier to write build programs for deps.edn in Java Super alpha. Functionality may be broken or missing entirely. https://github.com/bowbahdoe/jproject https://github.com/bowbahdoe/jproject-example
The example seems to suggest you still need the Clojure CLI installed for this to work?
yep. Still nowhere near a state i could walk up to a stock Java dev and convince them, but enough to show the concept imo
the next steps would be 1. Think way more about how to expose the basis concept 2. Fill out and document the build tools wrapper 3. Wrap the clojure CLI’s functionality - probably making a graalvm executable with a “simplified” api probably along the lines of
jproject --help
jproject --tree
jproject --pom
jproject run src/Something.java
jproject run --alias=build build/Build.java
jproject run --alias=build build/Build.java --argForBuildProgram 123
Terrifying
I've added options to those build tasks at least a dozen times in the last 6 months. every time I do that, you'll have to add new fields and methods and whatever
and if i get it into a workable/marketable state, which is doubtful. Especially considering that no IDE resolves deps.edn dependencies without a clojure plugin so any effort to make it seem “java native” is probably moot
and anyone who is comfortable installing a clojure plugin might as well just write the build program in clojure
You sure are dedicated to this 🙂
but can jbang let me stay up until 4am writing a script for test coverage
public final class GenerateCoverage {
public static void main(String[] args) throws IOException {
var execFileLoader = new ExecFileLoader();
execFileLoader.load(new File("jacoco.exec"));
var htmlFormatter = new HTMLFormatter();
var fileMultiReportOutput = new FileMultiReportOutput(new File("target/coverage/html"));
var visitor = htmlFormatter.createVisitor(fileMultiReportOutput);
var coverageBuilder = new CoverageBuilder();
for (var file : Files.walk(Path.of("target", "src"))
.filter(Files::isRegularFile)
.map(Path::toFile)
.toList()
) {
var analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
analyzer.analyzeAll(file);
}
var bundle = coverageBuilder.getBundle("project");
visitor.visitInfo(
execFileLoader.getSessionInfoStore().getInfos(),
execFileLoader.getExecutionDataStore().getContents()
);
visitor.visitBundle(bundle, new ISourceFileLocator() {
@Override
public Reader getSourceFile(String packageName, String fileName) throws IOException {
var resource = GenerateCoverage.class.getResourceAsStream(
packageName.replace(".", "/") + "/" + fileName
);
if (resource == null) {
return null;
}
return new InputStreamReader(resource);
}
@Override
public int getTabWidth() {
return 4;
}
});
visitor.visitEnd();
}
}
Which as horrible as it sounds and looks - a team of 10 engineers could not figure out how to properly filter certain files out of coverage for a week with the maven plugin (actual story, not an overstatement for dramatic effect)