aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 51768a096323251666ed7d678f50b380c4f715e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
plugins {
  id 'net.minecrell.licenser' version '0.3'
  id 'org.ajoberstar.grgit' version '2.3.0'
  //id 'com.github.johnrengelman.shadow' version '2.0.4'
}

apply plugin: 'java'
apply plugin: 'maven-publish'

group = 'net.minecraftforge'
version = gitVersion()
def gitVersion() {
    def raw = grgit.describe(longDescr: true)
    def desc = (raw == null ? 'unknown-unknown-unknown' : raw).split('-') as List
    def hash = desc.remove(desc.size() - 1)
    def offset = desc.remove(desc.size() - 1)
    def tag = desc.join('-')
    def branch = grgit.branch.current().name    
    return "${tag}.${offset}" //${t -> if (branch != 'master') t << '-' + branch}"
}

sourceSets {
    api
    shared
    gradlecomp
}

repositories {
    jcenter()
    mavenCentral()
}

configurations {
    sharedImplementation.extendsFrom apiImplementation
    gradlecompImplementation.extendsFrom sharedImplementation

    compile.extendsFrom sharedImplementation
    compile.extendsFrom gradlecompImplementation
}

dependencies {
    sharedImplementation sourceSets.api.output
    sharedImplementation 'commons-io:commons-io:2.4'

    gradlecompImplementation sourceSets.shared.output
    gradlecompImplementation gradleApi()
    gradlecompImplementation 'com.google.guava:guava:26.0-jre'
    gradlecompImplementation 'commons-io:commons-io:2.4'

    compile sourceSets.api.output
    compile sourceSets.shared.output
    compile sourceSets.gradlecomp.output
}

jar {
    from sourceSets.api.output
    from sourceSets.shared.output
    from sourceSets.gradlecomp.output
}


license {
    header = file("$rootDir/LICENSE-header.txt")
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
            pom {
                groupId = project.group
                version = project.version
                artifactId = project.archivesBaseName
                name = project.archivesBaseName
                packaging = 'jar'
                description = 'A Gradle artifact processing and management tool'
                url = 'https://github.com/MinecraftForge/Artifactural/'

                scm {
                    url = 'https://github.com/MinecraftForge/Artifactural/'
                    connection = 'scm:git:git://github.com/MinecraftForge/Artifactural.git'
                    developerConnection = 'scm:git:git@github.com:MinecraftForge/Artifactural.git'
                }
                issueManagement {
                    system = 'github'
                    url = 'https://github.com/MinecraftForge/Artifactural/issues'
                }
                licenses {
                    license {
                        name = 'LGPL-2.1'
                        url = 'https://www.gnu.org/licenses/lgpl-2.1.txt'
                        distribution = 'repo'
                    }
                }
            }
        }
    }
    repositories {
        maven {
            if (project.hasProperty('mavenPassword')) {
                credentials {
                    username = project.properties.mavenUser
                    password = project.properties.mavenPassword
                }
                url 'http://files.minecraftforge.net/maven/manage/upload'
            } else {
                url 'file://' + rootProject.file('repo').getAbsolutePath()
            }
        }
    }
}