Ctrl K
ComunidadGuías…

scm-webapp/build.gradle

Rama develop · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
/*
 * Copyright (c) 2020 - present Cloudogu GmbH
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see https://www.gnu.org/licenses/.
 */

plugins {
  id 'war'
  id 'org.scm-manager.java'
  id 'org.scm-manager.run'
  id 'org.scm-manager.core-plugins'
  id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.2.52'
}

configurations {
  assets
  webapp {
    canBeConsumed = true
    canBeResolved = false
    create("swaggerCoreDeps").defaultDependencies(new Action<DependencySet>() {
      @Override
      void execute(DependencySet dependencies) {
        dependencies.add(project.getDependencies().create(libs.commonsLang3.get()))
        dependencies.add(project.getDependencies().create(libs.jaxRs.get()))
        dependencies.add(project.getDependencies().create(libs.servletApi.get()))
        dependencies.add(project.getDependencies().create(libs.swaggerJaxRs.get()))
        def jacksonCore = project.getDependencies().create(libs.jacksonCore.get())
        jacksonCore.version { strictly libs.versions.jackson.get() }
        dependencies.add(jacksonCore)
      }
    })
  }
}

dependencies {
  implementation platform(project(':'))

  corePlugin project(path: ':scm-plugins:scm-git-plugin', configuration: 'smp')
  corePlugin project(path: ':scm-plugins:scm-hg-plugin', configuration: 'smp')
  corePlugin project(path: ':scm-plugins:scm-svn-plugin', configuration: 'smp')
  corePlugin project(path: ':scm-plugins:scm-legacy-plugin', configuration: 'smp')
  assets project(path: ':scm-ui', configuration: 'assets')

  implementation project(':scm-core')
  implementation project(':scm-persistence')
  testImplementation project(':scm-test')
  testImplementation project(':scm-queryable-test')
  annotationProcessor project(':scm-annotation-processor')
  testAnnotationProcessor project(':scm-core-annotation-processor')

  // servlet api
  providedCompile libs.servletApi
  testImplementation libs.servletApi

  // security
  implementation variantOf(libs.shiroWeb) { classifier('jakarta') }
  implementation variantOf(libs.shiroGuice) { classifier('jakarta') }

  // tests
  testImplementation libs.junitPioneer

  // jwt
  implementation libs.jjwtApi
  implementation libs.jjwtRuntime
  implementation libs.jjwtJackson

  // gpg
  implementation libs.bouncycastlePg
  implementation libs.bouncycastleProv
  implementation libs.bouncycastlePkix

  implementation 'org.pgpainless:pgpainless-core:1.7.6'
  constraints {
    implementation 'org.bouncycastle:bcprov-jdk18on:1.84'
    implementation 'org.bouncycastle:bcpg-jdk18on:1.84'
  }

  // json
  implementation libs.jacksonJaxbAnnotations
  implementation libs.jacksonJaxRsBase
  implementation libs.jacksonJaxRsJsonProvider
  implementation libs.jacksonDatatypeJdk8
  implementation libs.jacksonDatatypeJsr310
  implementation libs.jacksonDataFormatYaml

  // rest api
  implementation libs.resteasyJaxbProvider
  implementation libs.resteasyJackson2Provider
  implementation libs.resteasyMultiartProvider
  implementation libs.resteasyServletInitializer
  implementation libs.resteasyValidatorProvider
  implementation "org.apache.httpcomponents:httpcore:4.4.16"

  // openapi
  compileOnly libs.swaggerJaxRs

  // logging
  implementation libs.logback

  // cron expression
  implementation libs.cronUtils

  // templates
  implementation libs.mustache

  // static resources
  implementation libs.webResources

  // content type detection
  implementation libs.spotter
  implementation libs.tika

  // restart on unix
  implementation libs.akuma

  // native access
  implementation libs.jna

  // util
  implementation libs.commonsCompress

  // events
  implementation libs.legmanShiro
  implementation libs.legmanMicrometer

  // metrics
  implementation libs.micrometerExtra

  implementation libs.luceneCore
  implementation libs.luceneQueryParser
  implementation libs.luceneHighlighter
  implementation libs.luceneAnalyzersCommon

  // lombok
  compileOnly libs.lombok
  testCompileOnly libs.lombok
  annotationProcessor libs.lombok
  testAnnotationProcessor libs.lombok

  // dto mapping
  annotationProcessor libs.mapstructProcessor

  // testing async code
  testImplementation libs.awaitility

  // shiro unit
  testImplementation libs.shiroUnit

  // plugin transformer
  implementation 'org.eclipse.transformer:org.eclipse.transformer:1.0.0'
  implementation 'org.eclipse.transformer:org.eclipse.transformer.jakarta:1.0.0'

  constraints {
    implementation("commons-beanutils:commons-beanutils:1.11.0") {
      because "previous versions have a CVE-2025-48734"
    }
  }
}

war {
  from 'build/war'
  from project.configurations.assets
  into('WEB-INF/classes/META-INF/scm') {
    from('build/openapi')
  }
  duplicatesStrategy = 'WARN'
  dependsOn 'copy-core-plugins', 'resolve'
}

artifacts {
  webapp(war)
}

// war without assets for development and livereload
task 'dev-war'(type: War) {
  archiveFileName = 'scm-webapp-dev.war'
  from 'build/war'
  into('WEB-INF/classes') {
    from('src/main/conf/config.yml')
  }
  into('WEB-INF/classes/META-INF/scm') {
    from('build/openapi')
  }
  duplicatesStrategy = 'WARN'
  dependsOn 'copy-core-plugins', 'resolve'
}

scmServer {
  liveReload = true
  openBrowser = true
  warFile = file('build/libs/scm-webapp-dev.war')
}

run {
  dependsOn 'dev-war'
}

resolve {
  outputFileName = 'openapi'
  outputFormat = 'JSONANDYAML'
  prettyPrint = 'TRUE'
  classpath = sourceSets.main.runtimeClasspath
  resourcePackages = ['sonia.scm.api.v2.resources']
  outputDir = file('build/openapi')
  openApiFile = file('build/openapi_tmp/openapi.yml')
  setBuildClasspath(project.configurations.swaggerCoreDeps)
}

task prepareOpenAPI(type: Copy) {
  from 'src/main/doc/openapi.yml'
  into 'build/openapi_tmp'
  duplicatesStrategy = 'WARN'
  expand(version: project.version)
}

tasks.getByName("resolve").configure {
  dependsOn 'prepareOpenAPI'
}

test {
  //Requiered by set environment variable annotation
  //Explanation: https://junit-pioneer.org/docs/environment-variables/#warnings-for-reflective-access
  jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED")
}