-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from infinum/feature/move-to-maven-central
Update project for Maven central publishing
- Loading branch information
Showing
12 changed files
with
161 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
id "groovy" | ||
} |
41 changes: 41 additions & 0 deletions
41
buildSrc/src/main/groovy/com/infinum/maven/SonatypeConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.infinum.maven | ||
|
||
import com.infinum.maven.shared.Configuration | ||
|
||
class SonatypeConfiguration implements Configuration { | ||
|
||
private Properties properties = new Properties() | ||
|
||
@Override | ||
void load() { | ||
File file = new File("publish.properties") | ||
if (file.exists()) { | ||
properties.load(new FileInputStream(file)) | ||
} else { | ||
properties.setProperty("sonatype.name", "") | ||
properties.setProperty("sonatype.url", "") | ||
properties.setProperty("sonatype.user", "") | ||
properties.setProperty("sonatype.password", "") | ||
} | ||
} | ||
|
||
@Override | ||
String name() { | ||
return properties.getProperty("sonatype.name").toString() | ||
} | ||
|
||
@Override | ||
String url() { | ||
return properties.getProperty("sonatype.url").toString() | ||
} | ||
|
||
@Override | ||
String username() { | ||
return properties.getProperty("sonatype.user").toString() | ||
} | ||
|
||
@Override | ||
String password() { | ||
return properties.getProperty("sonatype.password").toString() | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
buildSrc/src/main/groovy/com/infinum/maven/shared/Configuration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.infinum.maven.shared | ||
|
||
interface Configuration { | ||
|
||
void load() | ||
|
||
String name() | ||
|
||
String url() | ||
|
||
String username() | ||
|
||
String password() | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
apply plugin: "maven-publish" | ||
apply plugin: "signing" | ||
|
||
task sourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} | ||
|
||
task javadocsJar(type: Jar, dependsOn: "dokkaJavadoc") { | ||
archiveClassifier.set("javadoc") | ||
from dokkaJavadoc.outputDirectory | ||
} | ||
|
||
afterEvaluate { | ||
publishing { | ||
repositories { | ||
maven { | ||
name sonatype.name() | ||
url sonatype.url() | ||
credentials { | ||
username sonatype.username() | ||
password sonatype.password() | ||
} | ||
} | ||
} | ||
publications { | ||
release(MavenPublication) { | ||
groupId = 'co.infinum' | ||
version = versions.goldeneye | ||
|
||
artifactId = 'goldeneye' | ||
|
||
artifact bundleReleaseAar | ||
artifact sourcesJar | ||
artifact javadocsJar | ||
|
||
pom { | ||
name = 'GoldenEye' | ||
description = 'A wrapper for Camera1 and Camera2 API which exposes simple to use interface.' | ||
url = 'https://github.com/infinum/Android-GoldenEye' | ||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'novakmarijan' | ||
name = 'Marijan Novak' | ||
email = 'marijan.novak@infinum.com' | ||
} | ||
} | ||
scm { | ||
connection = 'https://github.com/infinum/Android-GoldenEye.git' | ||
developerConnection = 'https://github.com/infinum/Android-GoldenEye.git' | ||
url = 'https://github.com/infinum/Android-GoldenEye' | ||
} | ||
} | ||
pom.withXml { | ||
def root = asNode() | ||
def dependenciesNode = root.appendNode('dependencies') | ||
configurations.implementation.allDependencies.each { | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode('groupId', it.group) | ||
dependencyNode.appendNode('artifactId', it.name) | ||
dependencyNode.appendNode('version', it.version) | ||
} | ||
} | ||
signing { | ||
sign publishing.publications.release | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Tue Sep 25 13:16:57 CEST 2018 | ||
#Fri Apr 02 14:00:41 CEST 2021 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import com.infinum.maven.SonatypeConfiguration | ||
|
||
SonatypeConfiguration.metaClass.constructor = { -> | ||
def constructor = SonatypeConfiguration.class.getConstructor() | ||
def instance = constructor.newInstance() | ||
instance.load() | ||
instance | ||
} | ||
|
||
ext { | ||
sonatype = new SonatypeConfiguration() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters