forked from JetBrains/pty4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
186 lines (165 loc) · 4.84 KB
/
build.gradle
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import java.text.SimpleDateFormat
import org.apache.tools.ant.filters.FixCrLfFilter
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import jetbrains.sign.GpgSignSignatoryProvider
buildscript {
repositories {
maven { url 'https://packages.jetbrains.team/maven/p/jcs/maven' }
}
dependencies {
classpath 'com.jetbrains:jet-sign:38'
}
}
plugins {
id 'java-library'
id 'maven-publish'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}
apply plugin: 'maven-publish'
apply plugin: 'signing'
def pathToNativeInJar = 'resources/com/pty4j/native'
def projectVersion = new File(rootProject.projectDir, 'VERSION').text
version = projectVersion
group = 'org.jetbrains.pty4j'
archivesBaseName = 'pty4j'
sourceSets {
main {
java {
srcDirs = ['src']
}
}
test {
java {
srcDirs = ['test']
}
resources {
srcDir 'test/resources'
}
}
}
test {
testLogging {
events("passed", "skipped", "failed")
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
}
}
compileJava {
sourceCompatibility = '11'
targetCompatibility = '11'
options.debugOptions.debugLevel = 'lines,vars,source'
}
repositories {
maven {
url "https://packages.jetbrains.team/maven/p/ij/intellij-dependencies"
}
mavenCentral()
}
jar {
from('os') {
include '**/*'
into pathToNativeInJar
}
manifest {
attributes(
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Created-By': "Gradle ${gradle.gradleVersion}",
'Build-Jdk': "${System.properties['java.runtime.version']}",
'Build-OS': "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
)
}
}
task sourcesZip(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
filter(FixCrLfFilter.class, eol:FixCrLfFilter.CrLf.newInstance("lf"))
}
task javadocJar(type: Jar) {
from javadoc
}
artifacts {
archives sourcesZip
}
task testJar(type: Test, dependsOn: [jar, testClasses]) {
description = 'Runs tests on built jar instead of build/classes/java/main/**/*.class files'
group = 'verification'
testClassesDirs = sourceSets.test.output.classesDirs
classpath = project.files("$buildDir/libs/" + jar.archiveFileName.get(),
sourceSets.test.output.classesDirs,
sourceSets.test.output.resourcesDir,
configurations.testRuntimeClasspath)
systemProperty 'pty4j.preferred.native.folder', 'false'
shouldRunAfter test
}
check.dependsOn test, testJar
dependencies {
implementation 'org.jetbrains.pty4j:purejavacomm:0.0.11.1'
implementation 'org.jetbrains:annotations:20.1.0'
implementation "org.slf4j:slf4j-api:1.7.36"
implementation 'net.java.dev.jna:jna:5.12.1'
implementation 'net.java.dev.jna:jna-platform:5.12.1'
testImplementation 'com.google.guava:guava:31.1-jre'
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly "org.slf4j:slf4j-simple:1.7.36"
}
ext.publishingUser = System.getenv('PUBLISHING_USER')
ext.publishingPassword = System.getenv('PUBLISHING_PASSWORD')
nexusPublishing {
repositories {
sonatype {
username = rootProject.ext.publishingUser
password = rootProject.ext.publishingPassword
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
group rootProject.group
artifactId archivesBaseName
artifact sourcesZip
artifact javadocJar {
classifier 'javadoc'
}
version rootProject.ext.publishingUser != null ? projectVersion : projectVersion + '-SNAPSHOT'
pom {
name = 'pty4j'
description = 'Pseudo terminal(PTY) implementation in Java'
url = 'https://github.com/JetBrains/pty4j'
licenses {
license {
name = 'Eclipse Public License 1.0'
url = 'https://opensource.org/licenses/eclipse-1.0.php'
}
}
developers {
developer {
id = 'sergey.simonchik'
name = 'Sergey Simonchik'
organization = 'JetBrains'
organizationUrl = 'https://www.jetbrains.com'
email = '[email protected]'
}
developer {
id = 'dmitry.trofimov'
name = 'Dmitry Trofimov'
organization = 'JetBrains'
organizationUrl = 'https://www.jetbrains.com'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:JetBrains/pty4j.git'
developerConnection = 'scm:git:ssh:github.com/JetBrains/pty4j.git'
url = 'https://github.com/JetBrains/pty4j'
}
}
}
}
}
signing {
sign publishing.publications
signatories = new GpgSignSignatoryProvider()
}