Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pmd-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@
<!-- error prone rules -->
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic" />
<rule ref="category/java/errorprone.xml/AvoidAssertAsIdentifier" />
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
<rule ref="category/java/errorprone.xml/AvoidCallingFinalize" />
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
<rule ref="category/java/errorprone.xml/AvoidEnumAsIdentifier" />
Expand Down Expand Up @@ -294,6 +293,8 @@
<!-- error prone rules that seem to be broken
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" />
False positive in OptionsDoclet.
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
Triggers for `return` as well as for branches within the method.
-->

<!-- error prone rules we are not using
Expand Down
92 changes: 92 additions & 0 deletions README-developers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Developer documentation

## Making a release

### Requirements

Your ~/.gradle/gradle.properties file must contain:

```properties
signing.keyId=...
signing.password=...
signing.secretKeyRingFile=...
mavenCentralUsername=...
mavenCentralPassword=...
```

### Steps

Run these steps on any filesystem, except the `javadocWeb` step.

* Make and test a snapshot release, see below.
* git pull
* In `build.gradle`, ensure that "To use a snapshot version" is not enabled.
Comment thread
mernst marked this conversation as resolved.
* Update the version number in `README.md`, `build.gradle`, and in this file
(multiple times in each).
Ensure the version number in `build.gradle` does not contain "-SNAPSHOT".
Comment thread
mernst marked this conversation as resolved.
* Update `CHANGELOG.md`.
* Save files and stage changes.
* ./gradlew publishToMavenCentral
* Browse to <https://central.sonatype.com/publishing/deployments>, click "publish".
* Add a git tag and commit:

```sh
VER=2.0.3 && \
git commit -m "Version $VER" && git push && \
git tag -a v$VER -m "Version $VER" && git push && git push --tags
```

* Make a GitHub release.
* Browse to <https://github.com/plume-lib/options/releases>
* Click "draft a new release"
* Call it "options 2.0.3"
* Use the text from `CHANGELOG.md` as the description
* Attach the .jar and -all.jar files from `build/libs/`
* Click "publish release"
* Finally, run on the CSE filesystem: git pull && ./gradlew javadocWeb
* Update clients and test, so that if it's broken we can re-release.

### Making a snapshot release

* git pull
* Set version to end in "-SNAPSHOT".
* Make the snapshot release.
* Approach 1: to Maven Central
* ./gradlew publishToMavenCentral
* In the clients' build.gradle: set version number and use:

<!-- markdownlint-disable line-length -->
```gradle
repositories {
maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") }
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, "seconds"
}
```
<!-- markdownlint-enable line-length -->

* Approach 2: to Maven Local
* ./gradlew publishToMavenLocal
* In the clients' build.gradle: set version number and use:

```gradle
repositories {
mavenLocal()
}
```

* Test the test snapshot release on some clients:
* For the Checker Framework (don't skip running the tests):

<!-- markdownlint-disable line-length -->
```sh
# This ensures that the correct JDK is being used
usecf THE-BRANCH-THAT-USES-THE-SNAPSHOT
cd $cf
checker/bin-devel/test-cftests-all.sh && checker/bin-devel/test-typecheck.sh && \
checker/bin-devel/test-plume-lib.sh
```
<!-- markdownlint-enable line-length -->

* For Daikon: make compile junit test
Comment thread
mernst marked this conversation as resolved.
76 changes: 65 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ plugins {

// Checker Framework pluggable type-checking
id("org.checkerframework").version("0.6.61")

// Publishing to Maven Central.
id("com.vanniktech.maven.publish").version("0.34.0")
}

repositories {
mavenLocal()
mavenCentral()
maven { url = "https://central.sonatype.com/repository/maven-snapshots/" }
gradlePluginPortal()
Expand All @@ -40,9 +44,6 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

// To upload to Maven Central, see instructions in the file.
apply from: "${buildscript.sourceFile.parent}/gradle/mavencentral.gradle"

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down Expand Up @@ -115,10 +116,12 @@ if (isJava21orHigher) {
}
tasks.withType(JavaCompile).configureEach {
options.errorprone {
disable("AnnotateFormatMethod") // Error Prone doesn't know about Checker Framework @FormatMethod.
disable("DoNotCallSuggester") // Suggests use of an Error Prone annotation.
disable("ExtendsObject") // Incorrect when using the Checker Framework.
disable("InlineMeSuggester") // Using `@InlineMe` requires clients to declare a dependency on error_prone_annotations.
disable("ReferenceEquality") // Use Interning Checker instead.
disable("StringSplitter") // Obscure case isn't likely.
disable("AnnotateFormatMethod") // Error Prone doesn't know about Checker Framework @FormatMethod.
disable("UseCorrectAssertInTests") // https://github.com/typetools/checker-framework/issues/3345
}
}
Expand Down Expand Up @@ -207,6 +210,9 @@ check.dependsOn(javadoc)

tasks.register("javadocWeb", Javadoc) {
description = "Upload API documentation to website."
dependsOn(javadocWebUpload, javadocWebChgrp, javadocWebChmod)
}
tasks.register("javadocWebUpload", Javadoc) {
source = sourceSets.main.allJava
destinationDir = file("/cse/web/research/plumelib/${project.name}/api")
Comment thread
mernst marked this conversation as resolved.
classpath = project.sourceSets.main.compileClasspath
Expand All @@ -216,15 +222,20 @@ tasks.register("javadocWeb", Javadoc) {
flags:"g", byline:true) {
fileset(dir: destinationDir)
}
// Set permissions
project.exec {
commandLine("chgrp", "-R", "plse_www", "/cse/web/research/plumelib/${project.name}/api")
}
project.exec {
commandLine("chmod", "-R", "g+w", "/cse/web/research/plumelib/${project.name}/api")
}
}
}
// Set permissions
tasks.register("javadocWebChgrp", Exec) {
commandLine("chgrp", "-R", "plse_www", "/cse/web/research/plumelib/${project.name}/api")
ignoreExitValue = true
}
Comment thread
mernst marked this conversation as resolved.
javadocWebChgrp.mustRunAfter("javadocWebUpload")
tasks.register("javadocWebChmod", Exec) {
commandLine("chmod", "-R", "g+w", "/cse/web/research/plumelib/${project.name}/api")
ignoreExitValue = true
}
javadocWebChmod.mustRunAfter("javadocWebUpload")


configurations {
requireJavadoc
Expand Down Expand Up @@ -255,6 +266,49 @@ tasks.register("requireJavadoc", JavaExec) {
check.dependsOn(requireJavadoc)
javadocWeb.dependsOn(requireJavadoc)


// Publishing

// To upload to Maven Central:
// * ./gradlew publishToMavenCentral
// * browse to https://central.sonatype.com/publishing/deployments

ext {
packageName = "options"
}
Comment thread
mernst marked this conversation as resolved.

mavenPublishing {
coordinates("org.plumelib", "${packageName}", "2.0.3")
Comment thread
mernst marked this conversation as resolved.

pom {
name = "Plume-lib Options"
description = "Command-line option processing for Java."
url = "https://github.com/plume-lib/${packageName}"

scm {
url = "https://github.com/plume-lib/${packageName}/"
connection = "scm:git:git://github.com/plume-lib/${packageName}.git"
developerConnection = "scm:git:ssh://git@github.com/plume-lib/${packageName}.git"
}

licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}

developers {
developer {
id = "mernst"
name = "Michael Ernst"
email = "mernst@alum.mit.edu"
}
}
}
}


// Emacs support

/* Make Emacs TAGS table */
Expand Down
100 changes: 0 additions & 100 deletions gradle/mavencentral.gradle

This file was deleted.