Skip to content

Commit

Permalink
dynamic version in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pyricau committed Nov 26, 2019
1 parent 50ae3ba commit b80fa47
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 37 deletions.
35 changes: 34 additions & 1 deletion docs/dev-env.md
Expand Up @@ -7,10 +7,43 @@
* Running the failing UI tests to confirm leak detection correctly fails UI tests: `./gradlew leakcanary-sample:connectedCheck`
* Normal UI tests: `./gradlew leakcanary-support-fragment:connectedCheck`


## Static Code Analysis
* LeakCanary [uses](https://github.com/square/leakcanary/pull/1535) tool [Detekt](https://arturbosch.github.io/detekt/) for static Code analysis
* Analyze whole project with `./gradlew check` or particular modules with `./gradlew :module-name:check`. Detekt will fail the build if any ruleset violations are found. **You should fix all issues before pushing the branch to remote**.
* There's also a **git pre-push** hook that will run analysis automatically before pushing branch to remote. If there are any violations - it will prevent the push. Fix the issues!
* You can bypass the git hook though; Travis CI will still run checks and will fail if any violations are found.
* Detekt report will be printed in console and saved to `/moduleDir/build/reports/

## Deploying locally

To deploy LeakCanary to your local maven repository, run the following command, changing the path to the path of your local repository:

```
./gradlew uploadArchives -PSNAPSHOT_REPOSITORY_URL=file:///Users/py/.m2/repository
```

Then add the SNAPSHOT dependency and `mavenLocal()` repository to your project:

```gradle
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:{{ leak_canary.next_release }}-SNAPSHOT'
}
repositories {
mavenLocal()
}
```

## Deploying the docs locally

Installing the markdownextradata plugin:

```
pip install mkdocs-markdownextradata-plugin
```

Deploying locally

```
mkdocs serve
```
18 changes: 9 additions & 9 deletions docs/faq.md
Expand Up @@ -45,20 +45,20 @@ On Android, content providers are created after the Application instance is crea
Update your dependencies to the latest SNAPSHOT (see [build.gradle](https://github.com/square/leakcanary/blob/master/build.gradle)):

```gradle
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-6-SNAPSHOT'
}
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:{{ leak_canary.next_release }}-SNAPSHOT'
}
```

Add Sonatype's `snapshots` repository:

```
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
```gradle
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
```

Status of the snapshot build: [![Build Status](https://travis-ci.org/square/leakcanary.svg?branch=master)](https://travis-ci.org/square/leakcanary)
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Expand Up @@ -5,7 +5,7 @@ Add LeakCanary to `build.gradle`:
```groovy
dependencies {
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-5'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:{{ leak_canary.release }}'
}
```

Expand Down
38 changes: 15 additions & 23 deletions docs/releasing.md
Expand Up @@ -4,37 +4,38 @@
```
git checkout master
git pull
git checkout -b release_1.5
git checkout -b release_{{ leak_canary.next_release }}
```

* Update `VERSION_NAME` in `gradle.properties` (remove `-SNAPSHOT`)
```gradle
VERSION_NAME = "1.5"
VERSION_NAME = "{{ leak_canary.next_release }}"
```

* Find all doc references to the current version and update them:

* Update the current version and next version in `mkdocs.yml`:
```
grep -R "2.0-beta-2" docs/
extra:
leak_canary:
release: '{{ leak_canary.next_release }}'
next_release: 'REPLACE_WITH_NEXT_VERSION_NUMBER'
```

* Generate the Dokka docs

```
rm -rf docs/api
./gradlew shark:dokka shark-android:dokka leakcanary-android-core:dokka leakcanary-android-instrumentation:dokka leakcanary-android-process:dokka shark-graph:dokka shark-hprof:dokka leakcanary-object-watcher-android:dokka shark-log:dokka leakcanary-object-watcher:dokka
```

* Update `docs/changelog.md` after checking out all changes:
* https://github.com/square/leakcanary/compare/v1.4...master
* https://github.com/square/leakcanary/compare/v{{ leak_canary.release }}...master
* Take one last look
```
git diff
```

* Commit all local changes
```
git commit -am "Prepare 1.5 release"
git commit -am "Prepare {{ leak_canary.next_release }} release"
```

* Perform a clean build
Expand All @@ -44,26 +45,22 @@ git commit -am "Prepare 1.5 release"

* Create a tag and push it
```
git tag v1.5
git push origin v1.5
git tag v{{ leak_canary.next_release }}
git push origin v{{ leak_canary.next_release }}
```

* Make sure you have valid credentials to upload the artifacts

`~/.gradle/gradle.properties`
* Make sure you have valid credentials in `~/.gradle/gradle.properties` to upload the artifacts
```
SONATYPE_NEXUS_USERNAME=
SONATYPE_NEXUS_PASSWORD=
```

* Upload the artifacts to Sonatype OSS Nexus

```
./gradlew uploadArchives --no-daemon --no-parallel
```

* Generate the CLI zip

```
./gradlew shark-cli:distZip
```
Expand All @@ -79,18 +76,13 @@ SONATYPE_NEXUS_PASSWORD=
```
git checkout master
git pull
git merge --no-ff release_1.5
git merge --no-ff release_{{ leak_canary.next_release }}
```
* Update `VERSION_NAME` in `gradle.properties` (increase version and add `-SNAPSHOT`)
```gradle
VERSION_NAME = "2.0-alpha-4-SNAPSHOT"
```
* Update the snapshot version in `docs/faq.md`:
```gradle
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-4-SNAPSHOT'
}
```

* Commit your changes
```
git commit -am "Prepare for next development iteration"
Expand All @@ -104,7 +96,7 @@ git push
* Go to [Milestones](https://github.com/square/leakcanary/milestones), rename the current release to the version just released, and create a new *Next Release* milestone.
* Wait for the release to be available [on Maven Central](https://repo1.maven.org/maven2/com/squareup/leakcanary/leakcanary-android/).
* Redeploy the docs: `mkdocs serve` to check locally, `mkdocs gh-deploy` to deploy.
* Go to the [Draft a new release](https://github.com/square/leakcanary/releases/new) page, enter the release name (v1.5) as tag and title, and have the description point to the changelog. You can find the direct anchor URL from the [Change Log](https://square.github.io/leakcanary/changelog) page on the doc site.
* Go to the [Draft a new release](https://github.com/square/leakcanary/releases/new) page, enter the release name (v{{ leak_canary.next_release }}) as tag and title, and have the description point to the changelog. You can find the direct anchor URL from the [Change Log](https://square.github.io/leakcanary/changelog) page on the doc site.
```
See [Change Log](https://square.github.io/leakcanary/changelog#version-20-alpha-2-2019-05-21)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/shark.md
Expand Up @@ -31,7 +31,7 @@ A few more things:

The Shark Command Line Interface (CLI) enables you to analyze heaps directly from your computer. It can dump the heap of an app installed on a connected Android device, analyze it, and even strip a heap dump of any sensitive data (e.g. PII, passwords or encryption keys) which is useful when sharing a heap dump.

Download it [here](https://github.com/square/leakcanary/releases/download/v2.0-beta-5/shark-cli-2.0-beta-5.zip)!
Download it [here](https://github.com/square/leakcanary/releases/download/v{{ leak_canary.release }}/shark-cli-{{ leak_canary.release }}.zip)!

Usage instructions:

Expand Down
4 changes: 2 additions & 2 deletions docs/upgrading-to-leakcanary-2.0.md
Expand Up @@ -22,7 +22,7 @@ dependencies {

```groovy
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-5'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:{{ leak_canary.release }}'
}
```

Expand Down Expand Up @@ -85,7 +85,7 @@ If you were using `RefWatcher` in non debug code, you now get a compile error be

```groovy
dependencies {
implementation 'com.squareup.leakcanary:leakcanary-object-watcher-android:2.0-beta-5'
implementation 'com.squareup.leakcanary:leakcanary-object-watcher-android:{{ leak_canary.release }}'
}
```

Expand Down
10 changes: 10 additions & 0 deletions mkdocs.yml
Expand Up @@ -2,6 +2,11 @@
# mkdocs serve
# mkdocs gh-deploy

extra:
leak_canary:
release: '2.0-beta-5'
next_release: '2.0-beta-6'

site_name: LeakCanary
repo_name: LeakCanary
repo_url: https://github.com/square/leakcanary
Expand All @@ -11,6 +16,7 @@ remote_branch: gh-pages

copyright: 'Copyright © 2015 Square, Inc.'


theme:
name: 'material'
custom_dir: 'docs/theme'
Expand Down Expand Up @@ -41,6 +47,10 @@ markdown_extensions:
- tables
- admonition

plugins:
- search
- markdownextradata: {}

nav:
- 'Overview': index.md
- 'Getting Started': getting_started.md
Expand Down

0 comments on commit b80fa47

Please sign in to comment.