build.gradle 2.68 KB
Newer Older
Jens Bendisposto's avatar
Jens Bendisposto committed
1
2
3
4
5
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'


hansen's avatar
hansen committed
6
project.version = '3.2.14-SNAPSHOT'
Jens Bendisposto's avatar
Jens Bendisposto committed
7
8
9
project.group = 'de.hhu.stups'
project.archivesBaseName = "sablecc"

dgelessus's avatar
dgelessus committed
10
wrapper {
11
12
  gradleVersion = "5.2.1"
  distributionType = Wrapper.DistributionType.ALL
dgelessus's avatar
dgelessus committed
13
14
}

15
16
sourceCompatibility = 1.6
targetCompatibility = 1.6
Jens Bendisposto's avatar
Jens Bendisposto committed
17
18

dependencies {
19
  testCompile 'junit:junit:4.8.2'
Jens Bendisposto's avatar
Jens Bendisposto committed
20
21
}

Jens Bendisposto's avatar
Jens Bendisposto committed
22
23

task javadocJar(type: Jar) {
24
25
  classifier = 'javadoc'
  from javadoc
Jens Bendisposto's avatar
Jens Bendisposto committed
26
27
28
}

task sourcesJar(type: Jar) {
29
30
  classifier = 'sources'
  from sourceSets.main.allSource
Jens Bendisposto's avatar
Jens Bendisposto committed
31
32
}

Jens Bendisposto's avatar
Jens Bendisposto committed
33
jar {
34
35
36
  manifest {
    attributes 'Main-Class': 'org.sablecc.sablecc.SableCC'
  }
Jens Bendisposto's avatar
Jens Bendisposto committed
37
}
Jens Bendisposto's avatar
Jens Bendisposto committed
38
39

artifacts {
40
  archives javadocJar, sourcesJar
Jens Bendisposto's avatar
Jens Bendisposto committed
41
42
}

43
44
45
task writeVersion() {

  doFirst {
46
47
    def buildconstants_class = """
package org.sablecc.sablecc;
48

49
50
51
52
53
54
55
56
public class Version
{
  public static final String VERSION = "${project.version}";
}
    """
    File f = file("src/main/java/org/sablecc/sablecc/Version.java")
    f.delete()
    f <<  buildconstants_class
57
58
59
60
61
62
63
  }
}

compileJava {
  dependsOn = ['writeVersion']
}

Jens Bendisposto's avatar
Jens Bendisposto committed
64
65
task deploy(dependsOn: [jar,test,javadoc], group: 'Build')

Jens Bendisposto's avatar
Jens Bendisposto committed
66
if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
67

68
  apply plugin: 'signing'
Jens Bendisposto's avatar
Jens Bendisposto committed
69

70
  signing {
Jens Bendisposto's avatar
Jens Bendisposto committed
71
    sign configurations.archives
72
73
74
75
76
  }
  uploadArchives {
    repositories {
      mavenDeployer {
        beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
Jens Bendisposto's avatar
Jens Bendisposto committed
77

78
79
80
        repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
          authentication(userName: ossrhUsername, password: ossrhPassword)
        }
Jens Bendisposto's avatar
Jens Bendisposto committed
81

82
83
        snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
          authentication(userName: ossrhUsername, password: ossrhPassword)
Jens Bendisposto's avatar
Jens Bendisposto committed
84
85
        }

86
87
88
89
90
        pom.project {
          name 'SableCC - Stups fork'
          packaging 'jar'
          // optionally artifactId can be defined here
          description 'This version of SableCC enriches the abstract syntax tree with information about tokens.'
Jens Bendisposto's avatar
Jens Bendisposto committed
91
92
          url 'https://github.com/bendisposto/sablecc-stups'

93
94
95
96
97
98
          licenses {
            license {
              name 'GNU Lesser General Public License, Version 2.1'
              url 'http://www.gnu.org/licenses/lgpl-2.1.html'
            }
          }
Jens Bendisposto's avatar
Jens Bendisposto committed
99

100
101
102
103
104
105
106
107
108
109
110
111
112
          scm {
            connection 'scm:git:git://github.com/bendisposto/sablecc-stups.git'
            developerConnection 'scm:git:git@github.com:bendisposto/sablecc-stups.git'
            url 'https://github.com/bendisposto/sablecc-stups'
          }


          developers {
            developer {
              id 'bendisposto'
              name 'Jens Bendisposto'
              email 'jens@bendisposto.de'
            }
Jens Bendisposto's avatar
Jens Bendisposto committed
113
114
115
116
117
118
          }
        }
      }
    }
  }
}