update: apply template
This commit is contained in:
commit
7adbc33487
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
12
GNUmakefile
Normal file
12
GNUmakefile
Normal file
@ -0,0 +1,12 @@
|
||||
JAVA_FMT = google-java-format
|
||||
JAVA_FILES = $(shell find . -name '*.java')
|
||||
XML_FMT = xmlindent
|
||||
XML_FILES = $(shell find . -name '*.xml')
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
@echo "Formatting all Java files..."
|
||||
@for f in $(JAVA_FILES); do \
|
||||
echo " $$f"; \
|
||||
$(JAVA_FMT) -i $$f; \
|
||||
done
|
||||
5
Main.java
Normal file
5
Main.java
Normal file
@ -0,0 +1,5 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
||||
57
flake.nix
Normal file
57
flake.nix
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
description = "java-template";
|
||||
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
];
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
||||
perSystem = { config, self', inputs', pkgs, system, ... }: let
|
||||
|
||||
jdk = pkgs.jdk21.override {
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
jdk
|
||||
];
|
||||
|
||||
devTools = [
|
||||
pkgs.google-java-format
|
||||
];
|
||||
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = buildInputs ++ devTools;
|
||||
};
|
||||
|
||||
packages = {
|
||||
default = pkgs.stdenv.mkDerivation {
|
||||
pname = "java-template";
|
||||
version = "1.0.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = buildInputs ++ [ pkgs.makeWrapper ];
|
||||
|
||||
buildPhase = ''
|
||||
javac -Werror -g:none -deprecation -verbose Main.java
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,lib}
|
||||
cp *.class $out/lib
|
||||
|
||||
makeWrapper ${pkgs.lib.getExe jdk} $out/bin/java-template --add-flags "-cp $out/lib/ Main"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
flake = {
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user