-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
* GUC-63 Add 2 GitHub examples for binary plugins * GUC-87 Add solution to Binary Plugin Assignment * GUC-87 Add Assignment test project
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/java,gradle,intellij | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=java,gradle,intellij | ||
|
||
### Intellij ### | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### Intellij Patch ### | ||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 | ||
|
||
# *.iml | ||
# modules.xml | ||
# .idea/misc.xml | ||
# *.ipr | ||
|
||
# Sonarlint plugin | ||
# https://plugins.jetbrains.com/plugin/7973-sonarlint | ||
.idea/**/sonarlint/ | ||
|
||
# SonarQube Plugin | ||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin | ||
.idea/**/sonarIssues.xml | ||
|
||
# Markdown Navigator plugin | ||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced | ||
.idea/**/markdown-navigator.xml | ||
.idea/**/markdown-navigator-enh.xml | ||
.idea/**/markdown-navigator/ | ||
|
||
# Cache file creation bug | ||
# See https://youtrack.jetbrains.com/issue/JBR-2257 | ||
.idea/$CACHE_FILE$ | ||
|
||
# CodeStream plugin | ||
# https://plugins.jetbrains.com/plugin/12206-codestream | ||
.idea/codestream.xml | ||
|
||
### Java ### | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
### Gradle ### | ||
.gradle | ||
build/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Cache of project | ||
.gradletasknamecache | ||
|
||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 | ||
# gradle/wrapper/gradle-wrapper.properties | ||
|
||
### Gradle Patch ### | ||
**/build/ | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/java,gradle,intellij |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Binary Plugin Assignment Done | ||
|
||
## Implementation | ||
|
||
This project shows you one possible solution for the Binary Plugin Assignment: | ||
- [Binary Plugin Assignment - Gradle Plugin Development](https://www.udemy.com/course/gradle-development/learn/practice/1361294) | ||
|
||
Solution for the assignment is taking over the functionality from Precompiled Plugin Assignment. | ||
Code is written in Java language. | ||
Plugin logic is broken down in two tasks: | ||
- [SortFilesTask](src/main/java/com/rivancic/gradle/plugin/files/tasks/sort/SortFilesTask.java) and | ||
- [DeleteTask](src/main/java/com/rivancic/gradle/plugin/files/tasks/delete/DeleteTask.java) | ||
|
||
While sorting algorithm is extracted further into [FileDirectoryMapper](src/main/java/com/rivancic/gradle/plugin/files/tasks/sort/mapper/FileDirectoryMapper.java) implementation classes. | ||
|
||
In [build.gradle](build.gradle) plugin ID: `com.rivancic.files-plugin` is defined withing the `gradlePlugin{}` block with the help of `java-gradle-plugin`. | ||
implementationClass property points to `com.rivancic.gradle.plugin.files.FilesPlugin`. | ||
|
||
## Testing | ||
|
||
For testing the solution you can publish plugin with the `maven-publish` plugin to local Maven repository and then apply | ||
it in the testing project as: | ||
``` | ||
plugins { | ||
id "com.rivancic.files-plugin" version "0.1.0" | ||
} | ||
``` | ||
|
||
I have created testing project just for this purpose in [binary-plugin-assignment-test-project](../binary-plugin-assignment-test-project) | ||
|
||
## Resources | ||
|
||
[Gradle Plugin Development Plugin (Gradle Userguide)](https://docs.gradle.org/current/userguide/java_gradle_plugin.html) | ||
|
||
[Developing Custom Gradle Plugins (Gradle Userguide)](https://docs.gradle.org/current/userguide/custom_plugins.html) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* java-gradle-plugin - Core Gradle Plugin, <a href="https://docs.gradle.org/current/userguide/java_gradle_plugin.html">Java Gradle Plugin</a>. | ||
* It simplifies compilation and publishing of Gradle binary plugins. | ||
* | ||
* maven-publish - Core Gradle Plugin, <a href="https://docs.gradle.org/current/userguide/publishing_maven.html">Java Gradle Plugin</a>Maven Publish</a> | ||
* plugin will make it possible to publish artifacts to Maven repositories. | ||
*/ | ||
plugins { | ||
id "java-gradle-plugin" | ||
id "maven-publish" | ||
} | ||
|
||
|
||
|
||
/** | ||
* An extension for java-gradle-plugin in which we define all the plugins that this project will create. | ||
* Each plugin should have name, id and an implementationClass defined. | ||
* During the jar task it will be verified that plugin descriptor is correct. implementationClass has to be an existing | ||
* class implementing Plugin interface. | ||
*/ | ||
gradlePlugin { | ||
plugins { | ||
create("filesPlugin") { | ||
id = "com.rivancic.files-plugin" | ||
implementationClass = "com.rivancic.gradle.plugin.files.FilesPlugin" | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* In publishing block we can define specific package repositories where the artifacts will be published. | ||
* As in our case we have Maven Archiva running locally we specify local URL, | ||
* name of the repository so that we can find publishing task easily and credentials as Archiva requires | ||
* them by default. | ||
*/ | ||
publishing { | ||
repositories { | ||
maven { | ||
url = "http://localhost:8080/repository/internal" | ||
name = "mavenArchivaPrivate" | ||
allowInsecureProtocol = true | ||
credentials { | ||
username = "$privateArchivaUser" | ||
password = "$privateArchivaPassword" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
group 'com.rivancic' | ||
version '0.1.0' | ||
|
||
tasks.files.folder=files | ||
tasks.files.sortType=alphabet |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |