summaryrefslogtreecommitdiff
path: root/build.gradle
blob: 69258792642bc52f26ddfbd9c7a3c6bc6d637d9f (plain) (blame)
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
plugins {
    id 'maven-publish'
}

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

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url 'https://maven.fabricmc.net/' }
    }

    dependencies {
        implementation 'com.google.guava:guava:28.0-jre'
        implementation 'com.google.code.gson:gson:2.8.5'

        testImplementation 'junit:junit:4.+'
        testImplementation 'org.hamcrest:hamcrest-all:1.+'
    }

    group = 'cuchaz'
    version = '0.21'

    def buildNumber = System.getenv("BUILD_NUMBER")
    version = version + "+" + (buildNumber ? "build.$buildNumber" : "local")

    task sourcesJar(type: Jar, dependsOn: classes) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }

    java {
        withSourcesJar()
    }

    publishing {
        publications {
            "$project.name"(MavenPublication) {
                groupId project.group
                artifactId project.name
                version project.version
                from components.java
            }
        }
    }
}

allprojects {
    publishing {
        repositories {
            mavenLocal()

            if (project.hasProperty('mavenPass')) {
                maven {
                    url = "http://mavenupload.modmuss50.me/"
                    credentials {
                        username = "buildslave"
                        password = project.getProperty('mavenPass')
                    }
                }
            }
        }
    }
}