HHH-16962 - General documentation improvements

https://hibernate.atlassian.net/browse/HHH-16962
(cherry picked from commit a6eefb0ced)
This commit is contained in:
Steve Ebersole 2023-08-31 10:44:31 -05:00 committed by Christian Beikov
parent 4186ca2b57
commit 8b3c686bb5
3 changed files with 24 additions and 20 deletions

View File

@ -29,8 +29,8 @@ public class DocumentationPublishing {
private final DirectoryProperty stagingDirectory;
private final Property<String> docServerUrl;
private final Property<String> docDescriptorServerUrl;
private final Property<String> docDescriptorUploadUrl;
private final RegularFileProperty updatedJsonFile;
private final ReleaseFamilyIdentifier releaseFamilyIdentifier;
@ -42,13 +42,14 @@ public class DocumentationPublishing {
stagingDirectory = project.getObjects()
.directoryProperty()
.convention( project.getLayout().getBuildDirectory().dir( "documentation" ) );
docServerUrl = project.getObjects()
.property( String.class )
.convention( "filemgmt-prod-sync.jboss.org:/docs_htdocs/hibernate/orm" );
docDescriptorServerUrl = project.getObjects()
docDescriptorUploadUrl = project.getObjects()
.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()
@ -62,22 +63,28 @@ public class DocumentationPublishing {
return releaseFamilyIdentifier;
}
public Provider<RegularFile> getUpdatedJsonFile() {
return updatedJsonFile;
}
public Property<String> getDocServerUrl() {
return docServerUrl;
}
public Property<String> getDocDescriptorServerUrl() {
return docDescriptorServerUrl;
}
public DirectoryProperty getStagingDirectory() {
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) {
updatedJsonFile.fileValue( project.file( ref ) );
}

View File

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

View File

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