Skip to content

Commit 6d141d3

Browse files
committed
fix
1 parent f9af10a commit 6d141d3

File tree

3 files changed

+43
-28
lines changed

3 files changed

+43
-28
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ dryRelease:
1919
# remember to remove the -SNAPSHOT suffix from the version
2020
# promotes the release to maven central
2121
doRelease:
22-
./gradlew publish --no-daemon
22+
cd scripts
23+
kotlinc -script release.kts -- -d ../distributions | sh
24+
cd ..
2325
./gradlew closeAndReleaseRepository
2426

2527
# clean, build, deploy and promote to maven central

build.gradle.kts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,14 @@ subprojects {
105105
apply<MavenPublishPlugin>()
106106

107107
configure<MavenPublishPluginExtension> {
108-
val sign = Config.BuildPlugins.shouldSignArtifacts(project.version.toString())
109-
releaseSigningEnabled = sign
108+
// signing is done when uploading files to MC
109+
// via gpg:sign-and-deploy-file (release.kts)
110+
releaseSigningEnabled = false
110111
}
111112

112-
// signing info and maven central info go to:
113+
// maven central info go to:
113114
// ~/.gradle/gradle.properties
114115

115-
// signing info:
116-
// signing.keyId=id
117-
// signing.password=password
118-
// signing.secretKeyRingFile=file path
119-
120116
// maven central info:
121117
// mavenCentralUsername=user name
122118
// mavenCentralPassword=password

scripts/release.kts

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,52 @@ val repositoryUrl = argOrDefault("repositoryUrl", "https://oss.sonatype.org/serv
4545
val repositoryId = argOrDefault("repositoryId", "ossrh")
4646

4747
File(path)
48-
.listFiles { file -> file.isDirectory() }
49-
.forEach { folder ->
50-
val path = folder.path
51-
val module = folder.name
48+
.listFiles { file -> file.isDirectory() }
49+
.forEach { folder ->
50+
val path = folder.path
51+
val module = folder.name
5252

53-
val file: String
53+
val file: String
5454

55-
val androidFile = folder.listFiles { it -> it.name.contains("release") && it.extension == "aar" }.firstOrNull()
56-
if (androidFile != null) {
57-
file = androidFile.path
58-
} else {
59-
file = "$path/$module.jar"
60-
}
61-
val javadocFile = "$path/$module-javadoc.jar"
62-
val sourcesFile = "$path/$module-sources.jar"
63-
val pomFile = "$path/pom-default.xml"
55+
val androidFile = folder
56+
.listFiles { it -> it.name.contains("release") && it.extension == "aar" }
57+
.firstOrNull()
58+
59+
if (androidFile != null) {
60+
file = androidFile.path
61+
} else {
62+
file = "$path/$module.jar"
63+
}
6464

65-
val command = "./mvnw deploy:deploy-file -Dfile=$file -Dfiles=$javadocFile,$sourcesFile -Dclassifiers=sources,javadoc -Dtypes=jar,jar -DpomFile=$pomFile -DrepositoryId=$repositoryId -Durl=$repositoryUrl --settings $settingsPath"
66-
println(command)
67-
}
65+
val javadocFile = "$path/$module-javadoc.jar"
66+
val sourcesFile = "$path/$module-sources.jar"
67+
val pomFile = "$path/pom-default.xml"
68+
69+
// requires GnuPG installed to sign files
70+
// using 'gpg:sign-and-deploy-file' because 'deploy:deploy-file' does not upload
71+
// .asc files.
72+
// TODO: find out where to set keyId, password and secretKeyRingFile if you have
73+
// more than one.
74+
val command = "./mvnw gpg:sign-and-deploy-file " +
75+
"-Dfile=$file " +
76+
"-Dfiles=$javadocFile,$sourcesFile " +
77+
"-Dclassifiers=sources,javadoc " +
78+
"-Dtypes=jar,jar " +
79+
"-DpomFile=$pomFile " +
80+
"-DrepositoryId=$repositoryId " +
81+
"-Durl=$repositoryUrl " +
82+
"--settings $settingsPath"
83+
println(command)
84+
}
6885

6986
/**
7087
* Returns the value for a command line argument passed with -argName flag or throws an exception if not provided.
7188
*/
7289
fun Release.requiredArg(argName: String) =
73-
if (args.contains("-$argName")) args[1 + args.indexOf("-$argName")] else throw Error("$argName parameter must be provided")
90+
if (args.contains("-$argName")) args[1 + args.indexOf("-$argName")] else throw Error("$argName parameter must be provided")
7491

7592
/**
7693
* Returns the value for a command line argument passed with -argName flag or returns the default value.
7794
*/
7895
fun Release.argOrDefault(argName: String, default: String) =
79-
if (args.contains("-$argName")) args[1 + args.indexOf("-$argName")] else default
96+
if (args.contains("-$argName")) args[1 + args.indexOf("-$argName")] else default

0 commit comments

Comments
 (0)