Skip to content

Commit 3c871ce

Browse files
authored
Merge pull request #1429 from lesserwhirls/docs_and_downloads
Documentation and downloads changes
2 parents e7f2eb2 + fee69ee commit 3c871ce

File tree

8 files changed

+58
-414
lines changed

8 files changed

+58
-414
lines changed

build.gradle

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@ buildscript {
1111
repositories {
1212
mavenCentral()
1313
gradlePluginPortal()
14-
exclusiveContent {
15-
forRepository {
16-
maven {
17-
url "https://artifacts.unidata.ucar.edu/repository/unidata-all/"
18-
}
19-
}
20-
// only look for unidata plugin related artifacts from the unidata-all repo
21-
filter {
22-
includeModule 'com.burgstaller', 'okhttp-digest'
23-
includeModule 'org.ysb33r.gradle', 'grolifant'
24-
includeModule 'edu.ucar.unidata', 'unidata-nexus-gradle'
25-
}
26-
}
2714
}
2815

2916
dependencies {
@@ -32,7 +19,6 @@ buildscript {
3219
classpath buildPlugins.spotless
3320
classpath buildPlugins.protobuf
3421
classpath buildPlugins.depcheck
35-
classpath buildPlugins.nexus
3622
}
3723
}
3824

docs/build.gradle

Lines changed: 3 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ gradle.projectsEvaluated { // Several statements below rely upon all subproject
3333
description = 'Generate Javadoc for the CDM subproject.'
3434

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

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

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

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

108108
tasks.build {
109109
// Aggregates the individual "build*" tasks.
110-
dependsOn buildJekyllSite, buildJavadocPublicApi, buildJavadocAll
110+
dependsOn buildJekyllSite, buildJavadocPublicApi, buildJavadocPublicApiWithDeps, buildJavadocAll
111111
}
112112
}
113113

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

177-
import edu.ucar.build.publishing.tasks.PublishToRawRepoTask
178-
179-
tasks.withType(PublishToRawRepoTask).all { // Common PublishToRawRepoTask config.
180-
group = 'Documentation'
181-
182-
host = 'https://artifacts.unidata.ucar.edu/'
183-
repoName = 'docs-netcdf-java'
184-
185-
onlyIf {
186-
// Will be evaluated at task execution time, not during configuration.
187-
// Fails the build if the specified properties haven't been provided.
188-
username = getPropertyOrFailBuild NEXUS_USERNAME_KEY
189-
password = getPropertyOrFailBuild NEXUS_PASSWORD_KEY
190-
return true
191-
}
192-
}
193-
194-
tasks.register('publishAsVersionedUserGuide', PublishToRawRepoTask) {
195-
description = 'Publish user guide (versioned) to Nexus under /major.minor/.'
196-
publishSrc = siteBuildDir.get().toString()
197-
destPath = "$project.docVersion/userguide/"
198-
dependsOn tasks.getByName('buildJekyllSite')
199-
}
200-
201-
tasks.register('publishAsCurrentUserGuide', PublishToRawRepoTask) {
202-
description = 'Publish the user guide to Nexus under /current/.'
203-
publishSrc = siteBuildDir.get().toString()
204-
destPath = 'current/userguide/'
205-
dependsOn tasks.getByName('buildJekyllSite')
206-
}
207-
208-
gradle.projectsEvaluated {
209-
// These tasks must be in a "projectsEvaluated" block because they depend on tasks that are also in a
210-
// "projectsEvaluated" block.
211-
212-
task publishAsVersionedJavadocPublicApi(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApi) {
213-
description = 'Publish Javadoc for the CDM subproject to Nexus under /major.minor/.'
214-
215-
publishSrc = tasks.buildJavadocPublicApi.destinationDir
216-
destPath = "$project.docVersion/javadoc/"
217-
}
218-
219-
task publishAsCurrentJavadocPublicApi(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApi) {
220-
description = 'Publish Javadoc for the CDM subproject to Nexus under /current/.'
221-
222-
publishSrc = tasks.buildJavadocPublicApi.destinationDir
223-
destPath = 'current/javadoc/'
224-
}
225-
226-
task publishAsVersionedJavadocPublicApiWithDeps(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApiWithDeps) {
227-
description = 'Publish Javadoc for the CDM subproject to Nexus under /major.minor/.'
228-
229-
publishSrc = tasks.buildJavadocPublicApiWithDeps.destinationDir
230-
destPath = "$project.docVersion/javadoc-with-deprecations/"
231-
}
232-
233-
task publishAsCurrentJavadocPublicApiWithDeps(type: PublishToRawRepoTask, dependsOn: buildJavadocPublicApiWithDeps) {
234-
description = 'Publish Javadoc for the CDM subproject to Nexus under /current/.'
235-
236-
publishSrc = tasks.buildJavadocPublicApiWithDeps.destinationDir
237-
destPath = 'current/javadoc-with-deprecations/'
238-
}
239-
240-
task publishAsVersionedJavadocAll(type: PublishToRawRepoTask, dependsOn: buildJavadocAll) {
241-
description = 'Publish Javadoc for all Java subprojects to Nexus under /major.minor/.'
242-
243-
publishSrc = tasks.buildJavadocAll.destinationDir
244-
destPath = "$project.docVersion/javadocAll/"
245-
}
246-
247-
task publishAsCurrentJavadocAll(type: PublishToRawRepoTask, dependsOn: buildJavadocAll) {
248-
description = 'Publish Javadoc for all Java subprojects to Nexus under /current/.'
249-
250-
publishSrc = tasks.buildJavadocAll.destinationDir
251-
destPath = 'current/javadocAll/'
252-
}
253-
254-
// We're deliberately NOT naming this task "publish", because we don't want it running when we do a:
255-
// ./gradlew publish
256-
// from the root directory. It simply takes too long.
257-
task publishAllDocsAsVersioned(group: 'Documentation') {
258-
description = 'Publish user guide and both Javadoc sets to Nexus under /major.minor/.'
259-
260-
// Aggregates the individual "publish*" tasks.
261-
dependsOn publishAsVersionedUserGuide, publishAsVersionedJavadocPublicApi,
262-
publishAsVersionedJavadocPublicApiWithDeps, publishAsVersionedJavadocAll
263-
}
264-
265-
task publishAllDocsAsCurrent(group: 'Documentation') {
266-
description = 'Publish user guide and both Javadoc sets to Nexus under /current/.'
267-
268-
// Aggregates the individual "publish*" tasks.
269-
dependsOn publishAsCurrentUserGuide, publishAsCurrentJavadocPublicApi, publishAsCurrentJavadocPublicApiWithDeps,
270-
publishAsCurrentJavadocAll
271-
}
272-
}
273-
274-
import edu.ucar.build.publishing.tasks.DeleteFromNexusTask
275-
276-
// By default, this will perform a dry run, which simply prints the components that the query matched.
277-
// To actually delete those components, do: ./gradlew :docs:deleteFromNexus --dryRun=false
278-
task deleteVersionedDocsFromNexus(group: 'Documentation', type: DeleteFromNexusTask) {
279-
description = 'Remove user guide and both Javadoc sets on Nexus under /major.minor/.'
280-
host = 'https://artifacts.unidata.ucar.edu/'
281-
searchQueryParameters.repository = 'docs-netcdf-java'
282-
searchQueryParameters.group = "/$project.docVersion/*"
283-
284-
onlyIf {
285-
// Will be evaluated at task execution time, not during configuration.
286-
// Fails the build if the specified properties haven't been provided.
287-
username = getPropertyOrFailBuild NEXUS_USERNAME_KEY
288-
password = getPropertyOrFailBuild NEXUS_PASSWORD_KEY
289-
return true
290-
}
291-
}
292-
293-
task deleteCurrentDocsFromNexus(group: 'Documentation', type: DeleteFromNexusTask) {
294-
description = 'Remove user guide and both Javadoc sets on Nexus under /current/.'
295-
host = 'https://artifacts.unidata.ucar.edu/'
296-
searchQueryParameters.repository = 'docs-netcdf-java'
297-
searchQueryParameters.group = '/current/*'
298-
299-
onlyIf {
300-
// Will be evaluated at task execution time, not during configuration.
301-
// Fails the build if the specified properties haven't been provided.
302-
username = getPropertyOrFailBuild NEXUS_USERNAME_KEY
303-
password = getPropertyOrFailBuild NEXUS_PASSWORD_KEY
304-
return true
305-
}
306-
}
307-
308177
tasks.withType(JavaCompile).configureEach {
309178
options.encoding = 'UTF-8'
310179
// whatever java is being used to run gradle will be used to compile java classes

docs/src/site/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
theme: unidata-jekyll-theme
33

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

77
# this appears on the top navigation bar next to the home button
88
topnav_title: netCDF-Java

gradle/any/shared-mvn-coords.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ ext {
1212
buildPlugins.spotless = 'com.diffplug.spotless:spotless-plugin-gradle:4.5.1'
1313
buildPlugins.protobuf = 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
1414
buildPlugins.depcheck = 'org.owasp:dependency-check-gradle:8.2.1'
15-
buildPlugins.nexus = 'edu.ucar.unidata:unidata-nexus-gradle:0.0.1'
1615

1716
// slf4j version is declared in a place where we cannot use the tds-platform project to handle resolving versions
1817
// (e.g. gradle/any/dependencies.gradle, for transitive dependency replacement purposes)

gradle/root/fatJars.gradle

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,57 @@ artifacts {
133133
archives buildNetcdfAll
134134
archives buildToolsUI
135135
}
136+
137+
import java.nio.file.Files
138+
import java.nio.file.Paths
139+
import java.security.DigestInputStream
140+
import java.security.MessageDigest
141+
142+
def createChecksumsTask = tasks.register('createChecksums') {
143+
group = 'publishing'
144+
description = 'Create .sha1, .sha256, and .md5 checksum files for the fatJars.'
145+
doLast {
146+
String sourceDir = "${rootProject.getBuildDir()}/libs"
147+
def files = fileTree(dir: "${sourceDir}", include: '**/*.jar')
148+
def algorithms = ["MD5", "SHA-1", "SHA-256"]
149+
algorithms.each { algorithm ->
150+
MessageDigest md = MessageDigest.getInstance(algorithm)
151+
files.each { File jarFile ->
152+
InputStream is = null
153+
DigestInputStream dis = null
154+
byte[] buffer = new byte[2048]
155+
try {
156+
is = Files.newInputStream(Paths.get(jarFile.absolutePath))
157+
dis = new DigestInputStream(is, md)
158+
while (dis.read(buffer) != -1) {
159+
// just need to read through the file
160+
}
161+
dis.close()
162+
is.close()
163+
} finally {
164+
if (dis != null) {
165+
dis.close()
166+
}
167+
if (is != null) {
168+
is.close()
169+
}
170+
}
171+
172+
byte[] digest = md.digest()
173+
StringBuilder sb = new StringBuilder()
174+
for (int b = 0; b < digest.length; b++) {
175+
sb.append(Integer.toString((digest[b] & 0xff) + 0x100, 16).substring(1))
176+
}
177+
String checksum = sb.toString()
178+
def ext = algorithm.toLowerCase().replace("-", "")
179+
String outputFilename = "${buildDir}/libs/${jarFile.getName()}.${ext}"
180+
new File(outputFilename).withWriter { writer ->
181+
writer.write checksum
182+
}
183+
}
184+
}
185+
}
186+
dependsOn buildNcIdv, buildNetcdfAll, buildToolsUI
187+
}
188+
189+
assemble.dependsOn(createChecksumsTask)

0 commit comments

Comments
 (0)