Skip to content

Commit 465b73c

Browse files
committed
Move libraries into the repository
1 parent d28bf1a commit 465b73c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7403
-44
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
!/gradle
1010
!/gradlew
1111
!/gradlew.bat
12+
!/libraries
13+
/libraries/*/*
14+
!/libraries/*/build.gradle
15+
!/libraries/*/res
16+
!/libraries/*/src
1217
!/LICENSE
1318
!/README.md
1419
!/settings.gradle

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# Dashchan Extensions
22

3-
This repository is used to store Dashchan extensions source code.
3+
Extensions and libraries.
44

55
Old extensions are placed under their own specific branch. It's planned to move them all into master branch.
66

7-
General dependencies: [Public API](https://github.com/Mishiranu/Dashchan-Library),
8-
[Static Library](https://github.com/Mishiranu/Dashchan-Static).
9-
107
## Building Guide
118

129
1. Install JDK 8 or higher
@@ -15,8 +12,6 @@ General dependencies: [Public API](https://github.com/Mishiranu/Dashchan-Library
1512

1613
The resulting APK file will appear in `extensions/%CHAN_NAME%/build/outputs/apk` directory.
1714

18-
The API library may be updated. In this case, run `gradle --refresh-dependencies assembleRelease`.
19-
2015
### Build Signed Binary
2116

2217
You can create `keystore.properties` in the source code directory with the following properties:

build.gradle

+57-21
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,54 @@ class GenerateFileTask extends DefaultTask {
2626
}
2727
}
2828

29+
def configureCommon(project, manifestFile) {
30+
project.android {
31+
compileSdkVersion 29
32+
buildToolsVersion '29.0.3'
33+
34+
defaultConfig {
35+
minSdkVersion 16
36+
targetSdkVersion 29
37+
}
38+
39+
sourceSets.main {
40+
manifest.srcFile manifestFile
41+
java.srcDirs = ['src']
42+
resources.srcDirs = []
43+
aidl.srcDirs = ['src']
44+
renderscript.srcDirs = ['src']
45+
res.srcDirs = ['res']
46+
assets.srcDirs = ['assets']
47+
}
48+
49+
compileOptions {
50+
sourceCompatibility JavaVersion.VERSION_1_8
51+
targetCompatibility JavaVersion.VERSION_1_8
52+
}
53+
}
54+
}
55+
56+
project.ext.set 'configureLibrary', { project ->
57+
def packageName = 'chan.library.' + project.name
58+
def xml = '<?xml version="1.0" encoding="utf-8"?>\n' +
59+
'<manifest xmlns:android="http://schemas.android.com/apk/res/android" ' +
60+
"package=\"$packageName\" />"
61+
62+
def manifestFile = new File(project.buildDir, 'generated/AndroidManifest.xml')
63+
if (!manifestFile.exists()) {
64+
// Fixes IntelliJ Android plugin error
65+
manifestFile.parentFile.mkdirs()
66+
manifestFile.write(xml)
67+
}
68+
69+
project.preBuild.dependsOn(project.task('generateManifest', type: GenerateFileTask) {
70+
inputText = xml
71+
outputFile = manifestFile
72+
})
73+
74+
configureCommon(project, manifestFile)
75+
}
76+
2977
project.ext.set 'configureExtension', { project, data ->
3078
def keyNotFound = { throw new NullPointerException(it + ' is not defined') }
3179

@@ -37,6 +85,7 @@ project.ext.set 'configureExtension', { project, data ->
3785
def icon = data['icon'] ?: 'ic_custom_' + chanName
3886
def updateUri = data['updateUri'] ?: '//raw.githubusercontent.com/Mishiranu/Dashchan/master/update/data.json'
3987
def hosts = data['hosts'] ?: keyNotFound('hosts')
88+
def customUriHandler = data['customFilter'] ?: false
4089
def customFilter = data['customFilter']
4190

4291
def requiredClasses = ['ChanConfiguration', 'ChanLocator', 'ChanMarkup', 'ChanPerformer']
@@ -60,8 +109,8 @@ project.ext.set 'configureExtension', { project, data ->
60109
"android:value=\".${chanNameUpper}ChanLocator\" />\n"
61110
xml += '<meta-data android:name="chan.extension.class.markup" ' +
62111
"android:value=\".${chanNameUpper}ChanMarkup\" />\n"
63-
xml += '<activity android:name="chan.app.UriHandlerActivity" android:label="Dashchan" ' +
64-
'android:theme="@android:style/Theme.NoDisplay">\n'
112+
xml += '<activity android:name="chan.application.UriHandlerActivity" ' +
113+
'android:label="Dashchan" android:theme="@android:style/Theme.NoDisplay">\n'
65114
xml += '<intent-filter>\n' +
66115
'<action android:name="android.intent.action.VIEW" />\n' +
67116
'<category android:name="android.intent.category.DEFAULT" />\n' +
@@ -100,30 +149,15 @@ project.ext.set 'configureExtension', { project, data ->
100149
})
101150

102151
project.archivesBaseName = 'Dashchan' + chanNameUpper
152+
configureCommon(project, manifestFile)
103153

104154
project.android {
105-
compileSdkVersion 29
106-
buildToolsVersion '29.0.3'
107-
108155
defaultConfig {
109-
minSdkVersion 16
110-
targetSdkVersion 29
111-
112156
// Don't warn about unused classes
113157
buildConfigField 'Class[]', 'USED_CLASSES',
114158
'{' + requiredClasses.collect { it + '.class' }.join(', ') + '}'
115159
}
116160

117-
sourceSets.main {
118-
manifest.srcFile manifestFile
119-
java.srcDirs = ['src']
120-
resources.srcDirs = []
121-
aidl.srcDirs = ['src']
122-
renderscript.srcDirs = ['src']
123-
res.srcDirs = ['res']
124-
assets.srcDirs = ['assets']
125-
}
126-
127161
if (file('keystore.properties').exists()) {
128162
def keystoreProperties = new Properties()
129163
keystoreProperties.load(new FileInputStream(file('keystore.properties')))
@@ -158,10 +192,12 @@ project.ext.set 'configureExtension', { project, data ->
158192
abortOnError false
159193
disable 'MissingTranslation'
160194
}
195+
}
161196

162-
compileOptions {
163-
sourceCompatibility JavaVersion.VERSION_1_8
164-
targetCompatibility JavaVersion.VERSION_1_8
197+
project.dependencies {
198+
compileOnly project.project(':libraries:api')
199+
if (!customUriHandler) {
200+
implementation project.project(':libraries:urihandler')
165201
}
166202
}
167203
}

extensions/dvach/build.gradle

-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,3 @@ rootProject.configureExtension(project, [
55
apiVersion: 1,
66
hosts: ['2ch.hk', '2ch.pm', '2ch.cm', '2ch.re', '2ch.tf', '2ch.wf', '2ch.yt', '2-ch.so']
77
])
8-
9-
dependencies {
10-
compileOnly 'com.github.mishiranu:dashchan.library:1.7'
11-
implementation 'com.github.mishiranu:dashchan.static:1.0'
12-
}

extensions/endchan/build.gradle

-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,3 @@ rootProject.configureExtension(project, [
55
apiVersion: 1,
66
hosts: ['endchan.net', 'endchan.gg', 'endchan.org', 'endchan.xyz']
77
])
8-
9-
dependencies {
10-
compileOnly 'com.github.mishiranu:dashchan.library:1.7'
11-
implementation 'com.github.mishiranu:dashchan.static:1.0'
12-
}

extensions/fourchan/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ rootProject.configureExtension(project, [
88
])
99

1010
dependencies {
11-
compileOnly 'com.github.mishiranu:dashchan.library:1.7'
12-
implementation 'com.github.mishiranu:dashchan.static:1.0'
11+
implementation project(':libraries:templateparser')
1312
}

extensions/local/build.gradle

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ rootProject.configureExtension(project, [
44
versionName: '1.8',
55
apiVersion: 1,
66
hosts: ['localhost'],
7+
customUriHandler: true,
78
customFilter: '<data android:scheme="file" />\n' +
89
'<data android:mimeType="text/html" />\n'
910
])
10-
11-
dependencies {
12-
compileOnly 'com.github.mishiranu:dashchan.library:1.7'
13-
}

extensions/local/src/chan/app/UriHandlerActivity.java extensions/local/src/chan/application/UriHandlerActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package chan.app;
1+
package chan.application;
22

33
import android.app.Activity;
44
import android.content.ActivityNotFoundException;

libraries/api/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apply plugin: 'com.android.library'
2+
3+
rootProject.configureLibrary(project)

0 commit comments

Comments
 (0)