├── LICENSE ├── PRJ_NAME ├── .gitignore ├── LICENSE ├── PRJ_NAME │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── piasy │ │ │ │ └── PRJ_PKG_NAME │ │ │ │ ├── MainActivity.java │ │ │ │ └── MyApp.java │ │ └── res │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── github │ │ └── piasy │ │ └── PRJ_PKG_NAME │ │ └── PRJ_NAME.java ├── README.md ├── build.gradle ├── gradle.properties ├── gradle │ ├── bintray.gradle │ ├── bintray.properties │ ├── simple_lib_android_bintray.gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── simple_lib_android_bintray_release.sh ├── README.md ├── package_piasy_android_simple_lib.sh ├── piasy_android_simple_lib.sh └── piasy_android_simple_lib.tar /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Piasy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PRJ_NAME/.gitignore: -------------------------------------------------------------------------------- 1 | **.iml 2 | .idea 3 | .gradle 4 | /local.properties 5 | gradle/bintray.properties 6 | .DS_Store 7 | **/build 8 | /captures 9 | 10 | .buckd 11 | .okbuck 12 | buck-out 13 | .buckconfig 14 | .buckconfig.local 15 | **/BUCK 16 | -------------------------------------------------------------------------------- /PRJ_NAME/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Piasy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/build.gradle: -------------------------------------------------------------------------------- 1 | apply from: "$rootProject.rootDir/gradle/simple_lib_android_bintray.gradle" 2 | 3 | //android { 4 | // if (!"true" == System.getenv('IS_PIASY_LIB_RELEASE')) { 5 | // defaultConfig { 6 | // } 7 | // } else { 8 | // defaultConfig { 9 | // } 10 | // } 11 | //} 12 | 13 | dependencies { 14 | implementation "com.android.support:appcompat-v7:$rootProject.androidSupportSdkVersion" 15 | 16 | debugImplementation 'com.jakewharton:butterknife:8.8.1' 17 | debugAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 18 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4' 19 | } 20 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/piasy/tools/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 29 | 30 | 31 | 32 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/java/com/github/piasy/PRJ_PKG_NAME/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Piasy 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.github.piasy.PRJ_PKG_NAME; 26 | 27 | import android.os.Bundle; 28 | import android.support.v7.app.AppCompatActivity; 29 | import butterknife.ButterKnife; 30 | 31 | public class MainActivity extends AppCompatActivity { 32 | 33 | @Override 34 | protected void onCreate(Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | setContentView(R.layout.activity_main); 37 | 38 | ButterKnife.bind(this); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/java/com/github/piasy/PRJ_PKG_NAME/MyApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Piasy 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.github.piasy.PRJ_PKG_NAME; 26 | 27 | import android.app.Application; 28 | import com.squareup.leakcanary.LeakCanary; 29 | 30 | /** 31 | * Created by Piasy{github.com/Piasy} on 15/01/2017. 32 | */ 33 | 34 | public class MyApp extends Application { 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | LeakCanary.install(this); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 38 | 39 | 44 | 45 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/PRJ_NAME/src/debug/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PRJ_NAME 3 | 4 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/debug/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /PRJ_NAME/PRJ_NAME/src/main/java/com/github/piasy/PRJ_PKG_NAME/PRJ_NAME.java: -------------------------------------------------------------------------------- 1 | package com.github.piasy.PRJ_PKG_NAME; 2 | 3 | /** 4 | * Created by Piasy{github.com/Piasy} on 25/12/2016. 5 | */ 6 | 7 | public class PRJ_NAME { 8 | } 9 | -------------------------------------------------------------------------------- /PRJ_NAME/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/README.md -------------------------------------------------------------------------------- /PRJ_NAME/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | 8 | maven { 9 | url "https://plugins.gradle.org/m2/" 10 | } 11 | } 12 | dependencies { 13 | classpath 'com.android.tools.build:gradle:3.1.2' 14 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' 15 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' 16 | 17 | // ./gradlew dependencyUpdates 18 | classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | jcenter() 25 | google() 26 | } 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | 33 | ext { 34 | userName = 'Piasy' 35 | developer = [id : 'piasy', 36 | name : 'piasy', 37 | email: 'xz4215@gmail.com'] 38 | license = [id : 'MIT', 39 | name: 'The MIT License (MIT)', 40 | url : 'http://opensource.org/licenses/MIT'] 41 | groupName = 'com.github.piasy' 42 | artifactName = 'PRJ_NAME' 43 | artifactDescription = 'PRJ_NAME' 44 | artifactLabels = ['PRJ_NAME'] 45 | releaseVersionCode = 1 46 | releaseVersionName = '1.0.0' 47 | 48 | androidCompileSdkVersion = 27 49 | androidBuildToolsVersion = '27.0.3' 50 | androidSupportSdkVersion = '27.1.1' 51 | androidMinSdkVersion = 16 52 | androidTargetSdkVersion = 27 53 | 54 | libDebugAppId = 'com.github.piasy.PRJ_PKG_NAME.example' 55 | } 56 | -------------------------------------------------------------------------------- /PRJ_NAME/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /PRJ_NAME/gradle/bintray.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2018 Piasy 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | import java.text.SimpleDateFormat 25 | 26 | apply plugin: 'com.github.dcendents.android-maven' 27 | apply plugin: "com.jfrog.bintray" 28 | 29 | def siteUrl = "https://github.com/${rootProject.ext.userName}/${rootProject.ext.artifactName}" 30 | def gitUrl = "https://github.com/${rootProject.ext.userName}/${rootProject.ext.artifactName}.git" 31 | def developerInfo = rootProject.ext.developer 32 | def licenseInfo = rootProject.ext.license 33 | 34 | group = rootProject.ext.groupName 35 | version = rootProject.ext.releaseVersionName 36 | 37 | install { 38 | repositories.mavenInstaller { 39 | // This generates POM.xml with proper parameters 40 | pom { 41 | project { 42 | packaging 'aar' 43 | // Add your description here 44 | name rootProject.ext.artifactName 45 | url siteUrl 46 | // Set your license 47 | licenses { 48 | license { 49 | name licenseInfo.name 50 | url licenseInfo.url 51 | } 52 | } 53 | developers { 54 | developer { 55 | id developerInfo.id 56 | name developerInfo.name 57 | email developerInfo.email 58 | } 59 | } 60 | scm { 61 | connection gitUrl 62 | developerConnection gitUrl 63 | url siteUrl 64 | } 65 | } 66 | } 67 | } 68 | } 69 | 70 | task sourcesJar(type: Jar) { 71 | if (project.getPlugins().hasPlugin('com.android.application') || 72 | project.getPlugins().hasPlugin('com.android.library')) { 73 | from android.sourceSets.main.java.srcDirs 74 | } 75 | classifier = 'sources' 76 | } 77 | 78 | if (project.getPlugins().hasPlugin('com.android.application') || 79 | project.getPlugins().hasPlugin('com.android.library')) { 80 | task javadoc(type: Javadoc) { 81 | failOnError = false 82 | source = android.sourceSets.main.java.srcDirs 83 | android.compileSdkVersion rootProject.ext.androidCompileSdkVersion 84 | android.buildToolsVersion rootProject.ext.androidBuildToolsVersion 85 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 86 | } 87 | } 88 | 89 | task javadocJar(type: Jar, dependsOn: javadoc) { 90 | classifier = 'javadoc' 91 | from javadoc.destinationDir 92 | } 93 | 94 | artifacts { 95 | archives javadocJar 96 | archives sourcesJar 97 | } 98 | 99 | Properties properties = new Properties() 100 | // for wrapper project structure 101 | File propertyFile = project.rootProject.file('gradle/bintray.properties') 102 | if (propertyFile.exists()) { 103 | properties.load(propertyFile.newDataInputStream()) 104 | } 105 | 106 | bintray { 107 | user = properties.getProperty("bintray.user") 108 | key = properties.getProperty("bintray.apikey") 109 | configurations = ['archives'] //When uploading Maven-based publication files 110 | dryRun = false //Whether to run this as dry-run, without deploying 111 | publish = true //If version should be auto published after an upload 112 | pkg { 113 | repo = 'maven' 114 | name = rootProject.ext.artifactName 115 | desc = rootProject.ext.artifactDescription 116 | websiteUrl = siteUrl 117 | issueTrackerUrl = siteUrl + '/issues' 118 | vcsUrl = gitUrl 119 | licenses = [licenseInfo.id] 120 | labels = rootProject.ext.artifactLabels 121 | publicDownloadNumbers = true 122 | //Optional version descriptor 123 | version { 124 | name = rootProject.ext.releaseVersionName //Bintray logical version name 125 | released = new SimpleDateFormat('yyyy-MM-dd\'T\'HH:mm:ss.SSSZZ').format(new Date()) 126 | //2 possible values: date in the format of 'yyyy-MM-dd'T'HH:mm:ss.SSSZZ' OR a java.util.Date instance 127 | vcsTag = rootProject.ext.releaseVersionName 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /PRJ_NAME/gradle/bintray.properties: -------------------------------------------------------------------------------- 1 | bintray.user=user 2 | bintray.apikey=key 3 | -------------------------------------------------------------------------------- /PRJ_NAME/gradle/simple_lib_android_bintray.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2018 Piasy 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | def isLibRelease = "true" == System.getenv('IS_PIASY_LIB_RELEASE') 26 | 27 | if (!isLibRelease) { 28 | apply plugin: 'com.android.application' 29 | apply plugin: 'com.github.ben-manes.versions' 30 | } else { 31 | apply plugin: 'com.android.library' 32 | apply plugin: 'com.github.ben-manes.versions' 33 | apply from: "$rootProject.rootDir/gradle/bintray.gradle" 34 | } 35 | 36 | android { 37 | compileSdkVersion rootProject.ext.androidCompileSdkVersion 38 | buildToolsVersion rootProject.ext.androidBuildToolsVersion 39 | 40 | defaultConfig { 41 | minSdkVersion rootProject.ext.androidMinSdkVersion 42 | targetSdkVersion rootProject.ext.androidTargetSdkVersion 43 | versionCode rootProject.ext.releaseVersionCode 44 | versionName rootProject.ext.releaseVersionName 45 | 46 | if (!isLibRelease) { 47 | applicationId rootProject.ext.libDebugAppId 48 | } else { 49 | consumerProguardFiles 'proguard-rules.pro' 50 | } 51 | } 52 | buildTypes { 53 | release { 54 | minifyEnabled false 55 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 56 | } 57 | } 58 | compileOptions { 59 | sourceCompatibility JavaVersion.VERSION_1_8 60 | targetCompatibility JavaVersion.VERSION_1_8 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /PRJ_NAME/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/PRJ_NAME/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /PRJ_NAME/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jan 14 15:04:35 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /PRJ_NAME/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /PRJ_NAME/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /PRJ_NAME/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':PRJ_NAME' 2 | -------------------------------------------------------------------------------- /PRJ_NAME/simple_lib_android_bintray_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export IS_PIASY_LIB_RELEASE=true 3 | ./gradlew clean bintrayUpload --offline --stacktrace 4 | unset IS_PIASY_LIB_RELEASE 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GradleScripts 2 | 3 | My common used gradle scripts. 4 | 5 | ## `bintray.gradle` 6 | 7 | Gradle script used for upload artifact to bintray.com. 8 | 9 | ### Usage 10 | 11 | + add this line into your module's `build.gradle`: 12 | 13 | ``` gradle 14 | apply from: "https://raw.githubusercontent.com/Piasy/GradleScripts/master/PRJ_NAME/gradle/bintray.gradle" 15 | ``` 16 | 17 | + add this block into your root project `build.gradle`, edit it in your need: 18 | 19 | ``` gradle 20 | ext { 21 | userName = 'Piasy' 22 | developer = [ 23 | id : 'piasy', 24 | name : 'piasy', 25 | email: 'xz4215@gmail.com' 26 | ] 27 | license = [ 28 | id : 'MIT', 29 | name: 'The MIT License (MIT)', 30 | url : 'http://opensource.org/licenses/MIT' 31 | ] 32 | groupName = 'com.github.piasy' 33 | artifactName = 'dialogfragmentanywhere' 34 | artifactDescription = 'Anchor your dialog fragment to anywhere! ' 35 | artifactLabels = ['DialogFragment', 'Position'] 36 | releaseVersionCode = 1 37 | releaseVersionName = '1.0.0' 38 | 39 | androidCompileSdkVersion = 26 40 | androidBuildToolsVersion = '27.0.1' 41 | androidSupportSdkVersion = '27.0.1' 42 | minSdkVersion = 16 43 | targetSdkVersion = 26 44 | } 45 | ``` 46 | 47 | + create file `gradle/bintray.properties`, and add this block into it: 48 | 49 | ``` 50 | bintray.user= 51 | bintray.apikey= 52 | ``` 53 | 54 | + run `./gradlew bintrayUpload`, your artifact will be uploaded to bintray. 55 | 56 | ## `simple_lib_android_bintray.gradle` 57 | 58 | Build a library and example in the same module, publish to bintray.com. 59 | 60 | + add this line into your module's `build.gradle`: 61 | 62 | ``` gradle 63 | apply from: "https://raw.githubusercontent.com/Piasy/GradleScripts/master/PRJ_NAME/gradle/simple_lib_android_bintray.gradle" 64 | ``` 65 | 66 | + Add more ext attributes into root project `build.gradle`: 67 | 68 | ``` gradle 69 | ext { 70 | ... // the same as you added when import bintray.gradle 71 | 72 | libDebugAppId = 'com.github.piasy.libxxx.example' 73 | } 74 | ``` 75 | 76 | + In your module's build.gradle, you only need specify dependency. 77 | + Download `simple_lib_android_bintray_release.sh`, and add execute permission for it, then run it for release. 78 | + If you want to run example, just hit the `Run` button of Android Studio. 79 | 80 | ## `piasy_android_simple_lib` template project 81 | 82 | + Clone this project, or download `piasy_android_simple_lib.sh` and `piasy_android_simple_lib.tar`, put them in the same folder; 83 | + Run `piasy_android_simple_lib.sh `, then a well configured template project will be there, shine! 84 | -------------------------------------------------------------------------------- /package_piasy_android_simple_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find PRJ_NAME -name ".DS_Store" | xargs rm && \ 4 | tar cvf piasy_android_simple_lib.tar PRJ_NAME 5 | -------------------------------------------------------------------------------- /piasy_android_simple_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # credit: https://github.com/dropbox/djinni/blob/master/example/run_djinni.sh 4 | # Locate the script file. Cross symlinks if necessary. 5 | loc="$0" 6 | while [ -h "$loc" ]; do 7 | ls=`ls -ld "$loc"` 8 | link=`expr "$ls" : '.*-> \(.*\)$'` 9 | if expr "$link" : '/.*' > /dev/null; then 10 | loc="$link" # Absolute link 11 | else 12 | loc="`dirname "$loc"`/$link" # Relative link 13 | fi 14 | done 15 | base_dir=$(cd "`dirname "$loc"`" && pwd) 16 | 17 | PRJ_NAME=$1 18 | PWD=$2 19 | 20 | if [[ -z "${PRJ_NAME// }" ]]; then 21 | echo "Please specify project name!" 22 | exit 1 23 | fi 24 | 25 | if [[ -z "${PWD// }" ]]; then 26 | echo "Please specify project working dir!" 27 | exit 1 28 | fi 29 | 30 | PRJ_PKG_NAME=`echo "$PRJ_NAME" | perl -pe 's/([a-z0-9])([A-Z])/$1_\L$2/g' | perl -ne 'print lc'` 31 | PKG="com.github.piasy.$PRJ_PKG_NAME" 32 | PKG_PATH=`echo "$PKG" | sed -e 's/\./\//g'` 33 | 34 | cd $PWD 35 | 36 | tar xvf $base_dir/piasy_android_simple_lib.tar 37 | 38 | mv PRJ_NAME $PRJ_NAME 39 | 40 | cd $PRJ_NAME 41 | 42 | mv PRJ_NAME $PRJ_NAME 43 | 44 | echo "# $PRJ_NAME" > README.md 45 | 46 | mkdir -p $PRJ_NAME/src/main/java/$PKG_PATH/ 47 | mkdir -p $PRJ_NAME/src/debug/java/$PKG_PATH/ 48 | 49 | mv $PRJ_NAME/src/main/java/com/github/piasy/PRJ_PKG_NAME/PRJ_NAME.java $PRJ_NAME/src/main/java/$PKG_PATH/$PRJ_NAME.java 50 | mv $PRJ_NAME/src/debug/java/com/github/piasy/PRJ_PKG_NAME/MainActivity.java $PRJ_NAME/src/debug/java/$PKG_PATH/MainActivity.java 51 | mv $PRJ_NAME/src/debug/java/com/github/piasy/PRJ_PKG_NAME/MyApp.java $PRJ_NAME/src/debug/java/$PKG_PATH/MyApp.java 52 | 53 | rmdir $PRJ_NAME/src/main/java/com/github/piasy/PRJ_PKG_NAME/ \ 54 | $PRJ_NAME/src/debug/java/com/github/piasy/PRJ_PKG_NAME 55 | 56 | sed -i '.bk' -e "s/PRJ_NAME/$PRJ_NAME/g" settings.gradle 57 | sed -i '.bk' -e "s/PRJ_NAME/$PRJ_NAME/g" build.gradle 58 | sed -i '.bk' -e "s/PRJ_PKG_NAME/$PRJ_PKG_NAME/g" build.gradle 59 | sed -i '.bk' -e "s/PRJ_PKG_NAME/$PRJ_PKG_NAME/g" $PRJ_NAME/src/main/AndroidManifest.xml 60 | sed -i '.bk' -e "s/PRJ_PKG_NAME/$PRJ_PKG_NAME/g" $PRJ_NAME/src/main/java/$PKG_PATH/$PRJ_NAME.java 61 | sed -i '.bk' -e "s/PRJ_NAME/$PRJ_NAME/g" $PRJ_NAME/src/main/java/$PKG_PATH/$PRJ_NAME.java 62 | sed -i '.bk' -e "s/PRJ_PKG_NAME/$PRJ_PKG_NAME/g" $PRJ_NAME/src/debug/AndroidManifest.xml 63 | sed -i '.bk' -e "s/PRJ_NAME/$PRJ_NAME/g" $PRJ_NAME/src/debug/res/values/strings.xml 64 | sed -i '.bk' -e "s/PRJ_PKG_NAME/$PRJ_PKG_NAME/g" $PRJ_NAME/src/debug/java/$PKG_PATH/MainActivity.java 65 | sed -i '.bk' -e "s/PRJ_PKG_NAME/$PRJ_PKG_NAME/g" $PRJ_NAME/src/debug/java/$PKG_PATH/MyApp.java 66 | 67 | rm settings.gradle.bk \ 68 | build.gradle.bk \ 69 | $PRJ_NAME/src/main/AndroidManifest.xml.bk \ 70 | $PRJ_NAME/src/main/java/$PKG_PATH/$PRJ_NAME.java.bk \ 71 | $PRJ_NAME/src/debug/AndroidManifest.xml.bk \ 72 | $PRJ_NAME/src/debug/res/values/strings.xml.bk \ 73 | $PRJ_NAME/src/debug/java/$PKG_PATH/MainActivity.java.bk \ 74 | $PRJ_NAME/src/debug/java/$PKG_PATH/MyApp.java.bk 75 | -------------------------------------------------------------------------------- /piasy_android_simple_lib.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piasy/GradleScripts/16fb4873ab0067efab913e5d04a1b053c12162db/piasy_android_simple_lib.tar --------------------------------------------------------------------------------