Skip to content

Commit

Permalink
LDEV-5047 lucee 6.2 war support
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jul 24, 2024
1 parent 39a30d3 commit acbbe21
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 31 deletions.
23 changes: 21 additions & 2 deletions apps/updateserver/services/legacy/S3.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,24 @@ component {
local.warTmp=temp&"lucee-"&version&"-temp-"&createUniqueId()&".war";
var curr=getDirectoryFromPath(getCurrenttemplatePath());

var noServlet = checkVersionGTE( arguments.version, 6, 2 );
systemOutput("War Version check, gte 6.2: #noServlet#", true );

var warFolder = noServlet ? "war-6.2" : "war";

try {
// temp directory
// create paths and dir if necessary
local.build={};
loop list="extensions,common,website,war" item="local.name" {
local.tmp=curr & "build/"&name&"/";
local.tmp=curr & "build/" & name & "/";
if ( name == "extensions" && !directoryExists( tmp ) )
directoryCreate( tmp, true );
build[ name ]=tmp;
if ( name == "war" ){
tmp = curr & "build/" & warFolder & "/";
}
build[ name ] = tmp;

}
systemOutput( "---- createWar", true );
systemOutput( build, true );
Expand Down Expand Up @@ -601,6 +610,16 @@ component {
return temp;
}

private function checkVersionGTE( version, major, minor ){
var v = listToArray( arguments.version, "." );
if ( v[ 1 ] gt arguments.major ) {
return true;
} else if ( v[ 1 ] eq arguments.major && v[ 2 ] gte arguments.minor ) {
return true;
}
return false;
}

}


Expand Down
110 changes: 110 additions & 0 deletions apps/updateserver/services/legacy/build/war-6.2/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true"
version="2.5">

<servlet>
<servlet-name>CFMLServlet</servlet-name>
<servlet-class>lucee.loader.servlet.CFMLServlet</servlet-class>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- to specify the location of the Lucee Server config and libraries, -->
<!-- uncomment the init-param below. make sure that the param-value -->
<!-- points to a valid folder, and that the process that runs Lucee has -->
<!-- write permissions to that folder. leave commented for defaults. -->
<!--
<init-param>
<param-name>lucee-server-directory</param-name>
<param-value>/var/Lucee/config/server/</param-value>
<description>Lucee Server configuration directory (for Server-wide configurations, settings, and libraries)</description>
</init-param>
!-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- to specify the location of the Web Contexts' config and libraries, -->
<!-- uncomment the init-param below. make sure that the param-value -->
<!-- points to a valid folder, and that the process that runs Lucee has -->
<!-- write permissions to that folder. the {web-context-label} can be -->
<!-- set in Lucee Server Admin homepage. leave commented for defaults. -->
<!--
<init-param>
<param-name>lucee-web-directory</param-name>
<param-value>/var/Lucee/config/web/{web-context-label}/</param-value>
<description>Lucee Web Directory (for Website-specific configurations, settings, and libraries)</description>
</init-param>
!-->
<load-on-startup>2</load-on-startup>

</servlet>


<!-- ===================================================================== -->
<!-- Lucee REST Servlet - handles Lucee's RESTful web services -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
<servlet-name>RESTServlet</servlet-name>
<servlet-class>lucee.loader.servlet.RestServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>

<!-- ===================================================================== -->
<!-- Lucee MessageBroker Servlet - Flex Gateway -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- * ATTENTION - ATENCION - ACHTUNG - ATTENTION - ATENCION - ACHTUNG * -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- messageBrokerId must be unique for each defintion of the MessageBroker-->
<!-- Servlet. if you use the MessageBroker Servlet and define it in more -->
<!-- than one xml file, you must uncomment the messageBrokerId init-param -->
<!-- and set a different value in each definition. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- <servlet>
<description>Lucee Servlet for Flex Gateway</description>
<servlet-name>MessageBrokerServlet</servlet-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<init-param>
<param-name>messageBrokerId</param-name>
<param-value>_default_</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet> -->



<servlet-mapping>
<servlet-name>LuceeServlet</servlet-name>
<url-pattern>*.lucee</url-pattern>
<url-pattern>/index.lucee/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>*.cfc</url-pattern>
<url-pattern>*.cfm</url-pattern>
<url-pattern>*.cfml</url-pattern>
<url-pattern>/index.cfc/*</url-pattern>
<url-pattern>/index.cfm/*</url-pattern>
<url-pattern>/index.cfml/*</url-pattern>
</servlet-mapping>



<servlet-mapping>
<servlet-name>RESTServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>


<!-- default file to execute if directory is called with no file name, e.g. http://mysite.com/ !-->
<welcome-file-list>
<welcome-file>index.cfm</welcome-file>
<welcome-file>index.lucee</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>

</web-app>
64 changes: 35 additions & 29 deletions tests/testBuildArtifacts.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,12 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="data-provider-inte

function run( testResults , testBox ) {
describe( "test build artifacts", function() {
it(title="check valid files are produced", body=function(){

var srcJar = fetchLuceeJar( "lucee-6.0.3.1" );
FileCopy( srcJar, variables.buildDir & listLast( srcJar, "/\" ) );

var s3 = new services.legacy.S3();
s3.init( variables.buildDir );
s3.addMissing( includingForgeBox=true, skipMaven=true );

var produced = directoryList( path=variables.buildDir, recurse=true, listinfo="query" );
for (var f in produced ) {
systemOutput( "", true );
var fileCount = -1;
var zip = queryNew("");
try {
zip action="list" file="#f.directory#/#f.name#" name="local.zip";
fileCount = zip.recordcount;
} catch ( e ) {
systemOutput( f, true );
systemOutput( e.stacktrace, true );
}
systemOutput( "#f.name#, #numberFormat( f.size )#, #fileCount# files", true );
var type = listLast( f.name, "." );
if ( zip.recordCount && type != "jar" && type != "lco" ){
for (var z in zip ){
systemOutput( "#chr(9)# #z.name#, #numberFormat( z.size )#", true );
}
}
}
it(title="check valid artifacts are produced, 6.0.3.1", body=function(){
buildArtifacts( "6.0.3.1" );
});

it(title="check valid artifacts are produced, 6.2.0.30-SNAPSHOT", body=function(){
buildArtifacts( "6.2.0.30-SNAPSHOT" );
});
});
}
Expand All @@ -64,5 +40,35 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="data-provider-inte
return file[ 1 ];
}

private function buildArtifacts( version ){
systemOutput( "--- buildArtifacts [#arguments.version#] ", true);
var srcJar = fetchLuceeJar( arguments.version );
FileCopy( srcJar, variables.buildDir & listLast( srcJar, "/\" ) );

var s3 = new services.legacy.S3();
s3.init( variables.buildDir );
s3.addMissing( includingForgeBox=true, skipMaven=true );

var produced = directoryList( path=variables.buildDir, recurse=true, listinfo="query" );
for (var f in produced ) {
systemOutput( "", true );
var fileCount = -1;
var zip = queryNew("");
try {
zip action="list" file="#f.directory#/#f.name#" name="local.zip";
fileCount = zip.recordcount;
} catch ( e ) {
systemOutput( f, true );
systemOutput( e.stacktrace, true );
}
systemOutput( "#f.name#, #numberFormat( f.size )#, #fileCount# files", true );
var type = listLast( f.name, "." );
if ( zip.recordCount && type != "jar" && type != "lco" ){
for (var z in zip ){
systemOutput( "#chr(9)# #z.name#, #numberFormat( z.size )#", true );
}
}
}
}

}

0 comments on commit acbbe21

Please sign in to comment.