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
14 changes: 0 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
exclusiveContent {
forRepository {
maven {
url "https://artifacts.unidata.ucar.edu/repository/unidata-all/"
}
}
// only look for unidata plugin related artifacts from the unidata-all repo
filter {
includeModule 'com.burgstaller', 'okhttp-digest'
includeModule 'org.ysb33r.gradle', 'grolifant'
includeModule 'edu.ucar.unidata', 'unidata-nexus-gradle'
}
}
}

dependencies {
Expand All @@ -32,7 +19,6 @@ buildscript {
classpath buildPlugins.spotless
classpath buildPlugins.protobuf
classpath buildPlugins.depcheck
classpath buildPlugins.nexus
}
}

Expand Down
137 changes: 3 additions & 134 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ gradle.projectsEvaluated { // Several statements below rely upon all subproject
description = 'Generate Javadoc for the CDM subproject.'

title = "NetCDF-Java CDM Public API v${version}"
destinationDir = file("$buildDir/javadocCdm/")
destinationDir = file("$buildDir/javadoc/")

options.showFromPublic()
options.noDeprecated()
Expand Down Expand Up @@ -65,7 +65,7 @@ gradle.projectsEvaluated { // Several statements below rely upon all subproject
description = 'Generate Javadoc for the CDM subproject - included deprecated classes and methods.'

title = "NetCDF-Java CDM Public API v${version} - with deprecations"
destinationDir = file("$buildDir/javadocCdmWithDeps/")
destinationDir = file("$buildDir/javadoc-with-deprecations/")

SourceSet cdmCoreSourceSet = rootProject.project(':cdm:cdm-core').sourceSets.main
source cdmCoreSourceSet.allJava
Expand Down Expand Up @@ -107,7 +107,7 @@ gradle.projectsEvaluated { // Several statements below rely upon all subproject

tasks.build {
// Aggregates the individual "build*" tasks.
dependsOn buildJekyllSite, buildJavadocPublicApi, buildJavadocAll
dependsOn buildJekyllSite, buildJavadocPublicApi, buildJavadocPublicApiWithDeps, buildJavadocAll
}
}

Expand Down Expand Up @@ -174,137 +174,6 @@ tasks.register("stopServe", Exec) {
delete("$projectDir/src/site/Gemfile.lock")
}

import edu.ucar.build.publishing.tasks.PublishToRawRepoTask

tasks.withType(PublishToRawRepoTask).all { // Common PublishToRawRepoTask config.
group = 'Documentation'

host = 'https://artifacts.unidata.ucar.edu/'
repoName = 'docs-netcdf-java'

onlyIf {
// Will be evaluated at task execution time, not during configuration.
// Fails the build if the specified properties haven't been provided.
username = getPropertyOrFailBuild NEXUS_USERNAME_KEY
password = getPropertyOrFailBuild NEXUS_PASSWORD_KEY
return true
}
}

tasks.register('publishAsVersionedUserGuide', PublishToRawRepoTask) {
description = 'Publish user guide (versioned) to Nexus under /major.minor/.'
publishSrc = siteBuildDir.get().toString()
destPath = "$project.docVersion/userguide/"
dependsOn tasks.getByName('buildJekyllSite')
}

tasks.register('publishAsCurrentUserGuide', PublishToRawRepoTask) {
description = 'Publish the user guide to Nexus under /current/.'
publishSrc = siteBuildDir.get().toString()
destPath = 'current/userguide/'
dependsOn tasks.getByName('buildJekyllSite')
}

gradle.projectsEvaluated {
// These tasks must be in a "projectsEvaluated" block because they depend on tasks that are also in a
// "projectsEvaluated" block.

task publishAsVersionedJavadocPublicApi(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApi) {
description = 'Publish Javadoc for the CDM subproject to Nexus under /major.minor/.'

publishSrc = tasks.buildJavadocPublicApi.destinationDir
destPath = "$project.docVersion/javadoc/"
}

task publishAsCurrentJavadocPublicApi(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApi) {
description = 'Publish Javadoc for the CDM subproject to Nexus under /current/.'

publishSrc = tasks.buildJavadocPublicApi.destinationDir
destPath = 'current/javadoc/'
}

task publishAsVersionedJavadocPublicApiWithDeps(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApiWithDeps) {
description = 'Publish Javadoc for the CDM subproject to Nexus under /major.minor/.'

publishSrc = tasks.buildJavadocPublicApiWithDeps.destinationDir
destPath = "$project.docVersion/javadoc-with-deprecations/"
}

task publishAsCurrentJavadocPublicApiWithDeps(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApiWithDeps) {
description = 'Publish Javadoc for the CDM subproject to Nexus under /current/.'

publishSrc = tasks.buildJavadocPublicApiWithDeps.destinationDir
destPath = 'current/javadoc-with-deprecations/'
}

task publishAsVersionedJavadocAll(type: PublishToRawRepoTask, dependsOn: buildJavadocAll) {
description = 'Publish Javadoc for all Java subprojects to Nexus under /major.minor/.'

publishSrc = tasks.buildJavadocAll.destinationDir
destPath = "$project.docVersion/javadocAll/"
}

task publishAsCurrentJavadocAll(type: PublishToRawRepoTask, dependsOn: buildJavadocAll) {
description = 'Publish Javadoc for all Java subprojects to Nexus under /current/.'

publishSrc = tasks.buildJavadocAll.destinationDir
destPath = 'current/javadocAll/'
}

// We're deliberately NOT naming this task "publish", because we don't want it running when we do a:
// ./gradlew publish
// from the root directory. It simply takes too long.
task publishAllDocsAsVersioned(group: 'Documentation') {
description = 'Publish user guide and both Javadoc sets to Nexus under /major.minor/.'

// Aggregates the individual "publish*" tasks.
dependsOn publishAsVersionedUserGuide, publishAsVersionedJavadocPublicApi,
publishAsVersionedJavadocPublicApiWithDeps, publishAsVersionedJavadocAll
}

task publishAllDocsAsCurrent(group: 'Documentation') {
description = 'Publish user guide and both Javadoc sets to Nexus under /current/.'

// Aggregates the individual "publish*" tasks.
dependsOn publishAsCurrentUserGuide, publishAsCurrentJavadocPublicApi, publishAsCurrentJavadocPublicApiWithDeps,
publishAsCurrentJavadocAll
}
}

import edu.ucar.build.publishing.tasks.DeleteFromNexusTask

// By default, this will perform a dry run, which simply prints the components that the query matched.
// To actually delete those components, do: ./gradlew :docs:deleteFromNexus --dryRun=false
task deleteVersionedDocsFromNexus(group: 'Documentation', type: DeleteFromNexusTask) {
description = 'Remove user guide and both Javadoc sets on Nexus under /major.minor/.'
host = 'https://artifacts.unidata.ucar.edu/'
searchQueryParameters.repository = 'docs-netcdf-java'
searchQueryParameters.group = "/$project.docVersion/*"

onlyIf {
// Will be evaluated at task execution time, not during configuration.
// Fails the build if the specified properties haven't been provided.
username = getPropertyOrFailBuild NEXUS_USERNAME_KEY
password = getPropertyOrFailBuild NEXUS_PASSWORD_KEY
return true
}
}

task deleteCurrentDocsFromNexus(group: 'Documentation', type: DeleteFromNexusTask) {
description = 'Remove user guide and both Javadoc sets on Nexus under /current/.'
host = 'https://artifacts.unidata.ucar.edu/'
searchQueryParameters.repository = 'docs-netcdf-java'
searchQueryParameters.group = '/current/*'

onlyIf {
// Will be evaluated at task execution time, not during configuration.
// Fails the build if the specified properties haven't been provided.
username = getPropertyOrFailBuild NEXUS_USERNAME_KEY
password = getPropertyOrFailBuild NEXUS_PASSWORD_KEY
return true
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
// whatever java is being used to run gradle will be used to compile java classes
Expand Down
2 changes: 1 addition & 1 deletion docs/src/site/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
theme: unidata-jekyll-theme

# this will appear in an HTML meta tag, sidebar, and perhaps elsewhere
docset_version: 5.7
docset_version: 5.8 (dev)

# this appears on the top navigation bar next to the home button
topnav_title: netCDF-Java
Expand Down
1 change: 0 additions & 1 deletion gradle/any/shared-mvn-coords.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ext {
buildPlugins.spotless = 'com.diffplug.spotless:spotless-plugin-gradle:4.5.1'
buildPlugins.protobuf = 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
buildPlugins.depcheck = 'org.owasp:dependency-check-gradle:8.2.1'
buildPlugins.nexus = 'edu.ucar.unidata:unidata-nexus-gradle:0.0.1'

// slf4j version is declared in a place where we cannot use the tds-platform project to handle resolving versions
// (e.g. gradle/any/dependencies.gradle, for transitive dependency replacement purposes)
Expand Down
54 changes: 54 additions & 0 deletions gradle/root/fatJars.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,57 @@ artifacts {
archives buildNetcdfAll
archives buildToolsUI
}

import java.nio.file.Files
import java.nio.file.Paths
import java.security.DigestInputStream
import java.security.MessageDigest

def createChecksumsTask = tasks.register('createChecksums') {
group = 'publishing'
description = 'Create .sha1, .sha256, and .md5 checksum files for the fatJars.'
doLast {
String sourceDir = "${rootProject.getBuildDir()}/libs"
def files = fileTree(dir: "${sourceDir}", include: '**/*.jar')
def algorithms = ["MD5", "SHA-1", "SHA-256"]
algorithms.each { algorithm ->
MessageDigest md = MessageDigest.getInstance(algorithm)
files.each { File jarFile ->
InputStream is = null
DigestInputStream dis = null
byte[] buffer = new byte[2048]
try {
is = Files.newInputStream(Paths.get(jarFile.absolutePath))
dis = new DigestInputStream(is, md)
while (dis.read(buffer) != -1) {
// just need to read through the file
}
dis.close()
is.close()
} finally {
if (dis != null) {
dis.close()
}
if (is != null) {
is.close()
}
}

byte[] digest = md.digest()
StringBuilder sb = new StringBuilder()
for (int b = 0; b < digest.length; b++) {
sb.append(Integer.toString((digest[b] & 0xff) + 0x100, 16).substring(1))
}
String checksum = sb.toString()
def ext = algorithm.toLowerCase().replace("-", "")
String outputFilename = "${buildDir}/libs/${jarFile.getName()}.${ext}"
new File(outputFilename).withWriter { writer ->
writer.write checksum
}
}
}
}
dependsOn buildNcIdv, buildNetcdfAll, buildToolsUI
}

assemble.dependsOn(createChecksumsTask)
Loading