-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbuild.gradle
More file actions
117 lines (103 loc) · 3.49 KB
/
build.gradle
File metadata and controls
117 lines (103 loc) · 3.49 KB
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
plugins {
id 'com.diffplug.spotless' version '6.23.1'
id 'com.github.node-gradle.node' version '7.0.1'
id 'java-library'
id 'maven-publish'
id 'signing'
}
group = 'org.sqids'
version = '0.1.0-SNAPSHOT'
String rootArtifactId = 'sqids'
String projectUrl = 'https://sqids.org/java'
repositories {
mavenCentral()
}
dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
test {
useJUnitPlatform()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = rootArtifactId
version = version
from components.java
pom {
name = 'Sqids'
description = 'Generate short YouTube-looking IDs from numbers.'
url = projectUrl
properties = [
'parent.groupId': 'org.sonatype.oss',
'parent.artifactId': 'oss-parent',
'parent.version': '7'
]
licenses {
license {
name = 'MIT License'
url = 'https://github.com/sqids/sqids-java/blob/main/LICENSE'
}
}
developers {
developer {
id = '0x3333'
name = 'Tercio Gaudencio Filho'
email = 'terciofilho@gmail.com'
}
}
scm {
connection = 'scm:git:https://github.com/sqids/sqids-java.git'
developerConnection = 'scm:git:ssh://git@github.com:sqids/sqids-java.git'
url = projectUrl
}
}
}
}
repositories {
maven {
String releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
String snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv('SONATYPE_USERNAME')
password System.getenv('SONATYPE_PASSWORD')
}
}
}
signing {
useGpgCmd()
sign publishing.publications.mavenJava
}
}
node {
download = true
}
String nodeSetup = 'nodeSetup'
String npmSetup = 'npmSetup'
spotless {
format 'prettier', {
target '**/*.java', '**/*.properties', '**/*.md', '**/*.yml', '**/*.yaml'
targetExclude 'bin/**/*', 'gradle/**/*'
boolean isWindows = System.getProperty('os.name').toLowerCase().contains('windows')
String nodeExec = isWindows ? '/node.exe' : '/bin/node'
String npmExec = isWindows ? '/npm.cmd' : '/bin/npm'
prettier(['prettier': '3.1.0', 'prettier-plugin-java': '2.2.0', 'prettier-plugin-properties': '0.3.0'])
.npmInstallCache()
.npmExecutable("${tasks.named(npmSetup).get().npmDir.get()}${npmExec}")
.nodeExecutable("${tasks.named(nodeSetup).get().nodeDir.get()}${nodeExec}")
.configFile('.prettierrc.yaml')
}
}
tasks.named('spotlessPrettier').configure { task ->
task.dependsOn(nodeSetup, npmSetup)
}