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


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

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

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

19
20
21
22
23
repositories {
  mavenLocal()
  jcenter()
}

dgelessus's avatar
dgelessus committed
24
25
mainClassName = "org.sablecc.sablecc.SableCC"

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

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

Jens Bendisposto's avatar
Jens Bendisposto committed
36
jar {
37
  manifest {
dgelessus's avatar
dgelessus committed
38
    attributes 'Main-Class': mainClassName
39
  }
Jens Bendisposto's avatar
Jens Bendisposto committed
40
}
Jens Bendisposto's avatar
Jens Bendisposto committed
41
42

artifacts {
43
  archives javadocJar, sourcesJar
Jens Bendisposto's avatar
Jens Bendisposto committed
44
45
}

46
47
48
task writeVersion() {

  doFirst {
49
50
    def buildconstants_class = """
package org.sablecc.sablecc;
51

52
53
54
55
public class Version
{
  public static final String VERSION = "${project.version}";
}
dgelessus's avatar
dgelessus committed
56
"""
57
58
59
    File f = file("src/main/java/org/sablecc/sablecc/Version.java")
    f.delete()
    f <<  buildconstants_class
60
61
62
63
64
65
66
  }
}

compileJava {
  dependsOn = ['writeVersion']
}

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

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

71
  apply plugin: 'signing'
Jens Bendisposto's avatar
Jens Bendisposto committed
72

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

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

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

89
90
91
92
93
        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
94
95
          url 'https://github.com/bendisposto/sablecc-stups'

96
97
98
99
100
101
          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
102

103
104
105
106
107
108
109
110
111
112
113
114
115
          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
116
117
118
119
120
121
          }
        }
      }
    }
  }
}