Skip to content

Commit 4f65612

Browse files
Merge pull request #1 from kanaksony/main
Library Ported to HarmonyOS
2 parents c291e3d + 6b320cc commit 4f65612

File tree

44 files changed

+990
-627
lines changed

Some content is hidden

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

44 files changed

+990
-627
lines changed

Diff for: .github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
env:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
24-
uses: applibgroup/HarmonyOsSdk@v1.2
24+
uses: applibgroup/HarmonyOsSdk@v1.3
2525
- name: Upload Artifact
2626
uses: actions/upload-artifact@v2
2727
with:

Diff for: .gitignore

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
*.iml
22
.gradle
33
/local.properties
4-
/.idea/caches
5-
/.idea/libraries
6-
/.idea/modules.xml
7-
/.idea/workspace.xml
8-
/.idea/navEditor.xml
9-
/.idea/assetWizardSettings.xml
4+
/.idea/
105
.DS_Store
116
/build
127
/captures

Diff for: build.gradle

+57-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,71 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
2+
apply plugin: 'com.huawei.ohos.app'
3+
apply plugin: 'org.sonarqube'
4+
apply plugin: 'checkstyle'
5+
//For instructions on signature configuration, see https://developer.harmonyos.com/en/docs/documentation/doc-guides/ide_debug_device-0000001053822404#EN-US_TOPIC_0000001154985555__section1112183053510
6+
ohos {
7+
compileSdkVersion 6
8+
defaultConfig {
9+
compatibleSdkVersion 5
10+
}
11+
}
12+
313
buildscript {
414
repositories {
5-
google()
15+
maven {
16+
url 'https://repo.huaweicloud.com/repository/maven/'
17+
}
18+
maven {
19+
url 'https://developer.huawei.com/repo/'
20+
}
21+
jcenter()
622
}
723
dependencies {
8-
classpath 'com.android.tools.build:gradle:4.2.2'
9-
10-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
11-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
12-
13-
// NOTE: Do not place your application dependencies here; they belong
14-
// in the individual module build.gradle files
24+
classpath 'com.huawei.ohos:hap:2.4.4.2'
25+
classpath 'com.huawei.ohos:decctest:1.2.4.0'
26+
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3"
1527
}
1628
}
1729

30+
1831
allprojects {
1932
repositories {
33+
maven {
34+
url 'https://repo.huaweicloud.com/repository/maven/'
35+
}
36+
maven {
37+
url 'https://developer.huawei.com/repo/'
38+
}
39+
maven {
40+
url 'https://mirrors.huaweicloud.com/repository/maven/'
41+
}
42+
jcenter()
43+
}
44+
45+
task checkstyle(type: Checkstyle) {
46+
showViolations = true
47+
configFile file("config/checkstyle.xml")
48+
49+
source 'sample/src/main/java'
50+
source 'xradar/src/main/java'
51+
include '**/*.java'
52+
53+
// empty classpath
54+
classpath = files()
2055
}
2156
}
2257

23-
task clean(type: Delete) {
24-
delete rootProject.buildDir
58+
checkstyle {
59+
toolVersion "8.43"
60+
}
61+
62+
sonarqube {
63+
properties {
64+
property "sonar.projectKey", "applibgroup_CacheUtilsLibrary"
65+
property "sonar.organization", "applibgroup"
66+
property "sonar.host.url", "https://sonarcloud.io"
67+
property "sonar.sources", "sample,cacheutilslibrary"
68+
property "sonar.java.binaries", "sample/build,cacheutilslibrary/build"
69+
property "sonar.java.checkstyle.reportPaths", "build/reports/checkstyle/checkstyle.xml"
70+
}
2571
}

Diff for: cacheutilslibrary/.gitignore

-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
*.iml
2-
.gradle
3-
/local.properties
4-
/.idea/caches
5-
/.idea/libraries
6-
/.idea/modules.xml
7-
/.idea/workspace.xml
8-
/.idea/navEditor.xml
9-
/.idea/assetWizardSettings.xml
10-
.DS_Store
111
/build
12-
/captures
13-
.externalNativeBuild
14-
/entry/.preview
15-
.cxx

Diff for: cacheutilslibrary/build.gradle

+16-108
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,27 @@
1-
apply plugin: 'com.android.library'
2-
3-
// This is the library version used when deploying the artifact
4-
version = "1.1.0"
5-
6-
android {
7-
compileSdkVersion 23
8-
buildToolsVersion "22.0.1"
9-
1+
apply plugin: 'com.huawei.ohos.library'
2+
//For instructions on signature configuration, see https://developer.harmonyos.com/en/docs/documentation/doc-guides/ide_debug_device-0000001053822404#EN-US_TOPIC_0000001154985555__section1112183053510
3+
ohos {
4+
compileSdkVersion 6
105
defaultConfig {
11-
minSdkVersion 15
12-
targetSdkVersion 30
13-
versionCode 1
14-
versionName "1.1.0"
6+
compatibleSdkVersion 5
157
}
168
buildTypes {
179
release {
18-
minifyEnabled false
19-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
10+
proguardOpt {
11+
proguardEnabled false
12+
rulesFiles 'proguard-rules.pro'
13+
}
2014
}
2115
}
16+
2217
}
2318

2419
dependencies {
25-
implementation 'com.google.code.gson:gson:2.2.2'
26-
implementation 'commons-io:commons-io:2.4'
27-
}
28-
29-
def siteUrl = 'https://github.com/westlinkin/CacheUtilsLibrary' // Homepage URL of the library
30-
def gitUrl = 'https://github.com/westlinkin/CacheUtilsLibrary.git' // Git repository URL
31-
group = "com.lifeofcoding" // Maven Group ID for the artifact
32-
//
33-
//install {
34-
// repositories.mavenInstaller {
35-
// // This generates POM.xml with proper parameters
36-
// pom {
37-
// project {
38-
// packaging 'aar'
39-
//
40-
// // Add your description here
41-
// name 'CacheUtilsLibrary'
42-
// description = 'This is a simple Android util library to write any type of data into cache files and then read them later, using Gson to serialize and deserialize these data.'
43-
// url siteUrl
44-
//
45-
// // Set your license
46-
// licenses {
47-
// license {
48-
// name 'The Apache Software License, Version 2.0'
49-
// url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
50-
// }
51-
// }
52-
// developers {
53-
// developer {
54-
// id 'westlinkin'
55-
// name 'Wesley Lin'
56-
57-
// }
58-
// }
59-
// scm {
60-
// connection gitUrl
61-
// developerConnection gitUrl
62-
// url siteUrl
63-
//
64-
// }
65-
// }
66-
// }
67-
// }
68-
//}
20+
implementation fileTree(dir: 'libs', include: ['*.jar'])
21+
testImplementation 'junit:junit:4.13'
22+
// https://mvnrepository.com/artifact/com.google.code.gson/gson
23+
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
24+
// https://mvnrepository.com/artifact/commons-io/commons-io
25+
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
6926

70-
task sourcesJar(type: Jar) {
71-
from android.sourceSets.main.java.srcDirs
72-
classifier = 'sources'
7327
}
74-
75-
task javadoc(type: Javadoc) {
76-
source = android.sourceSets.main.java.srcDirs
77-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
78-
}
79-
80-
task javadocJar(type: Jar, dependsOn: javadoc) {
81-
classifier = 'javadoc'
82-
from javadoc.destinationDir
83-
}
84-
artifacts {
85-
archives javadocJar
86-
archives sourcesJar
87-
}
88-
89-
Properties properties = new Properties()
90-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
91-
//
92-
//// https://github.com/bintray/gradle-bintray-plugin
93-
//bintray {
94-
// user = properties.getProperty("bintray.user")
95-
// key = properties.getProperty("bintray.apikey")
96-
//
97-
// configurations = ['archives']
98-
// pkg {
99-
// repo = "maven"
100-
// // it is the name that appears in bintray when logged
101-
// name = "CacheUtilsLibrary"
102-
// websiteUrl = siteUrl
103-
// vcsUrl = gitUrl
104-
// licenses = ["Apache-2.0"]
105-
// publish = true
106-
// version {
107-
// gpg {
108-
// sign = true //Determines whether to GPG sign the files. The default is false
109-
// passphrase = properties.getProperty("bintray.gpg.password") //Optional. The passphrase for GPG signing'
110-
// }
111-
//// mavenCentralSync {
112-
//// sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
113-
//// user = properties.getProperty("bintray.oss.user") //OSS user token
114-
//// password = properties.getProperty("bintray.oss.password") //OSS user password
115-
//// close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
116-
//// }
117-
// }
118-
// }
119-
//}

Diff for: cacheutilslibrary/consumer-rules.pro

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Add har specific ProGuard rules for consumer here.

Diff for: cacheutilslibrary/proguard-rules.pro

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
# Add project specific ProGuard rules here.
2-
# By default, the flags in this file are appended to flags specified
3-
# in /Users/Linkin/Study/Android/android-sdk-macosx/tools/proguard/proguard-android.txt
4-
# You can edit the include path and order by changing the proguardFiles
5-
# directive in build.gradle.
6-
#
7-
# For more details, see
8-
# http://developer.android.com/guide/developing/tools/proguard.html
9-
10-
# Add any project specific keep options here:
11-
12-
# If your project uses WebView with JS, uncomment the following
13-
# and specify the fully qualified class name to the JavaScript interface
14-
# class:
15-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16-
# public *;
17-
#}
1+
# config module specific ProGuard rules here.

Diff for: cacheutilslibrary/src/main/config.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"app": {
3+
"bundleName": "org.applibgroup.codelabs.myapplication",
4+
"vendor": "lifeofcoding",
5+
"version": {
6+
"code": 1000000,
7+
"name": "1.0.0"
8+
}
9+
},
10+
"deviceConfig": {
11+
"default": {
12+
"network": {
13+
"cleartextTraffic": true,
14+
"usesClearText": true
15+
}
16+
}
17+
},
18+
"module": {
19+
"package": "com.lifeofcoding.cacheutlislibrary",
20+
"deviceType": [
21+
"phone",
22+
"tablet",
23+
"tv"
24+
],
25+
"distro": {
26+
"deliveryWithInstall": true,
27+
"moduleType": "har",
28+
"moduleName": "cacheutilslibrary"
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)