HHH-10512 - Fix symlink handling for documentation tasks
(cherry picked from commit b4165d9530
)
This commit is contained in:
parent
94214f3488
commit
1a73125845
|
@ -8,15 +8,12 @@ idea.module {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final File documentationDir = mkdir( "${project.buildDir}/documentation" );
|
|
||||||
|
|
||||||
final String[] versionComponents = version.split( '\\.' );
|
final String[] versionComponents = version.split( '\\.' );
|
||||||
final String majorVersion = versionComponents[0];
|
|
||||||
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];
|
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];
|
||||||
|
|
||||||
final File stagingDir = mkdir( "${project.buildDir}/staging" );
|
final File documentationDir = mkdir( "${project.buildDir}/documentation" );
|
||||||
final File documentationUploadStagingDir = mkdir( new File( stagingDir, "docs" ) );
|
final File ormDocumentationDir = mkdir( new File( documentationDir, "orm" ) )
|
||||||
final File versionedDocumentationDir = mkdir( new File( new File( documentationUploadStagingDir, "orm" ), majorMinorVersion ) );
|
final File versionedDocumentationDir = mkdir( new File( ormDocumentationDir, majorMinorVersion ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles all documentation into the {buildDir}/documentation directory.
|
* Assembles all documentation into the {buildDir}/documentation directory.
|
||||||
|
@ -32,43 +29,15 @@ task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documen
|
||||||
// * it is also used as a base to build a staged directory for documentation upload
|
// * it is also used as a base to build a staged directory for documentation upload
|
||||||
copy {
|
copy {
|
||||||
from "${rootProject.project( 'documentation' ).buildDir}/docbook/publish"
|
from "${rootProject.project( 'documentation' ).buildDir}/docbook/publish"
|
||||||
into documentationDir
|
into versionedDocumentationDir
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc"
|
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc"
|
||||||
into documentationDir
|
into versionedDocumentationDir
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
from "${rootProject.project( 'documentation' ).buildDir}/javadocs"
|
from "${rootProject.project( 'documentation' ).buildDir}/javadocs"
|
||||||
into "${documentationDir}/javadocs"
|
into "${versionedDocumentationDir}/javadocs"
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stages the documentation into a version specific directory in preparation for uploading them to the JBoss
|
|
||||||
* doc server. Essentially copies the output from the {buildDir}/documentation directory (output of the
|
|
||||||
* assembleDocumentation task) into a version-specific directory
|
|
||||||
*/
|
|
||||||
task stageDocumentationForUpload(type: Copy, dependsOn: assembleDocumentation) {
|
|
||||||
description = 'Stages the documentation in preparation for uploading to the JBoss doc server'
|
|
||||||
|
|
||||||
from documentationDir
|
|
||||||
into versionedDocumentationDir
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
if ( ! version.endsWith( 'SNAPSHOT' ) ) {
|
|
||||||
final File currentSymLinkContainerDir = new File( documentationUploadStagingDir, 'stable' )
|
|
||||||
currentSymLinkContainerDir.mkdirs();
|
|
||||||
ant.symlink(
|
|
||||||
action: 'delete',
|
|
||||||
link: "${currentSymLinkContainerDir.absolutePath}/orm"
|
|
||||||
)
|
|
||||||
ant.symlink(
|
|
||||||
action: 'single',
|
|
||||||
link: "${currentSymLinkContainerDir.absolutePath}/orm",
|
|
||||||
resource: "../orm/${majorMinorVersion}"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,13 +45,13 @@ task stageDocumentationForUpload(type: Copy, dependsOn: assembleDocumentation) {
|
||||||
/**
|
/**
|
||||||
* Upload the documentation to the JBoss doc server
|
* Upload the documentation to the JBoss doc server
|
||||||
*/
|
*/
|
||||||
task uploadDocumentation(type:Exec, dependsOn: stageDocumentationForUpload) {
|
task uploadDocumentation(type:Exec, dependsOn: assembleDocumentation) {
|
||||||
description = "Uploads documentation to the JBoss doc server"
|
description = "Uploads documentation to the JBoss doc server"
|
||||||
|
|
||||||
final String url = 'filemgmt.jboss.org:/docs_htdocs/hibernate/';
|
final String url = 'filemgmt.jboss.org:/docs_htdocs/hibernate/';
|
||||||
|
|
||||||
executable 'rsync'
|
executable 'rsync'
|
||||||
args '-avz', '--links', '--protocol=28', "${documentationUploadStagingDir.absolutePath}/", url
|
args '-avz', '--links', '--protocol=28', "${ormDocumentationDir.absolutePath}/", url
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
if ( version.endsWith( "SNAPSHOT" ) ) {
|
if ( version.endsWith( "SNAPSHOT" ) ) {
|
||||||
|
|
Loading…
Reference in New Issue