Skip to content

Commit

Permalink
HHH-16962 - General documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Aug 31, 2023
1 parent 6ca035e commit a6eefb0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,13 +42,14 @@ public DocumentationPublishing(Project project) {
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()
Expand All @@ -62,22 +63,28 @@ public ReleaseFamilyIdentifier getReleaseFamilyIdentifier() {
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 ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void apply(Project 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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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() {
setGroup( "documentation" );
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();
}

Expand All @@ -41,8 +41,8 @@ public RegularFileProperty getJsonFile() {
}

@Input
public Property<String> getDocServerUrl() {
return docServerUrl;
public Property<String> getDocDescriptorUploadUrl() {
return docDescriptorUploadUrl;
}

@Input
Expand All @@ -53,10 +53,7 @@ public Provider<Object> getProjectVersion() {

@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() );
}
}

0 comments on commit a6eefb0

Please sign in to comment.