|
1 | 1 | apply plugin: 'idea' |
2 | 2 | apply plugin: 'eclipse' |
3 | | -apply plugin: 'java' |
4 | 3 | apply plugin: 'com.diffplug.spotless' |
5 | 4 | apply plugin: 'maven-publish' |
6 | | -apply plugin: 'signing' |
7 | 5 |
|
8 | 6 | group = 'com.fastcomments' |
9 | 7 | version = project.findProperty('releaseVersion') ?: '0.0.1-SNAPSHOT' |
@@ -36,137 +34,18 @@ jar { |
36 | 34 | } |
37 | 35 | } |
38 | 36 |
|
39 | | -java { |
40 | | - withJavadocJar() |
41 | | - withSourcesJar() |
42 | | -} |
43 | | - |
44 | | -publishing { |
45 | | - publications { |
46 | | - mavenJava(MavenPublication) { |
47 | | - from components.java |
48 | | - |
49 | | - pom { |
50 | | - name = 'FastComments Java Core' |
51 | | - description = 'Official FastComments Core Library for Java' |
52 | | - url = 'https://github.com/FastComments/fastcomments-java' |
53 | | - |
54 | | - licenses { |
55 | | - license { |
56 | | - name = 'MIT' |
57 | | - } |
58 | | - } |
59 | | - |
60 | | - developers { |
61 | | - developer { |
62 | | - id = 'fastcomments' |
63 | | - name = 'FastComments Team' |
64 | | - |
65 | | - } |
66 | | - } |
67 | | - |
68 | | - scm { |
69 | | - connection = 'scm:git:git://github.com/FastComments/fastcomments-java.git' |
70 | | - developerConnection = 'scm:git:ssh://github.com/FastComments/fastcomments-java.git' |
71 | | - url = 'https://github.com/FastComments/fastcomments-java' |
72 | | - } |
73 | | - } |
74 | | - } |
75 | | - } |
76 | | - |
77 | | - repositories { |
78 | | - maven { |
79 | | - name = "sonatype" |
80 | | - def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" |
81 | | - def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" |
82 | | - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
83 | | - |
84 | | - credentials { |
85 | | - username = findProperty('ossrhUsername') ?: System.getenv('OSSRH_USERNAME') |
86 | | - password = findProperty('ossrhPassword') ?: System.getenv('OSSRH_PASSWORD') |
87 | | - } |
88 | | - } |
89 | | - } |
90 | | -} |
91 | | - |
92 | | -signing { |
93 | | - def signingKey = findProperty('signingKey') ?: System.getenv('SIGNING_KEY') |
94 | | - def signingPassword = findProperty('signingPassword') ?: System.getenv('SIGNING_PASSWORD') |
95 | | - |
96 | | - // Only sign if credentials are available (required for Maven Central, optional for local) |
97 | | - required = signingKey != null && signingPassword != null |
98 | | - if (required) { |
99 | | - useInMemoryPgpKeys(signingKey, signingPassword) |
100 | | - sign publishing.publications.mavenJava |
101 | | - } |
102 | | -} |
103 | | - |
104 | | -if (hasProperty('target') && target == 'android') { |
105 | | - |
106 | | - apply plugin: 'com.android.library' |
107 | | - apply plugin: 'com.github.dcendents.android-maven' |
108 | | - |
109 | | - android { |
110 | | - compileSdkVersion 25 |
111 | | - buildToolsVersion '25.0.2' |
112 | | - defaultConfig { |
113 | | - minSdkVersion 14 |
114 | | - targetSdkVersion 25 |
115 | | - } |
116 | | - compileOptions { |
117 | | - sourceCompatibility JavaVersion.VERSION_1_8 |
118 | | - targetCompatibility JavaVersion.VERSION_1_8 |
119 | | - } |
120 | | - |
121 | | - // Rename the aar correctly |
122 | | - libraryVariants.all { variant -> |
123 | | - variant.outputs.each { output -> |
124 | | - def outputFile = output.outputFile |
125 | | - if (outputFile != null && outputFile.name.endsWith('.aar')) { |
126 | | - def fileName = "${project.name}-${variant.baseName}-${version}.aar" |
127 | | - output.outputFile = new File(outputFile.parent, fileName) |
128 | | - } |
129 | | - } |
130 | | - } |
131 | | - |
132 | | - dependencies { |
133 | | - provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" |
134 | | - } |
135 | | - } |
136 | | - |
137 | | - afterEvaluate { |
138 | | - android.libraryVariants.all { variant -> |
139 | | - def task = project.tasks.create "jar${variant.name.capitalize()}", Jar |
140 | | - task.description = "Create jar artifact for ${variant.name}" |
141 | | - task.dependsOn variant.javaCompile |
142 | | - task.from variant.javaCompile.destinationDirectory |
143 | | - task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") |
144 | | - task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" |
145 | | - artifacts.add('archives', task) |
146 | | - } |
147 | | - } |
148 | | - |
149 | | - task sourcesJar(type: Jar) { |
150 | | - from android.sourceSets.main.java.srcDirs |
151 | | - classifier = 'sources' |
152 | | - } |
153 | | - |
154 | | - artifacts { |
155 | | - archives sourcesJar |
156 | | - } |
| 37 | +// No need to define publishing here; it's in the init script |
157 | 38 |
|
158 | | -} else { |
159 | 39 |
|
160 | | - apply plugin: 'java' |
161 | | - apply plugin: 'maven-publish' |
| 40 | +// Only apply Java configuration |
| 41 | +apply plugin: 'java' |
162 | 42 |
|
163 | | - sourceCompatibility = JavaVersion.VERSION_1_8 |
164 | | - targetCompatibility = JavaVersion.VERSION_1_8 |
| 43 | +sourceCompatibility = JavaVersion.VERSION_1_8 |
| 44 | +targetCompatibility = JavaVersion.VERSION_1_8 |
165 | 45 |
|
166 | | - task execute(type: JavaExec) { |
167 | | - main = System.getProperty('mainClass') |
168 | | - classpath = sourceSets.main.runtimeClasspath |
169 | | - } |
| 46 | +task execute(type: JavaExec) { |
| 47 | + main = System.getProperty('mainClass') |
| 48 | + classpath = sourceSets.main.runtimeClasspath |
170 | 49 | } |
171 | 50 |
|
172 | 51 | ext { |
|
0 commit comments