Hosting Javadocs
The following section describes the steps taken to generate and publish javadocs to github pages.
First the implementing developer should create a gh-pages
branch
After creating the gh-pages
branch the following actions will have to be carried out by someone with admin access for the OpenSRP repos :-
Create a personal github access token with
public_repo
permission only to allow travis to deploy the java docs to thegh-pages
branch. Instructions can be found here . This has already been done for the OpenSRP projects. No need to create another one at the moment.Configure a publishing source for the github pages site using directions provided here
If the site has not published i.e you cannot view the projects Readme contents on http://smartregister.org/ {project repo name} , the admin should make a blank commit & push on the
gh-pages
branch for the project using this commandgit commit -S -m "Trigger CI" --allow-empty
. After the push, the contents of the project's Readme files should be displayed on http://smartregister.org/ {project repo name} url.Encrypt the gitub token generated on step 1 using the following command
travis encrypt GITHUB_TOKEN=actual_github_access_token
. Note that this step has to be done in the project directory itself. Encrypted travis values cannot be shared between projectsThis command will create the github access token and add it to the
travis.yml
file automatically.travis encrypt GITHUB_TOKEN=actual_github_access_token --add
You need
travis
installed on your local environment. Use the following commands:Ubuntu :-
sudo apt install ruby ruby-dev sudo gem install travis
Mac : -
brew install ruby gem update --system gem install travis -v 1.8.8 --no-rdoc --no-ri
The following details steps for setting up travis to generate and publish javadocs to github pages. This can be done by any developer.
This Reveal PR can be used as a template to follow.
Create a branch based on master. This can have any name you deem fit e.g
travis-deploy-javadoc
Add a gradle task in the project build file for generating javadocs in the project’s build.gradle file as shown here
For a library make sure this gradle task is placed on the library’s build.gradle file and not the sample app’s build.gradle file.
In the travis.yml file add a command for generating the javadocs as shown here on line 53 and 54. This goes in the
script
sectionIn the travis.yml file add a github pages provider which will deploy the javadocs to the github pages branch as shown here on line 58 to 64 . The special note of the following variables :-
local_dir
This variable specifies the location where the generated javadocs are found in the project structure
branch
The branch on which the deployment will be triggered on when a git push is done. Branch created on step 1 e.g
travis-deploy-javadoc
. This will be changed later tomaster
In the travis.yml file add the encrypted github access token to the
global env
section as shown herePush these changes. After a successful build the generated javadocs should be published on http://smartregister.org/{project repo name}
After confirming that the javadocs have been published, change the deploy branch to master as shown here . This is done so as to ensure that publishing of the javadocs is only done after changes are merged to master.
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.