aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2018-07-26 21:30:57 +0200
committerVictor Häggqvist <[email protected]>2018-07-26 21:30:57 +0200
commitb3cccb7a85211d6c0c3664afb5457d704e5708a8 (patch)
treef5a8637b61bdfa4335e1bf276fbad040ddcca353
parent2cc8561e3556892a7b13c6960acbe2a55f1f82ac (diff)
update gradle and android plugin
Diffstat (limited to '')
-rw-r--r--RELEASING.md14
-rw-r--r--aboutit-meta/build.gradle70
-rw-r--r--aboutit-meta/gradle.properties4
-rw-r--r--aboutit-sample/build.gradle14
-rw-r--r--aboutit-sample/src/main/java/com/snilius/aboutit/sample/AboutActivity.java5
-rw-r--r--aboutit-sample/src/main/java/com/snilius/aboutit/sample/MainActivity.java6
-rw-r--r--aboutit/build.gradle94
-rw-r--r--aboutit/gradle.properties4
-rw-r--r--build.gradle8
-rw-r--r--gradle.properties18
-rw-r--r--gradle/gradle-mvn-push.gradle218
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 54333 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
13 files changed, 283 insertions, 174 deletions
diff --git a/RELEASING.md b/RELEASING.md
new file mode 100644
index 0000000..fa19536
--- /dev/null
+++ b/RELEASING.md
@@ -0,0 +1,14 @@
+# Releasing
+
+ 1. Change the version in `gradle.properties` to a non-SNAPSHOT version.
+ 3. Update the `README.md` with the new version.
+ 4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version)
+ 5. `./gradlew clean uploadArchives`.
+ 6. Visit [Sonatype Nexus](https://oss.sonatype.org/) and promote the artifact.
+ 7. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version)
+ 8. Update the `gradle.properties` to the next SNAPSHOT version.
+ 9. `git commit -am "Prepare next development version."`
+ 10. `git push && git push --tags`
+ 11. Update the two sample modules to point to the newly released version.
+
+If step 5 or 6 fails, drop the Sonatype repo, fix the problem, commit, and start again at step 5. \ No newline at end of file
diff --git a/aboutit-meta/build.gradle b/aboutit-meta/build.gradle
index bb5b23c..a8aab23 100644
--- a/aboutit-meta/build.gradle
+++ b/aboutit-meta/build.gradle
@@ -1,21 +1,13 @@
apply plugin: 'com.android.library'
-apply plugin: 'maven'
-apply plugin: 'signing'
-apply plugin: 'nexus-workflow'
-
-group = "com.snilius.aboutit"
-archivesBaseName = "aboutit-meta"
-version = "1.0.0"
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ compileSdkVersion 27
+ buildToolsVersion "27.0.03"
defaultConfig {
minSdkVersion 14
- targetSdkVersion 23
+ targetSdkVersion 27
versionCode 1
- versionName version
}
buildTypes {
release {
@@ -26,57 +18,7 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:23.0.1'
- compile project(':aboutit')
-}
-
-
-signing {
- sign configurations.archives
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.android.support:appcompat-v7:27.1.1'
+ implementation project(':aboutit')
}
-
-uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-
- repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
- authentication(userName: ossrhUsername, password: ossrhPassword)
- }
-
- snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
- authentication(userName: ossrhUsername, password: ossrhPassword)
- }
-
- pom.project {
- name 'AboutIt Meta'
- packaging 'jar'
- // optionally artifactId can be defined here
- description 'Library presets for AboutIt'
- url 'https://github.com/victorhaggqvist/AboutIt'
-
- scm {
- connection 'scm:git:https://github.com/victorhaggqvist/AboutIt.git'
- developerConnection 'scm:git:https://github.com/victorhaggqvist/AboutIt.git'
- url 'https://github.com/victorhaggqvist/AboutIt'
- }
-
- licenses {
- license {
- name 'The Apache License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
-
- developers {
- developer {
- id 'atriix'
- name 'Victor Häggqvist'
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/aboutit-meta/gradle.properties b/aboutit-meta/gradle.properties
new file mode 100644
index 0000000..8bba6d2
--- /dev/null
+++ b/aboutit-meta/gradle.properties
@@ -0,0 +1,4 @@
+POM_ARTIFACT_ID=aboutit-meta
+POM_NAME=AboutIt Meta
+POM_PACKAGING=aar
+VERSION_NAME=1.0.0-SNAPSHOT \ No newline at end of file
diff --git a/aboutit-sample/build.gradle b/aboutit-sample/build.gradle
index d5ab9e5..6980597 100644
--- a/aboutit-sample/build.gradle
+++ b/aboutit-sample/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ compileSdkVersion 27
+ buildToolsVersion "27.0.03"
defaultConfig {
applicationId "com.snilius.aboutit.sample"
minSdkVersion 14
- targetSdkVersion 23
+ targetSdkVersion 27
versionCode 3
versionName "1.0.2"
}
@@ -20,8 +20,8 @@ android {
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- compile 'com.android.support:appcompat-v7:23.0.1'
- compile project(':aboutit')
- compile project(':aboutit-meta')
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support:appcompat-v7:27.1.1'
+ implementation project(':aboutit')
+ implementation project(':aboutit-meta')
}
diff --git a/aboutit-sample/src/main/java/com/snilius/aboutit/sample/AboutActivity.java b/aboutit-sample/src/main/java/com/snilius/aboutit/sample/AboutActivity.java
index 94b7c66..0520b50 100644
--- a/aboutit-sample/src/main/java/com/snilius/aboutit/sample/AboutActivity.java
+++ b/aboutit-sample/src/main/java/com/snilius/aboutit/sample/AboutActivity.java
@@ -1,11 +1,8 @@
package com.snilius.aboutit.sample;
-import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
-import android.view.Menu;
-import android.view.MenuItem;
import com.snilius.aboutit.AboutIt;
import com.snilius.aboutit.L;
@@ -18,7 +15,7 @@ public class AboutActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.about);
diff --git a/aboutit-sample/src/main/java/com/snilius/aboutit/sample/MainActivity.java b/aboutit-sample/src/main/java/com/snilius/aboutit/sample/MainActivity.java
index 1974129..f3ec338 100644
--- a/aboutit-sample/src/main/java/com/snilius/aboutit/sample/MainActivity.java
+++ b/aboutit-sample/src/main/java/com/snilius/aboutit/sample/MainActivity.java
@@ -25,14 +25,14 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.app_name);
- Spinner spinner = (Spinner) findViewById(R.id.spinner);
+ Spinner spinner = findViewById(R.id.spinner);
spinner.setOnItemSelectedListener(this);
- mSampleText = (TextView) findViewById(R.id.sample_text);
+ mSampleText = findViewById(R.id.sample_text);
}
diff --git a/aboutit/build.gradle b/aboutit/build.gradle
index bb3b89e..45d55d0 100644
--- a/aboutit/build.gradle
+++ b/aboutit/build.gradle
@@ -1,21 +1,13 @@
apply plugin: 'com.android.library'
-apply plugin: 'maven'
-apply plugin: 'signing'
-apply plugin: 'nexus-workflow'
-
-group = "com.snilius.aboutit"
-archivesBaseName = "aboutit"
-version = "1.2.1"
android {
- compileSdkVersion 23
- buildToolsVersion '23.0.1'
+ compileSdkVersion 27
+ buildToolsVersion '27.0.03'
defaultConfig {
minSdkVersion 14
- targetSdkVersion 23
+ targetSdkVersion 27
versionCode 7
- versionName version
}
buildTypes {
@@ -26,7 +18,7 @@ android {
}
dependencies {
- compile 'com.android.support:appcompat-v7:23.0.1'
+ implementation 'com.android.support:appcompat-v7:27.1.1'
}
configurations {
@@ -35,80 +27,4 @@ configurations {
}
}
-signing {
- sign configurations.archives
-}
-
-uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-
- repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
- authentication(userName: ossrhUsername, password: ossrhPassword)
- }
-
- snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
- authentication(userName: ossrhUsername, password: ossrhPassword)
- }
-
- pom.project {
- name 'AboutIt'
- packaging 'jar'
- // optionally artifactId can be defined here
- description 'A About-page creator'
- url 'https://github.com/victorhaggqvist/AboutIt'
-
- scm {
- connection 'scm:git:https://github.com/victorhaggqvist/AboutIt.git'
- developerConnection 'scm:git:https://github.com/victorhaggqvist/AboutIt.git'
- url 'https://github.com/victorhaggqvist/AboutIt'
- }
-
- licenses {
- license {
- name 'The Apache License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
-
- developers {
- developer {
- id 'atriix'
- name 'Victor Häggqvist'
- }
- }
- }
- }
- }
-}
-
-android.libraryVariants.all { variant ->
- task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") {
- source = variant.javaCompile.source
-
- title = "AboutIt"
-
- options.links("http://docs.oracle.com/javase/7/docs/api/");
- options.linksOffline("http://d.android.com/reference","${android.sdkDirectory}/docs/reference");
-
- // First add all of your dependencies to the classpath, then add the android jars
- classpath += files(variant.javaCompile.classpath.files)
- classpath += files(android.getBootClasspath())
-
- // We're excluding these generated files
- exclude '**/BuildConfig.java'
- exclude '**/R.java'
- }
-}
-
-android.libraryVariants.all { variant ->
- task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") {
- classifier = 'javadoc'
- from tasks["${variant.name}Javadoc"].destinationDir
- }
-
- // Add the Javadoc jar to the project's artifacts. This will allow us to upload it easily later
- project.artifacts.add("archives", tasks["${variant.name}JavadocJar"]);
-}
+apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
diff --git a/aboutit/gradle.properties b/aboutit/gradle.properties
new file mode 100644
index 0000000..676bc4a
--- /dev/null
+++ b/aboutit/gradle.properties
@@ -0,0 +1,4 @@
+POM_ARTIFACT_ID=aboutit
+POM_NAME=AboutIt
+POM_PACKAGING=aar
+VERSION_NAME=1.2.2-SNAPSHOT \ No newline at end of file
diff --git a/build.gradle b/build.gradle
index edc5247..d6d72df 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,18 +3,16 @@
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.3.0'
- classpath 'com.adaptc.gradle:nexus-workflow:0.6'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
}
}
allprojects {
repositories {
jcenter()
+ google()
}
}
diff --git a/gradle.properties b/gradle.properties
index 1d3591c..4520aeb 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -15,4 +15,20 @@
# 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
-# org.gradle.parallel=true \ No newline at end of file
+# org.gradle.parallel=true
+
+GROUP=com.snilius.aboutit
+
+POM_DESCRIPTION=A About-page creator
+
+POM_URL=https://github.com/victorhaggqvist/AboutIt
+POM_SCM_URL=https://github.com/victorhaggqvist/AboutIt
+POM_SCM_CONNECTION=scm:git:git://github.com/victorhaggqvist/AboutIt.git
+POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/victorhaggqvist/AboutIt.git
+
+POM_LICENCE_NAME=The Apache Software License, Version 2.0
+POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
+POM_LICENCE_DIST=repo
+
+POM_DEVELOPER_ID=atriix
+POM_DEVELOPER_NAME=Victor Häggqvist
diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle
new file mode 100644
index 0000000..322aa76
--- /dev/null
+++ b/gradle/gradle-mvn-push.gradle
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2013 Chris Banes
+ *
+ * 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'
+
+version = VERSION_NAME
+group = GROUP
+
+def isReleaseBuild() {
+ return VERSION_NAME.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('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : ""
+}
+
+def getRepositoryPassword() {
+ return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_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())
+ }
+ 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
+ }
+
+ if (project.getPlugins().hasPlugin('com.android.application') ||
+ project.getPlugins().hasPlugin('com.android.library')) {
+ 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
+ }
+ }
+ }
+ }
+ }
+
+ task androidJavadocs(type: Javadoc) {
+ source = android.sourceSets.main.java.source
+ classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
+ }
+
+ task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
+ classifier = 'javadoc'
+ from androidJavadocs.destinationDir
+ }
+
+ task androidSourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.java.source
+ }
+ } else {
+ install {
+ repositories.mavenInstaller {
+ 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_URLsignArchives
+ 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
+ }
+ }
+ }
+ }
+ }
+
+ task sourcesJar(type: Jar, dependsOn:classes) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+ }
+
+ task javadocJar(type: Jar, dependsOn:javadoc) {
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+ }
+ }
+
+ if (JavaVersion.current().isJava8Compatible()) {
+ allprojects {
+ tasks.withType(Javadoc) {
+ options.addStringOption('Xdoclint:none', '-quiet')
+ }
+ }
+ }
+
+ artifacts {
+ if (project.getPlugins().hasPlugin('com.android.application') ||
+ project.getPlugins().hasPlugin('com.android.library')) {
+ archives androidSourcesJar
+ archives androidJavadocsJar
+ } else {
+ archives sourcesJar
+ archives javadocJar
+ }
+ }
+} \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..c44b679
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..7169263 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip