From 61d5d57b972d0a31585a040867de2c1730b91c1e Mon Sep 17 00:00:00 2001 From: Jake Pusateri Date: Fri, 28 Aug 2026 21:52:03 -0400 Subject: [PATCH 1/2] Publish houndutil to GitHub Packages (Maven) Add maven-publish config that publishes a plain library jar (not the robot fat jar) to https://maven.pkg.github.com/frc868/houndutil, plus a workflow that publishes on tag pushes (v*) or manual dispatch. --- .github/workflows/publish.yml | 40 +++++++++++++++++++++++++++++++++++ build.gradle | 36 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9e84bc6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +name: Publish + +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + version: + description: Version to publish (e.g. 2026.0.0 or 2026.0.0-SNAPSHOT) + required: true + default: "2026.0.0-SNAPSHOT" + +jobs: + publish: + runs-on: ubuntu-latest + container: wpilib/roborio-cross-ubuntu:2026-22.04-py314 + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Determine version + id: version + run: | + if [ "$GITHUB_EVENT_NAME" != "push" ]; then + echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" + else + echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + fi + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Publish to GitHub Packages + run: ./gradlew publish -PpublishVersion=${{ steps.version.outputs.version }} + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 27d1cb3..3feaf27 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id "java" id "edu.wpi.first.GradleRIO" version "2026.2.1" + id "maven-publish" } java { @@ -105,3 +106,38 @@ wpi.java.configureTestTasks(test) tasks.withType(JavaCompile) { options.compilerArgs.add '-XDstringConcat=inline' } + +// --------------------------------------------------------------------------- +// Maven publishing. +// +// Publishes a plain jar of just houndutil's compiled classes (never the robot +// 'fat jar' above). WPILib/vendor dependencies are intentionally NOT bundled or +// declared transitively: the consuming robot already brings them via its own +// vendordeps. Version comes from -PpublishVersion (defaults to a snapshot). +// --------------------------------------------------------------------------- + +tasks.register("libraryJar", Jar) { + archiveClassifier = "lib" + from sourceSets.main.output +} + +publishing { + publications { + maven(MavenPublication) { + groupId = "com.techhounds" + artifactId = "houndutil" + version = project.findProperty("publishVersion") ?: "2026.0.0-SNAPSHOT" + artifact(tasks.named("libraryJar")) + } + } + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/frc868/houndutil") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } + } +} From f96b206b0079cfd4b8352d33d8db455c46d020e5 Mon Sep 17 00:00:00 2001 From: Jake Pusateri Date: Sat, 29 Aug 2026 12:03:43 -0400 Subject: [PATCH 2/2] Make houndutil a proper library: plain jar + group + clean POM - Set group = com.techhounds and overridable version (default snapshot) - Drop the robot fat-jar config so the default jar is plain classes, matching what a composite build substitutes and what gets published - Publish just the plain jar with no transitive POM dependencies --- .github/workflows/publish.yml | 2 +- build.gradle | 46 ++++++++++++++--------------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9e84bc6..8627f99 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -34,7 +34,7 @@ jobs: run: chmod +x gradlew - name: Publish to GitHub Packages - run: ./gradlew publish -PpublishVersion=${{ steps.version.outputs.version }} + run: ./gradlew publish -Pversion=${{ steps.version.outputs.version }} env: GITHUB_ACTOR: ${{ github.actor }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3feaf27..b457b20 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,13 @@ plugins { id "maven-publish" } +group = "com.techhounds" + +// Defaults to a snapshot; override with -Pversion=... (CI publish / releases). +// Without -Pversion, findProperty returns Gradle's "unspecified" sentinel. +def requestedVersion = project.findProperty("version") +version = (requestedVersion == "unspecified") ? "2026.0.0-SNAPSHOT" : requestedVersion + java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -85,21 +92,9 @@ test { wpi.sim.addGui().defaultEnabled = true wpi.sim.addDriverstation() -// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') -// in order to make them all available at runtime. Also adding the manifest so WPILib -// knows where to look for our Robot Class. -jar { - from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } - from('src') { into 'backup/src' } - from('vendordeps') { into 'backup/vendordeps' } - from('build.gradle') { into 'backup' } - manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} - -// Configure jar and deploy tasks -deployArtifact.jarTask = jar -wpi.java.configureExecutableTasks(jar) +// houndutil is a library, not a deployable robot project: keep the default +// plain jar (compiled classes only) so it stays identical whether consumed by a +// composite build (default configuration) or from a published Maven artifact. wpi.java.configureTestTasks(test) // Configure string concat to always inline compile @@ -110,24 +105,19 @@ tasks.withType(JavaCompile) { // --------------------------------------------------------------------------- // Maven publishing. // -// Publishes a plain jar of just houndutil's compiled classes (never the robot -// 'fat jar' above). WPILib/vendor dependencies are intentionally NOT bundled or -// declared transitively: the consuming robot already brings them via its own -// vendordeps. Version comes from -PpublishVersion (defaults to a snapshot). +// Publishes houndutil's plain jar (compiled classes only). WPILib/vendor +// dependencies are intentionally NOT bundled or declared transitively: the +// consuming robot already brings them via its own vendordeps. Version comes +// from the `version` property (defaults to a snapshot). // --------------------------------------------------------------------------- -tasks.register("libraryJar", Jar) { - archiveClassifier = "lib" - from sourceSets.main.output -} - publishing { publications { maven(MavenPublication) { - groupId = "com.techhounds" - artifactId = "houndutil" - version = project.findProperty("publishVersion") ?: "2026.0.0-SNAPSHOT" - artifact(tasks.named("libraryJar")) + // Publish just the plain jar (no transitive POM dependencies: + // the consuming robot brings WPILib/vendor libs via its own + // vendordeps, so versions stay single-sourced from there). + artifact(tasks.named("jar")) } } repositories {