From 83056b297d8d1ca7ddbfc83867145b8e54a02f23 Mon Sep 17 00:00:00 2001 From: Takaoka Kazumasa Date: Fri, 22 Apr 2016 19:14:56 +0900 Subject: [PATCH] modify gradles --- build.gradle | 27 +------ library/build.gradle | 2 - library/gradle-mvn-push.gradle | 142 --------------------------------- release.gradle | 44 ---------- 4 files changed, 1 insertion(+), 214 deletions(-) delete mode 100644 library/gradle-mvn-push.gradle delete mode 100644 release.gradle diff --git a/build.gradle b/build.gradle index 36486a8aa..2da409739 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,3 @@ -def isReleaseBuild() { - return version.contains("SNAPSHOT") == false -} - -/* - * Copyright 2014 Alex Curran - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - allprojects { group = GROUP version = VERSION_CODE @@ -26,9 +6,4 @@ allprojects { mavenCentral() } - tasks.withType(JavaCompile) { - options.encoding = "UTF-8" - } -} - -apply from:'release.gradle' +} \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index fddc539cb..c57076d28 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -55,5 +55,3 @@ def parseVersionName() { return "0" } } - -apply from: 'gradle-mvn-push.gradle' diff --git a/library/gradle-mvn-push.gradle b/library/gradle-mvn-push.gradle deleted file mode 100644 index afcf05a30..000000000 --- a/library/gradle-mvn-push.gradle +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2014 Alex Curran - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'maven' -apply plugin: 'signing' - -def isReleaseBuild() { - return versionName.contains("SNAPSHOT") == false -} - -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" -} - -def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" -} - -def getVersionName() { - if (project.hasProperty("versionName")) { - return project.property("versionName") - } else { - println("No version name supplied, using default (mvn-push)") - return "0" - } -} - -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = getVersionName() - - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - 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 - } - } - } - } - } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - task apklib(type: Zip) { - appendix = extension = 'apklib' - - from 'src/main/AndroidManifest.xml' - into('res') { - from 'src/main/res' - } - into('src') { - from 'src/main/java' - } - } - - task androidJavadocs(type: Javadoc) { - title = "ShowcaseView ${getVersionName()}" - ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - source = android.sourceSets.main.java.getSrcDirs() - classpath = files(ext.androidJar) - options.links("http://docs.oracle.com/javase/7/docs/api/") - options.linksOffline("http://d.android.com/reference/", "/Applications/Android Studio.app/sdk/docs/reference/") - exclude '**/BuildConfig.java' - exclude '**/R.java' - } - - task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = 'javadoc' - from androidJavadocs.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.getSrcDirs() - } - - artifacts { - archives androidSourcesJar - archives androidJavadocsJar - archives apklib - } -} diff --git a/release.gradle b/release.gradle deleted file mode 100644 index e62c5f158..000000000 --- a/release.gradle +++ /dev/null @@ -1,44 +0,0 @@ -task showcaseViewRelease << { - if (!project.hasProperty("versionName")) { - throw new TaskExecutionException(tasks['commitRelease'], new NullPointerException("No version name supplied")) - } -} - -showcaseViewRelease.dependsOn('editReadme') -showcaseViewRelease.dependsOn('library:uploadArchives') -showcaseViewRelease.finalizedBy('commitRelease') - -task commitRelease(type: Exec) { - commandLine 'git', "commit", "README.md", "-m", "Update to version " + getVersionName() -} - -task createGithubRelease(type: Exec) { - def versionName = getVersionName() - def jsonData = JsonOutput.toJson([ - tag_name: "$versionName", - name : "$versionName", - draft : true]) - commandLine "curl", "--data", jsonData, "-u", "tttakaoka:" + System.getenv('GITHUB_TOKEN'), "https://api.github.com/repos/tttakaoka/ShowcaseView/releases" -} - - -import groovy.json.JsonOutput -import org.apache.tools.ant.filters.ReplaceTokens - -task editReadme(type: Copy) { - from('.') { - include 'README-template.md' - rename('README-template.md', 'README.md') - filter(ReplaceTokens, tokens: ['version': versionName]) - } - into '.' -} - -def getVersionName() { - if (project.hasProperty("versionName")) { - return project.property("versionName") - } else { - println("using default version no.") - return "" - } -}