buildscript {
    repositories {
        gradlePluginPortal()
    }
}

plugins {
    id 'org.ajoberstar.grgit' version '5.2.0' apply false
    id 'org.ajoberstar.git-publish' version '4.2.0' apply false
    id 'pl.allegro.tech.build.axion-release' version '1.15.0' apply false
    id 'org.jdrupes.vmoperator.java-doc-conventions'
    id 'eclipse'
    id "com.github.node-gradle.node" version "7.0.1"
}

allprojects {
    project.group = 'org.jdrupes.vmoperator'
}

task stage {
    description = 'To be executed by CI, build and update JavaDoc.'
    group = 'build'

    // Build everything first
    gradle.projectsEvaluated {
        dependsOn subprojects.tasks.collect { 
            tc -> tc.findByName("build") }.flatten()
    }
    
    if (JavaVersion.current() == JavaVersion.VERSION_17) {
        // Publish JavaDoc
        dependsOn gitPublishPush
    }
}

eclipse {
    project {
        file {
            project.natures += 'org.eclipse.buildship.core.gradleprojectnature'
            project.buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
        }
    }
}
