-
-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1018 from mikepenz/develop
dev -> main
- Loading branch information
Showing
18 changed files
with
227 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Usage | ||
|
||
### Generate Dependency Information | ||
|
||
```bash | ||
./gradlew :app-test:exportLibraryDefinitions -PaboutLibraries.exportPath=files/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
plugins { | ||
kotlin("multiplatform") | ||
id("com.mikepenz.aboutlibraries.plugin") | ||
} | ||
|
||
kotlin { | ||
jvm() | ||
|
||
sourceSets { | ||
jvmMain { | ||
dependencies { | ||
// https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api | ||
implementation("javax.annotation:javax.annotation-api:1.3.2") | ||
} | ||
} | ||
} | ||
} | ||
|
||
aboutLibraries { | ||
fetchRemoteLicense = true | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
.../plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/PartialObjectConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.mikepenz.aboutlibraries.plugin.util | ||
|
||
import groovy.json.DefaultJsonGenerator | ||
import groovy.json.JsonGenerator | ||
import org.codehaus.groovy.runtime.DefaultGroovyMethods | ||
|
||
/** | ||
* A converter for [JsonGenerator], which allows properties to be excluded from the output. | ||
* The way it works is identical to the serialization of objects in [DefaultJsonGenerator]. | ||
* @property excludedQualifiedPropertyNames The qualified name (class name + property name) | ||
* of the properties that should be excluded from serialization. | ||
*/ | ||
class PartialObjectConverter( | ||
private val excludedQualifiedPropertyNames: Set<String>, | ||
) : JsonGenerator.Converter { | ||
|
||
private val targetClassNames: Set<String> = excludedQualifiedPropertyNames.mapTo(mutableSetOf()) { field -> | ||
field.substringBeforeLast('.') | ||
} | ||
|
||
private val excludedPropertyNames = setOf("class", "declaringClass", "metaClass") | ||
|
||
override fun handles(type: Class<*>?): Boolean { | ||
return type != null && targetClassNames.contains(type.simpleName) | ||
} | ||
|
||
override fun convert(value: Any, key: String?): Any { | ||
return DefaultGroovyMethods.getProperties(value).filterKeys { propertyName -> | ||
propertyName !in excludedPropertyNames && "${value::class.simpleName}.$propertyName" !in excludedQualifiedPropertyNames | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters