Giter Club home page Giter Club logo

oss-test's Introduction

OSS-TEST

Firebase와 Google Play OSS Service 서비스의 호환성에 대한 테스트

결과

오류 발생 부분

  • Kotlin 라이선스 정보에서 17글자가 실제보다 적은 오차가 발생함 임시 해결 방책
  • Kotlin 이후의 라이선스를 추출할 떄는 인덱스에서 17을 뺌

다운로드


코드

val rawTitles: String
val rawTitlesInputStream =
    context.resources.openRawResource(R.raw.third_party_license_metadata)
val rawTitlesByteArrayOutputStream = ByteArrayOutputStream()
var rawTitlesIndex: Int = rawTitlesInputStream.read()
while (rawTitlesIndex != -1) {
    rawTitlesByteArrayOutputStream.write(rawTitlesIndex)
    rawTitlesIndex = rawTitlesInputStream.read()
}
rawTitles = String(rawTitlesByteArrayOutputStream.toByteArray(), Charsets.UTF_8)
rawTitlesInputStream.close()

val rawLicenses: String
val rawLicensesInputStream = context.resources.openRawResource(R.raw.third_party_licenses)
val rawLicensesByteArrayOutputStream = ByteArrayOutputStream()
var rawLicensesIndex: Int = rawLicensesInputStream.read()
while (rawLicensesIndex != -1) {
    rawLicensesByteArrayOutputStream.write(rawLicensesIndex)
    rawLicensesIndex = rawLicensesInputStream.read()
}
rawLicenses = String(rawLicensesByteArrayOutputStream.toByteArray(), Charsets.UTF_8)


rawTitles.split("\n").forEach { rawTitle ->
    if (rawTitle.isNotEmpty()) {
        val spaceIndex = rawTitle.indexOf(" ")
        if (spaceIndex > 0) {
            val range = rawTitle.substring(0, spaceIndex).split(":")
            if (range.size == 2) {
                License.license[rawTitle.substring(spaceIndex + 1, rawTitle.length - 1)] =
                    try {
                        rawLicenses.substring(
                            if (License.license.keys.indexOf("Kotlin") != -1) range[0].toInt() - 17
                                    until range[0].toInt() + range[1].toInt() - 17
                            else range[0].toInt() until range[0].toInt() + range[1].toInt())
                    } catch (exception: Exception) {
                        "Error :("
                    }
            }
        }
    }
}
license = license.toSortedMap().toMutableMap()

Copyright 2022. Error0918 (JTAEYEON) all rights reserved.

oss-test's People

Contributors

error0918 avatar

Stargazers

 avatar

Watchers

Kostas Georgiou avatar  avatar

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.