Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Copyright Notice #57

Merged
merged 14 commits into from
Nov 27, 2016
Merged

Conversation

tiwanari
Copy link
Member

@tiwanari tiwanari commented Nov 8, 2016

This PR solves #40.

This PR introduces ;

  • the copyright notice of libraries used in this app
  • a dialog fragment in preferences to show a WebView that loads the copyright notice as a html (licenses.html)
  • a script to update the licenses.html easily

@tiwanari
Copy link
Member Author

tiwanari commented Nov 8, 2016

We can update the license.html by using scripts/update_licenses.sh.
At this time, the app shows the following dialog when you click the menu Copyright Notice.
screenshot_1478586986

I know this is very ugly and it contains some meaningless rows (no licensed). I will create a mechanism to format the file in a good style with the script. I'm using a plugin to collect licenses I referred in #40.

NOTE: The plugin fails to collect licenses of some libraries such as https://github.com/rejasupotaro/kvs-schema. I'm not sure why (maybe, the LICENSE file should not have any extension?).

@tiwanari
Copy link
Member Author

tiwanari commented Nov 8, 2016

And I found this PR causes an error in Travis because of some tasks introduced by the plugin.
Anyway, this PR is WIP.

Please give this some comments. What do you think about this way to update and show copyrights?

@mandaiy
Copy link
Member

mandaiy commented Nov 11, 2016

I don't know but I don't think the copyright notices have to have pretty appearance.
(you'll find, for instance, inbox has very ugly simple copyright notices)

Also I can't understand why you introduced the simple shell script. Does it have any advantages against grande scripts? or you couldn't do something in gradle?

0

@tiwanari
Copy link
Member Author

tiwanari commented Nov 11, 2016

Oh, I think it's better to use gradle :) I'm not so familiar with making gradle scripts but I'll try. Thanks for your comment.

I'm thinking of making a placeholder of copyright such as https://gist.github.com/cyrilmottier/4124374, and generating a html by inserting the libraries' information collected by a plugin.
My first idea to do that was making a simple Ruby script because it's easy and there is no other reason at present.

@tiwanari tiwanari force-pushed the feature/legal_notice branch 2 times, most recently from e2e516c to 297f271 Compare November 24, 2016 01:47
@tiwanari
Copy link
Member Author

tiwanari commented Nov 24, 2016

I changed my mind to use another plugin to make licenses.html and the plugin generates the HTML semi-automatically.

How to use it for others' licenses

Firstly, run

# ./gradlew checkLicenses

and you'll see some lists of licenses we use if they are lack in app/licenses.yml. The list is somewhat incomplete because some elements are not filled. So, you should gather the lacked information from their pages and fill it. Then, run

# ./gradlew generateLicensePage

If there is no error, you can get app/src/main/assets/licenses.html

@tiwanari
Copy link
Member Author

tiwanari commented Nov 24, 2016

While I decided to use the another plugin for others' libraries, I keep the original one for our license. Because it can maintain all the license headers of source files with a command.

How to use it for our license

Keep LICENSE file in the root directory that should be placed in the headers of source files.

Run

# ./gradlew licenseFormat

and this will format all the files.

If you want to know all the files follow the LICENSE file, run

# ./gradlew license

and this will be executed automatically while building our app.

Note

I'm not sure why it happens but *Test.java violates the license...

See the build error;

> License violations were found: /home/travis/build/PileProject/drive/app/src/androidTest/java/com/pileproject/drive/execution/NxtControllerTest.java,/home/travis/build/PileProject/drive/app/src/androidTest/java/com/pileproject/drive/execution/BlockProgramLogicTest.java,/home/travis/build/PileProject/drive/app/src/androidTest/java/com/pileproject/drive/programming/visual/block/NumberTextViewDelegateTest.java,/home/travis/build/PileProject/drive/app/src/androidTest/java/com/pileproject/drive/util/development/UnitTest.java,/home/travis/build/PileProject/drive/app/src/androidTest/java/com/pileproject/drive/comm/BluetoothCommunicatorTest.java,/home/travis/build/PileProject/drive/app/src/androidTest/java/com/pileproject/drive/ApplicationTest.java}

To avoid this, I set exclude for *Test.java.

license {
    include "**/*.java"
    exclude "**/*Test.java"
}

@tiwanari
Copy link
Member Author

And now, you can see the others' license like this;

screenshot_1479966966

(It is better than inbox's one, isn't it? :P )

@tiwanari tiwanari removed the wip label Nov 24, 2016
@tiwanari
Copy link
Member Author

Since the license checks of new plugins will be executed automatically, I had to fix the license headers of files and they may be annoying when you review this PR. I'm sorry for that.

@tiwanari
Copy link
Member Author

tiwanari commented Nov 24, 2016

Ah... one more thing. I had to fix .travis.yml because it became to always fail. I specified a supported android sdk version in it.

@tiwanari
Copy link
Member Author

Hey @Myusak,

Please review this PR. Thank you in advance.

@tiwanari tiwanari merged commit 9f12137 into PileProject:develop Nov 27, 2016
@tiwanari tiwanari deleted the feature/legal_notice branch November 27, 2016 23:47
This was referenced Nov 29, 2016
tiwanari added a commit that referenced this pull request Mar 22, 2017
* add icense-gradle-plugin

* add CopyrightNoticeFragment and a simple script (WIP)

* update LICENSE and refer it from gradle

* update the headers of Java files by using licenseFormat command

* refactor .travis.yml and change the android target version

* add tasks to clean up licenses

* rename license files

* replace the plugin to make licenses.html with cookpad's one

* remove scripts folder

* readd license-gradle-plugin

* update xml's licenses

* ignore *Test.java for license checking

* fix an error on app/src/main/res/layout/activity_setting.xml

* fix an error on app/src/main/res/layout/content_execution.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants