Properties are set in the project's gradle.properties
file(s).
Publish operations to external URLs require credentials: these are supplied through envronment variables:
MAVEN_ACTOR
- usernameMAVEN_TOKEN
- the you-know-what
Also, sometimes an insecure registry is involved. See this link to understand that particular setting.
Publishes source and binary JAR files for "library" projects to a Maven repository. See also Kotlin Examples.
id("crackers.buildstuff.library-publish")
- Tasks
libraryDistribution
creates and publishes the binary and source JARs- if the environment variable
PUBLISH_LIBRARY
is true, the artifacts are pushed to the designated repository - otherwise they are published "locally"
- the project's
-javadoc.jar
is automatically generated from artifacts labelled as "javadoc"- if no Javadoc is generated, an "empty" JAR is produced
- if the environment variable
- Requirements
- Java and/or Kotlin source files
group
,module
, andversion
properties are properly set
- Properties
library.publish.repoName
- the name of the "publish" repository to targetlibrary.publish.repoUrl
- the URL of the "publish" repositorylibrary.publish.insecure
- if "true" (default false), allows for use of an insecure registry (see above)
Generates protobuf
libraries.
This plugin:
- sets up IDEA "source directories" so generated source is available to projects
- creates artifacts with the project version
- message classes are compiled to Java
- service classes are compiled to both Java and Kotln client/server stubs
- stub dependencies included transitively (including the runtime-libraries)
id("crackers.buildstuff.generate-protobuf")
This is simply just the "typical" protobuf
generate setup as documented, nothing "fancy" added: just the Java and Kotlin generation parts. This should be completely transparent when used and all other options available should be available.
- Properties
protobuf.javaVersion
- sets the version of Java to use; defaults to 17
Really nothing more than a very simple "version counter" that keeps track of a semantic version (Major.Minor.Patch
) in a project file.
It does NOT:
- alter any project properties at run-time
- interact with
.git
or any other tag/library system - modify any build scripts or properties
It does:
- provide a very simple way of incrementing a version-like object and keeping track of if
id("crackers.buildstuff.simple-semver")
- Properties
- set the location/name of the file relative to the root project:
If not set, the default is a file named
simple.semver.file=path/to/shared/file
semver.version
in the project directory. NOTE This means that each subproject can have it's own version, so caveat emptor.
- set the location/name of the file relative to the root project:
- Tasks
incrementPatch
- incre ments the patch versionincrementMinor
- increments the minor versionincrementMajor
- increments the major versionshowVersion
- logs the version to INFO (not suitable for sripts)printVersion
- outputs the version to STDOUT
Directly using semver.get()
returns a SimpleSemverVersion
object with major
, minor
, and patch
fields. The toString()
returns major.minor.patch
.
To set the project version to the semantic version, you can use the following:
import crackers.buildstuff.semver.SimpleSemverVersion
val semver: Provider<SimpleSemverVersion> by project
version = semver.get().toString()
This does not work:
./gradlew incrementPatch doSomethingWithVersion
since project.version
is set before incrementPatch
is executed.
This will do the expected thing:
./gradlew incrementPatch
./gradlew doSomethingWithVersion