diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09d62e7b6..8a256ebd0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,15 @@ permissions: contents: write jobs: + nixbuild: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v25 + with: + nix_path: nixpkgs=channel:nixos-24.05 + - uses: DeterminateSystems/magic-nix-cache-action@v3 + - run: nix-build test: name: Run test suite strategy: @@ -162,4 +171,4 @@ jobs: name: jreleaser-release path: | out/jreleaser/trace.log - out/jreleaser/output.properties \ No newline at end of file + out/jreleaser/output.properties diff --git a/build.gradle b/build.gradle index babeb3dc0..273dc2575 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,10 @@ plugins { allprojects { group 'software.coley' version '4.0.0-SNAPSHOT' + tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true + } } subprojects { @@ -14,14 +18,6 @@ subprojects { apply plugin: 'jacoco' apply plugin: 'com.github.ben-manes.versions' - repositories { - mavenLocal() - mavenCentral() - google() - maven { url 'https://maven.quiltmc.org/repository/release/' } - maven { url 'https://jitpack.io' } - } - // ======================= DEPENDENCIES ======================== dependencies { // to enforce it everywhere as standard @@ -109,6 +105,7 @@ subprojects { includes = ['software/coley/recaf/**'] } } + } // Always emit HTML & XML aggregate reports diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..2cccff28d --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +(import + ( + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { src = ./.; } +).defaultNix diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..2ac1310d5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,143 @@ +{ + "nodes": { + "build-gradle-application": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1720015284, + "narHash": "sha256-8d7ikVoBWnEKleEZbJVeEE1GBSmAC6fTthu6axxY+vw=", + "owner": "raphiz", + "repo": "buildGradleApplication", + "rev": "ce29479025b5ddc5911799d6ed0a07850d476ac6", + "type": "github" + }, + "original": { + "owner": "raphiz", + "repo": "buildGradleApplication", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1717696253, + "narHash": "sha256-1+ua0ggXlYYPLTmMl3YeYYsBXDSCqT+Gw3u6l4gvMhA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b5328b7f761a7bbdc0e332ac4cf076a3eedb89b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1719848872, + "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "build-gradle-application": "build-gradle-application", + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs_2", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..a3ee84ebb --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + inputs = { + # This must be the stable nixpkgs if you're running the app on a + # stable NixOS install. Mixing EGL library versions doesn't work. + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + build-gradle-application.url = "github:raphiz/buildGradleApplication"; + utils.url = "github:numtide/flake-utils"; + flake-compat = { + url = github:edolstra/flake-compat; + flake = false; + }; + }; + + outputs = inputs @ { self, nixpkgs, utils, build-gradle-application, ... }: + utils.lib.eachDefaultSystem (system: + let + overlays = [build-gradle-application.overlays.default]; + pkgs = import nixpkgs {inherit system overlays;}; + version = self.shortRev or "dirty"; + jdk = pkgs.jdk22; + update_action = "build"; + gradle = (pkgs.callPackage pkgs.gradle-packages.gradle_8 { + java = jdk; + }); + libPath = with pkgs; lib.makeLibraryPath [ + libGL + libxkbcommon + wayland + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXrandr + xorg.libXxf86vm + xorg.libXtst + fontconfig + ]; + in + { + defaultPackage = pkgs.callPackage ./package.nix { + inherit version gradle jdk; + }; + + devShell = with pkgs; + mkShellNoCC { + buildInputs = [jdk openjfx22 gradle xorg.libxcb (updateVerificationMetadata.override { updateAction = update_action; gradle = gradle; })]; + LD_LIBRARY_PATH = libPath; + }; + }); +} diff --git a/gradle.properties b/gradle.properties index 5f1ed7bbe..7764ddaa5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ -org.gradle.caching=true \ No newline at end of file +org.gradle.caching=true +org.gradle.dependency.verification.console=verbose diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml new file mode 100644 index 000000000..7ec0d24bc --- /dev/null +++ b/gradle/verification-metadata.xml @@ -0,0 +1,1809 @@ + + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.nix b/package.nix new file mode 100644 index 000000000..cb537d2f8 --- /dev/null +++ b/package.nix @@ -0,0 +1,33 @@ +{ + pkgs, + lib, + version, + buildGradleApplication, + gradle, + jdk +}: +buildGradleApplication { + pname = "recaf"; + version = version; + src = ./.; + gradle = gradle; + jdk = jdk; + nativeBuildInputs = [ + pkgs.wrapGAppsHook + pkgs.git + ]; + repositories = ["https://plugins.gradle.org/m2/" "https://repo1.maven.org/maven2/" "https://maven.google.com" "https://maven.quiltmc.org/repository/release/" "https://jitpack.io"]; + buildTask = ":recaf-ui:installDist"; + installLocation = "recaf-ui/build/install/*/"; + meta = with lib; { + description = "A Java Bytecode editor"; + longDescription = '' + Recaf is a Java Bytecode editor + ''; + sourceProvenance = with sourceTypes; [ + fromSource + binaryBytecode + ]; + platforms = platforms.unix; + }; +} diff --git a/settings-gradle.lockfile b/settings-gradle.lockfile new file mode 100644 index 000000000..709a43f74 --- /dev/null +++ b/settings-gradle.lockfile @@ -0,0 +1,4 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +empty=incomingCatalogForLibs0 diff --git a/settings.gradle b/settings.gradle index aa3c95e07..759e1efb1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositories { + mavenLocal() + mavenCentral() + google() + maven { url 'https://maven.quiltmc.org/repository/release/' } + maven { url 'https://jitpack.io' } + } + + // Highly recommended, see https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:centralized-repository-declaration + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) +} + rootProject.name = 'Recaf' include 'recaf-core' @@ -8,4 +27,4 @@ buildCache { enabled = true directory = new File('build/cache') } -} \ No newline at end of file +}