-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add way to publish to MavenLocal (#11)
* Add way to publish to MavenLocal * Update update_version.sh
- Loading branch information
Showing
9 changed files
with
120 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
id 'com.android.application' version '8.0.2' apply false | ||
id 'com.android.library' version '8.0.2' apply false | ||
id 'com.android.application' version '8.1.1' apply false | ||
id 'com.android.library' version '8.1.1' apply false | ||
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false | ||
id 'com.google.dagger.hilt.android' version '2.41' apply false | ||
} |
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,52 @@ | ||
|
||
project.afterEvaluate { | ||
publishToMavenLocal { | ||
def groupId = LIBRARY_GROUP | ||
def artifactId = LIBRARY_ARTIFACT_ID | ||
def versionName = LIBRARY_VERSION_NAME + "-local" | ||
def debugSuffix = "-debug" | ||
def releaseSuffix = "-release" | ||
publishing { | ||
publications { | ||
LibraryRelease(MavenPublication) { | ||
from components.release | ||
// artifact(sourceJar) | ||
setGroupId groupId | ||
setArtifactId artifactId | ||
version versionName + releaseSuffix | ||
} | ||
LibraryDebug(MavenPublication) { | ||
from components.debug | ||
// artifact(sourceJar) | ||
setGroupId groupId | ||
setArtifactId artifactId | ||
version versionName + debugSuffix | ||
} | ||
} | ||
publications.all { | ||
pom.withXml { | ||
asNode().dependencies.'*' | ||
.findAll() { | ||
it.scope.text() == 'runtime' && | ||
project.configurations.implementation.allDependencies.find { | ||
dep -> dep.name == it.artifactId.text() | ||
} | ||
}.each { it.scope*.value = 'compile'} | ||
} | ||
} | ||
} | ||
|
||
doLast { | ||
def prettyPrint = { | ||
1.upto(100, { print "=" }) | ||
println() | ||
} | ||
println() | ||
prettyPrint() | ||
println "PUBLICATION FINISHED" | ||
println "Artifact RELEASE: " + groupId + ":" + artifactId + ":" + versionName + releaseSuffix | ||
println "Artifact DEBUG: " + groupId + ":" + artifactId + ":" + versionName + debugSuffix | ||
prettyPrint() | ||
} | ||
} | ||
} |
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,39 @@ | ||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId LIBRARY_GROUP | ||
artifactId LIBRARY_ARTIFACT_ID | ||
version LIBRARY_VERSION_NAME | ||
artifact sourceJar | ||
artifact "$buildDir/outputs/aar/cartera-release.aar" | ||
|
||
pom { | ||
withXml { | ||
def dependenciesNode = asNode().appendNode('dependencies') | ||
|
||
project.configurations.implementation.allDependencies.each { | ||
if (it.group != null || it.name != null || it.version != null || it.name == "unspecified") return | ||
|
||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode('groupId', it.group) | ||
dependencyNode.appendNode('artifactId', it.name) | ||
dependencyNode.appendNode('version', it.version) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
def github_username = System.getenv('github_username') | ||
def github_token = System.getenv('github_token') | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/dydxprotocol/cartera-android") | ||
credentials { | ||
username github_username | ||
password github_token | ||
} | ||
} | ||
} | ||
} |
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
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,16 +1,14 @@ | ||
#!/bin/sh | ||
|
||
# search for the first line that starts with "version" in cartera/ build.gradle | ||
# get the value in the quotes | ||
VERSION=$(grep "^ version" cartera/build.gradle | sed -n 's/ version "\(.*\)"/\1/p') | ||
|
||
# find the version number from the line LIBRARY_VERSION_NAME=0.0.1 in gradle.properties | ||
# and assign it to the variable VERSION | ||
VERSION=$(grep "^LIBRARY_VERSION_NAME=" gradle.properties | sed -n 's/LIBRARY_VERSION_NAME=\(.*\)/\1/p') | ||
|
||
echo "Current version is $VERSION. Enter new version (or press enter to skip):" | ||
read NEW_VERSION | ||
|
||
#if NEW_VERSION is not empty, replace the version in build.gradle | ||
if [ ! -z "$NEW_VERSION" ]; then | ||
echo "Updating version to $NEW_VERSION" | ||
sed -i '' "s/version \"$VERSION\"/version \"$NEW_VERSION\"/" cartera/build.gradle | ||
sed -i '' "s/LIBRARY_VERSION_NAME=$VERSION/LIBRARY_VERSION_NAME=$NEW_VERSION/" gradle.properties | ||
fi | ||
|