import: make it work most of the time with git repos

This includes real tests too.
This commit is contained in:
Hans-Christoph Steiner 2020-01-31 23:49:50 +01:00
parent e049a120f8
commit bfe587979d
28 changed files with 1184 additions and 42 deletions

View file

@ -0,0 +1,76 @@
/*
* Copyright 2015-2017 Hayai Software
* Copyright 2018 The KeikaiLauncher Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'com.android.application'
id 'pl.allegro.tech.build.axion-release' version '1.8.1'
}
scmVersion {
tag {
prefix = ''
}
}
/**
* Takes version {@code major.minor.patch[-suffix]} and returns numeric versionCode based on it
* Example: {@code 1.2.3-SNAPSHOT} will return {@code 1002003}
*/
static int versionCode(String versionName) {
def matcher = (versionName =~ /(\d+)\.(\d+)\.(\d+).*/)
return matcher.matches() ?
matcher.collect { version, major, minor, patch ->
major.toInteger() * 10000 + minor.toInteger() * 100 + patch.toInteger()
}.head() :
-1
}
def androidVersion = [
name: scmVersion.version,
code: versionCode(scmVersion.version),
]
android {
compileSdkVersion 28
defaultConfig {
applicationId 'com.anpmech.launcher'
minSdkVersion 15
targetSdkVersion 28
versionName androidVersion.name
versionCode androidVersion.code
}
lintOptions {
abortOnError false
}
buildTypes {
all {
buildConfigField("String", "GITHUB_USER", "\"KeikaiLauncher\"")
buildConfigField("String", "GITHUB_PROJECT", "\"KeikaiLauncher\"")
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.txt'
}
debug {
versionNameSuffix "-debug"
}
}
dependencies {
implementation 'com.android.support:support-annotations:28.0.0'
}
}
dependencies {
}

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2015-2017 Hayai Software
~ Copyright 2018 The KeikaiLauncher Project
~
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software distributed under the
~ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
~ either express or implied. See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest package="com.anpmech.launcher"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!--
~ This permission completely optional and set in the system settings menus. The following
~ declares intention to use, if available and granted.
-->
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:resizeableActivity="true"
android:theme="@style/AppBaseTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
tools:targetApi="n">
<activity
android:name="com.anpmech.launcher.activities.SearchActivity"
android:alwaysRetainTaskState="true"
android:label="@string/title_activity_search"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.ASSIST"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name="com.anpmech.launcher.activities.SettingsActivity"
android:label="@string/title_activity_settings"
android:theme="@style/AppSettingsTheme"/>
<activity
android:name=".activities.AboutActivity"
android:label="@string/about_header"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog"/>
<receiver
android:name=".monitor.PackageChangedReceiver"
android:enabled="false"/>
</application>
</manifest>

View file

@ -0,0 +1,45 @@
/*
* Copyright 2015-2017 Hayai Software
* Copyright 2018 The KeikaiLauncher Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.owasp:dependency-check-gradle:5.2.4'
}
}
apply plugin: 'org.owasp.dependencycheck'
dependencyCheck {
format='JSON'
}

View file

@ -0,0 +1,16 @@
/*
* Copyright 2015-2017 Hayai Software
* Copyright 2018 The KeikaiLauncher Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
include ':app'