Skip to content

Commit 8450dc8

Browse files
author
Jose Vitor Schneid
authored
Initial commit to setup repository (#1)
* Clean and update README * Add github config files * Plugin repository scaffolding
1 parent ef2e8ab commit 8450dc8

File tree

19 files changed

+954
-7
lines changed

19 files changed

+954
-7
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Add core contributors to all prs by default
2+
* @smithy-lang/smithy

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Issue #, if available:
2+
3+
### Description of changes:
4+
5+
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
name: Java ${{ matrix.java }} ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
java: [17]
16+
os: [macos-latest, ubuntu-latest, windows-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: gradle/wrapper-validation-action@v1
21+
22+
- name: Set up JDK ${{ matrix.java }}
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: ${{ matrix.java }}
26+
distribution: 'corretto'
27+
28+
- name: clean and build
29+
run: ./gradlew clean build -Plog-tests

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Eclipse
2+
.classpath
3+
.project
4+
.settings/
5+
6+
# Intellij
7+
.idea/
8+
*.iml
9+
*.iws
10+
11+
# VSCode
12+
bin/
13+
14+
# Mac
15+
.DS_Store
16+
17+
# Smithy
18+
.smithy.lsp.log
19+
20+
# Ignore Gradle project-specific cache directory
21+
.gradle
22+
23+
# Ignore Gradle build output directory
24+
build

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
## My Project
1+
## Smithy DocGen
22

3-
TODO: Fill this README out!
4-
5-
Be sure to:
6-
7-
* Change the title in this README
8-
* Edit your repository description on GitHub
3+
Smithy build plugin to generate API documentation from models authored in [Smithy](https://smithy.io) IDL.
94

105
## Security
116

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

build.gradle

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
/*
2+
* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
plugins {
17+
id "java-library"
18+
id "maven-publish"
19+
id "signing"
20+
id "checkstyle"
21+
id "jacoco"
22+
id "com.github.spotbugs" version "5.0.14"
23+
}
24+
25+
ext {
26+
// Load the plugin version from VERSION.
27+
libraryVersion = project.file("VERSION").getText('UTF-8').replace(System.lineSeparator(), "")
28+
}
29+
30+
println "Smithy DocGen version: '${libraryVersion}'"
31+
32+
allprojects {
33+
group = "software.amazon.smithy.docgen"
34+
version = libraryVersion
35+
}
36+
37+
subprojects {
38+
apply plugin: "java-library"
39+
40+
java {
41+
sourceCompatibility = JavaVersion.VERSION_17
42+
targetCompatibility = JavaVersion.VERSION_17
43+
}
44+
45+
repositories {
46+
mavenLocal()
47+
mavenCentral()
48+
}
49+
50+
dependencies {
51+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
52+
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.3")
53+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3")
54+
testImplementation("org.hamcrest:hamcrest:2.2")
55+
}
56+
57+
// Reusable license copySpec for building JARs
58+
def licenseSpec = copySpec {
59+
from "${project.rootDir}/LICENSE"
60+
from "${project.rootDir}/NOTICE"
61+
}
62+
63+
// Set up tasks that build source and javadoc jars.
64+
task sourcesJar(type: Jar) {
65+
metaInf.with(licenseSpec)
66+
from {
67+
sourceSets.main.allJava
68+
}
69+
archiveClassifier = "sources"
70+
}
71+
72+
// Build a javadoc JAR too.
73+
task javadocJar(type: Jar) {
74+
metaInf.with(licenseSpec)
75+
from {
76+
tasks.javadoc
77+
}
78+
archiveClassifier = "javadoc"
79+
}
80+
81+
// Include an Automatic-Module-Name in all JARs.
82+
afterEvaluate { Project project ->
83+
tasks.jar {
84+
metaInf.with(licenseSpec)
85+
inputs.property("moduleName", project.ext["moduleName"])
86+
manifest {
87+
attributes "Automatic-Module-Name": project.ext["moduleName"]
88+
}
89+
}
90+
}
91+
92+
// Always run javadoc after build.
93+
tasks["build"].dependsOn(tasks["javadoc"])
94+
95+
// ==== Tests ====
96+
// https://docs.gradle.org/current/samples/sample_java_multi_project_with_junit5_tests.html
97+
test {
98+
useJUnitPlatform()
99+
}
100+
// Log on passed, skipped, and failed test events if the `-Plog-tests` property is set.
101+
// https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/logging/TestLoggingContainer.html
102+
if (project.hasProperty("log-tests")) {
103+
test {
104+
testLogging {
105+
events = ["passed", "skipped", "failed"]
106+
exceptionFormat = "full"
107+
}
108+
}
109+
}
110+
111+
// ==== Maven ====
112+
apply plugin: "maven-publish"
113+
apply plugin: "signing"
114+
115+
publishing {
116+
publications {
117+
mavenJava(MavenPublication) { publication ->
118+
publication.from(components["java"])
119+
120+
// Ship the source and javadoc jars.
121+
artifact(tasks["sourcesJar"])
122+
artifact(tasks["javadocJar"])
123+
124+
// Include extra information in the POMs.
125+
project.afterEvaluate {
126+
pom {
127+
name.set(project.ext["displayName"].toString())
128+
description.set(project.description)
129+
url.set("https://github.com/smithy-lang/smithy-docgen")
130+
licenses {
131+
license {
132+
name.set("Apache License 2.0")
133+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
134+
distribution.set("repo")
135+
}
136+
}
137+
developers {
138+
developer {
139+
id.set("smithy")
140+
name.set("Smithy")
141+
organization.set("Amazon Web Services")
142+
organizationUrl.set("https://aws.amazon.com")
143+
roles.add("developer")
144+
}
145+
}
146+
scm {
147+
url.set("https://github.com/smithy-lang/smithy-docgen.git")
148+
}
149+
}
150+
}
151+
}
152+
}
153+
}
154+
155+
task copyMavenMetadataForDevelopment(type: Copy) {
156+
from('build/tmp/publishMavenJavaPublicationToMavenLocal') {
157+
rename 'module-maven-metadata.xml', 'maven-metadata.xml'
158+
}
159+
160+
def wdir = System.getProperty("user.home") + '/.m2/repository/software/amazon/smithy/docgen/' + project.name
161+
into(wdir)
162+
}
163+
164+
publishToMavenLocal.finalizedBy(copyMavenMetadataForDevelopment)
165+
166+
// ==== CheckStyle ====
167+
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
168+
apply plugin: "checkstyle"
169+
tasks["checkstyleTest"].enabled = false
170+
171+
// ==== Code coverage ====
172+
// https://docs.gradle.org/current/userguide/jacoco_plugin.html
173+
apply plugin: "jacoco"
174+
// report is always generated after tests run
175+
test {
176+
finalizedBy jacocoTestReport
177+
}
178+
// tests are required to run before generating the report
179+
jacocoTestReport {
180+
dependsOn test
181+
}
182+
jacocoTestReport {
183+
reports {
184+
xml.enabled false
185+
csv.enabled false
186+
html.destination file("$buildDir/reports/jacoco")
187+
}
188+
}
189+
190+
// ==== Spotbugs ====
191+
// https://plugins.gradle.org/plugin/com.github.spotbugs
192+
apply plugin: "com.github.spotbugs"
193+
// We don't need to lint tests.
194+
tasks["spotbugsTest"].enabled = false
195+
// Configure the bug filter for spotbugs.
196+
spotbugs {
197+
effort = "max"
198+
excludeFilter = file("${project.rootDir}/config/spotbugs/filter.xml")
199+
}
200+
}
201+
202+
// The root project doesn't produce a JAR.
203+
tasks["jar"].enabled = false

0 commit comments

Comments
 (0)