Skip to content

Commit

Permalink
Merge pull request #30 from TinkoffCreditSystems/prepare-project-for-…
Browse files Browse the repository at this point in the history
…autoreleases

Prepare project for autorelease
  • Loading branch information
Alex Maxakov authored Dec 8, 2020
2 parents dc85562 + d9af10d commit 2e16fd9
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 116 deletions.
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def useMavenLocal = project.hasProperty("useMavenLocal")

buildscript {

Expand All @@ -7,12 +7,13 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.6.4'
}
}

allprojects {
repositories {
if (useMavenLocal) mavenLocal()
google()
jcenter()
}
Expand All @@ -27,8 +28,11 @@ ext {
compileSdk = 28
targetSdk = 28

appCompatVersion = "1.1.0"
constraintLayoutVersion = "1.1.3"
isRelease = project.hasProperty('release')
versionName = isRelease ? VERSION_NAME : "$VERSION_NAME-SNAPSHOT"

appCompatVersion = "1.2.0"
constraintLayoutVersion = "2.0.4"
viewPagerVersion = "1.0.0"
viewPager2Version = "1.0.0"
cardViewVersion = "1.0.0"
Expand Down
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 1.2.1

#### Fixes
#### Changes
-[scrollingpagerindicator] updated android gradle plugin to 3.6.4
-[scrollingpagerindicator] changed publishing plugin to maven-publish
#### Additions
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

android.useAndroidX=true
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
161 changes: 52 additions & 109 deletions gradle/publish-lib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,155 +13,98 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'maven-publish'

apply plugin: 'maven'
apply plugin: 'signing'

version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
def getEnvValueOrEmpty(String key) {
String value = System.getenv(key)
return value != null ? value : ""
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def getReleaseRepository() {
return getEnvValueOrEmpty("PRIVATE_NEXUS_RELEASE_URL")
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
def getSnapshotRepository() {
return getEnvValueOrEmpty("PRIVATE_NEXUS_SNAPSHOT_URL")
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ''
return getEnvValueOrEmpty("PRIVATE_NEXUS_USER")
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ''
return getEnvValueOrEmpty("PRIVATE_NEXUS_PASSWORD")
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
publishing {
publications {
mavenAar(MavenPublication) {
from components.release
groupId GROUP
version versionName
afterEvaluate {
artifact sourcesJar
artifact javadocJar
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task install(type: Upload, dependsOn: assemble) {
repositories.mavenInstaller {
configuration = configurations.archives

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
repositories {
maven {
url isRelease ? getReleaseRepository() : getSnapshotRepository()
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
}

task androidJavadocs(type: Javadoc, dependsOn: preBuild) {
tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

tasks.register('androidJavadocJar', Javadoc) {
dependsOn(preBuild)
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
source = android.sourceSets.main.java.source
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

artifacts {
archives androidSourcesJar
archives androidJavadocsJar

tasks.register('javadocJar', Jar) {
dependsOn(tasks.named('androidJavadocJar'))
archiveClassifier.set('javadoc')
from "$buildDir/docs/javadoc"
}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 22 12:47:41 MSK 2018
#Mon Dec 07 17:17:41 MSK 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
2 changes: 1 addition & 1 deletion scrollingpagerindicator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
}

libraryVariants.all {
it.generateBuildConfig.enabled = false
it.getGenerateBuildConfigProvider().get().enabled = false
}
}

Expand Down

0 comments on commit 2e16fd9

Please sign in to comment.