Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap use of common Gradle docs infrastructure for a native-samples site #25

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
import org.asciidoctor.gradle.AsciidoctorTask

// This root project is simply a container of sample builds
plugins {
`java-library`
`kotlin-dsl`
id("org.asciidoctor.convert") version "1.5.3"
id("org.gradle.samples.wrapper")
}

repositories {
jcenter()
maven { url = uri("https://repo.gradle.org/gradle/libs-releases") }
}

dependencies {
testImplementation("org.gradle:sample-check:0.7.0")
testImplementation(gradleTestKit())
asciidoctor("org.gradle:docs-asciidoctor-extensions:0.6.0")
}

tasks {
getByName<AsciidoctorTask>("asciidoctor") {
inputs.dir("cpp/application")
sourceDir = file("cpp/application")
outputDir = file("docs")
backends("html5")

attributes(
mapOf("source-highlighter" to "prettify",
"imagesdir" to "images",
"stylesheet" to null,
"linkcss" to true,
"docinfodir" to ".",
"docinfo1" to "",
"nofooter" to true,
"icons" to "font",
"sectanchors" to true,
"sectlinks" to true,
"linkattrs" to true,
"encoding" to "utf-8",
"idprefix" to "",
"toc" to "auto",
"toclevels" to 1)
)
}
}
19 changes: 19 additions & 0 deletions cpp/application/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
= C++ Application
:description: A description of the sample

.Assembling and running the C++ application
====
[.testable-sample,dir="cpp/application"]
=====
[.sample-command,allow-additional-output=true]
----
$ ./gradlew assemble
----

[.sample-command]
----
$ ./build/install/main/debug/app
Hello, World!
----
=====
====
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2019 the original author or authors.
*
* 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.
*/
package org.gradle.samples;

import org.gradle.samples.test.runner.GradleEmbeddedSamplesRunner;
import org.gradle.samples.test.runner.SamplesRoot;
import org.junit.runner.RunWith;

@RunWith(GradleEmbeddedSamplesRunner.class)
@SamplesRoot("cpp/application")
public class EmbeddedSamplesRunnerIntegrationTest {
}