Skip to content

DM-7511: add JSDoc generation into build system. #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions buildScript/depends.gincl
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,42 @@ task buildClient (dependsOn: loadConfig) {
inputs.dir "${fireflyPath}/src/firefly/js"

doLast {
def res = project.ext.NPM 'run', 'build'
if (!file("webpack.config.js").exists()) {
println ">> webpack.config.js not found. Skipping buildClient."
throw new StopExecutionException("webpack.config.js not found. Skipping buildClient.")
}
def res = project.ext.NODE 'npm', 'run', 'build'
if (res.getExitValue() != 0) {
throw new GradleException("Fail to build Client")
}
}
}

task buildJsDoc (dependsOn: loadConfig) {
def outdir = "${buildDir}/gwt/${project['app-name']}"

outputs.dir outdir
inputs.dir "${projectDir}"
inputs.dir "${fireflyPath}/docs"
inputs.dir "${fireflyPath}/src/firefly"

doLast {
if (!file("jsdoc_config.json").exists()) {
println ">> jsdoc_config.json not found. Skipping buildJsDoc."
throw new StopExecutionException("jsdoc_config.json not found. Skipping buildJsDoc.")
}
def res = project.ext.NODE "${fireflyPath}/node_modules/.bin/jsdoc", '-c', 'jsdoc_config.json', '-d', "${outdir}/jsdoc"
if (res.getExitValue() != 0) {
throw new GradleException("Fail to build Client")
}
}
}


/**
* this function setup npm environment then run the given command.
* this function setup node.js environment then run the given command.
*/
ext.NPM = { ...cmd ->
ext.NODE = { ...cmd ->
def wpBuildDir = "${buildDir}/gwt/${project['app-name']}"
def tag = "v" + getVersionTag() + ' Built On:' + build_time;

Expand All @@ -130,11 +155,6 @@ ext.NPM = { ...cmd ->
throw new GradleException("Task failed due to missing npm package manager which comes bundled with node.js", e)
}

if (!file("webpack.config.js").exists()) {
println ">> webpack.config.js not found. Skipping buildClient."
throw new StopExecutionException("webpack.config.js not found. Skipping buildClient.")
}

if (file("${rootDir}/package.json").exists()) {
exec {
workingDir = rootDir
Expand All @@ -150,8 +170,7 @@ ext.NPM = { ...cmd ->
environment '__$help_base_url': project.appConfigProps['help.base.url']
environment 'WP_BUILD_DIR': wpBuildDir
environment 'NODE_ENV': (project.env == 'local' ? 'development' : 'production')
executable "npm"
args cmd
commandLine cmd
}
return res;
}
2 changes: 1 addition & 1 deletion buildScript/gwt.gincl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ task devMode (dependsOn: loadConfig) {
outputs.upToDateWhen { false }

doLast {
def res = project.ext.NPM 'run', 'dev'
def res = project.ext.NODE 'npm', 'run', 'dev'
if (res.getExitValue() == 0) {
throw new GradleException("Fail to run dev mode")
}
Expand Down
3 changes: 2 additions & 1 deletion buildScript/gwt_webapp.gincl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ task deploy (dependsOn: [loadConfig, webapp]) << {
}

task buildAndDeploy( dependsOn:[war, deploy] )

task buildAllAndDeploy( dependsOn:[war, buildJsDoc, deploy] )

task buildAndPublish( dependsOn: war ) << {
description= 'Build the war file and then publish it to a remote host. Property ${publish_host} is required'
Expand Down Expand Up @@ -248,6 +248,7 @@ task publishToGithub (dependsOn: loadConfig) {
//-------------------------
loadConfig.mustRunAfter gwt
buildClient.mustRunAfter prepareWebapp
buildJsDoc.mustRunAfter prepareWebapp
prepareWebapp.mustRunAfter gwtCompile
gwtCompile.mustRunAfter jar
deploy.mustRunAfter war
Expand Down
1 change: 1 addition & 0 deletions src/firefly/config/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
</mime-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>@launch.page@</welcome-file>
</welcome-file-list>

Expand Down
45 changes: 22 additions & 23 deletions src/firefly/jsdoc_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
},
"source": {
"include": [
"src/firefly/js/api/",
"src/firefly/js/tables/TableUtil.js",
"src/firefly/js/charts/XYPlotCntlr.js",
"src/firefly/js//visualize/CsysConverter.js",
"src/firefly/js/visualize/DrawLayerCntlr.js",
"docs/firefly-api-overview.md"
"./js/api/",
"./js/tables/TableUtil.js",
"./js/charts/XYPlotCntlr.js",
"./js//visualize/CsysConverter.js",
"./js/visualize/DrawLayerCntlr.js",
"../../docs/firefly-api-overview.md"

],
"exclude": [
Expand All @@ -33,36 +33,35 @@
"extensions": ["js", "jsx"]
},
"staticFiles": {
"include": ["./docs"],
"exclude": ["./docs/firefly-api-code-examples.md"],
"include": ["../../docs"],
"exclude": ["../../docs/firefly-api-code-examples.md"],
"includePattern": ".+\\.md?$",
"recursive": true

},


"opts": {
"template": "node_modules/ink-docstrap/template", //use the minami template insetad of the default
"template": "../../node_modules/ink-docstrap/template", //use the docstrap template insetad of the default
"encoding": "utf8", // same as -e utf8
"destination": "src/firefly/jsdoc/", // same as -d ./out/
"recurse": true , // same as -r
"tutorials": "./tutorial/", // same as -u path/to/tutorials
"tutorials": "../../tutorial/", // same as -u path/to/tutorials
"access": "all" //same as -a <value>, values are all, public, private etc

},
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"useLongnameInNav": true,
"include": ["./docs/"],
"exclude": ["./docs/firefly-api-code-examples.md"],
"recursive": true,
"outputSourceFiles":true,
"includeDate":true,
"navType" : "vertical",
"linenums":true,
"collapseSymbols": true,
"systemName" : "Firefly"
"cleverLinks" : false,
"monospaceLinks" : false,
"useLongnameInNav" : true,
"recursive" : true,
"outputSourceFiles" :true,
"includeDate" :true,
"navType" : "vertical",
"inverseNav" : true,
"linenums" :true,
"collapseSymbols" : false,
"systemName" : "Firefly",
"theme" : "spacelab"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the spacelab theme.

}

}
Expand Down