@@ -526,259 +526,7 @@ See https://github.com/oracle/opengrok/wiki/Webapp-configuration
526
526
527
527
## 8. Information for developers
528
528
529
- ### 8.0 Building
530
-
531
- Just run ` ant ` from command line in the top-level directory or use build
532
- process driven by graphical developer environment such as Netbeans.
533
-
534
- Note: in case you are behind http proxy, use ` ANT_OPTS ` to download jflex, lucene.
535
- E.g.
536
- ``` bash
537
- ANT_OPTS=" -Dhttp.proxyHost=?.? -Dhttp.proxyPort=80" ant
538
- ```
539
-
540
- #### 8.0.1 Package build
541
-
542
- Run ` ant package ` to create package (specific for the operating system this is
543
- being executed on) under the ` dist/ ` directory.
544
-
545
- ### 8.1 Unit testing
546
-
547
- ** Note** : For full coverage report, a proper junit test environment is required.
548
- That would mean:
549
-
550
- * You have to use Ant 1.9 and above
551
- * At least ` junit-4.12.jar ` and its dependencies have to be in ant's
552
- classpath (e.g. in ` ./lib ` ). The test task will download them automatically.
553
- * Your ` PATH ` must contain directory with exuberant ctags binary
554
- * ** Note** : make sure that the directory which contains exuberant ctags binary
555
- is prepended before the directory with plain ctags program.
556
- * Your ` PATH ` variable must contain directories which contain binaries of
557
- appropriate SCM software which means commands hg, sccs, cvs, git, bzr, svn
558
- (svnadmin too). They must be available for the full report.
559
-
560
- The tests are then run as follows:
561
-
562
- ``` bash
563
- ant -lib ./lib test
564
- ```
565
-
566
- To check if the test completed without error look for ` AssertionFailedError `
567
- occurrences in the ` TESTS-TestSuites.xml ` file produced by the test run.
568
-
569
- ### 8.2 Using Findbugs
570
-
571
- If you want to run Findbugs (< http://findbugs.sourceforge.net/ > ) on OpenGrok,
572
- you have to download Findbugs to your machine, and install it where you have
573
- checked out your OpenGrok source code, under the ` lib/findbugs ` directory,
574
- like this:
575
-
576
- ``` bash
577
- cd ~ /.ant/lib
578
- wget http://..../findbugs-x.y.z.tar.gz
579
- gtar -xf findbugs-x.y.z.tar.gz
580
- mv findbugs-x.y.z findbugs
581
- ```
582
-
583
- You can now run ant with the findbugs target:
584
-
585
- ```
586
- $ ant findbugs
587
- ...
588
- findbugs:
589
- [findbugs] Executing findbugs from ant task
590
- [findbugs] Running FindBugs...
591
- [findbugs] Warnings generated: nnn
592
- [findbugs] Output saved to findbugs/findbugs.html
593
- ```
594
-
595
- Now, open ` findbugs/findbugs.html ` in a web-browser, and start fixing bugs!
596
-
597
- If you want to install findbugs some other place than ` ~/.ant/lib ` , you can
598
- untar the ` .tar.gz ` file to a directory, and use the ` findbugs.home ` property to
599
- tell ant where to find findbugs, like this (if you have installed fundbugs
600
- under the lib directory):
601
-
602
- ``` bash
603
- ant findbugs -Dfindbugs.home=lib/findbug
604
- ```
605
-
606
- There is also a ` findbugs-xml ` ant target that can be used to generate XML files
607
- that can later be parsed, e.g. by Jenkins.
608
-
609
- ### 8.3 Using Jacoco
610
-
611
- If you want to check test coverage on OpenGrok, download jacoco from
612
- < http://www.eclemma.org/jacoco/ > . Place ` jacocoagent.jar ` and ` jacocoant.jar ` in the
613
- ` opengrok/lib ` , ` ~/.ant/lib ` or into classpath (` -lib ` option of ant).
614
-
615
- Now you can instrument your classes and test them run:
616
-
617
- ``` bash
618
- ant -Djacoco=true -Djacoco.home=/< path_to> /jacoco jacoco-code-coverage
619
- ```
620
-
621
- Now you should get output data in ` jacoco.exec `
622
-
623
- Look at ` jacoco/index.html ` to see how complete your tests are.
624
-
625
- ### 8.4 Using Checkstyle
626
-
627
- To check that your code follows the standard coding conventions,
628
- you can use checkstyle from < http://checkstyle.sourceforge.net/ >
629
-
630
- First you must download checkstyle from < http://checkstyle.sourceforge.net/ > .
631
- You need Version 6.8 (or newer). Extract the package you have
632
- downloaded, and create a symbolic link to it from ` ~/.ant/lib/checkstyle ` ,
633
- e.g. like this:
634
-
635
- ``` bash
636
- cd ~ /.ant/lib
637
- unzip ~ /Desktop/checkstyle-7.6.zip
638
- ln -s checkstyle-7.6 checkstyle
639
- ```
640
-
641
- You also have to create symbolic links to the jar files:
642
-
643
- ``` bash
644
- cd checkstyle
645
- ln -s checkstyle-7.6-all.jar checkstyle-all.jar
646
- ```
647
-
648
- To run checkstyle on the source code, just run ant checkstyle:
649
-
650
- ``` bash
651
- ant checkstyle
652
- ```
653
-
654
- Output from the command will be stored in the checkstyle directory.
655
-
656
- If you want to install checkstyle some other place than ` ~/.ant/lib ` , you can
657
- untar the ` .tar.gz ` file to a directory, and use the ` checkstyle.home ` property
658
- to tell ant where to find checkstyle, like this (if you have installed
659
- checkstyle under the lib directory):
660
-
661
- ``` bash
662
- ant checkstyle -Dcheckstyle.home=lib/checkstyle
663
- ```
664
-
665
- ### 8.5 Using PMD and CPD
666
-
667
- To check the quality of the OpenGrok code you can also use PMD
668
- from < https://pmd.github.io/ > .
669
-
670
- How to install:
671
-
672
- ``` bash
673
- cd ~ /.ant/lib
674
- unzip ~ /Desktop/pmd-bin-5.5.4.zip
675
- ln -s pmd-5.5.4/ pmd
676
- ```
677
-
678
- To run PMD on the source code, just run ant pmd:
679
-
680
- ``` bash
681
- ant -Dpmd.home=~ /.ant/lib/pmd pmd
682
- ```
683
-
684
- Output from the command will be stored in the pmd subdirectory:
685
-
686
- ```
687
- $ ls pmd
688
- pmd_report.html pmd_report.xml
689
- ```
690
-
691
- If you want to install PMD some other place than ` ~/.ant/lib ` , you can
692
- unzip the ` .zip ` file to a directory, and use the ` pmd.home ` property
693
- to tell ant where to find PMD, like this (if you have installed
694
- PMD under the ` ./ext_lib directory ` ):
695
-
696
- ``` bash
697
- ant pmd -Dpmd.home=ext_lib/pmd
698
- ```
699
-
700
- To run CPD, just use the same as above, but use targets:
701
-
702
- ``` bash
703
- ant -Dpmd.home=ext_lib/pmd cpd cpd-xml
704
- ```
705
-
706
- Which will result in:
707
-
708
- ```
709
- $ ls pmd
710
- cpd_report.xml cpd_report.txt
711
- ```
712
-
713
- ### 8.6 Using JDepend
714
-
715
- To see dependencies in the source code, you can use JDepend from
716
- < https://github.com/clarkware/jdepend > .
717
-
718
- How to install:
719
-
720
- ``` bash
721
- cd ~ /.ant/lib
722
- unzip ~ /Desktop/jdepend-2.9.1.zip
723
- ln -s jdepend-2.9.1/ jdepend
724
- cd jdepend/lib
725
- ln -s jdepend-2.9.1.jar jdepend.jar
726
- ```
727
-
728
- How to analyze:
729
-
730
- ``` bash
731
- ant jdepend
732
- ```
733
-
734
- Output is stored in the jdepend directory:
735
-
736
- ```
737
- $ ls jdepend/
738
- report.txt report.xml
739
- ```
740
-
741
- ### 8.7 Using SonarQube
742
-
743
- Use a sonar runner with included ` sonar-project.properties ` properties,
744
- e.g. using bash:
745
-
746
- ``` bash
747
- cd < checkout_dir> # it has to contain sonar-project.properties!
748
- export SONAR_RUNNER_OPTS=" -Xmx768m -XX:MaxPermSize=256m"
749
- export SERVERIP=10.163.26.78
750
- ~ //Projects/sonar-runner-2.3/bin/sonar-runner \
751
- -Dsonar.host.url=http://${SERVERIP} :9000 \
752
- -Dsonar.jdbc.url=jdbc:h2:tcp://${SERVERIP} :9092/sonar
753
- ```
754
-
755
- ### 8.8 Using Travis CI
756
-
757
- Travis depends on updated and working maven build.
758
- Please see ` .travis.yml ` , if your branch has this file,
759
- you should be able to connect your Github to Travis CI.
760
- OpenGroks Travis is here: < https://travis-ci.org/OpenGrok/OpenGrok >
761
-
762
- ### 8.9 Maven
763
-
764
- The build can now be done through Maven (< https://maven.apache.org/ > ) which takes care of the dependency management
765
- and setup (calls Ant for certain actions).
766
-
767
- #### 8.9.1 Unit Testing
768
-
769
- You can test the code at the moment by running ` ./mvnw test ` which will execute * all* tests.
770
- Conditionally, if you don't have every type of repository installed, you can set it to unit-test only those which are
771
- found to be working on your system.
772
-
773
- ``` bash
774
- ./mvnw test -Djunit-force-all=false
775
- ```
776
-
777
- You can also force a specific repository test from running through the following system property
778
-
779
- ``` bash
780
- ./mvnw test -Djunit-force-all=false -Djunit-force-git=true
781
- ```
529
+ See https://github.com/oracle/opengrok/wiki/Developer-intro and https://github.com/oracle/opengrok/wiki/Developers
782
530
783
531
## 9. Tuning OpenGrok for large code bases
784
532
0 commit comments