6

Let's say I need a piece of functionality and there is a library on GitHub, licensed under Apache 2.0, that provides that funcionality.

There are a couple of use cases that can occur that I would prefer to just copy-paste a certain part of the library instead of the whole thing:

It is written for Eclipse, and I am using Android Studio and I don't want to go through the trouble to convert it to a gradle project, so I want to just copy the meat of the project and paste it into a new package/module in my project

The library provides more functionality than needed and I only need a part of it.

I want to heavily customize the library.

What is the general rule in these cases? Can I just copy the files I need? Should I mention the author in the code? Should I add a reference to the library in the final product?

9

Open source allows you to create derivative works. That means you can create a derivative work which reduces the functionality to those parts you consider essential.

But remember that you need to comply with the license terms of the library, even when you only take selected parts of it. Almost all open source licenses have an attribution clause, including Apache 2.0. so you will have to give attribution to the original author, even when you only copied a single function.

  • So how do I do that, should I put their name in a comment above the class declaration? Should I include a page in my app that mentions them? Also, should I include a text file with the apache license in my github project's root source folder? – J. K. Mar 7 '16 at 17:03
  • @J.K. Yes, yes (if you have an about page with credits) and yes. – Philipp Mar 7 '16 at 19:26
2

You are allowed to do so, but consider the convenience for your users to just plug in a new (presumably bug-fixed) version of the library instead of having to hunt for the replacement code.

Perhaps it does make a significant enough difference to you, probably not. And it all obviously depends on how widely used your package will be (yes, we all dream it will have Linux' success, but let's be realistic, shall we?).

  • I like this answer. Hiding the use of the library behind a class of your own that delegates to the library is preferable from a development viewpoint. I believe it's called an Adapter. – RubberDuck Mar 10 '16 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.