diff --git a/build.gradle b/build.gradle index 3aba602d43..52bc7a43ee 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -32,7 +19,6 @@ buildscript { classpath buildPlugins.spotless classpath buildPlugins.protobuf classpath buildPlugins.depcheck - classpath buildPlugins.nexus } } diff --git a/docs/build.gradle b/docs/build.gradle index ac68f8f21c..ca17864f08 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -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() @@ -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 @@ -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 } } @@ -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 diff --git a/docs/src/site/_config.yml b/docs/src/site/_config.yml index 75f29ae65e..e00a3b2620 100644 --- a/docs/src/site/_config.yml +++ b/docs/src/site/_config.yml @@ -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 diff --git a/gradle/any/shared-mvn-coords.gradle b/gradle/any/shared-mvn-coords.gradle index f00171ed5d..68c806628b 100644 --- a/gradle/any/shared-mvn-coords.gradle +++ b/gradle/any/shared-mvn-coords.gradle @@ -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) diff --git a/gradle/root/fatJars.gradle b/gradle/root/fatJars.gradle index a49f48d0eb..c86b0be74c 100644 --- a/gradle/root/fatJars.gradle +++ b/gradle/root/fatJars.gradle @@ -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) diff --git a/gradle/root/publishing.gradle b/gradle/root/publishing.gradle index 5c576cb927..6cfc667089 100644 --- a/gradle/root/publishing.gradle +++ b/gradle/root/publishing.gradle @@ -8,22 +8,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 'edu.ucar.unidata', 'unidata-nexus-gradle' - includeModule 'com.burgstaller', 'okhttp-digest' - } - } - } - - dependencies { - classpath buildPlugins.nexus } } @@ -32,117 +16,8 @@ if (!name.equals(rootProject.name)) { } apply plugin: 'maven-publish' // gives us the publish task even though we are not going to publish anything to maven -apply plugin: 'com.github.johnrengelman.shadow' apply from: "$rootDir/gradle/any/properties.gradle" // For Nexus credential properties. -import edu.ucar.build.publishing.tasks.PublishToRawRepoTask - -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 -} - -def publishFatJarsTask = tasks.register('publishFatJars', PublishToRawRepoTask) { - group = 'publishing' - description = 'Publish fatJars to Nexus downloads under /version/.' - host = 'https://artifacts.unidata.ucar.edu/' - repoName = 'downloads-netcdf-java' - - publishSrc = new File(rootProject.getBuildDir(), "libs") - destPath = "$project.cleanVersion/" - dependsOn createChecksumsTask - - 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 - } -} - -publish.dependsOn publishFatJarsTask - -def publishReleaseInfoTask = tasks.register('publishReleaseInfo', PublishToRawRepoTask) { - group = 'publishing' - description = 'Publish release_info.json to Nexus downloads.' - host = 'https://artifacts.unidata.ucar.edu/' - repoName = 'downloads-netcdf-java' - - publishSrc = new File(rootProject.getProjectDir(), "project-files/downloads/") - - 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 - } -} - -def publishVersionInfoTask = tasks.register('publishVersionInfo', PublishToRawRepoTask) { - group = 'publishing' - description = 'Publish version-info.json to Nexus docs.' - host = 'https://artifacts.unidata.ucar.edu/' - repoName = 'docs-netcdf-java' - - publishSrc = new File(rootProject.getProjectDir(), "project-files/docs/") - - 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 - } -} // The "publish" tasks for all subprojects require credentials for our Nexus server, which they look for in Gradle // properties. If those properties (i.e. NEXUS_USERNAME_KEY and NEXUS_PASSWORD_KEY) haven't been provided, the build diff --git a/project-files/docs/version-info.json b/project-files/docs/version-info.json deleted file mode 100644 index c6d798905f..0000000000 --- a/project-files/docs/version-info.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "package" : "netcdf-java", - "packageName" : "netCDF-Java", - "releases" : [ - { - "version" : "5.0", - "include" : "0", - "releaseDate": "2019-07-29", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.0/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.1", - "include" : "0", - "releaseDate": "2019-09-18", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.1/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.2", - "include" : "0", - "releaseDate": "2019-10-23", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.2/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.3", - "include" : "0", - "releaseDate": "2020-04-29", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.3/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.4", - "include" : "0", - "releaseDate": "2020-12-07", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.4/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.5", - "include" : "0", - "releaseDate": "2022-06-02", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.5/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.6", - "include" : "1", - "releaseDate": "2024-07-15", - "status" : "", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/5.6/userguide/index.html", - "docsetName": "User's Guide" - } - } - }, - { - "version" : "5.7", - "include" : "1", - "releaseDate": "2025-01-06", - "status" : "current", - "docsets": { - "userguide": { - "baseUrl": "https://docs.unidata.ucar.edu/netcdf-java/current/userguide/index.html", - "docsetName": "User's Guide" - } - } - } - ] -} diff --git a/project-files/downloads/release_info.json b/project-files/downloads/release_info.json deleted file mode 100644 index 59a6e0cdef..0000000000 --- a/project-files/downloads/release_info.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "package": "netcdf-java", - "packageName": "netCDF-Java", - "releases": [ - { - "version": "5.7.0", - "releaseDate": "2025-01-06", - "status": "current", - "description": "", - "baseURL": "https://artifacts.unidata.ucar.edu/repository/downloads-netcdf-java/5.7.0/", - "resources": { - "netcdfAll": { - "type" : "library", - "package": "netcdfAll-5.7.0.jar", - "name": "Jar file", - "hash": { - "MD5": "netcdfAll-5.7.0.jar.md5", - "SHA1": "netcdfAll-5.7.0.jar.sha1", - "SHA256": "netcdfAll-5.7.0.jar.sha256" - }, - "info": "The netCDF library implements the full CDM model, including all other jar dependencies." - }, - "toolsUI": { - "type": "library", - "package": "toolsUI-5.7.0.jar", - "name": "Jar file", - "hash": { - "MD5": "toolsUI-5.7.0.jar.md5", - "SHA1": "toolsUI-5.7.0.jar.sha1", - "SHA256": "toolsUI-5.7.0.jar.sha256" - }, - "info": "The toolsUI.jar contains everything to run the ToolsUI application directly from it. " - } - } - } - ] -}