Skip to content

Commit

Permalink
Automatically create excerpt for blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Apr 26, 2024
1 parent 8b56610 commit 62404bb
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 23 deletions.
2 changes: 0 additions & 2 deletions docs/blog/posts/2017-03-01-hermetic-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ slug: hermetic-builds

Robolectric needs access to multiple Android SDK jars in order to perform its magic, which means it needs special configuration beyond just setting up dependencies in your build. By default, it tries to download Android SDK jars from Maven Central.

<!-- more -->

But what if you have a [hermetic build environment](http://blog.fahhem.com/2013/12/hermetic-build-systems/)? You just need to do a little more configuration.

Here's a Gradle build script that'll help:
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2017-03-02-robolectric-3-3-and-roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ slug: robolectric-3-3-and-roadmap

Your Robolectric maintainers are pleased to announce the release of [Robolectric 3.3](https://github.com/robolectric/robolectric/releases/tag/robolectric-3.3)! There's been a bunch of activity recently in Robolectric, and we wanted to give a quick update on our thinking about where the project is going.

<!-- more -->

### Introduction

Robolectric started life in 2010 as a quick hack to allow Android tests to be run on a regular JVM rather than a device or emulator, allowing for fast [TDD cycles](https://en.wikipedia.org/wiki/Test-driven_development#Test-driven_development_cycle). It was mostly developed in brief spurts as needed for testing specific projects.
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2017-11-13-resources-for-real.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ slug: resources-for-real

Up until now, Robolectric has relied on rough approximations of the Android framework's resource handling logic, backwards-engineered to be 'good enough' for many testing purposes.

<!-- more -->

We've gotten to the point where 'good enough' is no longer good enough. We've completely reimplemented Robolectric's resources system, transliterating the real native Android resource handling code from the original C++ to Java, and in the coming several releases we'll be rolling it out. The new code will fix numerous bugs in the old Robolectric simulation, which we expect will expose places where your tests rely on incorrect Robolectric behavior.

We're doing this in three separate releases to give you a chance to fix your tests in smaller batches. We strongly recommend you apply each upgrade individually and watch the release notes for migration hints.
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2018-05-09-robolectric-4-0-alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ slug: robolectric-4-0-alpha

The Robolectric team is super excited to announce the first alpha release of Robolectric 4.0, as well as some new developments in the world of Robolectric and Android testing in general.

<!-- more -->

### `androidx.test`
We’re collaborating closely with the Android Jetpack testing team to develop common APIs for writing Android tests that can run as both local (JVM-based) and on-device (instrumentation) tests. From 4.0 on, Robolectric will support Jetpack’s [androidx.test](https://developer.android.com/training/testing/) APIs, starting with support for the [`AndroidJUnit4` test runner](https://developer.android.com/training/testing/junit-runner), [`ActivityTestRule`](https://developer.android.com/training/testing/junit-rules), and [Espresso](https://developer.android.com/training/testing/espresso/) for interacting with UI components.

Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2018-10-25-robolectric-4-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ slug: robolectric-4-0

Robolectric 4.0 is released! Here's what's new!

<!-- more -->

### `androidx.test`
The different idioms for testing using Robolectric and instrumentation tests has long been a headache. With today's release of Robolectric 4.0 and `androidx.test` 1.0.0, both testing environments are converging on a set of common test APIs. Robolectric now supports the [`AndroidJUnit4` test runner](https://developer.android.com/training/testing/junit-runner), [`ActivityTestRule`](https://developer.android.com/training/testing/junit-rules), and [Espresso](https://developer.android.com/training/testing/espresso/) for interacting with UI components.

Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2019-06-04-paused-looper.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ slug: paused-looper
more realistic.** Try it out today by annotating your tests with _@LooperMode(PAUSED)_ and let us
know your experience!

<!-- more -->

## Background

Unlike on a real device, Robolectric shares a single thread for both UI operations and Test code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ contributor since 2014. He saw incredible potential in Robolectric and
championed it within Google, elevating it to an officially supported testing
tool that grew to be used by tens of thousands of Android developers.

<!-- more -->

The breadth of the contributions that Jonathan made to the project are too wide
to list in this post. He was involved in many high-profile projects such as
revamping PackageManager support and binary resources. He also worked
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2021-10-06-sharedTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ slug: sharedTest

After [Robolectric's 4.0 release][2], Robolectric supports the [`AndroidJUnit4` test runner][3], [`ActivityScenario`][5], and [Espresso][4] for interacting with UI components. As we know, we also can run those tests with an official emulator. This article will show an often overlooked but widely-used pattern called sharedTest to share tests between local and instrumentation tests. This will provide the benefit of fast unit testing while ensuring that tests are high-fidelity by enabling them to be run in an emulator.

<!-- more -->

## Using sharedTest steps by steps
The first thing that sharedTest needs is [`AndroidJUnit4` test runner][3]. It is a test runner that supports both Robolectric and [`androidx.test`][13]. There is a sample class, called [`SampleFragmentTest.kt`][14] from [FragmentScenarioSample][15] that uses [`AndroidJUnit4` test runner][3]:

Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2022-09-06-Umesh-GSoC-on-ConscryptMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ slug: Umesh-GSoC-on-ConscryptMode

My name is [Umesh Singh](https://github.com/Umesh-01) and I was an open source contributor through Google Summer of Code this year. Google Summer of Code (GSoC) is a program where external participants can contribute to an open source project over a few months. We learn new computer science concepts, how to work on open source repositories, and create real code contributions to projects!

<!-- more -->

My project was `Switching Robolectric from BouncyCastle to Conscrypt as the default security provider`. Robolectric was using [BouncyCastle](https://www.bouncycastle.org/) as the Java Cryptography Extension (JCE) security provider. After the introduction of Android P, Android switched to using [Google Conscrypt](https://source.android.com/docs/core/architecture/modular-system/conscrypt) as the security provider.
To be more consistent with Android, Robolectric needed to be updated to use Conscrypt as the default security provider.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ slug: improving-android-all-downloading
In recent years, the team has received multiple issues regarding Robolectric's inability to download/resolve
the necessary android-all jars when running Robolectric tests in a CI environment. Some examples include:

<!-- more -->

1. [android-all not downloaded as part of robolectric, or is it a separate dependency?](https://github.com/robolectric/robolectric/issues/7886)

2. [Robolectric failing because not downloading dependencies in Jenkins when using Artifactory](https://github.com/robolectric/robolectric/issues/8158)
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/posts/2024-02-25-robolectric-2024-gsoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ organization for the Google Summer of Code (GSOC) 2024! This will provide an
opportunity for students interested in Android development to contribute to one
of the most widely used testing frameworks for Android.

<!-- more -->

### What is Robolectric?

For those new to Robolectric, it's a powerful testing framework that allows
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ markdown_extensions:
plugins:
- blog:
categories: false
post_excerpt: required
post_excerpt_max_authors: 5
- macros:
on_error_fail: true
Expand Down
105 changes: 105 additions & 0 deletions overrides/partials/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!--
Copyright (c) 2016-2024 Martin Donath <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->

<!-- Post excerpt -->
<article class="md-post md-post--excerpt">
<header class="md-post__header">

<!-- Post authors -->
{% if post.authors %}
<nav class="md-post__authors md-typeset">
{% for author in post.authors %}
<span class="md-author">
<img src="{{ author.avatar }}" alt="{{ author.name }}" />
</span>
{% endfor %}
</nav>
{% endif %}

<!-- Post metadata -->
<div class="md-post__meta md-meta">
<ul class="md-meta__list">

<!-- Post date -->
<li class="md-meta__item">
<time datetime="{{ post.config.date.created }}">
{{- post.config.date.created | date -}}
</time>
{#- Collapse whitespace -#}
</li>

<!-- Post categories -->
{% if post.categories %}
<li class="md-meta__item">
{{ lang.t("blog.categories.in") }}
{% for category in post.categories %}
<a
href="{{ category.url | url }}"
class="md-meta__link"
>
{{- category.title -}}
</a>
{%- if loop.revindex > 1 %}, {% endif -%}
{% endfor -%}
</li>
{% endif %}

<!-- Post readtime -->
{% if post.config.readtime %}
{% set time = post.config.readtime %}
<li class="md-meta__item">
{% if time == 1 %}
{{ lang.t("readtime.one") }}
{% else %}
{{ lang.t("readtime.other") | replace("#", time) }}
{% endif %}
</li>
{% endif %}
</ul>

<!-- Draft marker -->
{% if post.config.draft %}
<span class="md-draft">
{{ lang.t("blog.draft") }}
</span>
{% endif %}
</div>
</header>

<!-- Post content -->
<div class="md-post__content md-typeset">
<!-- START Robolectric modification -->
{% set post_content = post.md.convert(post.markdown) %}

{{ post_content.split("</p>", 1)[0] }}</p>
<!-- END Robolectric modification -->

<!-- Continue reading link -->
{% if post.more %}
<nav class="md-post__action">
<a href="{{ post.url | url }}">
{{ lang.t("blog.continue") }}
</a>
</nav>
{% endif %}
</div>
</article>

0 comments on commit 62404bb

Please sign in to comment.