pluginManagement {
  repositories {
    mavenCentral() {
      content {
        excludeGroup 'com.axelor'
      }
    }
    maven {
      url 'https://repository.axelor.com/nexus/repository/maven-public/'
    }
  }
  plugins {
    id 'com.axelor.app' version '7.4.3'
  }
}

plugins {
  id 'com.github.node-gradle.node' version '3.5.1' apply false
}


dependencyResolutionManagement {
  repositories {
    mavenCentral() {
      content {
        excludeGroup 'com.axelor'
      }
    }
    maven {
      url 'https://repository.axelor.com/nexus/repository/maven-public/'
    }
    // Declare the Node.js download repository
    ivy {
      name = "Node.js"
      setUrl("https://nodejs.org/dist/")
      patternLayout {
        artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]")
      }
      metadataSources {
        artifact()
      }
      content {
        includeModule("org.nodejs", "node")
      }
    }
  }
}

//Include all modules
rootProject.name = "axelor-erp"

def modules = []
file("modules").traverse(type: groovy.io.FileType.DIRECTORIES, maxDepth: 1) { it ->
  if (new File(it, "build.gradle").exists()) {
    modules.add(it)
  }
}

gradle.ext.appModules = modules

modules.each { dir ->
  include "modules:$dir.name"
  project(":modules:$dir.name").projectDir = dir
}
