[text] test

Viewer

  1. import groovy.json.JsonBuilder
  2. import groovy.json.JsonSlurper
  3. buildscript {
  4.         ext.repos = {
  5.                 maven {
  6.                         url "${ARTIFACTORY_URL}/${PROXY_REPO_KEY}"
  7.                         credentials {
  8.                                 username = "${ARTIFACTORY_USER}"
  9.                                 password = "${ARTIFACTORY_PASSWORD}"
  10.                         }
  11.                 }
  12.         }
  13.         repositories repos
  14. }
  15.  
  16. plugins {
  17.         id 'java'
  18.     id 'maven-publish'
  19.     id 'war'
  20.     id 'eclipse-wtp'
  21.     id 'idea'
  22. }
  23.  
  24. ext{
  25.         if(project.hasProperty("os-build-deploy-profile")){
  26.                 if(project.hasProperty("CORE_VERSION")){
  27.                 dependencyVersion = project.getProperty("CORE_VERSION")
  28.                 println "CORE_VERSION is: "+dependencyVersion
  29.         }
  30.         else{
  31.                 throw new GradleException("CORE_VERSION not found neither from command line nor from gradle.properties")
  32.         }
  33.         }
  34.        
  35.         if(project.hasProperty("RELEASE_NAME")){
  36.                 releaseName = project.getProperty("RELEASE_NAME")
  37.                 println "RELEASE_NAME is: "+releaseName
  38.         }
  39.         else{
  40.                 throw new GradleException("RELEASE_NAME not found neither from command line nor from gradle.properties")
  41.         }
  42. }
  43.  
  44. group = 'com.oneshield.bundle.appserver'
  45. description = 'OsWeb'
  46. version = releaseName
  47.  
  48. repositories repos
  49.  
  50. configurations.runtimeOnly{
  51.         if(project.hasProperty("os-build-deploy-profile")){
  52.                 exclude group:'org.glassfish.hk2.external', module:'aopalliance-repackaged'
  53.                 exclude group:'org.glassfish.hk2', module:'hk2-api'
  54.                 exclude group:'org.glassfish.hk2', module:'hk2-locator'
  55.                 exclude group:'org.glassfish.hk2', module:'hk2-utils'
  56.                 exclude group:'com.fasterxml.jackson.module', module:'jackson-module-jaxb-annotations'
  57.                 exclude group:'org.glassfish.hk2.external', module:'jakarta.inject'
  58.                 exclude group:'jakarta.ws.rs', module:'jakarta.ws.rs-api'
  59.                 exclude group:'org.javassist', module:'javassist'
  60.                 exclude group:'javax.annotation-api', module:'javax.annotation-api'
  61.                 exclude group:'org.glassfish.main.javaee-api', module:'javax.jws'
  62.                 exclude group:'javax.servlet.jsp', module:'javax.servlet.jsp-api'
  63.                 exclude group:'javax.xml.soap', module:'javax.xml.soap-api'
  64.                 exclude group:'javax.xml.ws', module:'jaxws-api'
  65.                 exclude group:'org.glassfish.jersey.core', module:'jersey-common'
  66.                 exclude group:'org.glassfish.jersey.ext', module:'jersey-entity-filtering'
  67.                 exclude group:'org.glassfish.jersey.inject', module:'jersey-hk2'
  68.                 exclude group:'org.glassfish.jersey.media', module:'jersey-media-json-jackson'
  69.                 exclude group:'org.glassfish.hk2', module:'osgi-resource-locator'
  70.                 exclude group:'com.io7m.xom', module:'xom'
  71.                 exclude group:'jakarta.activation', module:'jakarta.activation-api'
  72.                 exclude group:'jakarta.annotation', module:'jakarta.annotation-api'
  73.                 exclude group:'javax.activation', module:'javax.activation-api'
  74.                 exclude group:'javax.jms', module: 'javax.jms-api'
  75.                 exclude group: 'javax.transaction', module:'javax.transaction-api'
  76.                 exclude group: 'javax.mail', module:'mail'
  77.                 exclude group: 'junit', module:'junit'
  78.                 exclude group: 'com.h2database', module:'h2'
  79.                 exclude group: 'javax.ws.rs', module:'javax.ws.rs-api'
  80.                 exclude group: 'javax.ejb', module:'javax.ejb-api'
  81.                 exclude group: 'com.sun.codemodel', module:'codemodel'
  82.         }
  83. //      exclude group: 'xml-apis'
  84. //      exclude group: 'org.w3c.dom', module: 'xerces'
  85. //      exclude module: 'javaee-api'
  86.         exclude group:'com.fasterxml.woodstox', module:'woodstox-core'
  87.         exclude group:'org.apache.commons', module:'commons-collections4'
  88.         exclude group:'org.apache.httpcomponents.client5', module:'httpclient5'
  89.         exclude group:'org.apache.httpcomponents.core5', module:'httpcore5'
  90.         exclude group:'commons-pool', module:'commons-pool'
  91. }
  92.  
  93. dependencies {
  94.         if(project.hasProperty("os-build-deploy-profile")){
  95.                 implementation "com.oneshield:BISchemaETL:$dependencyVersion"
  96.                 implementation "com.oneshield:OsAssignment:$dependencyVersion"
  97.                 implementation "com.oneshield:OsLib:$dependencyVersion"
  98.             implementation "com.oneshield:OsDto:$dependencyVersion"
  99.             implementation "com.oneshield:OsDao:$dependencyVersion"
  100.             implementation "com.oneshield:OsCommon:$dependencyVersion"
  101.             implementation "com.oneshield:OsObjectAccess:$dependencyVersion"
  102.             implementation "com.oneshield:OrpCommon:$dependencyVersion"
  103.             implementation "com.oneshield:OrpClient:$dependencyVersion"
  104.             implementation "com.oneshield:OsAjaxFramework:$dependencyVersion"
  105.             implementation "com.oneshield:OsBusinessLogic:$dependencyVersion"
  106.             implementation "com.oneshield:CsBusinessLogic:$dependencyVersion"
  107.             implementation "com.oneshield:OsCommand:$dependencyVersion"
  108.             implementation "com.oneshield:OsMetadataObject:$dependencyVersion"
  109.             implementation "com.oneshield:OsMetadata:$dependencyVersion"
  110.             implementation "com.oneshield:OsServiceFramework:$dependencyVersion"
  111.             implementation "com.oneshield:OsWorkflowService:$dependencyVersion"
  112.             implementation "com.oneshield:OsEnterpriseAuthentication:$dependencyVersion"
  113.             implementation "com.oneshield:OsNotifications:$dependencyVersion"
  114.             implementation "com.oneshield:OrcService:$dependencyVersion"
  115.             implementation "com.oneshield.microservice:mdserviceclient:$dependencyVersion"
  116.             implementation "com.oneshield.microservice:swarmcommons:$dependencyVersion"
  117.             implementation "com.oneshield:cdmsclient:$dependencyVersion"
  118.            
  119.             compileOnly "com.oneshield:OsDomainObject:$dependencyVersion"
  120.                 compileOnly "org.glassfish.hk2.external:aopalliance-repackaged:2.6.1"
  121.                 compileOnly "org.glassfish.hk2:hk2-api:2.6.1"
  122.                 compileOnly "org.glassfish.hk2:hk2-locator:2.6.1"
  123.                 compileOnly "org.glassfish.hk2:hk2-utils:2.6.1"
  124.                 compileOnly "com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.13.4"
  125.                 compileOnly "org.glassfish.hk2.external:jakarta.inject:2.6.1"
  126.                 compileOnly "jakarta.ws.rs:jakarta.ws.rs-api:2.1.6"
  127.                 compileOnly "org.javassist:javassist:3.22.0-CR2"
  128.                 compileOnly "javax.annotation:javax.annotation-api:1.3.2"
  129.                 compileOnly "org.glassfish.main.javaee-api:javax.jws:3.1.2.2"
  130.                 compileOnly "javax.servlet.jsp:javax.servlet.jsp-api:2.3.3"
  131.                 compileOnly "javax.xml.soap:javax.xml.soap-api:1.4.0"
  132.                 compileOnly "javax.xml.ws:jaxws-api:2.3.1"
  133.                 compileOnly "org.glassfish.jersey.core:jersey-common:2.29.1"
  134.                 compileOnly "org.glassfish.jersey.ext:jersey-entity-filtering:2.29.1"
  135.                 compileOnly "org.glassfish.jersey.inject:jersey-hk2:2.29.1"
  136.                 compileOnly "org.glassfish.jersey.media:jersey-media-json-jackson:2.29.1"
  137.                 compileOnly "org.glassfish.hk2:osgi-resource-locator:1.0.3"
  138.                 compileOnly "com.io7m.xom:xom:1.2.10"
  139.                 compileOnly "jakarta.activation:jakarta.activation-api:1.2.1"
  140.                 compileOnly "jakarta.annotation:jakarta.annotation-api:1.3.5"
  141.                 compileOnly "javax.activation:javax.activation-api:1.2.0"
  142.                 compileOnly 'javax.jms:javax.jms-api:2.0.1'
  143.                 compileOnly "javax.ejb:javax.ejb-api:3.2.2"
  144.                 compileOnly "javax.transaction:javax.transaction-api:1.3"
  145.                 compileOnly "javax.mail:mail:1.4.7"
  146.                 compileOnly "junit:junit:4.12"
  147.                 compileOnly "com.h2database:h2:2.2.220"
  148.                 compileOnly "com.sun.codemodel:codemodel:2.6"
  149.                 compileOnly "javax.ws.rs:javax.ws.rs-api:2.1.1"
  150.                 implementation 'javax.activation:activation:1.1'
  151.                 implementation 'org.hamcrest:hamcrest-core:1.3'
  152.         }
  153.         else{
  154.                 implementation project(":OsLib")
  155.             implementation project(":OsDto")
  156.             implementation project(":OsDao")
  157.             implementation project(":OsCommon")
  158.             implementation project(":OsObjectAccess")
  159.             implementation project(":OrpCommon")
  160.             implementation project(":OrpClient")
  161.             implementation project(":OsAjaxFramework")
  162.             implementation project(":OsBusinessLogic")
  163.             implementation project(":CsBusinessLogic")
  164.             implementation project(":OsCommand")
  165.             implementation project(":OsMetadataObject")
  166.             implementation project(":OsMetadata")
  167.             implementation project(":OsServiceFramework")
  168.             implementation project(":OsWorkflowService")
  169.             implementation project(":OsEnterpriseAuthentication")
  170.             implementation project(":OsNotifications")
  171.             implementation project(":BISchemaETL")
  172.             implementation project(":OsAssignment")
  173.             implementation project(":OrcService")
  174.             implementation project(":mdserviceclient")
  175.             implementation project(":swarmcommons")
  176.             implementation project(":cdmsclient")
  177.             compileOnly project(":OsDomainObject")
  178.         }
  179.        
  180.         implementation 'org.apache.cxf:cxf-rt-frontend-jaxws:3.5.2'
  181.     implementation 'javax.transaction:javax.transaction-api:1.3'
  182.     implementation 'net.sf.json-lib:json-lib:2.3:jdk15'
  183.     implementation 'org.apache.commons:commons-lang3:3.12.0'
  184.     implementation 'commons-fileupload:commons-fileupload:1.5'
  185.     implementation('org.apache.poi:poi-ooxml:5.2.2'){
  186.                 exclude group:'org.apache.commons', module:'commons-compress'
  187.         }
  188.     implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1'
  189.     implementation 'xerces:xercesImpl:2.12.2'
  190.     implementation 'ca.juliusdavies:not-yet-commons-ssl:0.3.17'
  191.     compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
  192.     compileOnly 'com.oracle.database.jdbc:ojdbc8:21.1.0.0'
  193.     compileOnly 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.3'
  194.     
  195.     testImplementation 'junit:junit:4.12'
  196. }
  197.  
  198. ext{
  199.         senchaCliLocation = SENCHA_CLI_LOCATION
  200.         senchaProfileTemp = SENCHA_BUILD_PROFILE
  201.         customThemeLocation = System.env.CUSTOM_THEME_PATH
  202.     if (!customThemeLocation?.trim()) {
  203.         customThemeLocation = CUSTOM_THEME_PATH
  204.     }
  205.     
  206.     customPackageLocation = System.env.CUSTOM_THEME_PACKAGES
  207.     if (!customPackageLocation?.trim()) {
  208.         customPackageLocation = CUSTOM_THEME_PACKAGES
  209.     }
  210.  
  211.     customThemeCopy = System.env.CUSTOM_THEME_COPY
  212.     if (!customThemeCopy?.trim()) {
  213.         customThemeCopy = CUSTOM_THEME_COPY
  214.     }
  215.     
  216.     customThemeAppJsonLocation = System.env.CUSTOM_THEME_APP_JSON_LOCATION
  217.     if(!customThemeAppJsonLocation?.trim()){
  218.             customThemeAppJsonLocation = CUSTOM_THEME_APP_JSON_LOCATION
  219.     }
  220.        
  221.         senchaPath = "${senchaCliLocation}/sencha"
  222.         senchaProfile = senchaProfileTemp
  223.         isWindows = org.gradle.internal.os.OperatingSystem.current().windows
  224. }
  225.  
  226. //not in use
  227. task senchaDownload {
  228.         doLast {
  229.             println 'If needed This task will download Sench CLI'
  230.             println 'Download Location ' + SENCHA_CLI_LOCATION
  231.     }
  232. }
  233.  
  234. task copyCustomTheme {
  235.     doLast {
  236.             File directory = new File(customThemeLocation);
  237.             if (directory.isDirectory() && customThemeCopy.toBoolean()) {
  238.                 String[] files = directory.list();
  239.                 if (files.length != 0) {
  240.                     println "Directory is not empty. Starting copy"
  241.                     println "Copying app.json"
  242.                         if(senchaProfile != "production"){
  243.                             copy {
  244.                                                 from ("src/main/webapp/OneShield/app.json")
  245.                                                 into("src/main/webapp/OneShield/")
  246.                                                 rename { String fileName ->
  247.                                                     fileName.replace('app.json', 'app_bkp.json')
  248.                                                 }
  249.                                     }
  250.                                     println "Copying Themes"
  251.                                     copy {
  252.                                 from(customThemeLocation) {
  253.                                     include('**/*.*')
  254.                                 }
  255.                                 into("${projectDir}/${CUSTOM_THEME_PROJECT_LOCATION}")
  256.                             }
  257.                             println "Copying packages"
  258.                             copy {
  259.                                 from(customPackageLocation) {
  260.                                     include('**/*.*')
  261.                                 }
  262.                                 into("${projectDir}/${CUSTOM_THEME_PROJECT_LOCATION}")
  263.                             }
  264.                             copy {
  265.                                         from ("${customThemeAppJsonLocation}/product_app_base.json")
  266.                                         into("src/main/webapp/OneShield/")
  267.                                         rename { String fileName ->
  268.                                             fileName.replace('product_app_base.json', 'app.json')
  269.                                         }
  270.                                     }
  271.                                     println "Copy of custom theme & packages completed"
  272.                     }
  273.                 }
  274.             }
  275.     }
  276. }
  277.  
  278. task senchaFrontendBuild {
  279.         dependsOn(copyCustomTheme)
  280.     doLast {
  281.             if(senchaProfile != "" && customThemeCopy.toBoolean()){
  282.                         println 'Sencha Path: ' + senchaPath
  283.                 println 'Sencha Profile: ' + senchaProfile
  284.             println "Building for profile ${senchaProfile}"
  285.             if(isWindows) {
  286.                 exec {
  287.                     workingDir webAppDir.toPath().toString() + '/OneShield'
  288.                     commandLine 'cmd', '/c', "${senchaPath}", 'app', 'build', senchaProfile
  289.                 }
  290.             } else {
  291.                 exec {
  292.                     workingDir webAppDir.toPath().toString() + '/OneShield'
  293.                     commandLine "${senchaPath}", "app", "build", senchaProfile
  294.                 }
  295.             }
  296.             if(senchaProfile != "production"){
  297.                     copy {
  298.                                                 from ("src/main/webapp/OneShield/app_bkp.json")
  299.                                                 into("src/main/webapp/OneShield/")
  300.                                                 rename { String fileName ->
  301.                                                     fileName.replace('app_bkp.json', 'app.json')
  302.                                                 }
  303.                             }
  304.                                 delete files("src/main/webapp/OneShield/app_bkp.json")
  305.                                 if(isWindows) {
  306.                                         exec {
  307.                                                 workingDir webAppDir.toPath().toString() + '/OneShield'
  308.                                                 commandLine 'cmd', '/c', "${senchaPath}", 'app', 'build', senchaProfile
  309.                                         }
  310.                                 } else {
  311.                                         exec {
  312.                                                 workingDir webAppDir.toPath().toString() + '/OneShield'
  313.                                                 commandLine "${senchaPath}", "app", "build", senchaProfile
  314.                                         }
  315.                                 }
  316.             }
  317.             }
  318.      }
  319. }
  320.  
  321. tasks.withType(War) {
  322.    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  323. }
  324.  
  325. war {
  326.     enabled = false
  327. }
  328.  
  329.  
  330.  
  331. task warWithoutStaticContent(type: War, dependsOn: [classes]) {
  332.         ext.runSenchaForStandardWar = { ->
  333.             if(isWindows) {
  334.                         exec {
  335.                                 workingDir "src/main/webapp/OneShield"
  336.                                 commandLine 'cmd', '/c', "${senchaPath}", 'app', 'build', 'production'
  337.                         }
  338.                 } 
  339.                 else {
  340.                         exec {
  341.                                 workingDir "src/main/webapp/OneShield"
  342.                                 commandLine "${senchaPath}", "app", "build", 'production'
  343.                         }
  344.                 }
  345.     }
  346.         copy {
  347.                         from ("src/main/webapp/OneShield/"){
  348.                         include(["dragon/", "tesl/", "*.jsp"])
  349.                 }
  350.                 into("src/main/webapp/")
  351.     }
  352.  
  353.     archiveFileName = 'OsWebWithoutStaticContent.war'
  354.     destinationDirectory = file("${projectDir}/dist/war")
  355.     exclude('**/OneShield/**','**/**/*.json','**/**/*.jsonp','**/**/*.css','**/**/*.html','**/**/*.js','**/**/*.jpg','**/**/*.jpeg','**/**/*.png','**/**/*.gif')
  356.     doLast{
  357.             delete fileTree(dir: "src/main/webapp/", include: ["*.jsp"])
  358.                 def dirToRemove = ["src/main/webapp/dragon", "src/main/webapp/tesl"]
  359.                 dirToRemove.forEach{ dir -> 
  360.                         delete "${projectDir}/${dir}"
  361.                 }
  362.                 runSenchaForStandardWar()
  363.     }
  364. }
  365.  
  366. task standardWar(type: War, dependsOn: [classes, warWithoutStaticContent]) {
  367.         exclude('src/main/webapp/OneShield/ext/**')
  368.     archiveFileName = 'OsWeb.war'
  369.     destinationDirectory = file("${projectDir}/dist/war")
  370. }
  371.  
  372. task createCopyOfStaticContent(type: Copy, dependsOn: [classes, standardWar]){
  373.         from('src/main/webapp/')
  374.     into("dist/war/oneshield/oneshield")
  375.     exclude('WEB-INF/**','META-INF/**','OneShield/build/**','OneShield/ext/**')   
  376. }
  377.  
  378. task createZipOfStaticContent(type: Zip, dependsOn: createCopyOfStaticContent){
  379.          from "${projectDir}/dist/war/oneshield/"
  380.          exclude('oneshield/OneShield/ext/**')
  381.      destinationDir = file("${projectDir}/dist/war/")
  382.      archiveName = "oneshield.zip"
  383.          doLast{
  384.             delete fileTree(dir: "src/main/webapp/", include: ["*.jsp","*.jsonp","*.json","*.js"])
  385.                 def dirToRemove = ["dragon", "locale", "oscore", "oscoreflat", "oscoremob", "osthemeflat", "osthememob", "tesl", "thirdparty"]
  386.                 dirToRemove.forEach{ dir -> 
  387.                         delete "${projectDir}/src/main/webapp/${dir}"
  388.                 }
  389.     }
  390. }
  391.  
  392. task createDists(dependsOn: [warWithoutStaticContent, standardWar, createZipOfStaticContent]) {
  393.         println "Cleaning ${projectDir}/dist/war folder"
  394.         delete "${projectDir}/dist/"
  395. }
  396.  
  397. publishing {
  398.        
  399.         publications {
  400.                 OsWeb(MavenPublication) {
  401.            groupId = group
  402.            artifactId = "OsWeb"
  403.            version = version
  404.            artifact("${projectDir}/dist/war/OsWeb.war")
  405.         }
  406.         OsWebWithoutStaticContent(MavenPublication) {
  407.             groupId = group
  408.             artifactId = "OsWebWithoutStaticContent"
  409.             version = version
  410.             artifact("${projectDir}/dist/war/OsWebWithoutStaticContent.war")
  411.         }
  412.         oneshield(MavenPublication) {
  413.                         groupId = "com.oneshield.bundle.httpserver"
  414.                artifactId = "oneshield"
  415.                version = version
  416.                         artifact("${projectDir}/dist/war/oneshield.zip")
  417.         }
  418.         }
  419.         repositories {
  420.                 maven {
  421.                         name 'nexus'
  422.                         url "${ARTIFACTORY_URL}/${REPO_KEY}"
  423.                         credentials {
  424.                                 username "${ARTIFACTORY_USER}"
  425.                                 password "${ARTIFACTORY_PASSWORD}"
  426.                         }
  427.                 }
  428.         }
  429. }
  430.  
  431.  
  432. tasks.withType(JavaCompile) {
  433.     options.encoding = 'UTF-8'
  434. }
  435.  

Editor

You can edit this paste and save as new:


File Description
  • test
  • Paste Code
  • 06 May-2024
  • 16.31 Kb
You can Share it: