Skip to content

Deploy classpath dependencies instead of creating a shadow jar #827

@SamCarlberg

Description

@SamCarlberg

Shadow jars have a few issues:

  • Longer build and deploy times (due to copying, unzipping, rezipping, and sending a larger archive over the wire)
  • Manifest and service file entries may be overwritten unless explicitly combined in the build
  • Java module boundaries are broken wide open, allowing access to internals not intended for public use

This could be done manually by adding the following block to the artifacts block in a deploy target, but it'd be nicer to have handled automatically by GradleRIO.

developerRobotRuntimeLibs(FileTreeArtifact) {
    // Use the runtime classpath of the project
    preWorkerThread << { artifact ->
        // 'artifact' is the current FileCollectionArtifact instance
        // We resolve the configuration here while we still have the Gradle lock
        def resolvedFiles = configurations.runtimeClasspath.resolve()
        artifact.files.set(project.files(resolvedFiles).asFileTree)
    }
    // Set the directory on the remote target where libs should be placed
    directory = deploy.targets.systemcore.directory + '/wpilib/classpath'
    // Use the md5sum cache method to skip existing/unchanged files
    cacheMethod = new Md5SumCacheMethod('md5sum')
    // Delete old files on the deploy target to avoid stale/unused libraries
    deleteOldFiles = true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions