Fix: fix premium build

This commit is contained in:
kr328 2021-09-12 01:33:52 +08:00
parent 07ff81f4db
commit 3973fb2706
6 changed files with 983 additions and 8 deletions

View File

@ -2,6 +2,7 @@
import com.android.build.gradle.BaseExtension
import java.net.URL
import java.util.*
buildscript {
repositories {
@ -105,6 +106,17 @@ subprojects {
create("premium") {
dimension = defaultDimension
versionNameSuffix = ".premium"
val trackFile = rootProject.file("track.properties")
if (trackFile.exists()) {
val track = Properties().apply {
trackFile.inputStream().use(this::load)
}
buildConfigField("String", "APP_CENTER_KEY", "\"${track.getProperty("appcenter.key")!!}\"")
} else {
buildConfigField("String", "APP_CENTER_KEY", "null")
}
}
}

View File

@ -24,7 +24,7 @@ golang {
srcDir.set(file("src/foss/golang"))
}
create("premium") {
tags.set(listOf("premium"))
tags.set(listOf("premium", "without_gvisor", "without_system"))
srcDir.set(file("src/premium/golang"))
}
all {
@ -69,7 +69,7 @@ repositories {
afterEvaluate {
tasks.withType(GolangBuildTask::class.java).forEach {
it.inputs.file(golangSource)
it.inputs.dir(golangSource)
}
}

View File

@ -2,7 +2,11 @@
package config
import "github.com/Dreamacro/clash/config"
import (
"io"
"github.com/Dreamacro/clash/config"
)
func forEachProviders(rawCfg *config.RawConfig, fun func(index int, total int, key string, provider map[string]interface{})) {
total := len(rawCfg.ProxyProvider) + len(rawCfg.RuleProvider)
@ -23,10 +27,10 @@ func forEachProviders(rawCfg *config.RawConfig, fun func(index int, total int, k
func destroyProviders(cfg *config.Config) {
for _, p := range cfg.ProxyProviders {
_ = p.Destroy()
_ = p.(io.Closer).Close()
}
for _, p := range cfg.RuleProviders {
_ = p.Destroy()
_ = p.(io.Closer).Close()
}
}

View File

@ -7,7 +7,8 @@ import (
"fmt"
"time"
"github.com/Dreamacro/clash/adapter/provider"
P "github.com/Dreamacro/clash/adapter/provider"
"github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/log"
"github.com/Dreamacro/clash/tunnel"
)
@ -48,7 +49,7 @@ func QueryProviders() []*Provider {
for _, p := range providers {
updatedAt := time.Time{}
if s, ok := p.(provider.UpdatableProvider); ok {
if s, ok := p.(P.UpdatableProvider); ok {
updatedAt = s.UpdatedAt()
}

View File

@ -8,23 +8,33 @@ require (
cfa/blob v0.0.0 // indirect
github.com/Dreamacro/clash v0.0.0 // indirect
github.com/Dreamacro/go-shadowsocks2 v0.1.7 // indirect
github.com/avast/apkparser v0.0.0-20210223100516-186f320f9bfc // indirect
github.com/avast/apkverifier v0.0.0-20210524110121-dfe686b45d88 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/google/btree v1.0.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/insomniacslk/dhcp v0.0.0-20210827173440-b95caade3eac // indirect
github.com/klauspost/compress v1.11.13 // indirect
github.com/kr328/tun2socket-lwip v0.0.0-20210911023118-0b4947e2a9c1 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/oschwald/geoip2-golang v1.5.0 // indirect
github.com/oschwald/maxminddb-golang v1.8.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/u-root/uio v0.0.0-20210528114334-82958018845c // indirect
go.starlark.net v0.0.0-20210901212718-87f333178d59 // indirect
go.uber.org/atomic v1.9.0 // indirect
go4.org/intern v0.0.0-20210108033219-3eb7198706b2 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20201222180813-1025295fd063 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gvisor.dev/gvisor v0.0.0-20210904021812-0d58674c658a // indirect
inet.af/netaddr v0.0.0-20210903134321-85fa6c94624e // indirect
)
replace cfa => ../../main/golang

File diff suppressed because it is too large Load Diff