@@ -45,35 +45,52 @@ val repositoryUrl = argOrDefault("repositoryUrl", "https://oss.sonatype.org/serv
4545val repositoryId = argOrDefault(" repositoryId" , " ossrh" )
4646
4747File (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 */
7289fun 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 */
7895fun 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