plugins {
    id 'java'
    id 'maven-publish'
    id 'java-library'
}

repositories {
    maven { url 'https://maven.aliyun.com/repository/public/' }
    mavenCentral()
    maven {
        url uri('../../repo')
    }
}
dependencies {
    compileOnly rootProject.fileTree(dir: 'tools', include: ['*.jar'])
    api project(":base")
    api project(":zircon")
}
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(8)
    }
}
jar {
    manifest {
        attributes(
                'Add-Exports': "jdk.compiler/com.sun.tools.javac.api jdk.compiler/com.sun.tools.javac.code jdk.compiler/com.sun.tools.javac.util jdk.compiler/com.sun.tools.javac.comp",
                'Add-Opens': "jdk.compiler/com.sun.tools.javac.main jdk.compiler/com.sun.tools.javac.parser",
        )
    }
}
compileJava {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
    options.fork = true
    options.compilerArgs << "-Xlint:deprecation" << "-XDignore.symbol.file"
}
task sourceJar(type: Jar) {
    from sourceSets.main.allJava
    archiveClassifier = "sources"
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId rootProject.ext.groupId
            artifactId "javac"
            version rootProject.ext.version
            from components.java
            artifact sourceJar
        }
    }
    repositories {
        maven {
            url = uri('../../repo')
        }
    }

}
