FWD Source Code Analytics
Added by Atul Dalvi over 6 years ago
How can we use FWD only for Source Code Analytics without much complicated setup ?
Replies (155)
RE: FWD Source Code Analytics - Added by Greg Shah over 6 years ago
The best way to do this is to start with one of the template projects. Pick the project that most closely matches your application. For example, a batch, appserver or ChUI application might use the ChUI project.
Each of these projects has some documentation on how to use the project as a template (for example, the ChUI version).
Using the scripts provided, one can get started because you are re-using most of an existing configuration.
With that in mind here are some additional things to note:
- We are just now finalizing the release of FWD v3.1 that has all the code analytics built in. I expect it to be available within the next week. If you need the code sooner, we can provide a drop of code now (it would be close to but not the same as the version that will be released as v3.1).
- At the same time we update the FWD code, we will also update the template projects. The current templates don't work for Analytics but can be used for the older Reporting tools.
- We are updating the Analytics documentation to make it clear how to setup and use the tools.
Let me know if you want early access. Otherwise, I will post here when we release everything and have the documentation updated.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Thanks.
Its not urgent, will wait for the next release. But for the Source Code Analytics, I have to setup all the components that you have mentioned in the document for FWD tool or it needs small setup ? It seems setup for whole FWD tool is quite complicated for me.
Pls suggest.
RE: FWD Source Code Analytics - Added by Greg Shah over 6 years ago
But for the Source Code Analytics, I have to setup all the components that you have mentioned in the document for FWD tool or it needs small setup ?
Not all steps from the use Hotel Project as a Template document are needed. Only steps 1 through 3 are needed for the Analytics.
This setup only needs to be done once. From then on, newer drops of 4GL code can be analyzed with little or no changes to your configuration and scripts.
The documentation we are preparing will make this clear.
It seems setup for whole FWD tool is quite complicated for me.
The setup for Analytics is much less than for full conversion and the runtime installation. For the use for running the converted application, there can be many details to get right. To make this easier:
- We have a developer virtual machine that can be downloaded and used to try the technology. All of the FWD code and dependencies are pre-installed and configured.
- We are working on automating this installation using devops tools (Vagrant and Ansible). This will make it easy to setup custom systems with FWD, including in the cloud. This part is not done yet but an early version has been implemented.
Anyway, for Analytics the installation is much less and should not be too difficult. If you do encounter any issues, we will be happy to help.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Hello,
But I think it still needs built copy of the FWD project named p2j as mentioned in the 3rd step. Can you pls give a step by step direction to setup the Source Code Analytics.
RE: FWD Source Code Analytics - Added by Greg Shah over 6 years ago
Today we have released the Code Analytics tools as part of FWD v3.1. The release can be downloaded from https://proj.goldencode.com/projects/p2j/wiki/FWD_v3_1_0.
The instructions on how to set it up can be found in Code Analytics. The "Setup, Parsing and Calculating Reports" section is complete enough for getting everything running. Follow the instructions in chapters 2 through 7. These instructions have been written to be straightforward and to eliminate unnecessary steps.
The Usage section is still being written but it has enough there to get going.
RE: FWD Source Code Analytics - Added by Greg Shah over 6 years ago
FYI, I just added a chapter on Internationalization to the setup portion. The instructions are now in chapters 2 through 8.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Thanks Greg. It looks simple now. But I am facing one problem here.
As per the chapter 2, I added JDK JRE locations in the PATh but I am using JDK and JRE folder from OpenEdge 11.6 installation - version 7 ( D:\Progressx86\OpenEdge\116\jdk\bin ) as I don't have JDK jdk1.8.0_121 installed on my dev system. Is that OK ?
Also while performing gradlew.bat jar command, our system is not allowing to download and cache the correct version of Gradle on first usage as we have firewall settings ( https://services.gradle.org/distributions/gradle-3.0-bin.zip ).
How can I bypass this step ?
Is that possible to download that zip file on different machine and then copy into the c:\app_name\p2j folder ? If yes, then what will be the folder name for that as we already have one folder named gradle inside c:\app_name\p2j
RE: FWD Source Code Analytics - Added by Greg Shah over 6 years ago
As per the chapter 2, I added JDK JRE locations in the PATh but I am using JDK and JRE folder from OpenEdge 11.6 installation - version 7 ( D:\Progressx86\OpenEdge\116\jdk\bin ) as I don't have JDK jdk1.8.0_121 installed on my dev system. Is that OK ?
Unfortunately, no. We cannot run on versions before Java 8.
Also while performing gradlew.bat jar command, our system is not allowing to download and cache the correct version of Gradle on first usage as we have firewall settings ( https://services.gradle.org/distributions/gradle-3.0-bin.zip ).
How can I bypass this step ?
The gradlew.bat is the so-called "Gradle Wrapper". Instead of that version which does an automatic download, you can install Gradle manually. Once it is installed locally, you would no longer use gradlew.bat
, you would directly use the local Gradle.
You should also know that if you encounter issues when Gradle subsequently downloads the build dependencies, you can manually download the dependencies in local-repo/ form and then unzip it into the p2j/
directory. This is all the jar files needed by the build and to run the code.
Hynek: Do you agree with my assessment? Also: please document the process for a local install of Gradle. It probably should be part of the Building FWD From Source chapter.
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Greg Shah wrote:
The gradlew.bat is the so-called "Gradle Wrapper". Instead of that version which does an automatic download, you can install Gradle manually. Once it is installed locally, you would no longer use
gradlew.bat
, you would directly use the local Gradle.You should also know that if you encounter issues when Gradle subsequently downloads the build dependencies, you can manually download the dependencies in local-repo/ form and then unzip it into the
p2j/
directory. This is all the jar files needed by the build and to run the code.Hynek: Do you agree with my assessment?
Greg, yes this is correct.
I will only add that if the firewalled environment allows connection through a HTTP/HTTPS proxy, then it is enough to configure Gradle to use the proxy. The steps are (1) create the file gradle.properties
in the project dir (or in the home dir) and (2) set the properties as follows.
systemProp.http.proxyHost=www.somehost.org systemProp.http.proxyPort=8080 systemProp.http.proxyUser=userid systemProp.http.proxyPassword=password systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
More details can be found at https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy.
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Please see Building_FWD_From_Source, the page covers the case when the build system resides in a controlled environment behind a firewall.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Thanks all.
As suggested,
1. Installed Gradle manually ( Location - C:\FWD\gradle\ )
2. Manually downloaded the dependencies in local-repo/ form and then unzip it into the p2j/ directory ( Location - C:\FWD\p2j\local-repo )
3. Installed JDK 9 and JRE 9 ( Location - C:\Program Files\Java\jdk-9 & C:\Program Files\Java\jre-9 )
4. Created one batch program to trigger the local Gradle as below for Build FWD -
@echo off
rem FWD JOB
rem working directory command files
set WrkDir=C:\FWD\gradle\bin
rem Set FWD HOME
set FWD=C:\FWD\p2j
rem Set JAVA HOME
set JAVA_HOME=C:\Program Files\Java\jdk-9
rem Set PATH
set PATH=%PATH%;%JAVA_HOME%;%FWD%
Call C:\FWD\gradle\bin\gradle.bat jar
5. Always getting below error -
FAILURE: Build failed with an exception.
- What went wrong:
Task 'jar' not found in root project 'bin'.
- Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option
to get the stack trace. Run with --info or --debug option to get more log output
.
- Get more help at https://help.gradle.org
BUILD FAILED in 1s
Not getting what is the issue. Inside C:\Program Files\Java\jdk-9\bin task jar is there but still showing error for this.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Atul Dalvi wrote:
Thanks all.
As suggested,1. Installed Gradle manually ( Location - C:\FWD\gradle\ )
2. Manually downloaded the dependencies in local-repo/ form and then unzip it into the p2j/ directory ( Location - C:\FWD\p2j\local-repo )
3. Installed JDK 9 and JRE 9 ( Location - C:\Program Files\Java\jdk-9 & C:\Program Files\Java\jre-9 )
4. Created one batch program to trigger the local Gradle as below for Build FWD -@echo off
rem FWD JOB
rem working directory command files
set WrkDir=C:\FWD\gradle\binrem Set FWD HOME
set FWD=C:\FWD\p2jrem Set JAVA HOME
set JAVA_HOME=C:\Program Files\Java\jdk-9rem Set PATH
set PATH=%PATH%;%JAVA_HOME%;%FWD%Call C:\FWD\gradle\bin\gradle.bat jar
5. Always getting below error -
FAILURE: Build failed with an exception.
- What went wrong:
Task 'jar' not found in root project 'bin'.
- Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option
to get the stack trace. Run with --info or --debug option to get more log output
.
- Get more help at https://help.gradle.org
BUILD FAILED in 1s
Not getting what is the issue. Inside C:\Program Files\Java\jdk-9\bin task jar is there but still showing error for this.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Hi,
Installed ANT aswell but still same error ( Location - C:\FWD\apache-ant )
Modified batch program --
@echo off
rem FWD JOB
rem working directory command files
set WrkDir=C:\FWD\gradle\bin
rem Set FWD HOME
set FWD=C:\FWD\p2j
rem Set JAVA HOME
set JAVA_HOME=C:\Program Files\Java\jdk-9
rem Set ANT HOME
set ANT_HOME=C:\FWD\apache-ant
rem Set PATH
set PATH=%PATH%;%JAVA_HOME%;%FWD%;%ANT_HOME%
Call C:\FWD\gradle\bin\gradle.bat jar
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Atul Dalvi wrote:
Thanks all.
As suggested,1. Installed Gradle manually ( Location - C:\FWD\gradle\ )
2. Manually downloaded the dependencies in local-repo/ form and then unzip it into the p2j/ directory ( Location - C:\FWD\p2j\local-repo )
3. Installed JDK 9 and JRE 9 ( Location - C:\Program Files\Java\jdk-9 & C:\Program Files\Java\jre-9 )
4. Created one batch program to trigger the local Gradle as below for Build FWD -@echo off
rem FWD JOB
rem working directory command files
set WrkDir=C:\FWD\gradle\binrem Set FWD HOME
set FWD=C:\FWD\p2jrem Set JAVA HOME
set JAVA_HOME=C:\Program Files\Java\jdk-9rem Set PATH
set PATH=%PATH%;%JAVA_HOME%;%FWD%Call C:\FWD\gradle\bin\gradle.bat jar
5. Always getting below error -
FAILURE: Build failed with an exception.
- What went wrong:
Task 'jar' not found in root project 'bin'.
It seems like the work directory for the script is not c:\FWD\p2j, as it should be, but c:\FWD\gradle\bin. Please try again with the following script, also make sure you run the script from within c:\FWD\p2j.
@echo off rem FWD JOB rem working directory command files rem set WrkDir=C:\FWD\gradle\bin rem Set FWD HOME set FWD=C:\FWD\p2j rem Set JAVA HOME set JAVA_HOME=C:\Program Files\Java\jdk-9 rem Set PATH set PATH=%PATH%;%JAVA_HOME%;%FWD%;C:\FWD\gradle\bin gradle.bat jar
Also, the current stable release of FWD doesn't support JDK 9. Java 9 removes some deprecated packages FWD at the moment depends on. Please uninstall JDK 9 and install the latest JDK 8 instead.
Please let us know if you encounter more issues.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Thanks.
As suggested, I modified and it worked for me, created build folder inside C:\FWD\p2j.
BUILD SUCCESSFUL in 2m 46s
26 actionable tasks: 26 executed
I will check for the next steps that "Gathering Inputs".
Anything I am missing here in this step "FWD Installation " after build successful ?
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Atul Dalvi wrote:
Thanks.
As suggested, I modified and it worked for me, created build folder inside C:\FWD\p2j.BUILD SUCCESSFUL in 2m 46s
26 actionable tasks: 26 executedI will check for the next steps that "Gathering Inputs".
Anything I am missing here in this step "FWD Installation " after build successful ?
I am assuming your near-term objective is to do a conversion of the Progress 4GL code, correct? If so you can skip to "Gathering Inputs". But please note that there are some more steps required when running a converted application - especially setting up the database and building the native client spawner.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
No, my objective is to use FWD for Source Code Analytics as of now and so I am performing these steps.
So now I downloaded sample project GUI template as mentioned in the Project Setup section. But while performing "prepare_template.cmd -a" command from location "C:\FWD\p2j\Project" getting below errors -
Error: Could not find or load main class com.goldencode.p2j.directory.DirectoryC
opy
Caused by: java.lang.ClassNotFoundException: com.goldencode.p2j.directory.Direct
oryCopy
Error: Could not find or load main class com.goldencode.p2j.directory.DirectoryC
opy
Caused by: java.lang.ClassNotFoundException: com.goldencode.p2j.directory.Direct
oryCopy
Error: Could not find or load main class com.goldencode.p2j.directory.DirectoryC
opy
Caused by: java.lang.ClassNotFoundException: com.goldencode.p2j.directory.Direct
oryCopy
Error: Could not find or load main class com.goldencode.p2j.directory.DirectoryC
opy
Caused by: java.lang.ClassNotFoundException: com.goldencode.p2j.directory.Direct
oryCopy
Error: Could not find or load main class com.goldencode.p2j.directory.DirectoryC
opy
Caused by: java.lang.ClassNotFoundException: com.goldencode.p2j.directory.Direct
oryCopy
1 file(s) copied.
The filename, directory name, or volume label syntax is incorrect.
Pls suggest.
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Atul Dalvi wrote:
No, my objective is to use FWD for Source Code Analytics as of now and so I am performing these steps.
So now I downloaded sample project GUI template as mentioned in the Project Setup section. But while performing "prepare_template.cmd -a" command from location "C:\FWD\p2j\Project" getting below errors -
Make sure you follow the recommended project dir layout. It will be much easier to get started quickly this way. In particular what you want to end up with is
Top level project directory: c:\FWD\ FWD project location: c:\FWD\p2j\ Application project location: c:\FWD\Project\
Then create FWD directory symlink in the project directory. This is needed because the scripts assume c:\FWD\Project\p2j exists with built FWD. The symlink is used here so that the project dir can be versioned for example without the FWD project content. Use the commands:
cd c:\FWD\Project\ mklink /D p2j ..\p2j
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
From command prompt, I am performing "prepare_template.cmd -a" this steps. I created the same structure as you suggested.
C:\FWD>cd c:\FWD\Project\
c:\FWD\Project>mklink /D p2j ..\p2j
You do not have sufficient privilege to perform this operation.
Below are the errors without that -----
Caused by: java.lang.ClassNotFoundException: com.goldencode.p2j.directory.D
oryCopy
The system cannot find the file cfg\p2j.cfg.xml.template.
The system cannot find the file specified.
Could Not Find c:\FWD\Project\cfg\p2j.cfg.xml
The system cannot find the file cfg\p2j.cfg.xml.dbs.
Could Not Find c:\FWD\Project\cfg\p2j.cfg.xml.dbs
Could Not Find c:\FWD\Project\hotel.bat
Could Not Find c:\FWD\Project\data\hotel.df
Could Not Find c:\FWD\Project\manifest\hotel.mf
Could Not Find c:\FWD\Project\src\text-metrics.xml
Could Not Find c:\FWD\Project\start_hotel_abl.cmd
The system cannot find the file specified.
The system cannot find the file specified.
The filename, directory name, or volume label syntax is incorrect.
Could Not Find c:\FWD\Project\cfg\p2j.cfg.xml.template
Could Not Find c:\FWD\Project\deploy\server\directory.xml.template
Could Not Find c:\FWD\Project\build.properties.template
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Atul Dalvi wrote:
From command prompt, I am performing "prepare_template.cmd -a" this steps. I created the same structure as you suggested.
C:\FWD>cd c:\FWD\Project\
c:\FWD\Project>mklink /D p2j ..\p2j
You do not have sufficient privilege to perform this operation.
You need to run mklink from an elevated shell (Right-click the Command Prompt shortcut, Run As Administrator).
If you are running mklink from an elevated shell, check the permissions on the directory and make sure there aren't any explicit Deny permissions set for the Administrators group.
If you still get troubles creating the symlink I suggest you just move c:\FWD\p2j in c:\FWD\Project.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Hi,
I copied c:\FWD\p2j in c:\FWD\Project but still getting the same errors.
Do I need to run build again after copy ?
RE: FWD Source Code Analytics - Added by Hynek Cihlar over 6 years ago
Atul Dalvi wrote:
Hi,
I copied c:\FWD\p2j in c:\FWD\Project but still getting the same errors.
Do I need to run build again after copy ?
Did you end up with the structure c:\FWD\Project\p2j\build\lib\*.jar? Did you run the prepare_template.cmd
from c:\FWD\Project? You should not need to build again after copy.
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Yes, this c:\FWD\Project\p2j\build\lib\*.jar structure is available. I have attached screenshot for the same.
And after that I am running "prepare_template.cmd -a" command but getting below errors.
C:\FWD\Project>prepare_template.cmd -a
Enter your application name (only letters or digits, first character a letter):
Talk3
1. Enter conversion configurations for your project
Edit the regex which matches all your include files (enter for default '*.[fhi]'
): .[fhi]
Edit the regex which matches all your program files (enter for default '.[pPwW]
'): *.[pPwW]
Enter the PROPATH from your progress.ini file (enter for default '.:'): .;
2. Enter database configuration for your project
Enter the legacy database name(s), separated by a comma: mercator,procs,stddb,ta
lkcore,talkmig,wldb
Could Not Find C:\FWD\Project\build.properties
The system cannot find the file build.properties.template.
Could Not Find C:\FWD\Project\deploy\server\directory.xml
The system cannot find the file deploy\server\directory.xml.template.
okt. 04, 2017 12:54:04 P.M. com.goldencode.p2j.directory.DirectoryService log
WARNING: {main} Failed copy of subtree from '/server/standard/database/' to '/se
rver/standard/database/'
copy operation failed
okt. 04, 2017 12:54:04 P.M. com.goldencode.p2j.directory.DirectoryService log
WARNING: {main} Failed copy of subtree from '/server/standard/database/' to '/se
rver/standard/database/'
copy operation failed
okt. 04, 2017 12:54:06 P.M. com.goldencode.p2j.directory.DirectoryService log
WARNING: {main} Failed copy of subtree from '/server/standard/database/' to '/se
rver/standard/database/'
copy operation failed
okt. 04, 2017 12:54:07 P.M. com.goldencode.p2j.directory.DirectoryService log
WARNING: {main} Failed copy of subtree from '/server/standard/database/' to '/se
rver/standard/database/'
copy operation failed
okt. 04, 2017 12:54:08 P.M. com.goldencode.p2j.directory.DirectoryService log
WARNING: {main} Failed copy of subtree from '/server/standard/database/' to '/se
rver/standard/database/'
copy operation failed
Could Not Find C:\FWD\Project\cfg\p2j.cfg.xml
The system cannot find the file cfg\p2j.cfg.xml.template.
The system cannot find the file specified.
Could Not Find C:\FWD\Project\cfg\p2j.cfg.xml
The system cannot find the file cfg\p2j.cfg.xml.dbs.
Could Not Find C:\FWD\Project\cfg\p2j.cfg.xml.dbs
Could Not Find C:\FWD\Project\hotel.bat
Could Not Find C:\FWD\Project\data\hotel.df
Could Not Find C:\FWD\Project\manifest\hotel.mf
Could Not Find C:\FWD\Project\src\text-metrics.xml
Could Not Find C:\FWD\Project\start_hotel_abl.cmd
The system cannot find the file specified.
The system cannot find the file specified.
The filename, directory name, or volume label syntax is incorrect.
Could Not Find C:\FWD\Project\cfg\p2j.cfg.xml.template
Could Not Find C:\FWD\Project\deploy\server\directory.xml.template
Could Not Find C:\FWD\Project\build.properties.template
C:\FWD\Project>
What will we expect after running this command ?
OVL_TC01_Quote.png (61.7 KB)
RE: FWD Source Code Analytics - Added by Atul Dalvi over 6 years ago
Sorry new image attached for the directory structure
FWDP.jpg (109 KB)
RE: FWD Source Code Analytics - Added by Constantin Asofiei over 6 years ago
Atul, the prepare_template.sh -a
script assumes it will run only once, and it will clear all template files after the first run, if the application is not named hotel
.
- unzip the contents of the Hotel GUI project archive again, in your
C:\FWD\Project
folder - copy the attached
prepare_template.cmd
file toC:\FWD\Project
- I've removed the code which clears the.template
files, so you will be able to run this script more than once
prepare_template.cmd (10.2 KB)