// Workaround for Shadow not supporting Java 19 classes.
// Remove this once Shadow updates.
// See: https://github.com/johnrengelman/shadow/pull/770
// See: https://discord.com/channels/722722769950998560/793019909055578113/978939925061857315
buildscript {
    configurations.all {
        resolutionStrategy {
            force("org.ow2.asm:asm:9.5")
            force("org.ow2.asm:asm-commons:9.5")
        }
    }
}

plugins {
    //id  "com.github.johnrengelman.shadow" version "7.1.0"
    id  "io.github.goooler.shadow" version "8.1.7"
    id  'java'
    id  'maven-publish'
}

apply plugin: 'eclipse'

eclipse {
    project {
        name = "Dynmap"
    }
}

allprojects  {
  repositories {
     mavenLocal()
     maven { url 'https://libraries.minecraft.net/' }
     maven { url "https://maven.pkg.github.com/linktosriram/s3-lite"
          credentials {
              username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
              password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
          }
     }
     maven { url "https://oss.sonatype.org/content/repositories/releases" }
     maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
     maven { url "https://repo.mikeprimm.com" }
     maven { url "https://repo.maven.apache.org/maven2" }
     maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
     maven { url "https://repo.codemc.org/repository/maven-public/" }
  }

  apply plugin: 'java'
  
  group = 'us.dynmap'
  version = '3.7-beta-11'

}

class Globals {
  String buildNumber =  System.getenv().BUILD_NUMBER ?: "Dev"
}
ext {
  globals = new Globals()
}

subprojects {  
  apply plugin: "io.github.goooler.shadow"
  apply plugin: 'java'
  apply plugin: 'maven-publish'

  sourceCompatibility = 1.8
  targetCompatibility = 1.8
  tasks.withType(JavaCompile) {
  	options.encoding = 'UTF-8'
  }
}

clean {
  delete "target" 
}

task setupCIWorkspace {
}
