diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae751608..bbd0a949 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,9 +7,7 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - name: set up JDK 1.8 @@ -17,4 +15,4 @@ jobs: with: java-version: 1.8 - name: Build with Gradle - run: ./gradlew build + run: ./gradlew build -Prelease diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml deleted file mode 100644 index dfb474a6..00000000 --- a/.github/workflows/develop.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Snapshot - -on: - push: - branches: - - develop - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Gradle - run: ./gradlew build -Prelease - - deploy: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: deploy snapshot - env: - NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} - NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - run: ./gradlew upA -Prelease -PCI diff --git a/CHANGELOG.md b/CHANGELOG.md index eaad5fec..b705150c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -# $nap; +# $SNAPSHOT; #### Added * `core` - `MovementMethodPlugin.none()`, `MovementMethodPlugin.link()` factory methods diff --git a/app-sample/README.md b/app-sample/README.md index ffb738fb..46fad408 100644 --- a/app-sample/README.md +++ b/app-sample/README.md @@ -1,5 +1,14 @@ # Markwon sample app +Collection of sample snippets showing different aspects of `Markwon` library usage. Includes +source code of samples, latest stable/snapshot version of the library and search functionality. +Additionally can check for updates. Can be used to preview markdown documents from the `Github.com`. + + + + + + ## Distribution Sample app is distributed via special parent-less branch [sample-store](https://github.com/noties/Markwon/tree/sample-store). @@ -10,8 +19,10 @@ Application is signed with `keystore.jks`, which fingerprints are: * __SHA1__: `BA:70:A5:D2:40:65:F1:FA:88:90:59:BA:FC:B7:31:81:E6:37:D9:41` * __SHA256__: `82:C9:61:C5:DF:35:B1:CB:29:D5:48:83:FB:EB:9F:3E:7D:52:67:63:4F:D2:CE:0A:2D:70:17:85:FF:48:67:51` + [Download latest APK](https://github.com/noties/Markwon/raw/sample-store/markwon-debug.apk) + ## Deeplink Sample app handles special `markwon` scheme: @@ -32,7 +43,7 @@ Please note that you might need to _url encode_ the `-d` argument When adding/removing samples _most likely_ a clean build would be required. First, for annotation processor to create `samples.json`. And secondly, -in order for Android Gradle plugin to bundle resources references via +in order for Android Gradle plugin to bundle resources referenced via symbolic links (the `sample.json` itself and `io.noties.markwon.app.samples.*` directory) ``` diff --git a/app-sample/src/main/java/io/noties/markwon/app/sample/ui/adapt/CheckForUpdateItem.kt b/app-sample/src/main/java/io/noties/markwon/app/sample/ui/adapt/CheckForUpdateItem.kt index 7112e4f5..562aa123 100644 --- a/app-sample/src/main/java/io/noties/markwon/app/sample/ui/adapt/CheckForUpdateItem.kt +++ b/app-sample/src/main/java/io/noties/markwon/app/sample/ui/adapt/CheckForUpdateItem.kt @@ -6,7 +6,7 @@ import android.view.ViewGroup import io.noties.adapt.Item import io.noties.markwon.app.R -class CheckForUpdateItem(private val action: () -> Unit) : Item(42L) { +class CheckForUpdateItem(private val action: () -> Unit) : Item(43L) { override fun createHolder(inflater: LayoutInflater, parent: ViewGroup): Holder { return Holder(inflater.inflate(R.layout.adapt_check_for_update, parent, false)) diff --git a/art/sample-screen-01.png b/art/sample-screen-01.png new file mode 100644 index 00000000..796c0945 Binary files /dev/null and b/art/sample-screen-01.png differ diff --git a/art/sample-screen-02.png b/art/sample-screen-02.png new file mode 100644 index 00000000..93bdc452 Binary files /dev/null and b/art/sample-screen-02.png differ diff --git a/art/sample-screen-03.png b/art/sample-screen-03.png new file mode 100644 index 00000000..2f862c0c Binary files /dev/null and b/art/sample-screen-03.png differ diff --git a/art/sample-screen-04.png b/art/sample-screen-04.png new file mode 100644 index 00000000..a978465a Binary files /dev/null and b/art/sample-screen-04.png differ diff --git a/gradle.properties b/gradle.properties index 601c8418..796bb0c0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ android.enableJetifier=true android.enableBuildCache=true android.buildCacheDir=build/pre-dex-cache -VERSION_NAME=4.4.1-SNAPSHOT +VERSION_NAME=4.5.0-SNAPSHOT GROUP=io.noties.markwon POM_DESCRIPTION=Markwon markdown for Android diff --git a/markwon-core/src/main/java/io/noties/markwon/MarkwonReducer.java b/markwon-core/src/main/java/io/noties/markwon/MarkwonReducer.java index 146b20e3..cd9c8bbc 100644 --- a/markwon-core/src/main/java/io/noties/markwon/MarkwonReducer.java +++ b/markwon-core/src/main/java/io/noties/markwon/MarkwonReducer.java @@ -49,7 +49,7 @@ public abstract class MarkwonReducer { Node temp; while (node != null) { - // @since $nap; do not include LinkReferenceDefinition node (would result + // @since $SNAPSHOT; do not include LinkReferenceDefinition node (would result // in empty textView if rendered in recycler-view) if (!(node instanceof LinkReferenceDefinition)) { list.add(node); diff --git a/markwon-core/src/main/java/io/noties/markwon/core/CorePlugin.java b/markwon-core/src/main/java/io/noties/markwon/core/CorePlugin.java index 9622e56b..845eb90f 100644 --- a/markwon-core/src/main/java/io/noties/markwon/core/CorePlugin.java +++ b/markwon-core/src/main/java/io/noties/markwon/core/CorePlugin.java @@ -115,14 +115,14 @@ public class CorePlugin extends AbstractMarkwonPlugin { // @since 4.0.0 private final List onTextAddedListeners = new ArrayList<>(0); - // @since $nap; + // @since $SNAPSHOT; private boolean hasExplicitMovementMethod; protected CorePlugin() { } /** - * @since $nap; + * @since $SNAPSHOT; */ @SuppressWarnings("UnusedReturnValue") @NonNull @@ -201,7 +201,7 @@ public class CorePlugin extends AbstractMarkwonPlugin { // let's ensure that there is a movement method applied // we do it `afterSetText` so any user-defined movement method won't be // replaced (it should be done in `beforeSetText` or manually on a TextView) - // @since $nap; we additionally check if we should apply _implicit_ movement method + // @since $SNAPSHOT; we additionally check if we should apply _implicit_ movement method if (!hasExplicitMovementMethod && textView.getMovementMethod() == null) { textView.setMovementMethod(LinkMovementMethod.getInstance()); } diff --git a/markwon-core/src/main/java/io/noties/markwon/image/AsyncDrawable.java b/markwon-core/src/main/java/io/noties/markwon/image/AsyncDrawable.java index 330403b8..b7ac8aca 100644 --- a/markwon-core/src/main/java/io/noties/markwon/image/AsyncDrawable.java +++ b/markwon-core/src/main/java/io/noties/markwon/image/AsyncDrawable.java @@ -18,7 +18,7 @@ public class AsyncDrawable extends Drawable { private final ImageSize imageSize; private final ImageSizeResolver imageSizeResolver; - // @since $nap; + // @since $SNAPSHOT; private final Drawable placeholder; private Drawable result; @@ -30,7 +30,7 @@ public class AsyncDrawable extends Drawable { // @since 2.0.1 for use-cases when image is loaded faster than span is drawn and knows canvas width private boolean waitingForDimensions; - // @since $nap; in case if result is Animatable and this drawable was detached, we + // @since $SNAPSHOT; in case if result is Animatable and this drawable was detached, we // keep the state to resume when we are going to be attached again (when used in RecyclerView) private boolean wasPlayingBefore = false; @@ -136,13 +136,13 @@ public class AsyncDrawable extends Drawable { result.setCallback(callback); } - // @since $nap; we trigger loading only if we have no result (and result is not placeholder) + // @since $SNAPSHOT; we trigger loading only if we have no result (and result is not placeholder) final boolean shouldLoad = result == null || result == placeholder; if (result != null) { result.setCallback(callback); - // @since $nap; + // @since $SNAPSHOT; if (result instanceof Animatable && wasPlayingBefore) { ((Animatable) result).start(); } @@ -229,7 +229,7 @@ public class AsyncDrawable extends Drawable { public void setResult(@NonNull Drawable result) { - // @since $nap; revert this flag when we have new source + // @since $SNAPSHOT; revert this flag when we have new source wasPlayingBefore = false; // if we have previous one, detach it diff --git a/markwon-core/src/main/java/io/noties/markwon/movement/MovementMethodPlugin.java b/markwon-core/src/main/java/io/noties/markwon/movement/MovementMethodPlugin.java index b672cb6e..40e8efec 100644 --- a/markwon-core/src/main/java/io/noties/markwon/movement/MovementMethodPlugin.java +++ b/markwon-core/src/main/java/io/noties/markwon/movement/MovementMethodPlugin.java @@ -22,7 +22,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin { * * @see #create(MovementMethod) * @see #link() - * @deprecated $nap; use {@link #link()} + * @deprecated $SNAPSHOT; use {@link #link()} */ @NonNull @Deprecated @@ -31,7 +31,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin { } /** - * @since $nap; + * @since $SNAPSHOT; */ @NonNull public static MovementMethodPlugin link() { @@ -42,7 +42,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin { * Special {@link MovementMethodPlugin} that is not applying a MovementMethod on a TextView * implicitly * - * @since $nap; + * @since $SNAPSHOT; */ @NonNull public static MovementMethodPlugin none() { @@ -58,7 +58,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin { private final MovementMethod movementMethod; /** - * Since $nap; change to be nullable + * Since $SNAPSHOT; change to be nullable */ @SuppressWarnings("WeakerAccess") MovementMethodPlugin(@Nullable MovementMethod movementMethod) { @@ -73,7 +73,7 @@ public class MovementMethodPlugin extends AbstractMarkwonPlugin { @Override public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) { - // @since $nap; check for equality + // @since $SNAPSHOT; check for equality final MovementMethod current = textView.getMovementMethod(); if (current != movementMethod) { textView.setMovementMethod(movementMethod); diff --git a/markwon-ext-latex/src/main/java/io/noties/markwon/ext/latex/JLatexMathTheme.java b/markwon-ext-latex/src/main/java/io/noties/markwon/ext/latex/JLatexMathTheme.java index 5e97fd96..7655c510 100644 --- a/markwon-ext-latex/src/main/java/io/noties/markwon/ext/latex/JLatexMathTheme.java +++ b/markwon-ext-latex/src/main/java/io/noties/markwon/ext/latex/JLatexMathTheme.java @@ -83,7 +83,7 @@ public abstract class JLatexMathTheme { } /** - * @since $nap; + * @since $SNAPSHOT; */ @NonNull public static Padding of(int left, int top, int right, int bottom) { diff --git a/markwon-html/src/main/java/io/noties/markwon/html/tag/SimpleTagHandler.java b/markwon-html/src/main/java/io/noties/markwon/html/tag/SimpleTagHandler.java index d0ffef45..cb887bc1 100644 --- a/markwon-html/src/main/java/io/noties/markwon/html/tag/SimpleTagHandler.java +++ b/markwon-html/src/main/java/io/noties/markwon/html/tag/SimpleTagHandler.java @@ -28,7 +28,7 @@ public abstract class SimpleTagHandler extends TagHandler { @Override public void handle(@NonNull MarkwonVisitor visitor, @NonNull MarkwonHtmlRenderer renderer, @NonNull HtmlTag tag) { - // @since $nap; check if tag is block one and visit children + // @since $SNAPSHOT; check if tag is block one and visit children if (tag.isBlock()) { visitChildren(visitor, renderer, tag.getAsBlock()); } diff --git a/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java b/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java index 657229ec..416624b2 100644 --- a/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java +++ b/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java @@ -44,7 +44,7 @@ public class GlideImagesPlugin extends AbstractMarkwonPlugin { @NonNull public static GlideImagesPlugin create(@NonNull final Context context) { - // @since $nap; cache RequestManager + // @since $SNAPSHOT; cache RequestManager // sometimes `cancel` would be called after activity is destroyed, // so `Glide.with(context)` will throw an exception return create(Glide.with(context)); diff --git a/markwon-inline-parser/src/main/java/io/noties/markwon/inlineparser/BangInlineProcessor.java b/markwon-inline-parser/src/main/java/io/noties/markwon/inlineparser/BangInlineProcessor.java index 9d0d2217..47bad470 100644 --- a/markwon-inline-parser/src/main/java/io/noties/markwon/inlineparser/BangInlineProcessor.java +++ b/markwon-inline-parser/src/main/java/io/noties/markwon/inlineparser/BangInlineProcessor.java @@ -29,7 +29,7 @@ public class BangInlineProcessor extends InlineProcessor { return node; } else { - // @since $nap; return null in case no match (multiple inline + // @since $SNAPSHOT; return null in case no match (multiple inline // processors can define `!` as _special_ character, so let them handle it) // NB! do not forget to reset index index = startIndex; diff --git a/release-management.md b/release-management.md index da2721d5..d08f1e79 100644 --- a/release-management.md +++ b/release-management.md @@ -1,49 +1,42 @@ # Release management -There are 2 core branches: -* `master` -* `develop` +Development happens in the `master` branch. Although CI (via Github workflows) is triggered +with each push, all releases are happening in manual mode (stable and snapshot versions +of the library and the sample app). -`master` represents currently released version. In most cases its `HEAD` must also -point to a tag with release version name. +``` +# Stable and snapshot library release (depending on the version specified in `gradle.properties`) +./gradlew upA -Prelease -`develop` represents version that is currently in development. It always should have -`-SNAPSHOT` suffix in `VERSION_NAME` variable (defined in `gradle.properties`). -Ideally each push to `develop` should also publish a SNAPSHOT version to MavenCentral (pending resolution). +# Sample app release +./app-sample/deploy.sh +``` -Before releasing a new version a new branch is created. It's name should follow -the `v4.1.1` pattern (where `4.1.1` is upcoming release version name). In this branch -should all release preparations be done (removing all mentions of SNAPSHOT and updating -version name). Then a pull-request is issued from this branch to `master`. - -After a pull-request is resolved (merged to `master`) all changes must be reflected in `develop` -branch (merge with `master`), next `VERSION_NAME` must be assigned with `-SNAPSHOT` suffix and published to snapshot Maven repo -(snapshot users will see an update available). -The issuer branch (with version name) should be deleted. - -A new version must be pushed to MavenCentral and new git-tag with version name must be -created in the repository. - -Rinse and repeat. +Tests must be run before releasing (either locally or via CI). ## `@since` annotation -Although it is not required it is a nice thing to do: add `@since $VERSION` comment to the code -whenever it is possible (at least for publicly accessible code - API). This would help -navigating the project without the need to checkout the full VCS history. As keeping track of -current and/or upcoming version can be error-prone it is better to insert a generic `@since code` -that can be properly substituted upon a release. +All code changes should have a documentation comment with version of the library specified. +For changes before _stable_ release (snapshots) a special `$SNAPSHOT;` version can be used +(useful when the next version name of the library is still not known). -For example, `@since $nap` seems like a good candidate. For this a live template can be created and used -whenever a new API method/field/functionality-change is introduced (`snc`): +```java +/** + * @since $SNAPSHOT; + */ -``` -// semicolon with a space so this one is not accedentally replaced with release version -@since $nap ; +// @since $SNAPSHOT; ``` -This live template would be possible to use in both inline comment and javadoc comment. +These changes must also be placed in according section of the `CHANGELOG.md` file: +* `Added` +* `Changed` +* `Fixed` +* `Deprecated` +* `Removed` -## documentation +Stable release must replace all `$SNAPSHOT;` occurrences with proper library version name. -If there are updates to documentation web site, do not forget to publish it \ No newline at end of file +## Documentation + +If there are updates to documentation web site these should be published \ No newline at end of file