Skip to content

Commit

Permalink
Specify a plugin version in the build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
iandees committed Sep 9, 2024
1 parent 454c755 commit fcf5684
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ sourceSets {

archivesBaseName = 'fieldpapers'
josm {
version = '0.5.0'
i18n {
pathTransformer = getPathTransformer("github.com/fieldpapers/josm-fieldpapers/blob")
}
Expand Down

6 comments on commit fcf5684

@tsmock
Copy link
Contributor

@tsmock tsmock commented on fcf5684 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to do this. The gradle plugin should be reading the latest tag.

@iandees
Copy link
Collaborator Author

@iandees iandees commented on fcf5684 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a build error when I first ran Gradle in Github CI: https://github.com/fieldpapers/josm-fieldpapers/actions/runs/10774405220/job/29876379547

It said:

> Task :compileLang NO-SOURCE
> Task :processResources
> Task :classes
You haven't configured the version of your plugin. Please add version = ‹a version number› to your build.gradle file.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jar'.
> The JOSM plugin josm-fieldpapers misses required configuration options. See above for which options are missing.

> Task :jar FAILED

@floscher
Copy link
Contributor

@floscher floscher commented on fcf5684 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iandees You should set version = "something" at the root of your build.gradle file, not in the JOSM block. Put the version of your plugin (the fieldpapers plugin) in there, not the version of the gradle-josm-plugin.

This line needs to be set to the version of the gradle-josm-plugin (currently 0.8.2):

id "org.openstreetmap.josm" version "0.5.0"

@iandees
Copy link
Collaborator Author

@iandees iandees commented on fcf5684 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Will update!

@tsmock
Copy link
Contributor

@tsmock tsmock commented on fcf5684 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is probably related to the default behavior of github.com/actions/checkout. In order for the autotagging to work, the tags must be available.
So adding

with:
    fetch-depth: 0

to the actions/checkout@v4 github checkout action should also work. If you don't want to get all history (not a problem with this repo, I don't think), then @floscher's method is better. But you have to remember to update the version.

@floscher
Copy link
Contributor

@floscher floscher commented on fcf5684 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iandees @tsmock Ah yes, normally the plugin would read the version from the tag, when available. That would indeed be easier.

The issue could also be that you are using a non-annotated tag. Only annotated tags are considered for the version number. See here for how to do that: https://git-scm.com/book/en/v2/Git-Basics-Tagging#_creating_tags

The issue with tags not being available in Github Actions probably comes on top, wasn't aware of that. There seems to be an option specifically for that as well:

with:
  fetch-tags: true

(https://github.com/actions/checkout)

Then you don't need to add version = "something" to the build.gradle

Please sign in to comment.