Browse Source

fix bulid

tags/v1.1.0
gongdaguo 5 years ago
parent
commit
0e7e754144
15 changed files with 56 additions and 204 deletions
  1. +4
    -1
      model_zoo/official/lite/Himindspore/imageObject/.gitignore
  2. +3
    -1
      model_zoo/official/lite/Himindspore/mindsporelibrary/.gitignore
  3. +2
    -66
      model_zoo/official/lite/Himindspore/mindsporelibrary/build.gradle
  4. +0
    -0
      model_zoo/official/lite/Himindspore/mindsporelibrary/consumer-rules.pro
  5. +0
    -57
      model_zoo/official/lite/Himindspore/mindsporelibrary/download.gradle
  6. +0
    -21
      model_zoo/official/lite/Himindspore/mindsporelibrary/proguard-rules.pro
  7. +0
    -26
      model_zoo/official/lite/Himindspore/mindsporelibrary/src/androidTest/java/com/mindspore/mindsporelibrary/ExampleInstrumentedTest.java
  8. +0
    -4
      model_zoo/official/lite/Himindspore/mindsporelibrary/src/main/AndroidManifest.xml
  9. +0
    -17
      model_zoo/official/lite/Himindspore/mindsporelibrary/src/test/java/com/mindspore/mindsporelibrary/ExampleUnitTest.java
  10. +2
    -1
      model_zoo/official/lite/Himindspore/posenet/.gitignore
  11. +1
    -1
      model_zoo/official/lite/Himindspore/posenet/build.gradle
  12. +40
    -2
      model_zoo/official/lite/Himindspore/posenet/download.gradle
  13. +2
    -1
      model_zoo/official/lite/Himindspore/styletransfer/.gitignore
  14. +1
    -3
      model_zoo/official/lite/Himindspore/styletransfer/build.gradle
  15. +1
    -3
      model_zoo/official/lite/Himindspore/styletransfer/download.gradle

+ 4
- 1
model_zoo/official/lite/Himindspore/imageObject/.gitignore View File

@@ -1 +1,4 @@
/build
build/
.cxx/
src/main/assets/
src/main/cpp/mindspore-lite*

+ 3
- 1
model_zoo/official/lite/Himindspore/mindsporelibrary/.gitignore View File

@@ -1 +1,3 @@
/build
build/
mindspore*.aar


+ 2
- 66
model_zoo/official/lite/Himindspore/mindsporelibrary/build.gradle View File

@@ -1,66 +1,2 @@
plugins {
id 'com.android.library'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.1"

defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [moduleName: project.getName()]
}
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}

aaptOptions {
noCompress "ms"
}

repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

// Download default models; if you wish to use your own models then
// place them in the "assets" directory and comment out this line.
apply from: 'download.gradle'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'com.alibaba:arouter-api:1.2.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.2'
}
configurations.maybeCreate("default")
artifacts.add("default", file('mindspore-lite-1.0.1.aar'))

+ 0
- 0
model_zoo/official/lite/Himindspore/mindsporelibrary/consumer-rules.pro View File


+ 0
- 57
model_zoo/official/lite/Himindspore/mindsporelibrary/download.gradle View File

@@ -1,57 +0,0 @@
/**
* To download necessary library from HuaWei server.
* Including mindspore-lite .so file, minddata-lite .so file and model file.
* The libraries can be downloaded manually.
*/
def mindsporeLite_Version = "mindspore-lite-maven-1.0.1"
def mindsporeLiteDownloadUrl = "https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.0.1/lite/java/${mindsporeLite_Version}.zip"
def mindSporeLibrary = "libs/${mindsporeLite_Version}.zip"
def cleantargetMindSporeInclude = "libs"
def targetMindSporeInclude = "libs/"


task downloadMindSporeLibrary(type: DownloadUrlTask) {
doFirst {
println "Downloading ${mindsporeLiteDownloadUrl}"
}
sourceUrl = "${mindsporeLiteDownloadUrl}"
target = file("${mindSporeLibrary}")
}

task unzipMindSporeInclude(type: Copy, dependsOn: ['downloadMindSporeLibrary']) {
doFirst {
println "Unzipping ${mindSporeLibrary}"
}
from zipTree("${mindSporeLibrary}")
into "${targetMindSporeInclude}"
}

task cleanUnusedmindsporeFiles(type: Delete, dependsOn: ['unzipMindSporeInclude']) {
delete fileTree("${cleantargetMindSporeInclude}").matching {
include "*.zip"
}
}

if (file("libs/mindspore-lite-1.0.1.aar").exists()) {
downloadMindSporeLibrary.enabled = false
unzipMindSporeInclude.enabled = false
cleanUnusedmindsporeFiles.enabled = false
}


preBuild.dependsOn downloadMindSporeLibrary
preBuild.dependsOn unzipMindSporeInclude
preBuild.dependsOn cleanUnusedmindsporeFiles

class DownloadUrlTask extends DefaultTask {
@Input
String sourceUrl

@OutputFile
File target

@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
}
}

+ 0
- 21
model_zoo/official/lite/Himindspore/mindsporelibrary/proguard-rules.pro View File

@@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

+ 0
- 26
model_zoo/official/lite/Himindspore/mindsporelibrary/src/androidTest/java/com/mindspore/mindsporelibrary/ExampleInstrumentedTest.java View File

@@ -1,26 +0,0 @@
package com.mindspore.mindsporelibrary;

import android.content.Context;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertEquals;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.mindspore.mindsporelibrary.test", appContext.getPackageName());
}
}

+ 0
- 4
model_zoo/official/lite/Himindspore/mindsporelibrary/src/main/AndroidManifest.xml View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.mindspore.mindsporelibrary">

</manifest>

+ 0
- 17
model_zoo/official/lite/Himindspore/mindsporelibrary/src/test/java/com/mindspore/mindsporelibrary/ExampleUnitTest.java View File

@@ -1,17 +0,0 @@
package com.mindspore.mindsporelibrary;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

+ 2
- 1
model_zoo/official/lite/Himindspore/posenet/.gitignore View File

@@ -1 +1,2 @@
/build
build/
src/main/assets/

+ 1
- 1
model_zoo/official/lite/Himindspore/posenet/build.gradle View File

@@ -58,6 +58,7 @@ android {
apply from: 'download.gradle'

dependencies {
implementation project(':mindsporelibrary')
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
@@ -67,5 +68,4 @@ dependencies {

implementation 'com.alibaba:arouter-api:1.2.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.2'
implementation(name: 'mindspore-lite-1.0.1', ext: 'aar')
}

+ 40
- 2
model_zoo/official/lite/Himindspore/posenet/download.gradle View File

@@ -1,11 +1,46 @@
/**
* To download necessary library from HuaWei server.
* Including mindspore-lite .so file, minddata-lite .so file and model file.
* To download necessary library from Server.
* Including mindspore-lite .aar file and model file.
* The libraries can be downloaded manually.
*/

def mindsporeLite_Version = "mindspore-lite-maven-1.0.1"
def mindsporeLiteDownloadUrl = "https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.0.1/lite/java/${mindsporeLite_Version}.zip"
def mindSporeLibrary = "../mindsporelibrary/${mindsporeLite_Version}.zip"
def cleantargetMindSporeInclude = "../mindsporelibrary"
def targetMindSporeInclude = "../mindsporelibrary/"

def targetModelFile = "src/main/assets/posenet_model.ms"
def modelDownloadUrl = "https://download.mindspore.cn/model_zoo/official/lite/posenet_lite/posenet_model.ms"

task downloadMindSporeLibrary(type: DownloadUrlTask) {
doFirst {
println "Downloading ${mindsporeLiteDownloadUrl}"
}
sourceUrl = "${mindsporeLiteDownloadUrl}"
target = file("${mindSporeLibrary}")
}

task unzipMindSporeInclude(type: Copy, dependsOn: ['downloadMindSporeLibrary']) {
doFirst {
println "Unzipping ${mindSporeLibrary}"
}
from zipTree("${mindSporeLibrary}")
into "${targetMindSporeInclude}"
}

task cleanUnusedmindsporeFiles(type: Delete, dependsOn: ['unzipMindSporeInclude']) {
delete fileTree("${cleantargetMindSporeInclude}").matching {
include "*.zip"
}
}

if (file("../mindsporelibrary/mindspore-lite-1.0.1.aar").exists()) {
downloadMindSporeLibrary.enabled = false
unzipMindSporeInclude.enabled = false
cleanUnusedmindsporeFiles.enabled = false
}

task downloadModelFile(type: DownloadUrlTask) {
doFirst {
println "Downloading ${modelDownloadUrl}"
@@ -18,6 +53,9 @@ if (file("src/main/assets/posenet_model.ms").exists()) {
downloadModelFile.enabled = false
}

preBuild.dependsOn downloadMindSporeLibrary
preBuild.dependsOn unzipMindSporeInclude
preBuild.dependsOn cleanUnusedmindsporeFiles
preBuild.dependsOn downloadModelFile

class DownloadUrlTask extends DefaultTask {


+ 2
- 1
model_zoo/official/lite/Himindspore/styletransfer/.gitignore View File

@@ -1 +1,2 @@
/build
build/
src/main/assets/

+ 1
- 3
model_zoo/official/lite/Himindspore/styletransfer/build.gradle View File

@@ -61,6 +61,7 @@ android {
apply from: 'download.gradle'

dependencies {
implementation project(':mindsporelibrary')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
@@ -74,7 +75,4 @@ dependencies {

implementation 'com.alibaba:arouter-api:1.2.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.2'
implementation(name: 'mindspore-lite-1.0.1', ext: 'aar')


}

+ 1
- 3
model_zoo/official/lite/Himindspore/styletransfer/download.gradle View File

@@ -1,7 +1,5 @@
/**
* To download necessary library from HuaWei server.
* Including mindspore-lite .so file, minddata-lite .so file and model file.
* The libraries can be downloaded manually.
* To download necessary model file from Server.
*/
def targetPredictModelFile = "src/main/assets/style_predict_quant.ms"
def targetTransferModelFile = "src/main/assets/style_transfer_quant.ms"


Loading…
Cancel
Save