Skip to content

Commit

Permalink
Release 1.0.0 Tokyo
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderLS committed Aug 5, 2018
1 parent fb7ff7f commit e354ebf
Show file tree
Hide file tree
Showing 8 changed files with 373 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2018 Vorlonsoft LLC
#
# 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.

# Gradle files
.gradle/

# Windows thumbnail cache
Thumbs.db

# macOS
.DS_Store/

# IntelliJ
.idea/

# Other
TODO.md
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## 1.0.0 Tokyo (released 05.08.2018)

- Initial Public Version
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
CONTRIBUTING
============
EasyDokkaPlugin is an open-source project made by developers for developers!

If you would like to contribute to the project, it's really great. You can contribute in a variety of ways:

* Help us with test cases and examples for the Wiki (and kindly follow our [Coding Standards](#coding-standards))
* If you have a good idea/patch for the project, create a [pull request](#pull-requests)
* Found a bug? You're more than welcome to [submit an issue](#issues)
* Help other fellow developers solve their problems, you're welcome to do so in issues

We do require certain guidelines to be followed so that the quality of the project remains top-notch:

PULL requests
-------------
When you submit a patch or a new functionality for the project, you must open a pull request. We will get to the pull request as soon as possible, investigate what functionality or bug fixes have been added and decide whether to include it in the project or not -- for the benefit of everyone.

**You agree that all contributions that you make to the project will be distributed further under the same license as the project itself (the Apache License, Version 2.0).**

Don't be discouraged if your pull request is rejected. This is not a deadline and sometimes with a proper explanation on your side, we are persuaded to merge in the request. Just remember that this is a project for everyone and as such must meet certain, generic rules that we would like to believe are following.

ISSUES
---------

![Read the ISSUES?](https://i.imgur.com/LPWyLe7.jpg "Read the ISSUES?")

The issues system is the place to report bugs and not for submitting patches or new functionality. As helpful as we would like to be, we cannot replace the developer and we certainly do not see what you're seeing. So when you come to report an issue, follow these simple rules:

* Report bugs in the English language only
* Use Markdown to format your issue in a fashionable way (easier to read): [Writing on GitHub](https://help.github.com/articles/github-flavored-markdown)
* If the issue is due to a crash, include the stack trace -- `throwable.printStackTrace()` -- and any other detail that will shed light on the problem
* We need to see the source code (minus certain details that you think are confidential) that caused the problem in the first place, so include it too

Opening issues without providing us with the information necessary to debug and fix it is useless; so we will close such issues within 7 days period

CODING STANDARDS
----------------
We need you to follow certain rules when sending source code contributions. These are the basic principles that we ourselves abide to and we require that you do so as well:

* Do not use the Tab character (it's in first place for a reason)
* Indentation is 4 spaces
* Include the copyright info (as in other files) at the top of the file
* You must provide proper doc, including description, in English
9 changes: 9 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GradleMavenPush

Copyright 2018 Vorlonsoft LLC

Licensed under the Apache License, Version 2.0
(https://www.apache.org/licenses/LICENSE-2.0)

Project based on GradleMavenPush (https://github.com/Vorlonsoft/GradleMavenPush)
by Vorlonsoft LLC.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
EasyDokkaPlugin
===============

Gradle script plugin to generate documentation by Dokka documentation engine in Javadoc format for Java, Kotlin, Android and non-Android projects. It's very easy, you don't need to add to `dependencies` section additional `classpath` or think about compatibility issues, you don't need additional repositories also.

## Usage

### 1. Have a working Gradle build

It is up to you.


### 2. Call the script

Add the following at the end of `build.gradle` of each sub-module that you wish to generate documentation:

```groovy
apply from: 'https://raw.github.com/Vorlonsoft/EasyDokkaPlugin/master/dokka.gradle'
```

### 3. Generate documentation

You can now generate documentation by Dokka documentation engine in Javadoc format:

```bash
$ gradle dokkaJavadocsJar
```

### 4. Get documentation

Get generated documentation from `${buildDir}` directory.

## Our other pligins

[GradleMavenPush](https://github.com/Vorlonsoft/GradleMavenPush) - helper to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories)

## Contribute

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## License

Copyright 2018 Vorlonsoft LLC

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

https://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.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-tactile
182 changes: 182 additions & 0 deletions dokka.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
/*
* Copyright 2018 Vorlonsoft LLC
*
* 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
*
* https://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.
*/

afterEvaluate { project ->
final boolean androidOs = DokkaUtils.with(project).isAndroid()
final boolean kotlinLanguage = DokkaUtils.with(project).isKotlin()
final String dokkaFatJarVersion = '0.9.17'
final String dokkaFatJarPath = 'org/jetbrains/dokka/dokka-fatjar'

task dokkaInitializer {
DokkaUtils.downloadLib("https://jcenter.bintray.com/${dokkaFatJarPath}/${dokkaFatJarVersion}/dokka-fatjar-${dokkaFatJarVersion}.pom",
dokkaFatJarPath, dokkaFatJarVersion, "dokka-fatjar-${dokkaFatJarVersion}.pom")
DokkaUtils.downloadLib("https://jcenter.bintray.com/${dokkaFatJarPath}/${dokkaFatJarVersion}/dokka-fatjar-${dokkaFatJarVersion}.jar",
dokkaFatJarPath, dokkaFatJarVersion, "dokka-fatjar-${dokkaFatJarVersion}.jar")
}

task dokkaJavadocsJar(type: GradleBuild) {
description 'Generate documentation by Dokka in Javadoc format.'
if (androidOs) {
tasks = ['androidDokkaJar']
} else {
tasks = ['dokkaJar']
}
}

if (androidOs) {
task androidDokka(type: Exec, dependsOn: dokkaInitializer) {
final byte srcDirsJavaNumber = (android.sourceSets.main.java.srcDirs != null) ? android.sourceSets.main.java.srcDirs.size() : 0
final byte srcDirsKotlinNumber = (kotlinLanguage && (android.sourceSets.main.kotlin.srcDirs != null)) ? android.sourceSets.main.kotlin.srcDirs.size() : 0
final byte classpathNumber = (android.getBootClasspath() != null) ? android.getBootClasspath().size() : 0
final String classpath = (classpathNumber > 0) ? android.getBootClasspath()[0] : ''
final String javaAPISpecificationLink = DokkaUtils.getJavaAPISpecificationLink()
if (srcDirsJavaNumber > 0) {
mkdir android.sourceSets.main.java.srcDirs[0]
if (srcDirsJavaNumber > 1) {
mkdir android.sourceSets.main.java.srcDirs[1]
}
}
if (srcDirsKotlinNumber > 0) {
mkdir android.sourceSets.main.kotlin.srcDirs[0]
}
if (srcDirsJavaNumber + srcDirsKotlinNumber > 0) {
commandLine 'java', '-jar',
"${System.properties['user.home']}/.m2/repository/${dokkaFatJarPath}/${dokkaFatJarVersion}/dokka-fatjar-${dokkaFatJarVersion}.jar",
(srcDirsJavaNumber > 0) ? android.sourceSets.main.java.srcDirs[0] : '',
(srcDirsJavaNumber > 1) ? android.sourceSets.main.java.srcDirs[1] : '',
(srcDirsKotlinNumber > 0) ? android.sourceSets.main.kotlin.srcDirs[0] : '',
'-output', "${buildDir}/javadoc", '-format', 'javadoc',
(classpathNumber > 0) ? '-classpath' : '', (classpathNumber > 0) ? classpath : '',
'-links', "https://developer.android.com/reference/^${android.sdkDirectory}/docs/reference/^${javaAPISpecificationLink}"
} else {
commandLine 'java', '-jar',
"${System.properties['user.home']}/.m2/repository/${dokkaFatJarPath}/${dokkaFatJarVersion}/dokka-fatjar-${dokkaFatJarVersion}.jar"
}
}

task androidDokkaJar(type: Jar, dependsOn: androidDokka) {
from "${buildDir}/javadoc"
}
} else {
task coreDokka(type: Exec, dependsOn: dokkaInitializer) {
final byte srcDirsJavaNumber = (sourceSets.main.java.srcDirs != null) ? sourceSets.main.java.srcDirs.size() : 0
final byte srcDirsKotlinNumber = (kotlinLanguage && (sourceSets.main.kotlin.srcDirs != null)) ? sourceSets.main.kotlin.srcDirs.size() : 0
final String javaAPISpecificationLink = DokkaUtils.getJavaAPISpecificationLink()
if (srcDirsJavaNumber > 0) {
mkdir sourceSets.main.java.srcDirs[0]
if (srcDirsJavaNumber > 1) {
mkdir sourceSets.main.java.srcDirs[1]
}
}
if (srcDirsKotlinNumber > 0) {
mkdir sourceSets.main.kotlin.srcDirs[0]
}
if (srcDirsJavaNumber + srcDirsKotlinNumber > 0) {
commandLine 'java', '-jar',
"${System.properties['user.home']}/.m2/repository/${dokkaFatJarPath}/${dokkaFatJarVersion}/dokka-fatjar-${dokkaFatJarVersion}.jar",
(srcDirsJavaNumber > 0) ? sourceSets.main.java.srcDirs[0] : '',
(srcDirsJavaNumber > 1) ? sourceSets.main.java.srcDirs[1] : '',
(srcDirsKotlinNumber > 0) ? sourceSets.main.kotlin.srcDirs[0] : '',
'-output', "${buildDir}/javadoc", '-format', 'javadoc',
'-links', "${javaAPISpecificationLink}"
} else {
commandLine 'java', '-jar',
"${System.properties['user.home']}/.m2/repository/${dokkaFatJarPath}/${dokkaFatJarVersion}/dokka-fatjar-${dokkaFatJarVersion}.jar"
}
}

task dokkaJar(type: Jar, dependsOn: coreDokka) {
from "${buildDir}/javadoc"
}
}

tasks.withType(Jar) {
classifier = 'javadoc'
destinationDir = buildDir
}
}

final class DokkaUtils {

private static volatile DokkaUtils singleton = null

private final def project

private DokkaUtils(project) {
this.project = project
}

static DokkaUtils with(project) {
if (singleton == null) {
synchronized (DokkaUtils.class) {
if (singleton == null) {
singleton = new DokkaUtils(project)
}
}
}
return singleton
}

static String getJavaAPISpecificationLink() {
if (JavaVersion.current().isJava10Compatible()) {
return 'https://docs.oracle.com/javase/10/docs/api/overview-summary.html'
} else if (JavaVersion.current().isJava9()) {
return 'https://docs.oracle.com/javase/9/docs/api/overview-summary.html'
} else if (JavaVersion.current().isJava8()) {
return 'https://docs.oracle.com/javase/8/docs/api/'
} else if (JavaVersion.current().isJava7()) {
return 'https://docs.oracle.com/javase/7/docs/api/'
} else if (JavaVersion.current().isJava6()) {
return 'https://docs.oracle.com/javase/6/docs/api/'
} else if (JavaVersion.current().isJava5()) {
return 'https://docs.oracle.com/javase/1.5.0/docs/api/'
} else {
return ''
}
}

static void downloadLib(String url, String path, String version, String name) {
File file = new File("${System.properties['user.home']}/.m2/repository/${path}/${version}/${name}")
file.parentFile.mkdirs()
if (!file.exists()) {
new URL(url).withInputStream { downloadStream ->
file.withOutputStream { fileOutputStream ->
fileOutputStream << downloadStream
}
}
}
}

boolean isAndroid() {
return project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library') ||
project.getPlugins().hasPlugin('android') ||
project.getPlugins().hasPlugin('android-library')
}

boolean isKotlin() {
return project.getPlugins().hasPlugin('kotlin') ||
project.getPlugins().hasPlugin('kotlin-platform-common') ||
project.getPlugins().hasPlugin('kotlin-platform-jvm') ||
project.getPlugins().hasPlugin('kotlin-platform-js') ||
project.getPlugins().hasPlugin('org.jetbrains.kotlin') ||
project.getPlugins().hasPlugin('org.jetbrains.kotlin.jvm') ||
project.getPlugins().hasPlugin('org.jetbrains.kotlin.js') ||
project.getPlugins().hasPlugin('kotlin2js') ||
project.getPlugins().hasPlugin('kotlin-android') ||
project.getPlugins().hasPlugin('kotlin-android-extensions')
}
}

0 comments on commit e354ebf

Please sign in to comment.