Skip to content

Commit a7bfff1

Browse files
Aleksander GrininAleksander Grinin
authored andcommitted
Improved the code related to 'publish' task.
Prepared release 23.12.1
1 parent bfeb9fd commit a7bfff1

8 files changed

Lines changed: 57 additions & 13 deletions

File tree

app/build.gradle

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ def proguardFileName = "gradles/proguard.app.conf"
66
//def githubProperties = new Properties()
77
//githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
88

9-
def githubProperties = GradleAssist.readProperties("$rootDir/github.properties");
9+
//def githubProperties = GradleAssist.readProperties("$rootDir/github.properties");
10+
def githubCredentials = GradleAssist.readGitHubCredentials("$rootDir/local.environment");
1011

1112
publishing {
1213
publications {
@@ -24,8 +25,10 @@ publishing {
2425
url = uri("https://maven.pkg.github.com/aspose-barcode/Barcode_Android_Application")
2526

2627
credentials {
27-
username = githubProperties['github.user']
28-
password = githubProperties['github.key']
28+
// username = githubProperties['github.user']
29+
// password = githubProperties['github.key']
30+
username = githubCredentials.userName;
31+
password = githubCredentials.password;
2932
}
3033
}
3134
}
@@ -93,10 +96,11 @@ task copyApk(type: Copy) {
9396
}
9497
destinationDir(file("$publishPath"))
9598
doFirst {
96-
logger.info('\n### Executing copyApk')
99+
logger.info('\n### copyApk started')
97100
}
98101
doLast {
99102
logger.info("copied $apkFinalName to $publishPath")
103+
logger.info('\n### copyApk completed')
100104
}
101105
}
102106

@@ -115,6 +119,23 @@ gradle.taskGraph.whenReady { taskGraph ->
115119
}
116120
}
117121

122+
task clearGeneratedFiles {
123+
def treePublish = fileTree("$rootDir/publish")
124+
treePublish.include '*.apk'
125+
treePublish.exclude '*.gitignore'
126+
127+
doFirst {
128+
delete(treePublish)
129+
delete("$projectDir/out")
130+
delete("$buildDir")
131+
logger.info("clearGeneratedFiles started")
132+
}
133+
doLast {
134+
logger.info("clearGeneratedFiles completed")
135+
}
136+
}
137+
138+
clean.dependsOn 'clearGeneratedFiles'
118139
preBuild.dependsOn('echoBuildParameters')
119140
copyApk.dependsOn 'check'
120141
build.dependsOn 'copyApk'

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ project.ext {
2525
versionName = project.ext.get('version_name')
2626
groupId = "com.aspose.barcode.android"
2727
artifactFinalName = "android-barcode-application"
28-
apkFinalName = artifactFinalName + ".apk"
28+
apkFinalName = artifactFinalName + "-" + versionName + ".apk"
2929
logPath = "${rootDir}/app/logs"
3030
}
3131

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class GitHubCredentials
2+
{
3+
private final String userName;
4+
private final String password;
5+
6+
public GitHubCredentials(String userName, String password)
7+
{
8+
this.userName = userName;
9+
this.password = password;
10+
}
11+
12+
public String getUserName()
13+
{
14+
return userName;
15+
}
16+
17+
public String getPassword()
18+
{
19+
return password;
20+
}
21+
}

buildSrc/src/main/java/GradleAssist.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ public class GradleAssist
66
{
77
private static String TAG = "## GradleAssist ->";
88

9-
public static void sayHi()
10-
{
11-
System.out.println("HI");
12-
}
13-
149
public static Properties readProperties(String filePath)
1510
{
1611
Properties properties = new Properties();
@@ -33,4 +28,13 @@ public static Properties readProperties(String filePath)
3328
}
3429
return properties;
3530
}
31+
32+
public static GitHubCredentials readGitHubCredentials(String filePath)
33+
{
34+
Properties properties = readProperties(filePath);
35+
String userName = properties.get("github.user").toString();
36+
String key = properties.get("github.key").toString();
37+
GitHubCredentials gitHubCredentials = new GitHubCredentials(userName, key);
38+
return gitHubCredentials;
39+
}
3640
}

github.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ android.useAndroidX=true
2020
# thereby reducing the size of the R class for that library
2121
android.nonTransitiveRClass=true
2222
obfuscate_apk = false
23-
version_name = 23.12.0
23+
version_name = 23.12.1
7.17 MB
Binary file not shown.
-3.57 MB
Binary file not shown.

0 commit comments

Comments
 (0)