diff --git a/app/build.gradle b/app/build.gradle index 2a659c99..ae56acc1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,7 +19,7 @@ android { } } - if(hasProperty('MATERIAL_KEYSTORE_FILE')) { + if(project.hasProperty('MATERIAL_KEYSTORE_FILE')) { android.signingConfigs { release { storeFile file(MATERIAL_KEYSTORE_FILE) diff --git a/dist/bintray.gradle b/dist/bintray.gradle index c333caed..d32323c5 100644 --- a/dist/bintray.gradle +++ b/dist/bintray.gradle @@ -1,41 +1,42 @@ apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' -apply from: "$rootProject.projectDir/dist/distInfo.gradle" -group = publishedGroupId // Maven Group ID for the artifact +def distInfo = ext.distInfo; + +group = distInfo.publishedGroupId // Maven Group ID for the artifact install { repositories.mavenInstaller { // This generates POM.xml with proper parameters pom { project { - packaging 'aar' - groupId publishedGroupId - artifactId artifact + packaging distInfo.libraryPackaging + groupId distInfo.publishedGroupId + artifactId distInfo.artifact // Add your description here - name libraryName - description libraryDescription - url siteUrl + name distInfo.libraryName + description distInfo.libraryDescription + url distInfo.siteUrl // Set your license licenses { license { - name licenseName - url licenseUrl + name distInfo.licenseName + url distInfo.licenseUrl } } developers { developer { - id developerId - name developerName - email developerEmail + id distInfo.developerId + name distInfo.developerName + email distInfo.developerEmail } } scm { - connection gitUrl - developerConnection gitUrl - url siteUrl + connection distInfo.gitUrl + developerConnection distInfo.gitUrl + url distInfo.siteUrl } } @@ -43,7 +44,7 @@ install { } } -version = libraryVersion +version = distInfo.libraryVersion task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs @@ -66,24 +67,24 @@ artifacts { } bintray { - user = bintrayUser - key = bintrayApiKey + user = distInfo.bintrayUser + key = distInfo.bintrayApiKey configurations = ['archives'] pkg { - repo = bintrayRepo - name = bintrayName - desc = libraryDescription - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = allLicenses + repo = distInfo.bintrayRepo + name = distInfo.bintrayName + desc = distInfo.libraryDescription + websiteUrl = distInfo.siteUrl + vcsUrl = distInfo.gitUrl + licenses = distInfo.allLicenses publish = true publicDownloadNumbers = true version { - desc = libraryDescription + desc = distInfo.libraryDescription gpg { sign = true //Determines whether to GPG sign the files. The default is false - passphrase = bintrayGpgPassword + passphrase = distInfo.bintrayGpgPassword //Optional. The passphrase for GPG signing' } } diff --git a/dist/distInfo.gradle b/dist/distInfo.gradle index 391d387a..5ce9ef33 100644 --- a/dist/distInfo.gradle +++ b/dist/distInfo.gradle @@ -1,34 +1,33 @@ -ext { - bintrayUser = project.hasProperty('BINTRAY_USERNAME') ? BINTRAY_USERNAME : "" - bintrayApiKey = project.hasProperty('BINTRAY_APIKEY') ? BINTRAY_APIKEY : "" - bintrayGpgPassword = project.hasProperty('GPG_PASSWORD') ? GPG_PASSWORD : "" - - mavenUser = project.hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" - mavenPassword = project.hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" - mavenReleaseRepo = project.hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - mavenSnapshotRepo = project.hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : "https://oss.sonatype.org/content/repositories/snapshots/" - - bintrayRepo = 'maven' - bintrayName = 'material' - - publishedGroupId = 'com.github.rey5137' - libraryName = 'Material Library' - artifact = 'material' - libraryPackaging = 'aar' - - libraryDescription = 'An Android library to bring Material Design UI to pre-Lolipop Android.' - - siteUrl = 'https://github.com/rey5137/material' - gitUrl = 'https://github.com/rey5137/material.git' - - libraryVersion = '1.2.3' - - developerId = 'rey5137' - developerName = 'Rey Pham' - developerEmail = 'pea5137@gmail.com' - - licenseName = 'The Apache Software License, Version 2.0' - licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - licenseDist = 'repo' - allLicenses = ["Apache-2.0"] -} +ext.distInfo = [ + bintrayUser : project.hasProperty('BINTRAY_USERNAME') ? BINTRAY_USERNAME : "", + bintrayApiKey : project.hasProperty('BINTRAY_APIKEY') ? BINTRAY_APIKEY : "", + bintrayGpgPassword : project.hasProperty('GPG_PASSWORD') ? GPG_PASSWORD : "", + + mavenUser : project.hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "", + mavenPassword : project.hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "", + mavenReleaseRepo : project.hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : "https://oss.sonatype.org/service/local/staging/deploy/maven2/", + mavenSnapshotRepo : project.hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : "https://oss.sonatype.org/content/repositories/snapshots/", + + bintrayRepo : "maven", + bintrayName : "material", + + publishedGroupId : "com.github.rey5137", + libraryName : "Material Library", + libraryVersion : "1.2.4", + libraryDescription : "An Android library to bring Material Design UI to pre-Lolipop Android.", + artifact : "material", + libraryPackaging : "aar", + + siteUrl : "https://github.com/rey5137/material", + gitUrl : "https://github.com/rey5137/material.git", + + + developerId : "rey5137", + developerName : "Rey Pham", + developerEmail : "pea5137@gmail.com", + + licenseName : "The Apache Software License, Version 2.0", + licenseUrl : "http://www.apache.org/licenses/LICENSE-2.0.txt", + licenseDist : "repo", + allLicenses : ["Apache-2.0"] +] diff --git a/dist/maven.gradle b/dist/maven.gradle index 9930a156..ca577140 100644 --- a/dist/maven.gradle +++ b/dist/maven.gradle @@ -16,10 +16,11 @@ apply plugin: 'maven' apply plugin: 'signing' -apply from: "$rootProject.projectDir/dist/distInfo.gradle" + +def distInfo = ext.distInfo; def isReleaseBuild() { - return libraryVersion.contains("SNAPSHOT") == false + return distInfo.libraryVersion.contains("SNAPSHOT") == false } afterEvaluate { project -> @@ -28,41 +29,41 @@ afterEvaluate { project -> mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - pom.groupId = publishedGroupId - pom.artifactId = artifact - pom.version = libraryVersion + pom.groupId = distInfo.publishedGroupId + pom.artifactId = distInfo.artifact + pom.version = distInfo.libraryVersion - repository(url: mavenReleaseRepo) { - authentication(userName: mavenUser, password: mavenPassword) + repository(url: distInfo.mavenReleaseRepo) { + authentication(userName: distInfo.mavenUser, password: distInfo.mavenPassword) } - snapshotRepository(url: mavenSnapshotRepo) { - authentication(userName: mavenUser, password: mavenPassword) + snapshotRepository(url: distInfo.mavenSnapshotRepo) { + authentication(userName: distInfo.mavenUser, password: distInfo.mavenPassword) } pom.project { - name libraryName - packaging libraryPackaging - description libraryDescription - url siteUrl + name distInfo.libraryName + packaging distInfo.libraryPackaging + description distInfo.libraryDescription + url distInfo.siteUrl scm { - url siteUrl - connection gitUrl - developerConnection gitUrl + url distInfo.siteUrl + connection distInfo.gitUrl + developerConnection distInfo.gitUrl } licenses { license { - name licenseName - url licenseUrl - distribution licenseDist + name distInfo.licenseName + url distInfo.licenseUrl + distribution distInfo.licenseDist } } developers { developer { - id developerId - name developerName + id distInfo.developerId + name distInfo.developerName } } } diff --git a/material/build.gradle b/material/build.gradle index 1eea2ea3..38b9c1fe 100644 --- a/material/build.gradle +++ b/material/build.gradle @@ -8,7 +8,7 @@ android { minSdkVersion 9 targetSdkVersion 23 versionCode 21 - versionName "1.2.3" + versionName "1.2.4" } buildTypes { release { @@ -18,9 +18,6 @@ android { } } -apply from: "$rootProject.projectDir/dist/bintray.gradle" -apply from: "$rootProject.projectDir/dist/maven.gradle" - ext{ libSupportVersion = '23.4.0' } @@ -32,3 +29,8 @@ dependencies { compile "com.android.support:cardview-v7:${libSupportVersion}" compile "com.android.support:recyclerview-v7:${libSupportVersion}" } + +// Place it at the end of the file +apply from: "$rootProject.projectDir/dist/distInfo.gradle" +apply from: "$rootProject.projectDir/dist/bintray.gradle" +apply from: "$rootProject.projectDir/dist/maven.gradle"