Can asdoc merge docs of swc When use merged or internal dependencies ?

cwocwo's Avatar

cwocwo

07 Jun, 2012 07:06 AM

For example :


buildscript {

repositories {
    maven {
        credentials {
            userName = nexusUsername
            password = nexusPassword
        }
        url repositoriesUrl
    }
}
dependencies {
    classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.5-beta'
}

}

apply plugin: 'gradlefx'

version = '1.0-SNAPSHOT'
type = 'swc'
asdoc.additionalASDocOptions = ['-skip-xsl=true']
fatSwc = true
locales = ['en_US']
repositories {

maven {
    credentials {
        userName = nexusUsername
        password = nexusPassword
    }
    url repositoriesUrl
}

}

dependencies {

internal group: 'com.**', name: 'Jumanji', version: '1.0', ext: 'swc'
internal group: 'com.**', name: 'ark', version: '1.0-SNAPSHOT', ext: 'swc'
external group: 'org.httpclient', name: 'as3httpclientlib', version: '1_0_6', ext: 'swc'
external group: 'com.adobe', name: 'as3corelib', version: '0.93', ext: 'swc'

external files("${flexHome}/frameworks/libs/spark.swc",
       "${flexHome}/frameworks/libs/framework.swc",
       "${flexHome}/frameworks/libs/mx/mx.swc",
       "${flexHome}/frameworks/libs/advancedgrids.swc",
       "${flexHome}/frameworks/libs/textLayout.swc",
       "${flexHome}/frameworks/libs/core.swc",
       "${flexHome}/frameworks/libs/rpc.swc",
       "${flexHome}/frameworks/libs/sparkskins.swc",
       "${flexHome}/frameworks/libs/flash-integration.swc",
       "${flexHome}/frameworks/libs/osmf.swc"

       )

}

Assume that this project generate a swc file named foo.swc, could asdoc merge Jumanji and ark's docs into foo.swc?

  1. Support Staff 1 Posted by Yennick Trevels on 07 Jun, 2012 07:20 AM

    Yennick Trevels's Avatar

    This is something I'm still trying to find out, so I don't have an answer for this right now. Looking into it though.

    Btw, with this new version of GradleFx you shouldn't have to manually specify the external framework linkage for swc projects, it's automatically linked like that ;)
    We (actually Maxime) introduced a frameworkLinkage property, which can have the following values: 'external', 'merged', 'rsl' and 'none'.
    The default for swc projects is 'external' and for swf projects it's 'rsl'

  2. 2 Posted by cwocwo on 11 Jun, 2012 09:18 AM

    cwocwo's Avatar

    I write two tasks to do this.

    1.Compile the project, generate the swc file.
    2.Unzip the swc file.
    3.Unzip internal dependencies and read 'packages.dita' , add apiItemRefs in it to the file named 'packages.dita' of swc.
    4.Zip

  3. Support Staff 3 Posted by Yennick Trevels on 11 Jun, 2012 11:03 AM

    Yennick Trevels's Avatar

    For some reason I can't download the attachments (keeps saying "Processing Asset"), but it looks interesting, thanks for explaining how you did it, will certainly make it easier for me :)

  4. 4 Posted by cwocwo on 12 Jun, 2012 12:58 AM

    cwocwo's Avatar

    gradle.properties


    
    flexHome = E:/apps/flex/SDK4.6.0
    buildDirName = build
    
    sourceEncoding=UTF-8
    nexusUsername=deployment
    nexusPassword=deployment123
    
    nexusDeployUsername=deployment
    nexusDeployPassword=deployment123
    
    group=xxx
    version = 1.0-SNAPSHOT
    archivesBaseName = surfing
    release=false
    
    repositoriesUrl=xxx
    repositoriesUploadReleasesUrl=xxx
    repositoriesUploadSnapshotsUrl=xx
    

    build.gradle

    
    buildscript {
        repositories {
            maven {
                credentials {
                    userName = nexusUsername
                    password = nexusPassword
                }
                url repositoriesUrl
            }
        }
        dependencies {
            classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.5-beta'
        }
    }
    import groovy.xml.XmlUtil
    apply plugin: 'gradlefx'
    apply plugin: 'maven'
    
    type = 'swc'
    fatSwc = true
    locales = ['en_US', 'zh_CN']
    output="${archivesBaseName}-${version}"
    asdoc.additionalASDocOptions = ['-skip-xsl=true', '-exclude-dependencies=false']
    asdoc.outputDir = "${buildDirName}/docs"
    
    repositories {
        maven {
            credentials {
                userName = nexusUsername
                password = nexusPassword
            }
            url repositoriesUrl
        }
    }
    
    dependencies {
        merged group: 'com.xxx', name: 'E_Jumanji', version: '1.0', ext: 'swc'
        merged group: 'com.xxx', name: 'ark', version: '1.0-SNAPSHOT', ext: 'swc'
        internal group: 'com.xxx', name: 'E_Jumanji', version: '1.0', ext: 'swc'
        internal group: 'com.xxx', name: 'ark', version: '1.0-SNAPSHOT', ext: 'swc'
        external group: 'org.httpclient', name: 'as3httpclientlib', version: '1_0_6', ext: 'swc'
        external group: 'com.adobe', name: 'as3corelib', version: '0.93', ext: 'swc'
        
        external files("${flexHome}/frameworks/libs/spark.swc",
               "${flexHome}/frameworks/libs/framework.swc",
               "${flexHome}/frameworks/libs/mx/mx.swc",
               "${flexHome}/frameworks/libs/advancedgrids.swc",
               "${flexHome}/frameworks/libs/textLayout.swc",
               "${flexHome}/frameworks/libs/core.swc",
               "${flexHome}/frameworks/libs/rpc.swc",
               "${flexHome}/frameworks/libs/sparkskins.swc",
               "${flexHome}/frameworks/libs/flash-integration.swc",
               "${flexHome}/frameworks/libs/osmf.swc"
               
               )
    }
    
    uploadArchives.repositories.mavenDeployer {
          name = 'nexusDeployer'
          repository(url: repositoriesUploadReleasesUrl) {
                authentication(userName: nexusDeployUsername, password: nexusDeployPassword)
          }
          repository(url: repositoriesUploadSnapshotsUrl) {
                authentication(userName: nexusDeployUsername, password: nexusDeployPassword)
          }
          pom.version = version
          pom.artifactId = output
        
    }
    
    mergeDocDir = "${buildDirName}/merge-docs"
    swcUnzipDir = "${mergeDocDir}/swc"
    
    task mergeDocs(dependsOn : 'compile', description:'Merge the internal dependencies into swc.') << {
        copy {
            into swcUnzipDir
            from zipTree("${buildDirName}/${output}.swc")
         }
        docsPackagesPath = "${swcUnzipDir}/docs/packages.dita"
        packages = new XmlSlurper().parse(docsPackagesPath)
        configurations.internal.files.each { file -> 
             extractPath = "${mergeDocDir}/internal-doc/${file.name}"
             copy {
                into extractPath
                from zipTree(file.path)
             }
             docDir = new File("${extractPath}/docs/")
             if(docDir.exists()) {
                internalPackages = new XmlSlurper().parse(new File("${extractPath}/docs/packages.dita"))
                internalPackages.apiItemRef.each {apiItem->
                    packages.appendNode(apiItem)
                }
             }
        }
        
        XmlUtil.serialize(packages, new FileOutputStream(new File(docsPackagesPath)))
    
    }
    
    task assembleWithInternalDocs(type: Zip, dependsOn : 'mergeDocs', description:'Zip the swc file with full packages.dita') {
        from(swcUnzipDir)
        extension 'swc'
        baseName archivesBaseName
        destinationDir new File(buildDirName)
    }
    

    MergeDocs and assembleWithInternalDocs

  5. Support Staff 5 Posted by Yennick Trevels on 12 Jun, 2012 06:03 AM

    Yennick Trevels's Avatar

    Thanks ;)

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac