Skip to content

Commit

Permalink
feat: add publishing details
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilpanju committed Jul 3, 2022
1 parent 7092e91 commit 63cf493
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 10 deletions.
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,32 @@ What really is NeoPop? NeoPop was created with one simple goal, to create the ne


## Install
You can install NeoPop by adding this to your build.gradle file:
You can install NeoPop by adding these to your project:

```
1. Add this to your module `build.gradle` file:

```groovy
dependencies {
implementation 'club.cred.android:neopop:1.0.0'
}
```
implementation 'club.cred:neopop:1.0.0'
}
```


2. Add this to the root/project `build.gradle` file:

```groovy
allprojects {
repositories {
google()
jcenter()
maven {
url = 'https://libs.dev.cred.club/'
}
}
}
```


# PopLayout
![Configs](https://user-images.githubusercontent.com/9965653/173539706-fa521743-b214-4372-87dd-799d9b8b6c70.png)
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ allprojects {
repositories {
google()
jcenter()

maven {
url = 'https://libs.dev.cred.club/'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
14 changes: 11 additions & 3 deletions neopop/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
}

apply from: "$project.rootDir/scripts/build-utils.gradle"
apply from: "$project.rootDir/scripts/publish.gradle"

def verCode, verName, verBuild, verNameShort
(verCode, verName, verBuild, verNameShort) = genVersion()

android {
compileSdkVersion 32
buildToolsVersion "30.0.3"

defaultConfig {
minSdkVersion 21
targetSdkVersion 32
versionCode 1
versionName "1.0"
versionCode verCode
versionName "${verName}"
buildConfigField "String", "VERSION_NAME", "\"${verName}\""

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down Expand Up @@ -41,4 +49,4 @@ dependencies {
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
}
3 changes: 2 additions & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ android {
dependencies {
implementation project(":neopop")

// implementation 'club.cred:neopop:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.fragment:fragment-ktx:1.4.1"
implementation 'androidx.core:core-ktx:1.7.0'
Expand All @@ -48,4 +49,4 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
}
26 changes: 26 additions & 0 deletions scripts/build-utils.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ext.genVersion = {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(file('../version.properties')))

def versionMajor = versionProps['major'].toInteger()
def versionMinor = versionProps['minor'].toInteger()
def versionPatch = versionProps['patch'].toInteger()
def versionBuild = versionProps['build'].toInteger()

def verCode = (versionMajor * 10_000_000) + (versionMinor * 100_000) + (versionPatch * 1_000) + versionBuild
def verName = "${versionMajor}.${versionMinor}.${versionPatch}"
if (versionBuild > 0) {
verName = "${verName}-rc${versionBuild}"
}
def verNameShort = "${versionMajor}.${versionMinor}.${versionPatch}"

return [verCode, verName, versionBuild, verNameShort]
}

ext.gitSha = {
return 'git rev-parse --short=10 HEAD'.execute().text.trim()
}

ext.fullGitSha = {
return 'git rev-parse HEAD'.execute().text.trim()
}
53 changes: 53 additions & 0 deletions scripts/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
buildscript {
ext {
awsAccessKeyId = findProperty('aws_access_key_id') ?: 'dummy'
awsSecretAccessKey = findProperty('aws_secret_access_key') ?: 'dummy'
s3ArtifactsUrl = findProperty('artifacts_url') ?: 'https://dummy.com'
}
}

repositories {
mavenCentral()
repositories {
maven {
url = s3ArtifactsUrl
credentials(AwsCredentials) {
accessKey = awsAccessKeyId
secretKey = awsSecretAccessKey
}
}
}
}

def verCode, verName, verBuild, verNameShort
(verCode, verName, verBuild, verNameShort) = genVersion()

afterEvaluate {
publishing {
repositories {
maven {
url = s3ArtifactsUrl
credentials(AwsCredentials) {
accessKey = awsAccessKeyId
secretKey = awsSecretAccessKey
}
}
}
publications {
release(MavenPublication) {
groupId 'club.cred'
artifactId 'neopop'
version "${verName}"
if (project.plugins.findPlugin("com.android.library")) {
from components.release
}

pom {
name = 'neopop'
description = 'cred neopop UI library for android'
url = 'https://cred.club'
}
}
}
}
}
4 changes: 4 additions & 0 deletions version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
major=1
minor=0
patch=0
build=0

0 comments on commit 63cf493

Please sign in to comment.