diff --git a/apps/updateserver/services/legacy/S3.cfc b/apps/updateserver/services/legacy/S3.cfc index bd34027..6548262 100644 --- a/apps/updateserver/services/legacy/S3.cfc +++ b/apps/updateserver/services/legacy/S3.cfc @@ -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 ); @@ -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; + } + } diff --git a/apps/updateserver/services/legacy/build/war-6.2/WEB-INF/web.xml b/apps/updateserver/services/legacy/build/war-6.2/WEB-INF/web.xml new file mode 100644 index 0000000..ce1a4e8 --- /dev/null +++ b/apps/updateserver/services/legacy/build/war-6.2/WEB-INF/web.xml @@ -0,0 +1,110 @@ + + + + + CFMLServlet + lucee.loader.servlet.CFMLServlet + + + + + + + + + + + + + + + 2 + + + + + + + + + RESTServlet + lucee.loader.servlet.RestServlet + 3 + + + + + + + + + + + + + + + + + + LuceeServlet + *.lucee + /index.lucee/* + + + + CFMLServlet + *.cfc + *.cfm + *.cfml + /index.cfc/* + /index.cfm/* + /index.cfml/* + + + + + + RESTServlet + /rest/* + + + + + + index.cfm + index.lucee + index.html + index.htm + + + \ No newline at end of file diff --git a/tests/testBuildArtifacts.cfc b/tests/testBuildArtifacts.cfc index 057684b..dd1e0b6 100644 --- a/tests/testBuildArtifacts.cfc +++ b/tests/testBuildArtifacts.cfc @@ -8,46 +8,16 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="data-provider-inte variables.artifacts = dir & "/artifacts"; if ( !DirectoryExists( variables.artifacts )) directoryCreate( variables.artifacts ); - - variables.buildDir = getTempDirectory() & "/build-test-#createUniqueId()#/"; - if ( DirectoryExists( variables.buildDir ) ) - directoryDelete( variables.buildDir, true ); - directoryCreate( variables.buildDir, true ); - } 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( "lucee-6.0.3.1" ); + }); + it(title="check valid artifacts are produced, 6.2.0.30-SNAPSHOT", body=function(){ + buildArtifacts( "lucee-6.2.0.30-SNAPSHOT" ); }); }); } @@ -58,11 +28,72 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="data-provider-inte var artifact = "https://cdn.lucee.org/#arguments.version#.jar"; systemOutput( "Downloading #artifact# (cache miss)", true); - http url=artifact method="get" result="local.core" path=variables.artifacts; + http url=artifact method="get" result="local.core" path=variables.artifacts throwonerror="true"; var file = directoryList(path=variables.artifacts, filter="#arguments.version#.jar"); - //systemOutput(file, true); + systemOutput(file, true); return file[ 1 ]; } + private function buildArtifacts( version ){ + + var buildDir = getTempDirectory() & "/build-artifacts-#createUUID()#/"; + if ( DirectoryExists( buildDir ) ) + directoryDelete( buildDir, true ); + directoryCreate( buildDir, true ); + + systemOutput( "--- buildArtifacts [#arguments.version#] ", true); + var srcJar = fetchLuceeJar( arguments.version ); + FileCopy( srcJar, buildDir & listLast( srcJar, "/\" ) ); + + var s3 = new services.legacy.S3(); + s3.init( buildDir ); + s3.addMissing( includingForgeBox=true, skipMaven=true ); + + var produced = directoryList( path=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 ); + if ( listLast( z.name, "." ) eq "war" ){ + dumpWarContents( "#f.directory#/#f.name#", true ); + } + } + } + } + } + + private function dumpWarContents( zip, recurse=true ){ + var warDir = getTempDirectory() & "/build-war-#createUUID()#/"; + if ( DirectoryExists( warDir ) ) + directoryDelete( warDir, true ); + directoryCreate( warDir, true ); + zip action="unzip" file=arguments.zip destination=wardir; + + if ( arguments.recurse ) { + var wars = directoryList( path=warDir, recurse=true, listinfo="query", filter="*.war" ); + for (var war in wars ){ + if ( listLast( war.name, ".") eq "war" ){ + dumpWarContents( zip=(war.directory & "/" & war.name), recurse=false ); + } + } + } else { + var warContents = directoryList( path=warDir, recurse=true, listinfo="query" ); + for ( var f in warContents ){ + systemOutput( "#chr(9)##chr(9)##mid(f.directory,len(warDir))#/#f.name#, #numberFormat( f.size )#", true ); + } + } + } }