{"id":15134543,"url":"https://github.com/schlan/java-censor","last_synced_at":"2025-10-23T11:30:35.046Z","repository":{"id":56557912,"uuid":"121954305","full_name":"schlan/java-censor","owner":"schlan","description":"Gradle plugin for censoring Java source files","archived":false,"fork":false,"pushed_at":"2020-10-31T17:30:14.000Z","size":100,"stargazers_count":52,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T17:43:37.461Z","etag":null,"topics":["android","android-library","android-studio","gradle","gradle-plugin","hacktoberfest","intellij","java","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schlan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-18T13:27:37.000Z","updated_at":"2024-02-22T11:49:47.000Z","dependencies_parsed_at":"2022-08-15T20:50:59.636Z","dependency_job_id":null,"html_url":"https://github.com/schlan/java-censor","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlan%2Fjava-censor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlan%2Fjava-censor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlan%2Fjava-censor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlan%2Fjava-censor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schlan","download_url":"https://codeload.github.com/schlan/java-censor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237811548,"owners_count":19370146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","android-studio","gradle","gradle-plugin","hacktoberfest","intellij","java","kotlin"],"created_at":"2024-09-26T05:22:44.895Z","updated_at":"2025-10-23T11:30:34.270Z","avatar_url":"https://github.com/schlan.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/schlan/java-censor\"\u003e\u003cimg src=\"https://i.imgur.com/P4jbfWm.png\" title=\"source: imgur.com\" /\u003e\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://travis-ci.org/schlan/java-censor\"\u003e\u003cimg src=\"https://travis-ci.org/schlan/java-censor.svg?branch=master\" alt=\"Build Status\" /\u003e\u003c/a\u003e\u003ca href=\"https://repo.jfrog.org/artifactory/libs-release-bintray/com/sebchlan/javacensor/java-censor/\"\u003e\n\u003cimg src=\"https://img.shields.io/maven-central/v/com.sebchlan.javacensor/java-censor.svg\" alt=\"Java Censor Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://oss.sonatype.org/content/repositories/snapshots/com/sebchlan/javacensor/java-censor/\"\u003e \u003cimg src=\"https://img.shields.io/nexus/s/https/oss.sonatype.org/com.sebchlan.javacensor/java-censor.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/schlan/java-censor/blob/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\" /\u003e\u003c/a\u003e \u003ca href=\"https://plugins.gradle.org/plugin/com.sebchlan.javacensor\"\u003e\u003cimg src=\"https://img.shields.io/badge/Gradle-Plugin-yellow.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nJava Censor is a Gradle plugin that enables developers to publish sources of closed source projects to a Maven repository. It does this by removing implemented code only leaving the signatures of public interfaces, classes, methods and fields behind. \n\u003cimg src=\"https://i.imgur.com/XO8EQ1a.png\" /\u003e\n\n\n## Purpose\n\nJava Censor is built for closed source java libraries, in particular, closed source Android libraries. When working on closed source libraries, it is usually not possible to ship a source artefact when deploying a release. \nThat brings one big downside* for the integrators of your library. Even if you ship a Javadoc artefact, IDEs like Android Studio or IntelliJ don't use that artefact for showing documentation. Instead, they rely solely on the source artefact for showing inline documentation.  \n\nThat is where Java Censor can help. Java Censor makes it possible to release a source artefact of a closed source library without exposing secret code but still allows IDEs to show inline documentation. It does that when running before the release, by removing any implemented code, only keeping public signatures (interfaces, classes, methods, constructors, fields) and Javadoc. \n\n## Usage\n\nFor using Java Censor in a Gradle project, it needs to be added to the project first. That is done by adding it as a classpath dependency to the `buildscript` block and applying the plugin to a module. \nApplying the plugin to a module introduces a new task type called `CensorCopyTask`.  The `CensorCopyTask` behaves like the built-in `Copy` task and has two mandatory configuration options.\n\n\u003cdl\u003e\n  \u003cdt\u003efrom = [set of input directories/files]\u003c/dt\u003e\n  \u003cdd\u003eTakes a set of files as input.\u003c/dd\u003e\n\n  \u003cdt\u003einto = [output directory]\u003c/dt\u003e\n  \u003cdd\u003eThe output directory. (File)\u003c/dd\u003e\n\u003c/dl\u003e\n\nExample:\n\n```gradle\n// Add classpath dependency\nbuildscript {\n  dependencies {\n    classpath group: 'com.sebchlan.javacensor', name: 'java-censor', version: '1.2.1'\n  }\n}\n\n// Apply the plugin\napply plugin: 'com.sebchlan.javacensor'\n\n// Add a new task\ntasks.register(\"censorSource\", com.sebchlan.javacensor.CensorCopyTask) { task -\u003e\n    inputs.files(sourceSets.main.java.srcDirs)\n    destinationDir = file(\"$buildDir/censored_source\")\n}\n```\n\n### Android\n\nJava Censor is also applicable to Android projects. The installation steps are very similar to the ones above. \nThis is how a configuration can look like:\n\n```gradle\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n\n    dependencies {\n        classpath group: 'com.sebchlan.javacensor', name: 'java-censor', version: '1.2.1'\n    }\n}\n\napply plugin: 'com.sebchlan.javacensor'\n\nafterEvaluate { project -\u003e\n\n    uploadArchives {\n        repositories {\n            mavenDeployer {\n                // ....\n            }\n        }\n\n        task censorSource(type: com.sebchlan.javacensor.CensorCopyTask) {\n            inputs.files(android.sourceSets.main.java.srcDirs)\n            destinationDir = file(\"$buildDir/generated-src\")\n        }\n\n        task androidSourcesJar(type: Jar) {\n            classifier = 'sources'\n            from \"$buildDir/generated-src/\"\n            dependsOn censorSource\n        }\n\n        artifacts {\n            archives androidSourcesJar\n        }\n        \n    }\n}\n```\n\n## Contribution \n\nFeel free to submit a PR or file an issue. Please make sure, when filing a bug, to provide sufficient reproduction steps or even a failing test.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschlan%2Fjava-censor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschlan%2Fjava-censor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschlan%2Fjava-censor/lists"}