Add a way to dependent android and iOS library from node modules
This commit is contained in:
parent
904d1d99cf
commit
67915e6db0
@ -1,5 +1,3 @@
|
|||||||
android/
|
|
||||||
iOS/
|
|
||||||
.vscode/
|
.vscode/
|
||||||
node_modules/
|
node_modules/
|
||||||
example/
|
example/
|
||||||
|
0
doric-cli/assets-lib/__doric_library__
Normal file
0
doric-cli/assets-lib/__doric_library__
Normal file
@ -47,4 +47,19 @@ afterEvaluate {
|
|||||||
task buildJSBundle(type: Exec) {
|
task buildJSBundle(type: Exec) {
|
||||||
workingDir project.rootDir.getParent()
|
workingDir project.rootDir.getParent()
|
||||||
commandLine 'npm', 'run', 'build'
|
commandLine 'npm', 'run', 'build'
|
||||||
|
}
|
||||||
|
|
||||||
|
def nodeModuleDir = new File(rootDir.getParent() + File.separator + "node_modules")
|
||||||
|
if (nodeModuleDir.isDirectory()) {
|
||||||
|
nodeModuleDir.listFiles().each {
|
||||||
|
if (new File(it.getAbsolutePath() + File.separator + "__doric_library__").exists()) {
|
||||||
|
println("Find doric plugin library ${it.name} in ${it}")
|
||||||
|
def name = it.name
|
||||||
|
android {
|
||||||
|
dependencies {
|
||||||
|
implementation project(":${name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,2 +1,13 @@
|
|||||||
include ':app'
|
include ':app'
|
||||||
rootProject.name='__$__'
|
rootProject.name='__$__'
|
||||||
|
|
||||||
|
def nodeModuleDir = new File(rootDir.getParent() + File.separator + "node_modules")
|
||||||
|
if (nodeModuleDir.isDirectory()) {
|
||||||
|
nodeModuleDir.listFiles().each {
|
||||||
|
if (new File(it.getAbsolutePath() + File.separator + "__doric_library__").exists()) {
|
||||||
|
println("Find doric plugin library ${it.name} in ${it}")
|
||||||
|
include ":${it.name}"
|
||||||
|
project(":${it.name}").projectDir = file(it.getAbsolutePath() + File.separator + "android")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -21,4 +21,18 @@ target '__$__' do
|
|||||||
pod 'SDWebImageWebPCoder'
|
pod 'SDWebImageWebPCoder'
|
||||||
|
|
||||||
pod 'PINCache'
|
pod 'PINCache'
|
||||||
|
|
||||||
|
dir_node_modules = File.join(__dir__,"../node_modules")
|
||||||
|
Dir.foreach(dir_node_modules) do |file|
|
||||||
|
if File.exist?(File.join(dir_node_modules, file, "__doric_library__"))
|
||||||
|
puts "Doric Library: #{File.join(dir_node_modules, file)}"
|
||||||
|
ret = Dir.glob(File.join(dir_node_modules,file,"*.podspec"))
|
||||||
|
if(ret.length > 0)
|
||||||
|
podspecPath = ret[0]
|
||||||
|
extn = File.extname podspecPath
|
||||||
|
podspecName = File.basename podspecPath, extn
|
||||||
|
pod podspecName, :path => File.join(dir_node_modules, file)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user