HHH-16962 - General documentation improvements

https://hibernate.atlassian.net/browse/HHH-16962
This commit is contained in:
Steve Ebersole 2023-08-31 10:44:31 -05:00
parent 6ca035e764
commit a6eefb0ced
3 changed files with 24 additions and 20 deletions

View File

@ -29,8 +29,8 @@ public class DocumentationPublishing {
private final DirectoryProperty stagingDirectory; private final DirectoryProperty stagingDirectory;
private final Property<String> docServerUrl; private final Property<String> docServerUrl;
private final Property<String> docDescriptorServerUrl;
private final Property<String> docDescriptorUploadUrl;
private final RegularFileProperty updatedJsonFile; private final RegularFileProperty updatedJsonFile;
private final ReleaseFamilyIdentifier releaseFamilyIdentifier; private final ReleaseFamilyIdentifier releaseFamilyIdentifier;
@ -42,13 +42,14 @@ public class DocumentationPublishing {
stagingDirectory = project.getObjects() stagingDirectory = project.getObjects()
.directoryProperty() .directoryProperty()
.convention( project.getLayout().getBuildDirectory().dir( "documentation" ) ); .convention( project.getLayout().getBuildDirectory().dir( "documentation" ) );
docServerUrl = project.getObjects() docServerUrl = project.getObjects()
.property( String.class ) .property( String.class )
.convention( "filemgmt-prod-sync.jboss.org:/docs_htdocs/hibernate/orm" ); .convention( "filemgmt-prod-sync.jboss.org:/docs_htdocs/hibernate/orm" );
docDescriptorServerUrl = project.getObjects() docDescriptorUploadUrl = project.getObjects()
.property( String.class ) .property( String.class )
.convention( "filemgmt-prod-sync.jboss.org:/docs_htdocs/hibernate" ); .convention( "filemgmt-prod-sync.jboss.org:/docs_htdocs/hibernate/_outdated-content/orm.json" );
updatedJsonFile = project.getObjects() updatedJsonFile = project.getObjects()
@ -62,22 +63,28 @@ public class DocumentationPublishing {
return releaseFamilyIdentifier; return releaseFamilyIdentifier;
} }
public Provider<RegularFile> getUpdatedJsonFile() {
return updatedJsonFile;
}
public Property<String> getDocServerUrl() { public Property<String> getDocServerUrl() {
return docServerUrl; return docServerUrl;
} }
public Property<String> getDocDescriptorServerUrl() {
return docDescriptorServerUrl;
}
public DirectoryProperty getStagingDirectory() { public DirectoryProperty getStagingDirectory() {
return stagingDirectory; return stagingDirectory;
} }
/**
* Where to upload the {@link #getUpdatedJsonFile() documentation descriptor}
*/
public Property<String> getDocDescriptorUploadUrl() {
return docDescriptorUploadUrl;
}
/**
* THe ORM documentation descriptor
*/
public Provider<RegularFile> getUpdatedJsonFile() {
return updatedJsonFile;
}
public void setUpdatedJsonFile(Object ref) { public void setUpdatedJsonFile(Object ref) {
updatedJsonFile.fileValue( project.file( ref ) ); updatedJsonFile.fileValue( project.file( ref ) );
} }

View File

@ -45,7 +45,7 @@ public class DocumentationPublishingPlugin implements Plugin<Project> {
UPLOAD_DESC_TASK_NAME, UPLOAD_DESC_TASK_NAME,
PublishDescriptorTask.class, PublishDescriptorTask.class,
(task) -> { (task) -> {
task.getDocServerUrl().convention( docPubDsl.getDocServerUrl() ); task.getDocDescriptorUploadUrl().convention( docPubDsl.getDocDescriptorUploadUrl() );
task.getJsonFile().convention( docPubDsl.getUpdatedJsonFile() ); task.getJsonFile().convention( docPubDsl.getUpdatedJsonFile() );
task.dependsOn( generateDescriptorTask ); task.dependsOn( generateDescriptorTask );

View File

@ -22,7 +22,7 @@ public abstract class PublishDescriptorTask extends DefaultTask {
public static final String UPLOAD_DESC_TASK_NAME = "uploadDocumentationDescriptor"; public static final String UPLOAD_DESC_TASK_NAME = "uploadDocumentationDescriptor";
private final Provider<Object> projectVersion; private final Provider<Object> projectVersion;
private final Property<String> docServerUrl; private final Property<String> docDescriptorUploadUrl;
private final RegularFileProperty jsonFile; private final RegularFileProperty jsonFile;
public PublishDescriptorTask() { public PublishDescriptorTask() {
@ -30,7 +30,7 @@ public abstract class PublishDescriptorTask extends DefaultTask {
setDescription( "Publishes the documentation publication descriptor (JSON)" ); setDescription( "Publishes the documentation publication descriptor (JSON)" );
projectVersion = getProject().provider( () -> getProject().getVersion() ); projectVersion = getProject().provider( () -> getProject().getVersion() );
docServerUrl = getProject().getObjects().property( String.class ); docDescriptorUploadUrl = getProject().getObjects().property( String.class );
jsonFile = getProject().getObjects().fileProperty(); jsonFile = getProject().getObjects().fileProperty();
} }
@ -41,8 +41,8 @@ public abstract class PublishDescriptorTask extends DefaultTask {
} }
@Input @Input
public Property<String> getDocServerUrl() { public Property<String> getDocDescriptorUploadUrl() {
return docServerUrl; return docDescriptorUploadUrl;
} }
@Input @Input
@ -53,10 +53,7 @@ public abstract class PublishDescriptorTask extends DefaultTask {
@TaskAction @TaskAction
public void uploadDescriptor() { public void uploadDescriptor() {
final String base = docServerUrl.get(); final String url = docDescriptorUploadUrl.get();
final String normalizedBase = base.endsWith( "/" ) ? base : base + "/";
final String url = normalizedBase + "_outdated-content/orm.json";
RsyncHelper.rsync( jsonFile.get(), url, getProject() ); RsyncHelper.rsync( jsonFile.get(), url, getProject() );
} }
} }