es ctags for code on win

发布时间 2023-06-21 16:07:12作者: fndefbwefsowpvqfx

setup

# dep: tar, 7z, pwsh, java

$theGrokRoot="D:/sevtest/opengrok"

$theTomcatRoot="D:/sevtest/tomcat"

$theGrokFile="./opengrok-1.12.11.tar.gz"
$theTomcatFile="./apache-tomcat-10.1.8.tar.gz"

#===============================================================================
# make root
#===============================================================================
New-Item -Path @($theGrokRoot,$theTomcatRoot) -ItemType Directory

#===============================================================================
# extract grok
#===============================================================================
cd $theGrokRoot

New-Item -Path @('src','data','dist','etc','log') -ItemType Directory

cd -

tar -C $theGrokRoot/dist --strip-components=1 -xzf $theGrokFile


#===============================================================================
# copy log property
#===============================================================================
Copy-Item -Path $theGrokRoot/dist/doc/logging.properties $theGrokRoot/etc/logging.properties


#===============================================================================
# extract Tomcat
#===============================================================================
tar -C $theTomcatRoot/ --strip-components=1 -xzf $theTomcatFile

#===============================================================================
# extract web page source
#===============================================================================
$webAppSource=$theTomcatRoot+"/webapps/source"

New-Item -Path @($webAppSource) -ItemType Directory

$inputSource=$theGrokRoot + "/dist/lib/source.war"
$sourceExtractPathOption="-o" + $webAppSource
7z x $inputSource $sourceExtractPathOption


#===============================================================================
# edit web.xml
#===============================================================================
$webConfig=$theTomcatRoot + "/webapps/source/WEB-INF/web.xml"
$fromString="/var/opengrok/etc/configuration.xml"
$toString=$theGrokRoot + "/etc/configuration.xml"
(Get-Content $webConfig).replace($fromString, $toString) | Set-Content $webConfig

Get-Content $theTomcatRoot/webapps/source/WEB-INF/web.xml

start tom

$theTomcatRoot="D:/sevtest/tomcat"


$env:CATALINA_HOME=$theTomcatRoot
$tomcatStartFile=$theTomcatRoot+"/bin/startup.bat"
echo $tomcatStartFile

cmd.exe -/c $tomcatStartFile

create index

$theGrokRoot="D:\sevtest\opengrok"

# universal ctags.exe is in current directory

$CurrentDirectory = Get-Location
$CurrentDirectoryString=Convert-Path -LiteralPath $CurrentDirectory
$absRootToUniversalCtags=$CurrentDirectoryString + "\ctags"


cmd.exe -/c java -jar $theGrokRoot\dist\lib\opengrok.jar -c $absRootToUniversalCtags -s $theGrokRoot\src -d $theGrokRoot\data -P -S -G -W $theGrokRoot\etc\configuration.xml

shut tom

$theTomcatRoot="D:/sevtest/tomcat"


$env:CATALINA_HOME=$theTomcatRoot
$tomcatShutdownFile=$theTomcatRoot+"/bin/shutdown.bat"
echo $tomcatShutdownFile

cmd.exe -/c $tomcatShutdownFile

127.0.0.1:8080/source

pitfall

missing configuration.xml

create index, the file will be created