Code Monkey home page Code Monkey logo

deepstrip's Introduction

DeepStrip

DeepStrip is an advanced reference assembly creator. It deletes all members inaccessible to other assemblies. From those members, it deletes all method bodies (including those of properties and events). Member deletion is done intelligently as to be compatible with syntax-sugar C# features such as nullable reference types, init only setters, etc.

Installation

Install DeepStrip via .NET CLI:

dotnet tool install --global DeepStrip

Update it similarly:

dotnet tool update --global DeepStrip

Usage

DeepStrip uses files. Simply provide the path to original assembly (input) and path to the reference assembly (output).

For example, to read Assembly-CSharp.dll and output the stripped result to Assembly-CSharp.stripped.dll:

deepstrip Assembly-CSharp.dll Assembly-CSharp.stripped.dll 

By default, DeepStrip will resolve any dependencies in the current directory or the bin directory (also within current directory). If those directories do not have all of the dependencies, the --include or -i option can be used:

deepstrip Assembly-CSharp.dll Assembly-CSharp.stripped.dll --include "$PATH_TO_MANAGED_DIR"

Note: due to a bug in CommandLineParser, the include option must come after the input/output.

DeepStrip runs quiet to prevent console spam in scripts, but verbose mode can be helpful when running manually. Simply set the --verbose or -v flag:

deepstrip --verbose UnityEngine.dll UnityEngine.stripped.dll

Which produces the following output:

Read 'UnityEngine.dll': UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
┌──────────────────────────────────────────┐
│ ############## Statistics ############## │
├──────────────────────────────────────────┤
│ Sizes                                    │
│ ├── Source ..................... 1.3 MiB │
│ ├── Result ................... 547.0 KiB │
│ └── Truncation Ratio ............... 60% │
│                                          │
│ Types .............................. 182 │
| ├── Interface Implementations ........ 1 │
│ ├── Attributes ..................... 134 │
│ ├── Fields ......................... 859 │
│ │   └── Attributes ................... 0 │
│ ├── Properties ...................... 84 │
│ │   ├── Attributes .................. 17 │
│ │   ├── Getters ..................... 84 │
│ │   │   └── Attributes ............ 1378 │
│ │   └── Setters ..................... 70 │
│ │       └── Attributes ............. 939 │
│ ├── Events ........................... 3 │
│ │   ├── Attributes ................... 0 │
│ │   ├── Adders ....................... 3 │
│ │   │   └── Attributes ............... 0 │
│ │   └── Removers ..................... 3 │
│ │       └── Attributes ............... 0 │
│ └── Methods ....................... 2843 │
│     └── Attributes ................. 980 │
└──────────────────────────────────────────┘

Use deepstrip --help to view all options in a concise manner.

Why use DeepStrip?

DeepStrip's intended purpose is to make reference assemblies for use in Git repositories. Reference assemblies contain the minimum metadata and no executable code (CIL), meaning they are easier to redistribute. Storing reference assemblies in a Git repository makes it easier for contributors to get started on a project, as it avoids the hassle of finding all the references needed. It also allows for automated builds, as all the information needed to compile is already in the repository.

Why not use mono-cil-strip?

mono-cil-strip does delete method bodies, but it leaves heaps of metadata that is unusable to other assemblies. DeepStrip deletes this unnecessary metadata.

For one, Stubber-Publicizer stubs rather than strips. This means the files produced by it are slightly larger than mono-cil-strip. Additionally, it's not the same use case. If a publicized reference assembly is needed, Stubber-Publicizer should be used. If a reference assembly that contains members with identical visibility is needed, use DeepStrip.

deepstrip's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

deepstrip's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.