Skip to content

Commit

Permalink
Deps/Version update to latest API 30 + androidx (#17)
Browse files Browse the repository at this point in the history
* Deps/Version update to latest API 30 + androidx

* Move publishing logic to https://jitpack.io/#discord/SimpleAST/

Bintray publishing is dated, broken, and hard

* bump version

* update README
  • Loading branch information
lytefast authored Oct 25, 2020
2 parents 8213b04 + b1638f2 commit 61d772a
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 159 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ For example:
"<@123456789> has \*\*joined the server\*\*." becomes "@AndyG has **joined the server**." Read more here: [How Discord Renders Rich Messages on the Android App](https://blog.discordapp.com/how-discord-renders-rich-messages-on-the-android-app-67b0e5d56fbe)

# Using SimpleAST in your application
If you are building with Gradle, simply add the following line to the dependencies section of your build.gradle file:
If you are building with Gradle, see https://jitpack.io/#discord/SimpleAST/ for instructions:

```
implementation 'com.discord:simpleast:1.1.1'
```
Latest versions can be found on the [releases page](https://github.com/discord/SimpleAST/releases).

# Basic Usage with SimpleMarkdownRenderer

Expand Down
17 changes: 7 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 30
buildToolsVersion '30.0.2'

defaultConfig {
applicationId "com.agarron.simpleast"
minSdkVersion 16
targetSdkVersion 27
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -24,14 +24,11 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':simpleast-core')
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation "androidx.appcompat:appcompat:$appCompat_version"

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
testImplementation "junit:junit:$junit_version"
}
repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.discord.simpleast.sample
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.support.annotation.StyleRes
import android.text.style.*
import androidx.annotation.StyleRes
import com.agarron.simpleast.R
import com.discord.simpleast.core.node.Node
import com.discord.simpleast.core.node.StyleNode
Expand All @@ -24,8 +24,8 @@ import java.util.regex.Pattern
object CustomMarkdownRules {

fun <RC, S> createMarkdownRules(context: Context,
@StyleRes headerStyles: List<Int>,
@StyleRes classStyles: List<Int>) =
@StyleRes headerStyles: List<Int>,
@StyleRes classStyles: List<Int>) =
createHeaderRules<RC, S>(context, headerStyles, classStyles) + MarkdownRules.ListItemRule {
BulletSpan(24, Color.parseColor("#6E7B7F"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package com.discord.simpleast.sample

import android.annotation.SuppressLint
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.text.SpannableStringBuilder
import android.util.Log
import android.view.View
import android.widget.EditText
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.agarron.simpleast.R
import com.discord.simpleast.core.node.Node
import com.discord.simpleast.core.node.TextNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.discord.simpleast.sample.spans

import android.graphics.Paint
import android.support.annotation.Dimension
import android.text.style.LineHeightSpan
import androidx.annotation.Dimension


/**
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.41'
ext.supportlibrary_version = '27.1.1'
ext.kotlin_version = '1.4.10'
ext.junit_version = '4.13'
ext.androidxAnnotation_version = '1.1.0'
ext.appCompat_version = '1.2.0'

repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ org.gradle.jvmargs=-Xmx1536m
# 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

android.useAndroidX=true
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 @@
#Wed Jun 13 15:01:45 PDT 2018
#Wed Oct 21 12:52:15 PDT 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
141 changes: 8 additions & 133 deletions simpleast-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,139 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'
apply plugin: 'maven-publish'

group = 'com.discord'
version = '2.0.0'

def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
scm {
url "https://github.com/angarron/SimpleAST.git"
}
}

publishing {
// Publish to local repository
repositories {
mavenLocal() // ~/.m2
}

publications {
// Create tasks based on the application build variant (productFlavor + buildType = variant)
android.libraryVariants.all { variant ->

def variantName = variant.name.capitalize()

/**
* Generate Jar of Java sources.
*/
def jarSourceTask = task("jar${variantName}Sources", type: Jar) {
description = "Generates Java Sources for ${variantName}."
group = "artifact"
classifier = "sources"
from variant.javaCompile.source
}
jarSourceTask.dependsOn variant.javaCompile
artifacts.add("archives", jarSourceTask)

/**
* Generate Javadocs.
*/
def javadocTask = task("generate${variantName}Javadocs", type: Javadoc) {
description = "Generates Javadoc for ${variantName}."
source = variant.javaCompile.source
classpath += files(variant.javaCompile.classpath.files)
classpath += files(android.getBootClasspath().join(File.pathSeparator))
classpath += files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
exclude "**/R.java"
}
javadocTask.dependsOn variant.javaCompile

/**
* Generate Jar of Javadocs.
*/
def jarJavadocTask = task("jar${variantName}Javadocs", type: Jar) {
description = "Generate Javadoc Jar for ${variantName}."
group = "artifact"
classifier = "javadoc"
from javadocTask.destinationDir
}
jarJavadocTask.dependsOn javadocTask
artifacts.add("archives", jarJavadocTask)

// Create custom publication based on the "variant"
// "Debug" and "Release" variants
"${variantName}"(MavenPublication) {

groupId 'com.discord'
artifactId 'simpleast'
artifact "${project.buildDir}/outputs/aar/${project.name}-${variant.name}.aar"
artifact jarSourceTask
artifact jarJavadocTask

pom {
withXml {
def root = asNode()

// List dependencies
def dependenciesNode = root.appendNode("dependencies")
configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}

// Add parent POM information
root.children().last() + pomConfig
}
}
}
}
}
}

bintray {
user = bintrayUser
key = bintrayApiKey

publications = ['Release']
pkg {
repo = 'android'
name = 'SimpleAST'
userOrg = 'discord'
desc = 'Extensible Android library for both parsing text into Abstract Syntax Trees and rendering those trees as rich text.'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/angarron/SimpleAST.git'
publicDownloadNumbers = true

version {
gpg {
sign = true
passphrase = discord_bintray_gpg_passphrase
}
}
}
}

android {
compileSdkVersion 27
compileSdkVersion 30

defaultConfig {
minSdkVersion 16
targetSdkVersion 27
minSdkVersion 21
targetSdkVersion 30
versionCode 28
versionName "0.5.2"
versionName "0.5.3"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -147,12 +22,12 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation "com.android.support:support-annotations:$supportlibrary_version"
implementation "androidx.annotation:annotation:$androidxAnnotation_version"

testImplementation 'junit:junit:4.12'
testImplementation "junit:junit:$junit_version"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.discord.simpleast.core.simple

import android.support.annotation.StringRes
import android.text.SpannableStringBuilder
import android.widget.TextView
import androidx.annotation.StringRes
import com.discord.simpleast.core.node.Node
import com.discord.simpleast.core.parser.Parser
import com.discord.simpleast.core.parser.Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package com.discord.simpleast.markdown
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.support.annotation.StyleRes
import android.text.style.BulletSpan
import android.text.style.CharacterStyle
import android.text.style.StyleSpan
import android.text.style.TextAppearanceSpan
import androidx.annotation.StyleRes
import com.discord.simpleast.core.node.Node
import com.discord.simpleast.core.node.StyleNode
import com.discord.simpleast.core.parser.ParseSpec
Expand Down

0 comments on commit 61d772a

Please sign in to comment.