Code Monkey home page Code Monkey logo

wpilib-version-plugin's Introduction

WPILib Versioning Plugin

CI

This Gradle plugin is responsible for determining what repositories the build should be getting Maven dependencies from, where it should be publishing Maven dependencies to, and for generating a version number scheme we use in WPILib. This is used by most of the other WPILib projects, and can be used by third party projects to automate selecting of which repositories to use.

Building

This plugin is written in Groovy, and therefore needs to have Groovy installed on your local machine. Groovy is available from here: http://www.groovy-lang.org/. Building is accomplished with Gradle, as with the rest of WPILib. To build, run the following command:

./gradlew build

For a full list of tasks, see the output of:

./gradlew tasks

Note that you will not be able to publish to plugins.gradle.org. To get a new version uploaded, contact 333fred.

To publish for local testing, use the following command.

./gradlew publishToMavenLocal -PlocalPublish

You will then be able to use the plugins block with an updated version. You will need to ensure your plugin management is setup in your settings.gradle as well. We use the following

pluginManagement {
    repositories {
        mavenLocal()
        gradlePluginPortal()
    }
}

Usage

To use this plugin in your program with Gradle version >= 2.1, use the following snippit:

plugins {
  // NOTE: Substitute latest-version with the latest published version
  id "edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin" version "latest-version"
}

For other versions use the following (note that using this plugin with less than Gradle 3.0 hasn't been tested):

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    // NOTE: Substitute latest-version with the latest published version
    classpath "gradle.plugin.edu.wpi.first.wpilib.versioning:wpilib-version-plugin:latest-version"
  }
}

apply plugin: "edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin"

This plugin introduces the following extension:

WPILibVersion {
    /*
     * This triggers version generation, which is used by the WPILib repositories to generate the correct version number
     * for this build. You must have an annotated git tag in the form v1.0.0-(beta|rc)-1, where v1.0.0 is mandatory
     * and the -(beta|rc)-1 part is optional. If you don't have this tag, a warning message will be printed. Set to
     * false to disable version generation.
     */
    generateVersion = false

    /*
     * This controls whether you use the developer repositories or the release repositories. For competition, use should
     * use the official repositories. "dev" is only useful when developing with WPILib. Valid options are "official"
     * and "dev". You *must* set this last, as setting it triggers evaluation of the plugin.
     */
    releaseType = "official"

    /*
     * The rest of the parameters are for WPILib internal use only. Don't set them unless you know what you're doing.
     * The default values have been copied here for documentation purposes.
     */
    remoteUrlBase = 'https://first.wpi.edu/FRC/roborio/maven'
    mavenLocalBase = "${System.getProperty('user.home')}/releases/maven"
    devExtension = 'development'
    officialExtension = 'release'
    mavenLocalUrl = ''
    mavenRemoteUrl = ''
    version = ''
    time // For internal testing use only. Do not use outside of test code.
}

Contributing

See CONTRIBUTING.md

wpilib-version-plugin's People

Contributors

333fred avatar austinshalit avatar jacibrunning avatar jcaporuscio avatar peterjohnson avatar sciencewhiz avatar thadhouse avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wpilib-version-plugin's Issues

No way to use beta repository

When using this plugin to get access to the maven repo, there is only options for the development repo and the release repo. An option should be added to use the beta repo if requested as well.

Fails to run if not in git repo has no commits

If the plugin is added to a project that has no commits, gradle fails to run.

org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:573)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:125)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
        at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:162)
        at org.gradle.internal.Factories$1.create(Factories.java:25)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:159)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:36)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:118)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:98)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.ajoberstar.grgit.exception.GrgitException: Problem retrieving description.
        at org.ajoberstar.grgit.operation.DescribeOp.call(DescribeOp.groovy:53)
        at org.ajoberstar.grgit.operation.DescribeOp.call(DescribeOp.groovy)
        at java_util_concurrent_Callable$call.call(Unknown Source)
        at java_util_concurrent_Callable$call.call(Unknown Source)
        at org.ajoberstar.grgit.util.OpSyntaxUtil.tryOp(OpSyntaxUtil.groovy:45)
        at org.ajoberstar.grgit.Grgit.methodMissing(Grgit.groovy:188)
        at edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin.getVersion(WPILibVersioningPlugin.groovy:66)
        at edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin.triggerSetup(WPILibVersioningPlugin.groovy:117)
        at edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin$_apply_closure2.doCall(WPILibVersioningPlugin.groovy:153)
        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy15.afterEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
        ... 52 more
Caused by: org.eclipse.jgit.api.errors.RefNotFoundException: Ref HEAD can not be resolved
        at org.eclipse.jgit.api.DescribeCommand.setTarget(DescribeCommand.java:142)
        at org.eclipse.jgit.api.DescribeCommand.call(DescribeCommand.java:190)
        at org.eclipse.jgit.api.DescribeCommand.call(DescribeCommand.java:76)
        at java_util_concurrent_Callable$call$0.call(Unknown Source)
        at org.ajoberstar.grgit.operation.DescribeOp.call(DescribeOp.groovy:51)
        ... 68 more

Update readme

As versioning is no longer handled here, and the DSL changed the readme needs to be updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.